From brukman at cs.uiuc.edu Mon Jan 31 00:20:08 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon, 31 Jan 2005 00:20:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200501310620.AAA30822@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.219 -> 1.220 --- Log message: Fix hyphenation in output comment --- Diffs of the changes: (+1 -1) Writer.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.219 llvm/lib/Target/CBackend/Writer.cpp:1.220 --- llvm/lib/Target/CBackend/Writer.cpp:1.219 Sat Jan 22 22:32:47 2005 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Jan 31 00:19:57 2005 @@ -1122,7 +1122,7 @@ if (const AllocaInst *AI = isDirectAlloca(&*I)) { Out << " "; printType(Out, AI->getAllocatedType(), Mang->getValueName(AI)); - Out << "; /* Address exposed local */\n"; + Out << "; /* Address-exposed local */\n"; } else if (I->getType() != Type::VoidTy && !isInlinableInst(*I)) { Out << " "; printType(Out, I->getType(), Mang->getValueName(&*I)); From lattner at cs.uiuc.edu Mon Jan 31 18:18:46 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 18:18:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200502010018.j110IkAM001336@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.30 -> 1.31 --- Log message: Fix a problem where we could infinitely recurse on phi nodes. --- Diffs of the changes: (+1 -1) ScalarEvolution.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.30 llvm/lib/Analysis/ScalarEvolution.cpp:1.31 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.30 Mon Dec 6 22:03:45 2004 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Jan 31 18:18:30 2005 @@ -1163,7 +1163,7 @@ std::set &UpdatedInsts) { std::map::iterator SI = Scalars.find(I); if (SI == Scalars.end()) return; // This scalar wasn't previous processed. - if (UpdatedInsts.insert(I).second) { + if (UpdatedInsts.insert(I).second && !isa(PN)) { Scalars.erase(SI); // Remove the old entry getSCEV(I); // Calculate the new entry From lattner at cs.uiuc.edu Mon Jan 31 19:22:22 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:22:22 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CFG.h Message-ID: <200502010122.j111MMDu009124@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CFG.h updated: 1.22 -> 1.23 --- Log message: Switch from using an ilist for uses to using a custom doubly linked list. This list does not provide the ability to go backwards in the list (its more of an unordered collection, stored in the shape of a list). This change means that use iterators are now only forward iterators, not bidirectional. This improves the memory usage of use lists from '5 + 4*#use' per value to '1 + 4*#use'. While it would be better to reduce the multiplied factor, I'm not smart enough to do so. This list also has slightly more efficient operators for manipulating list nodes (a few less loads/stores), due to not needing to be able to iterate backwards through the list. This change reduces the memory footprint required to hold 176.gcc from 66.025M -> 57.687M, a 14% reduction. It also speeds up the compiler, 7.73% in the case of bytecode loading alone (release build loading 176.gcc). --- Diffs of the changes: (+5 -10) CFG.h | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-) Index: llvm/include/llvm/Support/CFG.h diff -u llvm/include/llvm/Support/CFG.h:1.22 llvm/include/llvm/Support/CFG.h:1.23 --- llvm/include/llvm/Support/CFG.h:1.22 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/Support/CFG.h Mon Jan 31 19:22:06 2005 @@ -27,22 +27,22 @@ //===--------------------------------------------------------------------===// template // Predecessor Iterator -class PredIterator : public bidirectional_iterator<_Ptr, ptrdiff_t> { - typedef bidirectional_iterator<_Ptr, ptrdiff_t> super; +class PredIterator : public forward_iterator<_Ptr, ptrdiff_t> { + typedef forward_iterator<_Ptr, ptrdiff_t> super; _Ptr *BB; _USE_iterator It; public: typedef PredIterator<_Ptr,_USE_iterator> _Self; typedef typename super::pointer pointer; - inline void advancePastConstants() { + inline void advancePastNonTerminators() { // Loop to ignore non terminator uses (for example PHI nodes)... while (It != BB->use_end() && !isa(*It)) ++It; } inline PredIterator(_Ptr *bb) : BB(bb), It(bb->use_begin()) { - advancePastConstants(); + advancePastNonTerminators(); } inline PredIterator(_Ptr *bb, bool) : BB(bb), It(bb->use_end()) {} @@ -57,18 +57,13 @@ inline _Self& operator++() { // Preincrement assert(It != BB->use_end() && "pred_iterator out of range!"); - ++It; advancePastConstants(); + ++It; advancePastNonTerminators(); return *this; } inline _Self operator++(int) { // Postincrement _Self tmp = *this; ++*this; return tmp; } - - inline _Self& operator--() { --It; return *this; } // Predecrement - inline _Self operator--(int) { // Postdecrement - _Self tmp = *this; --*this; return tmp; - } }; typedef PredIterator pred_iterator; From lattner at cs.uiuc.edu Mon Jan 31 19:22:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:22:34 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Use.h Value.h Message-ID: <200502010122.j111MYs3009135@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Use.h updated: 1.10 -> 1.11 Value.h updated: 1.68 -> 1.69 --- Log message: Switch from using an ilist for uses to using a custom doubly linked list. This list does not provide the ability to go backwards in the list (its more of an unordered collection, stored in the shape of a list). This change means that use iterators are now only forward iterators, not bidirectional. This improves the memory usage of use lists from '5 + 4*#use' per value to '1 + 4*#use'. While it would be better to reduce the multiplied factor, I'm not smart enough to do so. This list also has slightly more efficient operators for manipulating list nodes (a few less loads/stores), due to not needing to be able to iterate backwards through the list. This change reduces the memory footprint required to hold 176.gcc from 66.025M -> 57.687M, a 14% reduction. It also speeds up the compiler, 7.73% in the case of bytecode loading alone (release build loading 176.gcc). --- Diffs of the changes: (+75 -109) Use.h | 132 ++++++++++++++++++++++++---------------------------------------- Value.h | 52 +++++++++++-------------- 2 files changed, 75 insertions(+), 109 deletions(-) Index: llvm/include/llvm/Use.h diff -u llvm/include/llvm/Use.h:1.10 llvm/include/llvm/Use.h:1.11 --- llvm/include/llvm/Use.h:1.10 Sat Jan 29 18:08:26 2005 +++ llvm/include/llvm/Use.h Mon Jan 31 19:21:51 2005 @@ -16,11 +16,11 @@ #ifndef LLVM_USE_H #define LLVM_USE_H -#include "llvm/ADT/ilist" +#include "llvm/Support/Casting.h" +#include "llvm/ADT/iterator" namespace llvm { -template struct ilist_traits; class Value; class User; @@ -62,43 +62,28 @@ Value *operator->() { return Val; } const Value *operator->() const { return Val; } + Use *getNext() const { return Next; } private: - // NOTE!! The Next/Prev fields MUST stay at the start of this structure. The - // end-token for the ilist is allocated as JUST the next/prev pair to reduce - // memory usage instead of allocating an entire Use. - struct NextPrevPtrs { - Use *Next, *Prev; - } UseLinks; - + Use *Next, **Prev; Value *Val; User *U; - friend struct ilist_traits; -}; -template<> -struct ilist_traits { - static Use *getPrev(Use *N) { return N->UseLinks.Prev; } - static Use *getNext(Use *N) { return N->UseLinks.Next; } - static const Use *getPrev(const Use *N) { return N->UseLinks.Prev; } - static const Use *getNext(const Use *N) { return N->UseLinks.Next; } - static void setPrev(Use *N, Use *Prev) { N->UseLinks.Prev = Prev; } - static void setNext(Use *N, Use *Next) { N->UseLinks.Next = Next; } - - /// createSentinel - this is used to create the end marker for the use list. - /// Note that we only allocate a UseLinks structure, which is just enough to - /// hold the next/prev pointers. This saves us 8 bytes of memory for every - /// Value allocated. - static Use *createSentinel() { return (Use*)new Use::NextPrevPtrs(); } - static void destroySentinel(Use *S) { delete (Use::NextPrevPtrs*)S; } - - void addNodeToList(Use *NTy) {} - void removeNodeFromList(Use *NTy) {} - void transferNodesFromList(iplist &L2, - ilist_iterator first, - ilist_iterator last) {} -}; + void addToList(Use **List) { + Next = *List; + if (Next) Next->Prev = &Next; + Prev = List; + *List = this; + } + void removeFromList() { + *Prev = Next; + if (Next) Next->Prev = Prev; + } + friend class Value; +}; +// simplify_type - Allow clients to treat uses just like values when using +// casting operators. template<> struct simplify_type { typedef Value* SimpleType; static SimpleType getSimplifiedValue(const Use &Val) { @@ -112,64 +97,49 @@ } }; -struct UseListIteratorWrapper : public iplist::iterator { - typedef iplist::iterator Super; - UseListIteratorWrapper() {} - UseListIteratorWrapper(const Super &RHS) : Super(RHS) {} - UseListIteratorWrapper &operator=(const Super &RHS) { - Super::operator=(RHS); - return *this; - } - inline User *operator*() const; - User *operator->() const { return operator*(); } +template // UserTy == 'User' or 'const User' +class value_use_iterator : public forward_iterator { + typedef forward_iterator super; + typedef value_use_iterator _Self; + + Use *U; + value_use_iterator(Use *u) : U(u) {} + friend class Value; +public: + typedef typename super::reference reference; + typedef typename super::pointer pointer; - UseListIteratorWrapper operator--() { return Super::operator--(); } - UseListIteratorWrapper operator++() { return Super::operator++(); } + value_use_iterator(const _Self &I) : U(I.U) {} + value_use_iterator() {} - UseListIteratorWrapper operator--(int) { // postdecrement operators... - UseListIteratorWrapper tmp = *this; - --*this; - return tmp; - } - UseListIteratorWrapper operator++(int) { // postincrement operators... - UseListIteratorWrapper tmp = *this; - ++*this; - return tmp; + bool operator==(const _Self &x) const { + return U == x.U; + } + bool operator!=(const _Self &x) const { + return !operator==(x); } -}; - -struct UseListConstIteratorWrapper : public iplist::const_iterator { - typedef iplist::const_iterator Super; - UseListConstIteratorWrapper() {} - UseListConstIteratorWrapper(const Super &RHS) : Super(RHS) {} - - // Allow conversion from non-const to const iterators - UseListConstIteratorWrapper(const UseListIteratorWrapper &RHS) : Super(RHS) {} - UseListConstIteratorWrapper(const iplist::iterator &RHS) : Super(RHS) {} - UseListConstIteratorWrapper &operator=(const Super &RHS) { - Super::operator=(RHS); - return *this; + // Iterator traversal: forward iteration only + _Self &operator++() { // Preincrement + assert(U && "Cannot increment end iterator!"); + U = U->getNext(); + return *this; + } + _Self operator++(int) { // Postincrement + _Self tmp = *this; ++*this; return tmp; } - inline const User *operator*() const; - const User *operator->() const { return operator*(); } + // Retrieve a reference to the current SCC + UserTy *operator*() const { + assert(U && "Cannot increment end iterator!"); + return U->getUser(); + } - UseListConstIteratorWrapper operator--() { return Super::operator--(); } - UseListConstIteratorWrapper operator++() { return Super::operator++(); } + UserTy *operator->() const { return operator*(); } - UseListConstIteratorWrapper operator--(int) { // postdecrement operators... - UseListConstIteratorWrapper tmp = *this; - --*this; - return tmp; - } - UseListConstIteratorWrapper operator++(int) { // postincrement operators... - UseListConstIteratorWrapper tmp = *this; - ++*this; - return tmp; - } + Use &getUse() const { return *U; } }; } // End llvm namespace Index: llvm/include/llvm/Value.h diff -u llvm/include/llvm/Value.h:1.68 llvm/include/llvm/Value.h:1.69 --- llvm/include/llvm/Value.h:1.68 Fri Jan 28 18:30:42 2005 +++ llvm/include/llvm/Value.h Mon Jan 31 19:21:51 2005 @@ -43,7 +43,7 @@ class Value { unsigned SubclassID; // Subclass identifier (for isa/dyn_cast) PATypeHolder Ty; - iplist Uses; + Use *UseList; std::string Name; void operator=(const Value &); // Do not implement @@ -86,33 +86,39 @@ //---------------------------------------------------------------------- // Methods for handling the vector of uses of this Value. // - typedef UseListIteratorWrapper use_iterator; - typedef UseListConstIteratorWrapper use_const_iterator; - typedef iplist::size_type size_type; - - size_type use_size() const { return Uses.size(); } - bool use_empty() const { return Uses.empty(); } - use_iterator use_begin() { return Uses.begin(); } - use_const_iterator use_begin() const { return Uses.begin(); } - use_iterator use_end() { return Uses.end(); } - use_const_iterator use_end() const { return Uses.end(); } - User *use_back() { return Uses.back().getUser(); } - const User *use_back() const { return Uses.back().getUser(); } + typedef value_use_iterator use_iterator; + typedef value_use_iterator use_const_iterator; + + bool use_empty() const { return UseList == 0; } + use_iterator use_begin() { return use_iterator(UseList); } + use_const_iterator use_begin() const { return use_const_iterator(UseList); } + use_iterator use_end() { return use_iterator(0); } + use_const_iterator use_end() const { return use_const_iterator(0); } + User *use_back() { return *use_begin(); } + const User *use_back() const { return *use_begin(); } /// hasOneUse - Return true if there is exactly one user of this value. This /// is specialized because it is a common request and does not require /// traversing the whole use list. /// bool hasOneUse() const { - iplist::const_iterator I = Uses.begin(), E = Uses.end(); + use_const_iterator I = use_begin(), E = use_end(); if (I == E) return false; return ++I == E; } + /// hasNUses - Return true if this Value has exactly N users. + /// + bool hasNUses(unsigned N) const; + + /// getNumUses - This method computes the number of uses of this Value. This + /// is a linear time operation. Use hasOneUse or hasNUses to check for + /// specific values. + unsigned getNumUses() const; + /// addUse/killUse - These two methods should only be used by the Use class. /// - void addUse(Use &U) { Uses.push_back(&U); } - void killUse(Use &U) { Uses.remove(&U); } + void addUse(Use &U) { U.addToList(&UseList); } /// getValueType - Return an ID for the concrete type of this object. This is /// used to implement the classof checks. This should not be used for any @@ -157,16 +163,6 @@ return OS; } - -inline User *UseListIteratorWrapper::operator*() const { - return Super::operator*().getUser(); -} - -inline const User *UseListConstIteratorWrapper::operator*() const { - return Super::operator*().getUser(); -} - - void Use::init(Value *v, User *user) { Val = v; U = user; @@ -174,11 +170,11 @@ } Use::~Use() { - if (Val) Val->killUse(*this); + if (Val) removeFromList(); } void Use::set(Value *V) { - if (Val) Val->killUse(*this); + if (Val) removeFromList(); Val = V; if (V) V->addUse(*this); } From lattner at cs.uiuc.edu Mon Jan 31 19:23:08 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:23:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp Message-ID: <200502010123.j111N8QL009148@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.101 -> 1.102 --- Log message: Hacks to make this ugly ugly code work with the new use lists. --- Diffs of the changes: (+12 -17) ExprTypeConvert.cpp | 29 ++++++++++++----------------- 1 files changed, 12 insertions(+), 17 deletions(-) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.101 llvm/lib/Transforms/ExprTypeConvert.cpp:1.102 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.101 Fri Jan 28 18:37:36 2005 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Mon Jan 31 19:22:56 2005 @@ -539,13 +539,14 @@ VMC.ExprMap[I] = Res; - unsigned NumUses = I->use_size(); + //// WTF is this code! FIXME: remove this. + unsigned NumUses = I->getNumUses(); for (unsigned It = 0; It < NumUses; ) { unsigned OldSize = NumUses; Value::use_iterator UI = I->use_begin(); std::advance(UI, It); ConvertOperandToType(*UI, I, Res, VMC, TD); - NumUses = I->use_size(); + NumUses = I->getNumUses(); if (NumUses == OldSize) ++It; } @@ -898,13 +899,14 @@ const TargetData &TD) { ValueHandle VH(VMC, V); - unsigned NumUses = V->use_size(); + // FIXME: This is horrible! + unsigned NumUses = V->getNumUses(); for (unsigned It = 0; It < NumUses; ) { unsigned OldSize = NumUses; Value::use_iterator UI = V->use_begin(); std::advance(UI, It); ConvertOperandToType(*UI, V, NewVal, VMC, TD); - NumUses = V->use_size(); + NumUses = V->getNumUses(); if (NumUses == OldSize) ++It; } } @@ -1237,22 +1239,15 @@ if (I->getType() != Res->getType()) ConvertValueToNewType(I, Res, VMC, TD); else { - bool FromStart = true; - Value::use_iterator UI; - while (1) { - if (FromStart) UI = I->use_begin(); - if (UI == I->use_end()) break; - + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); + UI != E; ) if (isa(*UI)) { ++UI; - FromStart = false; } else { - User *U = *UI; - if (!FromStart) --UI; - U->replaceUsesOfWith(I, Res); - if (!FromStart) ++UI; + Use &U = UI.getUse(); + ++UI; // Do not invalidate UI. + U.set(Res); } - } } } @@ -1301,7 +1296,7 @@ RecursiveDelete(Cache, dyn_cast(V)); } else { //DEBUG(std::cerr << "VH RELEASING: " << (void*)Operands[0].get() << " " - // << Operands[0]->use_size() << " " << Operands[0]); + // << Operands[0]->getNumUses() << " " << Operands[0]); } } From lattner at cs.uiuc.edu Mon Jan 31 19:23:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:23:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp GlobalOpt.cpp Message-ID: <200502010123.j111Nipt009163@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.54 -> 1.55 GlobalOpt.cpp updated: 1.33 -> 1.34 --- Log message: Adjust to changes in APIs --- Diffs of the changes: (+10 -16) FunctionResolution.cpp | 6 +++--- GlobalOpt.cpp | 20 +++++++------------- 2 files changed, 10 insertions(+), 16 deletions(-) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.54 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.55 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.54 Wed Sep 29 19:12:29 2004 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Mon Jan 31 19:23:31 2005 @@ -98,11 +98,11 @@ // functions and that the Old function has no varargs fns specified. In // otherwords it's just (...) // - if (!Old->use_empty()) { // Avoid making the CPR unless we really need it + if (!Old->use_empty()) { Value *Replacement = Concrete; if (Concrete->getType() != Old->getType()) - Replacement = ConstantExpr::getCast(Concrete,Old->getType()); - NumResolved += Old->use_size(); + Replacement = ConstantExpr::getCast(Concrete, Old->getType()); + NumResolved += Old->getNumUses(); Old->replaceAllUsesWith(Replacement); } Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.33 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.34 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.33 Sat Jan 8 13:45:31 2005 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Mon Jan 31 19:23:31 2005 @@ -361,7 +361,8 @@ else assert(0 && "Unknown aggregate sequential type!"); - if (NumElements > 16 && GV->use_size() > 16) return 0; // It's not worth it. + if (NumElements > 16 && GV->getNumUses() > 16) + return 0; // It's not worth it. NewGlobals.reserve(NumElements); for (unsigned i = 0, e = NumElements; i != e; ++i) { Constant *In = getAggregateConstantElement(Init, @@ -614,17 +615,11 @@ if (Constant *NewC = ConstantFoldInstruction(I)) { I->replaceAllUsesWith(NewC); - // Back up UI to avoid invalidating it! - bool AtBegin = false; - if (UI == V->use_begin()) - AtBegin = true; - else - --UI; - I->eraseFromParent(); - if (AtBegin) - UI = V->use_begin(); - else + // Advance UI to the next non-I use to avoid invalidating it! + // Instructions could multiply use V. + while (UI != E && *UI == I) ++UI; + I->eraseFromParent(); } } @@ -683,8 +678,7 @@ while (!GV->use_empty()) if (LoadInst *LI = dyn_cast(GV->use_back())) { while (!LI->use_empty()) { - // FIXME: the iterator should expose a getUse() method. - Use &LoadUse = *(const iplist::iterator&)LI->use_begin(); + Use &LoadUse = LI->use_begin().getUse(); if (!isa(LoadUse.getUser())) LoadUse = RepValue; else { From lattner at cs.uiuc.edu Mon Jan 31 19:24:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:24:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Message-ID: <200502010124.j111O2Ru009180@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.26 -> 1.27 --- Log message: API change. --- Diffs of the changes: (+1 -1) CorrelatedExprs.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.26 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.27 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.26 Sun Sep 19 23:43:14 2004 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Mon Jan 31 19:23:49 2005 @@ -634,7 +634,7 @@ assert(Orig != New && "Cannot replace value with itself"); std::vector InstsToChange; std::vector PHIsToChange; - InstsToChange.reserve(Orig->use_size()); + InstsToChange.reserve(Orig->getNumUses()); // Loop over instructions adding them to InstsToChange vector, this allows us // an easy way to avoid invalidating the use_iterator at a bad time. From lattner at cs.uiuc.edu Mon Jan 31 19:24:14 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:24:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200502010124.j111OEqO009191@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.168 -> 1.169 --- Log message: Update for API change. --- Diffs of the changes: (+1 -1) AsmWriter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.168 llvm/lib/VMCore/AsmWriter.cpp:1.169 --- llvm/lib/VMCore/AsmWriter.cpp:1.168 Mon Jan 3 19:56:57 2005 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Jan 31 19:24:01 2005 @@ -1019,7 +1019,7 @@ else Out << ':' << SlotNum; // Print out the def slot taken. } - Out << " [#uses=" << V.use_size() << ']'; // Output # uses + Out << " [#uses=" << V.getNumUses() << ']'; // Output # uses } } From lattner at cs.uiuc.edu Mon Jan 31 19:24:33 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:24:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Value.cpp Message-ID: <200502010124.j111OXOa009242@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Value.cpp updated: 1.51 -> 1.52 --- Log message: Updates for new use list changes. --- Diffs of the changes: (+23 -6) Value.cpp | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/Value.cpp diff -u llvm/lib/VMCore/Value.cpp:1.51 llvm/lib/VMCore/Value.cpp:1.52 --- llvm/lib/VMCore/Value.cpp:1.51 Fri Oct 15 18:08:50 2004 +++ llvm/lib/VMCore/Value.cpp Mon Jan 31 19:24:21 2005 @@ -31,7 +31,7 @@ } Value::Value(const Type *ty, unsigned scid, const std::string &name) - : SubclassID(scid), Ty(checkType(ty)), Name(name) { + : SubclassID(scid), Ty(checkType(ty)), UseList(0), Name(name) { if (!isa(this) && !isa(this)) assert((Ty->isFirstClassType() || Ty == Type::VoidTy || isa(ty)) && @@ -48,19 +48,36 @@ // still being referenced. The value in question should be printed as // a // - if (Uses.begin() != Uses.end()) { + if (use_begin() != use_end()) { std::cerr << "While deleting: " << *Ty << " %" << Name << "\n"; - for (use_const_iterator I = Uses.begin(), E = Uses.end(); I != E; ++I) + for (use_iterator I = use_begin(), E = use_end(); I != E; ++I) std::cerr << "Use still stuck around after Def is destroyed:" << **I << "\n"; } #endif - assert(Uses.begin() == Uses.end() &&"Uses remain when a value is destroyed!"); + assert(use_begin() == use_end() && "Uses remain when a value is destroyed!"); // There should be no uses of this object anymore, remove it. LeakDetector::removeGarbageObject(this); } +/// hasNUses - Return true if this Value has exactly N users. +/// +bool Value::hasNUses(unsigned N) const { + use_const_iterator UI = use_begin(), E = use_end(); + + for (; N; --N, ++UI) + if (UI == E) return false; // Too few. + return UI == E; +} + +/// getNumUses - This method computes the number of uses of this Value. This +/// is a linear time operation. Use hasOneUse or hasNUses to check for specific +/// values. +unsigned Value::getNumUses() const { + return (unsigned)std::distance(use_begin(), use_end()); +} + // uncheckedReplaceAllUsesWith - This is exactly the same as replaceAllUsesWith, // except that it doesn't have all of the asserts. The asserts fail because we @@ -69,8 +86,8 @@ // this problem. // void Value::uncheckedReplaceAllUsesWith(Value *New) { - while (!Uses.empty()) { - Use &U = Uses.back(); + while (!use_empty()) { + Use &U = *UseList; // Must handle Constants specially, we cannot call replaceUsesOfWith on a // constant! if (Constant *C = dyn_cast(U.getUser())) { From lattner at cs.uiuc.edu Mon Jan 31 19:34:08 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:34:08 -0600 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200502010134.j111Y8ol009557@apoc.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.291 -> 1.292 --- Log message: Update speedup and shrinkage info --- Diffs of the changes: (+3 -3) ReleaseNotes.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.291 llvm/docs/ReleaseNotes.html:1.292 --- llvm/docs/ReleaseNotes.html:1.291 Fri Jan 28 18:44:22 2005 +++ llvm/docs/ReleaseNotes.html Mon Jan 31 19:33:52 2005 @@ -78,8 +78,8 @@
  • LLVM now includes an Interprocedural Sparse Conditional Constant Propagation pass, named -ipsccp, which is run by default at link-time.
  • -
  • LLVM is now about 10% faster than before due to its core data structures - using less memory.
  • +
  • LLVM 1.5 is now about 15% faster than LLVM 1.4 and its core data structures + use about 20% less memory.
  • @@ -567,7 +567,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/01/29 00:44:22 $ + Last modified: $Date: 2005/02/01 01:33:52 $ From alenhar2 at cs.uiuc.edu Mon Jan 31 19:37:40 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 31 Jan 2005 19:37:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200502010137.TAA18907@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.21 -> 1.22 AlphaInstrInfo.td updated: 1.12 -> 1.13 --- Log message: pecimise loads, put indirect call addr in right register. still doesn't fix methcall --- Diffs of the changes: (+19 -14) AlphaISelPattern.cpp | 9 ++++++++- AlphaInstrInfo.td | 24 +++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.21 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.22 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.21 Sun Jan 30 19:44:26 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Mon Jan 31 19:37:24 2005 @@ -307,6 +307,12 @@ Node->dump(); assert(0 && "Node not handled!\n"); + case ISD::FP_ROUND: + assert (DestType == MVT::f32 && N.getOperand(0).getValueType() == MVT::f64 && "only f64 to f32 conversion supported here"); + Tmp1 = SelectExpr(N.getOperand(0)); + BuildMI(BB, Alpha::CVTTS, 1, Result).addReg(Tmp1); + return Result; + case ISD::FP_EXTEND: assert (DestType == MVT::f64 && N.getOperand(0).getValueType() == MVT::f32 && "only f32 to f64 conversion supported here"); Tmp1 = SelectExpr(N.getOperand(0)); @@ -660,7 +666,8 @@ { //no need to restore GP as we are doing an indirect call Tmp1 = SelectExpr(N.getOperand(1)); - BuildMI(BB, Alpha::JSR, 2, Alpha::R26).addReg(Tmp1).addImm(1); + BuildMI(BB, Alpha::BIS, 2, Alpha::R27).addReg(Tmp1).addReg(Tmp1); + BuildMI(BB, Alpha::JSR, 2, Alpha::R26).addReg(Alpha::R27).addImm(0); } //push the result into a virtual register Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.12 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.13 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.12 Sun Jan 30 21:19:31 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Mon Jan 31 19:37:24 2005 @@ -56,17 +56,13 @@ let Uses = [R28] in def LOAD_IMM : PseudoInstAlpha<(ops GPRC:$RC, s64imm:$IMM), "ldiq $RC,$IMM">; //Load Immediate Quadword -let Uses = [R29, R28] in +let Uses = [R29, R28] in { def STORE : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "stq $RA,$DISP">; //Store quadword - -let Uses = [R29, R28] in def LOAD_ADDR : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "lda $RA,$DISP">; //Load address - -let Uses = [R29, R28] in def LOAD : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldq $RA,$DISP">; //Load quadword - -def LDW : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldw $RA,$DISP($RB)">; // Load sign-extended word -def LDB : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldb $RA,$DISP($RB)">; //Load byte + def LDW : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldw $RA,$DISP($RB)">; // Load sign-extended word + def LDB : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldb $RA,$DISP($RB)">; //Load byte +} let Uses = [R28, R23, R24, R25, R26] in { @@ -252,7 +248,7 @@ F0, F1, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30], - Uses = [R27, R29] in { + Uses = [R29] in { def JSR : MForm< 0x1A, (ops GPRC:$RD, GPRC:$RS, s14imm:$DISP), "jsr $RD,($RS),$DISP">; //Jump to subroutine def BSR : BForm<0x34, (ops GPRC:$RD, s21imm:$DISP), "bsr $RD,$DISP">; //Branch to subroutine } @@ -260,16 +256,13 @@ def JSR_COROUTINE : MForm< 0x1A, (ops GPRC:$RD, GPRC:$RS), "jsr_coroutine $RD,($RS),1">; //Jump to subroutine return def BR : BForm<0x30, (ops GPRC:$RD, s21imm:$DISP), "br $RD,$DISP">; //Branch +let Uses = [R29, R28] in { //Stores, int def STB : MForm<0x0E, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "stb $RA,$DISP($RB)">; // Store byte def STW : MForm<0x0D, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "stw $RA,$DISP($RB)">; // Store word def STL : MForm<0x2C, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "stl $RA,$DISP($RB)">; // Store longword def STQ : MForm<0x2D, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "stq $RA,$DISP($RB)">; //Store quadword -//Load address -def LDA : MForm<0x08, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "lda $RA,$DISP($RB)">; //Load address -def LDAH : MForm<0x08, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldah $RA,$DISP($RB)">; //Load address high - //Loads, int def LDL : MForm<0x28, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldq $RA,$DISP($RB)">; // Load sign-extended longword def LDQ : MForm<0x29, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldq $RA,$DISP($RB)">; //Load quadword @@ -283,6 +276,11 @@ //Loads, float def LDS : MForm<0x22, (ops FPRC:$RA, s16imm:$DISP, GPRC:$RB), "lds $RA,$DISP($RB)">; //Load S_floating def LDT : MForm<0x23, (ops FPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldt $RA,$DISP($RB)">; //Load T_floating +} + +//Load address +def LDA : MForm<0x08, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "lda $RA,$DISP($RB)">; //Load address +def LDAH : MForm<0x08, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldah $RA,$DISP($RB)">; //Load address high //Branches, int From lattner at cs.uiuc.edu Mon Jan 31 19:45:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:45:09 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2005-01-31-CallingAggregateFunction.ll Message-ID: <200502010145.j111j9gv009655@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2005-01-31-CallingAggregateFunction.ll added (r1.1) --- Log message: This bug crashes the assembler, distilled from a testcase produced by Andrew. --- Diffs of the changes: (+8 -0) 2005-01-31-CallingAggregateFunction.ll | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/test/Regression/Assembler/2005-01-31-CallingAggregateFunction.ll diff -c /dev/null llvm/test/Regression/Assembler/2005-01-31-CallingAggregateFunction.ll:1.1 *** /dev/null Mon Jan 31 19:45:04 2005 --- llvm/test/Regression/Assembler/2005-01-31-CallingAggregateFunction.ll Mon Jan 31 19:44:54 2005 *************** *** 0 **** --- 1,8 ---- + ; RUN: llvm-as %s -o /dev/null 2>&1 | grep "LLVM functions cannot return aggregate types" + + void %test() { + call {} %foo() + ret void + } + + declare {} %foo() From lattner at cs.uiuc.edu Mon Jan 31 19:47:25 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:47:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Makefile Message-ID: <200502010147.j111lPj5010085@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Makefile updated: 1.6 -> 1.7 --- Log message: Apparently := confuses makellvm --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/AsmParser/Makefile diff -u llvm/lib/AsmParser/Makefile:1.6 llvm/lib/AsmParser/Makefile:1.7 --- llvm/lib/AsmParser/Makefile:1.6 Wed Oct 27 19:43:24 2004 +++ llvm/lib/AsmParser/Makefile Mon Jan 31 19:47:12 2005 @@ -7,7 +7,7 @@ # ##===----------------------------------------------------------------------===## -LEVEL := ../.. +LEVEL = ../.. LIBRARYNAME := LLVMAsmParser BUILT_SOURCES := llvmAsmParser.cpp llvmAsmParser.h Lexer.cpp From lattner at cs.uiuc.edu Mon Jan 31 19:47:55 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 31 Jan 2005 19:47:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200502010147.j111ltqd010099@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.210 -> 1.211 --- Log message: Fix test/Regression/Assembler/2005-01-31-CallingAggregateFunction.ll --- Diffs of the changes: (+3 -0) llvmAsmParser.y | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.210 llvm/lib/AsmParser/llvmAsmParser.y:1.211 --- llvm/lib/AsmParser/llvmAsmParser.y:1.210 Fri Jan 28 18:35:55 2005 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Jan 31 19:47:42 2005 @@ -2057,6 +2057,9 @@ bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); + if (!(*$2)->isFirstClassType() && *$2 != Type::VoidTy) + ThrowException("LLVM functions cannot return aggregate types!"); + Ty = FunctionType::get($2->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } From jeffc at jolt-lang.org Tue Feb 1 09:59:39 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 1 Feb 2005 09:59:39 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStartedVS.html index.html Message-ID: <200502011559.JAA24845@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStartedVS.html updated: 1.1 -> 1.2 index.html updated: 1.42 -> 1.43 --- Log message: Put finishing touches on GettingStartedVS.html and link it to the index. --- Diffs of the changes: (+19 -92) GettingStartedVS.html | 105 ++++++-------------------------------------------- index.html | 6 ++ 2 files changed, 19 insertions(+), 92 deletions(-) Index: llvm/docs/GettingStartedVS.html diff -u llvm/docs/GettingStartedVS.html:1.1 llvm/docs/GettingStartedVS.html:1.2 --- llvm/docs/GettingStartedVS.html:1.1 Sun Jan 30 23:42:10 2005 +++ llvm/docs/GettingStartedVS.html Tue Feb 1 09:59:28 2005 @@ -24,8 +24,6 @@
  • Getting Started with LLVM
    1. Terminology and Notation -
    2. Unpacking the LLVM Archives -
    3. Checkout LLVM from CVS
    4. The Location of LLVM Object Files
  • @@ -36,7 +34,7 @@

    Written by: - Jeff Cohen, + Jeff Cohen

    @@ -55,12 +53,13 @@ functional, but it is currently not possible to directly generate an executable file. You can do so indirectly by using the C back end.

    -

    To emphasize, there is no C/C++ front end currently available. llvm-gcc - is based on GCC, which cannot be bootstrapped using VC++. Eventually there - should be a llvm-gcc based on Cygwin or Mingw that is usable. There is also - the option of generating bytecode files on Unix and copying them over to - Windows. But be aware the odds of linking C++ code compiled with llvm-gcc - with code compiled with VC++ is essentially zero.

    +

    To emphasize, there is no C/C++ front end currently available. + llvm-gcc is based on GCC, which cannot be bootstrapped using VC++. + Eventually there should be a llvm-gcc based on Cygwin or MinGW that + is usable. There is also the option of generating bytecode files on Unix and + copying them over to Windows. But be aware the odds of linking C++ code + compiled with llvm-gcc with code compiled with VC++ is essentially + zero.

    The LLVM test suite cannot be run on the Visual Studio port at this time.

    @@ -95,7 +94,7 @@
    1. cd where-you-want-llvm-to-live
    2. gunzip --stdout llvm-version.tar.gz | tar -xvf - - or use WinZip +       or use WinZip
    3. cd llvm
    @@ -128,6 +127,9 @@ +

    It is strongly encouraged that you get the latest version from CVS. Much +progress has been made since the 1.4 release.

    + @@ -222,84 +224,6 @@ - -
    - -

    -If you have the LLVM distribution, you will need to unpack it before you -can begin to compile it. LLVM is distributed as a set of two files: the LLVM -suite and the LLVM GCC front end compiled for your platform. There is an -additional test suite that is optional. Each file is a TAR archive that is -compressed with the gzip program. The WinZip program can also unpack this -archive. Only the LLVM suite is usable with Visual Studio. -

    - -

    The files are as follows: -

    -
    llvm-1.4.tar.gz
    -
    This is the source code for the LLVM libraries and tools.
    -
    - -
    - - - - -
    - -

    If you have access to our CVS repository, you can get a fresh copy of -the entire source code. Note that significant progress has been made on the -Visual Studio port since 1.4 was released. All you need to do is check it out -from CVS as follows:

    - -
      -
    • cd where-you-want-llvm-to-live -
    • cvs -d :pserver:anon at llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login -
    • Hit the return key when prompted for the password. -
    • cvs -z3 -d :pserver:anon at llvm-cvs.cs.uiuc.edu:/var/cvs/llvm co - llvm -
    - -

    This will create an 'llvm' directory in the current -directory and fully populate it with the LLVM source code, Makefiles, -test directories, and local copies of documentation files.

    - -

    If you want to get a specific release (as opposed to the most recent -revision), you can specify a label. The following releases have the following -label:

    - -
      -
    • Release 1.4: RELEASE_14
    • -
    • Release 1.3: RELEASE_13
    • -
    • Release 1.2: RELEASE_12
    • -
    • Release 1.1: RELEASE_11
    • -
    • Release 1.0: RELEASE_1
    • -
    - -
    - - - - -
    - -

    If the main CVS server is overloaded or inaccessible, you can try one of -these user-hosted mirrors:

    - - -
    - - - @@ -424,10 +348,9 @@ Valid HTML 4.01! - Chris Lattner
    - Reid Spencer
    + Jeff Cohen
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/01/31 05:42:10 $ + Last modified: $Date: 2005/02/01 15:59:28 $ Index: llvm/docs/index.html diff -u llvm/docs/index.html:1.42 llvm/docs/index.html:1.43 --- llvm/docs/index.html:1.42 Fri Jan 7 12:57:33 2005 +++ llvm/docs/index.html Tue Feb 1 09:59:28 2005 @@ -51,6 +51,10 @@ Everything from unpacking and compilation of the distribution to execution of some tools. +
  • Getting Started with the LLVM System using +Microsoft Visual Studio - An addendum to the main Getting Started guide for +those using Visual Studio on Windows.
  • +
  • LLVM Command Guide - A reference manual for the LLVM command line utilities ("man" pages for LLVM tools).
    Current tools: @@ -230,6 +234,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/01/07 18:57:33 $ + Last modified: $Date: 2005/02/01 15:59:28 $ From lattner at cs.uiuc.edu Tue Feb 1 11:36:07 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 1 Feb 2005 11:36:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200502011736.j11Ha7gj026519@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.87 -> 1.88 --- Log message: Do not revisit nodes in the SCC traversal. This speeds up the BU pass a bit. --- Diffs of the changes: (+29 -7) BottomUpClosure.cpp | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.87 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.88 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.87 Sun Jan 30 18:10:45 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Tue Feb 1 11:35:52 2005 @@ -40,9 +40,13 @@ GlobalsGraph = new DSGraph(LocalDSA.getGlobalsGraph()); GlobalsGraph->setPrintAuxCalls(); + std::vector Stack; + hash_map ValMap; + unsigned NextID = 1; + Function *MainFunc = M.getMainFunction(); if (MainFunc) - calculateReachableGraphs(MainFunc); + calculateGraphs(MainFunc, Stack, NextID, ValMap); // Calculate the graphs for any functions that are unreachable from main... for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) @@ -52,7 +56,7 @@ std::cerr << "*** Function unreachable from main: " << I->getName() << "\n"; #endif - calculateReachableGraphs(I); // Calculate all graphs... + calculateGraphs(I, Stack, NextID, ValMap); // Calculate all graphs. } NumCallEdges += ActualCallees.size(); @@ -69,10 +73,6 @@ } void BUDataStructures::calculateReachableGraphs(Function *F) { - std::vector Stack; - hash_map ValMap; - unsigned NextID = 1; - calculateGraphs(F, Stack, NextID, ValMap); } DSGraph &BUDataStructures::getOrCreateGraph(Function *F) { @@ -253,7 +253,29 @@ DSGraph::ReturnNodesTy &ReturnNodes = Graph.getReturnNodes(); - // Loop over all of the resolvable call sites + // Print out multi-call sites. + bool Printed = false; + for (std::list::iterator I = TempFCs.begin(), E = TempFCs.end(); + I != E; ++I) { + if (!I->isDirectCall()) { + DSNode *Node = I->getCalleeNode(); + if (Node->getGlobals().size() > 1) { + if (!Printed) + std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; + std::cerr << " calls " << Node->getGlobals().size() + << " fns from site: " << *I->getCallSite().getInstruction(); + unsigned NumToPrint = Node->getGlobals().size(); + if (NumToPrint > 5) NumToPrint = 5; + std::cerr << " Fns ="; + for (unsigned i = 0; i != NumToPrint; ++i) + std::cerr << " " << Node->getGlobals()[i]->getName(); + std::cerr << "\n"; + } + } + } + + + // Loop over all of the resolvable call sites. DSCallSiteIterator I = DSCallSiteIterator::begin(TempFCs); DSCallSiteIterator E = DSCallSiteIterator::end(TempFCs); From lattner at cs.uiuc.edu Tue Feb 1 12:38:43 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 1 Feb 2005 12:38:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200502011838.j11IcheH026749@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.57 -> 1.58 --- Log message: Fix some bugs andrew noticed legalizing memset for alpha --- Diffs of the changes: (+3 -3) LegalizeDAG.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.57 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.58 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.57 Fri Jan 28 16:58:25 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Feb 1 12:38:28 2005 @@ -710,17 +710,17 @@ case ISD::MEMSET: case ISD::MEMCPY: case ISD::MEMMOVE: { - Tmp1 = LegalizeOp(Node->getOperand(0)); // Function + Tmp1 = LegalizeOp(Node->getOperand(0)); // Chain Tmp2 = LegalizeOp(Node->getOperand(1)); // Pointer if (Node->getOpcode() == ISD::MEMSET) { // memset = ubyte switch (getTypeAction(Node->getOperand(2).getValueType())) { case Expand: assert(0 && "Cannot expand a byte!"); case Legal: - Tmp3 = LegalizeOp(Node->getOperand(1)); + Tmp3 = LegalizeOp(Node->getOperand(2)); break; case Promote: - Tmp3 = PromoteOp(Node->getOperand(1)); + Tmp3 = PromoteOp(Node->getOperand(2)); break; } } else { From lattner at cs.uiuc.edu Tue Feb 1 13:11:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 1 Feb 2005 13:11:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200502011911.j11JB3FZ027692@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.74 -> 1.75 --- Log message: Signficantly speed up printing by not emitting the same file twice with different names. Large SCC's tend to be big, so this saves a lot of time. --- Diffs of the changes: (+9 -3) Printer.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.74 llvm/lib/Analysis/DataStructure/Printer.cpp:1.75 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.74 Sun Jan 30 17:51:02 2005 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Tue Feb 1 13:10:48 2005 @@ -274,9 +274,15 @@ Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size(); TotalCallNodes += NumCalls; - if (I->getName() == "main" || !OnlyPrintMain) - Gr.writeGraphToFile(O, Prefix+I->getName()); - else { + if (I->getName() == "main" || !OnlyPrintMain) { + Function *SCCFn = Gr.getReturnNodes().begin()->first; + if (&*I == SCCFn) + Gr.writeGraphToFile(O, Prefix+I->getName()); + else + O << "Didn't write '" << Prefix+I->getName() + << ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName() + << "\n"; + } else { O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... [" << Gr.getGraphSize() << "+" << NumCalls << "]\n"; } From alenhar2 at cs.uiuc.edu Tue Feb 1 14:34:45 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 14:34:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaRegisterInfo.td Message-ID: <200502012034.OAA02322@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaRegisterInfo.td updated: 1.2 -> 1.3 --- Log message: fix register names --- Diffs of the changes: (+16 -16) AlphaRegisterInfo.td | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.td diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.2 llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.3 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.2 Thu Jan 27 02:31:19 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.td Tue Feb 1 14:34:29 2005 @@ -52,22 +52,22 @@ def R30 : GPR<30, "$30">; def R31 : GPR<31, "$31">; // Floating-point registers -def F0 : FPR< 0, "F0">; def F1 : FPR< 1, "F1">; -def F2 : FPR< 2, "F2">; def F3 : FPR< 3, "F3">; -def F4 : FPR< 4, "F4">; def F5 : FPR< 5, "F5">; -def F6 : FPR< 6, "F6">; def F7 : FPR< 7, "F7">; -def F8 : FPR< 8, "F8">; def F9 : FPR< 9, "F9">; -def F10 : FPR<10, "F10">; def F11 : FPR<11, "F11">; -def F12 : FPR<12, "F12">; def F13 : FPR<13, "F13">; -def F14 : FPR<14, "F14">; def F15 : FPR<15, "F15">; -def F16 : FPR<16, "F16">; def F17 : FPR<17, "F17">; -def F18 : FPR<18, "F18">; def F19 : FPR<19, "F19">; -def F20 : FPR<20, "F20">; def F21 : FPR<21, "F21">; -def F22 : FPR<22, "F22">; def F23 : FPR<23, "F23">; -def F24 : FPR<24, "F24">; def F25 : FPR<25, "F25">; -def F26 : FPR<26, "F26">; def F27 : FPR<27, "F27">; -def F28 : FPR<28, "F28">; def F29 : FPR<29, "F29">; -def F30 : FPR<30, "F30">; def F31 : FPR<31, "F31">; +def F0 : FPR< 0, "$f0">; def F1 : FPR< 1, "$f1">; +def F2 : FPR< 2, "$f2">; def F3 : FPR< 3, "$f3">; +def F4 : FPR< 4, "$f4">; def F5 : FPR< 5, "$f5">; +def F6 : FPR< 6, "$f6">; def F7 : FPR< 7, "$f7">; +def F8 : FPR< 8, "$f8">; def F9 : FPR< 9, "$f9">; +def F10 : FPR<10, "$f10">; def F11 : FPR<11, "$f11">; +def F12 : FPR<12, "$f12">; def F13 : FPR<13, "$f13">; +def F14 : FPR<14, "$f14">; def F15 : FPR<15, "$f15">; +def F16 : FPR<16, "$f16">; def F17 : FPR<17, "$f17">; +def F18 : FPR<18, "$f18">; def F19 : FPR<19, "$f19">; +def F20 : FPR<20, "$f20">; def F21 : FPR<21, "$f21">; +def F22 : FPR<22, "$f22">; def F23 : FPR<23, "$f23">; +def F24 : FPR<24, "$f24">; def F25 : FPR<25, "$f25">; +def F26 : FPR<26, "$f26">; def F27 : FPR<27, "$f27">; +def F28 : FPR<28, "$f28">; def F29 : FPR<29, "$f29">; +def F30 : FPR<30, "$f30">; def F31 : FPR<31, "$f31">; // //#define FP $15 // //#define RA $26 From alenhar2 at cs.uiuc.edu Tue Feb 1 14:35:06 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 14:35:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Message-ID: <200502012035.OAA02337@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaTargetMachine.cpp updated: 1.3 -> 1.4 --- Log message: try to match alpha pattern --- Diffs of the changes: (+19 -0) AlphaTargetMachine.cpp | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.3 llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.4 --- llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.3 Mon Jan 24 12:48:22 2005 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Tue Feb 1 14:34:54 2005 @@ -12,11 +12,13 @@ #include "Alpha.h" #include "AlphaTargetMachine.h" +#include "llvm/Module.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Transforms/Scalar.h" #include + using namespace llvm; namespace { @@ -24,6 +26,23 @@ RegisterTarget X("alpha", " Alpha (incomplete)"); } +unsigned AlphaTargetMachine::getModuleMatchQuality(const Module &M) { + // We strongly match "alpha*". + std::string TT = M.getTargetTriple(); + if (TT.size() >= 5 && TT[0] == 'a' && TT[1] == 'l' && TT[2] == 'p' && + TT[3] == 'h' && TT[4] == 'a') + return 20; + + if (M.getEndianness() == Module::LittleEndian && + M.getPointerSize() == Module::Pointer64) + return 10; // Weak match + else if (M.getEndianness() != Module::AnyEndianness || + M.getPointerSize() != Module::AnyPointerSize) + return 0; // Match for some other target + + return 0; +} + AlphaTargetMachine::AlphaTargetMachine( const Module &M, IntrinsicLowering *IL) : TargetMachine("alpha", IL, true), FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) //TODO: check these From alenhar2 at cs.uiuc.edu Tue Feb 1 14:35:24 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 14:35:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaTargetMachine.h Message-ID: <200502012035.OAA02352@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaTargetMachine.h updated: 1.3 -> 1.4 --- Log message: try to match alpha pattern --- Diffs of the changes: (+2 -1) AlphaTargetMachine.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaTargetMachine.h diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.3 llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.4 --- llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.3 Mon Jan 24 13:44:07 2005 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.h Tue Feb 1 14:35:11 2005 @@ -38,7 +38,8 @@ } virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out); - + + static unsigned getModuleMatchQuality(const Module &M); }; } // end namespace llvm From alenhar2 at cs.uiuc.edu Tue Feb 1 14:36:09 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 14:36:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Message-ID: <200502012036.OAA02373@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaRegisterInfo.cpp updated: 1.9 -> 1.10 --- Log message: Correct stack stuff for FP --- Diffs of the changes: (+12 -5) AlphaRegisterInfo.cpp | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.9 llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.10 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.9 Sun Jan 30 10:33:46 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Tue Feb 1 14:35:57 2005 @@ -49,8 +49,12 @@ unsigned SrcReg, int FrameIdx) const { //std::cerr << "Trying to store " << getPrettyName(SrcReg) << " to " << FrameIdx << "\n"; //BuildMI(MBB, MI, Alpha::WTF, 0).addReg(SrcReg); - BuildMI(MBB, MI, Alpha::STQ, 3).addReg(SrcReg).addFrameIndex(FrameIdx).addReg(Alpha::F31); - // assert(0 && "TODO"); + if (getClass(SrcReg) == Alpha::FPRCRegisterClass) + BuildMI(MBB, MI, Alpha::STT, 3).addReg(SrcReg).addFrameIndex(FrameIdx).addReg(Alpha::F31); + else if (getClass(SrcReg) == Alpha::GPRCRegisterClass) + BuildMI(MBB, MI, Alpha::STQ, 3).addReg(SrcReg).addFrameIndex(FrameIdx).addReg(Alpha::F31); + else + abort(); } void @@ -58,9 +62,12 @@ MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIdx) const{ //std::cerr << "Trying to load " << getPrettyName(DestReg) << " to " << FrameIdx << "\n"; - //BuildMI(MBB, MI, Alpha::WTF, 0, DestReg); - BuildMI(MBB, MI, Alpha::LDQ, 2, DestReg).addFrameIndex(FrameIdx).addReg(Alpha::F31); - // assert(0 && "TODO"); + if (getClass(DestReg) == Alpha::FPRCRegisterClass) + BuildMI(MBB, MI, Alpha::LDT, 2, DestReg).addFrameIndex(FrameIdx).addReg(Alpha::F31); + else if (getClass(DestReg) == Alpha::GPRCRegisterClass) + BuildMI(MBB, MI, Alpha::LDQ, 2, DestReg).addFrameIndex(FrameIdx).addReg(Alpha::F31); + else + abort(); } void AlphaRegisterInfo::copyRegToReg(MachineBasicBlock &MBB, From alenhar2 at cs.uiuc.edu Tue Feb 1 14:36:56 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 14:36:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.td Message-ID: <200502012036.OAA02388@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.td updated: 1.13 -> 1.14 --- Log message: Make cmov work right and loads for fp from constant pool --- Diffs of the changes: (+20 -18) AlphaInstrInfo.td | 38 ++++++++++++++++++++------------------ 1 files changed, 20 insertions(+), 18 deletions(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.13 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.14 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.13 Mon Jan 31 19:37:24 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Tue Feb 1 14:36:44 2005 @@ -62,6 +62,8 @@ def LOAD : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldq $RA,$DISP">; //Load quadword def LDW : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldw $RA,$DISP($RB)">; // Load sign-extended word def LDB : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldb $RA,$DISP($RB)">; //Load byte + def LDS_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "lds $RA,$DISP">; //Load quadword + def LDT_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldt $RA,$DISP">; //Load quadword } let Uses = [R28, R23, R24, R25, R26] in @@ -78,24 +80,24 @@ //Operation Form: -//let isTwoAddress = 1 in { - def CMOVEQ : OForm< 0x11, 0x24, (ops GPRC:$RDEST, GPRC:$RSRC, GPRC:$RCOND), "cmoveq $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND = zero - def CMOVEQi : OFormL< 0x11, 0x24, (ops GPRC:$RDEST, u8imm:$L, GPRC:$RCOND), "cmoveq $RCOND,$L,$RDEST">; //CMOVE if RCOND = zero - def CMOVGE : OForm< 0x11, 0x46, (ops GPRC:$RDEST, GPRC:$RSRC, GPRC:$RCOND), "CMOVGE $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND >= zero - def CMOVGEi : OFormL< 0x11, 0x46, (ops GPRC:$RDEST, u8imm:$L, GPRC:$RCOND), "CMOVGE $RCOND,$L,$RDEST">; //CMOVE if RCOND >= zero - def CMOVGT : OForm< 0x11, 0x66, (ops GPRC:$RDEST, GPRC:$RSRC, GPRC:$RCOND), "CMOVGT $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND > zero - def CMOVGTi : OFormL< 0x11, 0x66, (ops GPRC:$RDEST, u8imm:$L, GPRC:$RCOND), "CMOVGT $RCOND,$L,$RDEST">; //CMOVE if RCOND > zero - def CMOVLBC : OForm< 0x11, 0x16, (ops GPRC:$RDEST, GPRC:$RSRC, GPRC:$RCOND), "CMOVLBC $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND low bit clear - def CMOVLBCi : OFormL< 0x11, 0x16, (ops GPRC:$RDEST, u8imm:$L, GPRC:$RCOND), "CMOVLBC $RCOND,$L,$RDEST">; //CMOVE if RCOND low bit clear - def CMOVLBS : OForm< 0x11, 0x14, (ops GPRC:$RDEST, GPRC:$RSRC, GPRC:$RCOND), "CMOVLBS $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND low bit set - def CMOVLBSi : OFormL< 0x11, 0x14, (ops GPRC:$RDEST, u8imm:$L, GPRC:$RCOND), "CMOVLBS $RCOND,$L,$RDEST">; //CMOVE if RCOND low bit set - def CMOVLE : OForm< 0x11, 0x64, (ops GPRC:$RDEST, GPRC:$RSRC, GPRC:$RCOND), "CMOVLE $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND <= zero - def CMOVLEi : OFormL< 0x11, 0x64, (ops GPRC:$RDEST, u8imm:$L, GPRC:$RCOND), "CMOVLE $RCOND,$L,$RDEST">; //CMOVE if RCOND <= zero - def CMOVLT : OForm< 0x11, 0x44, (ops GPRC:$RDEST, GPRC:$RSRC, GPRC:$RCOND), "CMOVLT $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND < zero - def CMOVLTi : OFormL< 0x11, 0x44, (ops GPRC:$RDEST, u8imm:$L, GPRC:$RCOND), "CMOVLT $RCOND,$L,$RDEST">; //CMOVE if RCOND < zero - def CMOVNE : OForm< 0x11, 0x26, (ops GPRC:$RDEST, GPRC:$RSRC, GPRC:$RCOND), "cmovne $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND != zero - def CMOVNEi : OFormL< 0x11, 0x26, (ops GPRC:$RDEST, u8imm:$L, GPRC:$RCOND), "cmovne $RCOND,$L,$RDEST">; //CMOVE if RCOND != zero -//} +let isTwoAddress = 1 in { + def CMOVEQ : OForm< 0x11, 0x24, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "cmoveq $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND = zero + def CMOVEQi : OFormL< 0x11, 0x24, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "cmoveq $RCOND,$L,$RDEST">; //CMOVE if RCOND = zero + def CMOVGE : OForm< 0x11, 0x46, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "CMOVGE $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND >= zero + def CMOVGEi : OFormL< 0x11, 0x46, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "CMOVGE $RCOND,$L,$RDEST">; //CMOVE if RCOND >= zero + def CMOVGT : OForm< 0x11, 0x66, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "CMOVGT $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND > zero + def CMOVGTi : OFormL< 0x11, 0x66, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "CMOVGT $RCOND,$L,$RDEST">; //CMOVE if RCOND > zero + def CMOVLBC : OForm< 0x11, 0x16, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "CMOVLBC $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND low bit clear + def CMOVLBCi : OFormL< 0x11, 0x16, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "CMOVLBC $RCOND,$L,$RDEST">; //CMOVE if RCOND low bit clear + def CMOVLBS : OForm< 0x11, 0x14, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "CMOVLBS $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND low bit set + def CMOVLBSi : OFormL< 0x11, 0x14, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "CMOVLBS $RCOND,$L,$RDEST">; //CMOVE if RCOND low bit set + def CMOVLE : OForm< 0x11, 0x64, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "CMOVLE $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND <= zero + def CMOVLEi : OFormL< 0x11, 0x64, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "CMOVLE $RCOND,$L,$RDEST">; //CMOVE if RCOND <= zero + def CMOVLT : OForm< 0x11, 0x44, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "CMOVLT $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND < zero + def CMOVLTi : OFormL< 0x11, 0x44, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "CMOVLT $RCOND,$L,$RDEST">; //CMOVE if RCOND < zero + def CMOVNE : OForm< 0x11, 0x26, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "cmovne $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND != zero + def CMOVNEi : OFormL< 0x11, 0x26, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "cmovne $RCOND,$L,$RDEST">; //CMOVE if RCOND != zero +} def ADDL : OForm< 0x10, 0x00, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), "addl $RA,$RB,$RC">; //Add longword def ADDLi : OFormL<0x10, 0x00, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), "addl $RA,$L,$RC">; //Add longword From alenhar2 at cs.uiuc.edu Tue Feb 1 14:39:06 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 14:39:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Message-ID: <200502012039.OAA02409@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.3 -> 1.4 --- Log message: Print the Constant pool --- Diffs of the changes: (+7 -8) AlphaAsmPrinter.cpp | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.3 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.4 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.3 Tue Jan 25 13:58:40 2005 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Tue Feb 1 14:38:53 2005 @@ -211,14 +211,13 @@ if (CP.empty()) return; - abort(); -// for (unsigned i = 0, e = CP.size(); i != e; ++i) { -// O << "\t.section\t.rodata\n"; -// emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType())); -// O << ".CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString -// << *CP[i] << "\n"; -// //emitGlobalConstant(CP[i]); -// } + for (unsigned i = 0, e = CP.size(); i != e; ++i) { + O << "\t.section\t.rodata\n"; + emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType())); + O << "$CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString + << *CP[i] << "\n"; + emitGlobalConstant(CP[i]); + } } bool AlphaAsmPrinter::doInitialization(Module &M) From alenhar2 at cs.uiuc.edu Tue Feb 1 14:40:39 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 14:40:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502012040.OAA02433@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.22 -> 1.23 --- Log message: fix FP arg passing bug, Add unsigned to/from int, fix SELECT, fix Constant pool --- Diffs of the changes: (+17 -12) AlphaISelPattern.cpp | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.22 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.23 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.22 Mon Jan 31 19:37:24 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Feb 1 14:40:27 2005 @@ -148,7 +148,7 @@ argVreg.push_back(MF.getSSARegMap()->createVirtualRegister(getRegClassFor(getValueType(I->getType())))); argPreg.push_back(args_float[count]); argOpc.push_back(Alpha::CPYS); - newroot = DAG.getCopyFromReg(argVreg[count], getValueType(I->getType()), DAG.getRoot()); + argt = newroot = DAG.getCopyFromReg(argVreg[count], getValueType(I->getType()), DAG.getRoot()); break; case MVT::i1: case MVT::i8: @@ -179,7 +179,7 @@ BuildMI(&BB, Alpha::IDEF, 0, Alpha::R29); BuildMI(&BB, Alpha::BIS, 2, GP).addReg(Alpha::R29).addReg(Alpha::R29); - for (int i = 0; i < count; ++i) + for (int i = 0; i < std::min(count,6); ++i) BuildMI(&BB, argOpc[i], 2, argVreg[i]).addReg(argPreg[i]).addReg(argPreg[i]); return ArgValues; @@ -354,6 +354,14 @@ Opc = DestType == MVT::f64 ? Alpha::LDS : Alpha::LDT; BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); } + else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { + AlphaLowering.restoreGP(BB); + if (DestType == MVT::f64) { + BuildMI(BB, Alpha::LDT_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); + } else { + BuildMI(BB, Alpha::LDS_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); + } + } else { Select(Chain); @@ -401,7 +409,8 @@ if (Node->getValueType(0) == MVT::f64) { assert(cast(Node)->getExtraValueType() == MVT::f32 && "Bad EXTLOAD!"); - BuildMI(BB, Alpha::LDS, 1, Tmp2).addConstantPoolIndex(CP->getIndex()); + AlphaLowering.restoreGP(BB); + BuildMI(BB, Alpha::LDS_SYM, 1, Tmp2).addConstantPoolIndex(CP->getIndex()); BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); return Result; } @@ -412,9 +421,8 @@ return Result; - //case ISD::UINT_TO_FP: - - case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: + case ISD::SINT_TO_FP: { assert (N.getOperand(0).getValueType() == MVT::i64 && "only quads can be loaded from"); Tmp1 = SelectExpr(N.getOperand(0)); // Get the operand register @@ -969,9 +977,8 @@ Tmp2 = SelectExpr(N.getOperand(1)); BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2); return Result; -// // case ISD::UINT_TO_FP: - + case ISD::FP_TO_UINT: case ISD::FP_TO_SINT: { assert (DestType == MVT::i64 && "only quads can be loaded to"); @@ -1004,13 +1011,11 @@ case ISD::SELECT: { + Tmp1 = SelectExpr(N.getOperand(0)); //Cond Tmp2 = SelectExpr(N.getOperand(1)); //Use if TRUE Tmp3 = SelectExpr(N.getOperand(2)); //Use if FALSE - Tmp1 = SelectExpr(N.getOperand(0)); //Cond // Get the condition into the zero flag. - unsigned dummy = MakeReg(MVT::i64); - BuildMI(BB, Alpha::BIS, 2, dummy).addReg(Tmp3).addReg(Tmp3); - BuildMI(BB, Alpha::CMOVEQ, 2, Result).addReg(Tmp2).addReg(Tmp1); + BuildMI(BB, Alpha::CMOVEQ, 2, Result).addReg(Tmp2).addReg(Tmp3).addReg(Tmp1); return Result; } From lattner at cs.uiuc.edu Tue Feb 1 15:37:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 1 Feb 2005 15:37:21 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DataStructure.h Message-ID: <200502012137.j11LbLHH030415@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DataStructure.h updated: 1.82 -> 1.83 --- Log message: remove dead method --- Diffs of the changes: (+0 -3) DataStructure.h | 3 --- 1 files changed, 3 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.82 llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.83 --- llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.82 Mon Jan 24 13:55:34 2005 +++ llvm/include/llvm/Analysis/DataStructure/DataStructure.h Tue Feb 1 15:37:06 2005 @@ -140,9 +140,6 @@ private: void calculateGraph(DSGraph &G); - void calculateReachableGraphs(Function *F); - - DSGraph &getOrCreateGraph(Function *F); unsigned calculateGraphs(Function *F, std::vector &Stack, From lattner at cs.uiuc.edu Tue Feb 1 15:37:40 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 1 Feb 2005 15:37:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200502012137.j11LbevL030426@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.88 -> 1.89 --- Log message: Eliminate use of DSCallSiteIterator in key loop. This is a half step to a tasty speedup. --- Diffs of the changes: (+120 -62) BottomUpClosure.cpp | 182 ++++++++++++++++++++++++++++++++++------------------ 1 files changed, 120 insertions(+), 62 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.88 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.89 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.88 Tue Feb 1 11:35:52 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Tue Feb 1 15:37:27 2005 @@ -72,9 +72,6 @@ return false; } -void BUDataStructures::calculateReachableGraphs(Function *F) { -} - DSGraph &BUDataStructures::getOrCreateGraph(Function *F) { // Has the graph already been created? DSGraph *&Graph = DSInfo[F]; @@ -244,6 +241,20 @@ GlobalsGraph = 0; } +static bool isVAHackFn(const Function *F) { + return F->getName() == "printf" || F->getName() == "sscanf" || + F->getName() == "fprintf" || F->getName() == "open" || + F->getName() == "sprintf" || F->getName() == "fputs" || + F->getName() == "fscanf"; +} + +// isUnresolvableFunction - Return true if this is an unresolvable +// external function. A direct or indirect call to this cannot be resolved. +// +static bool isResolvableFunc(const Function* callee) { + return !callee->isExternal() || isVAHackFn(callee); +} + void BUDataStructures::calculateGraph(DSGraph &Graph) { // Move our call site list into TempFCs so that inline call sites go into the // new call site list and doesn't invalidate our iterators! @@ -263,7 +274,8 @@ if (!Printed) std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; std::cerr << " calls " << Node->getGlobals().size() - << " fns from site: " << *I->getCallSite().getInstruction(); + << " fns from site: " << I->getCallSite().getInstruction() + << " " << *I->getCallSite().getInstruction(); unsigned NumToPrint = Node->getGlobals().size(); if (NumToPrint > 5) NumToPrint = 5; std::cerr << " Fns ="; @@ -274,75 +286,121 @@ } } + while (!TempFCs.empty()) { + DSCallSite &CS = *TempFCs.begin(); - // Loop over all of the resolvable call sites. - DSCallSiteIterator I = DSCallSiteIterator::begin(TempFCs); - DSCallSiteIterator E = DSCallSiteIterator::end(TempFCs); - - // If DSCallSiteIterator skipped over any call sites, they are unresolvable: - // move them back to the AuxCallsList. - std::list::iterator LastCallSiteIdx = TempFCs.begin(); - while (LastCallSiteIdx != I.getCallSiteIdx()) - AuxCallsList.splice(AuxCallsList.end(), TempFCs, LastCallSiteIdx++); - - while (I != E) { - // Resolve the current call... - Function *Callee = *I; - DSCallSite CS = I.getCallSite(); - - if (Callee->isExternal()) { - // Ignore this case, simple varargs functions we cannot stub out! - } else if (ReturnNodes.count(Callee)) { - // Self recursion... simply link up the formal arguments with the - // actual arguments... - DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n"); - - // Handle self recursion by resolving the arguments and return value - Graph.mergeInGraph(CS, *Callee, Graph, 0); + std::set CalledFuncs; + if (CS.isDirectCall()) { + Function *F = CS.getCalleeFunc(); + if (isResolvableFunc(F)) + if (F->isExternal()) { // Call to fprintf, etc. + TempFCs.erase(TempFCs.begin()); + continue; + } else { + CalledFuncs.insert(F); + } } else { - ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), - Callee)); - - // Get the data structure graph for the called function. - // - DSGraph &GI = getDSGraph(*Callee); // Graph to inline - - DEBUG(std::cerr << " Inlining graph for " << Callee->getName() - << "[" << GI.getGraphSize() << "+" - << GI.getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() << "+" - << Graph.getAuxFunctionCalls().size() << "]\n"); - Graph.mergeInGraph(CS, *Callee, GI, - DSGraph::KeepModRefBits | - DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes); - ++NumBUInlines; + DSNode *Node = CS.getCalleeNode(); -#if 0 - Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + - Callee->getName()); -#endif + if (!Node->isIncomplete()) + for (unsigned i = 0, e = Node->getGlobals().size(); i != e; ++i) + if (Function *CF = dyn_cast(Node->getGlobals()[i])) + if (isResolvableFunc(CF) && !CF->isExternal()) + CalledFuncs.insert(CF); } - LastCallSiteIdx = I.getCallSiteIdx(); - ++I; // Move to the next call site. + if (CalledFuncs.empty()) { + // Remember that we could not resolve this yet! + AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); + } else if (CalledFuncs.size() == 1) { + Function *Callee = *CalledFuncs.begin(); + + if (ReturnNodes.count(Callee)) { + // Self recursion... simply link up the formal arguments with the + // actual arguments. + DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n"); + + // Handle self recursion by resolving the arguments and return value + Graph.mergeInGraph(CS, *Callee, Graph, 0); + } else { + ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), + Callee)); + + // Get the data structure graph for the called function. + // + DSGraph &GI = getDSGraph(*Callee); // Graph to inline + + DEBUG(std::cerr << " Inlining graph for " << Callee->getName() + << "[" << GI.getGraphSize() << "+" + << GI.getAuxFunctionCalls().size() << "] into '" + << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" + << Graph.getAuxFunctionCalls().size() << "]\n"); + Graph.mergeInGraph(CS, *Callee, GI, + DSGraph::KeepModRefBits | + DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); + ++NumBUInlines; - if (I.getCallSiteIdx() != LastCallSiteIdx) { - ++LastCallSiteIdx; // Skip over the site we already processed. +#if 0 + Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + + Callee->getName()); +#endif + } - // If there are call sites that get skipped over, move them to the aux - // calls list: they are not resolvable. - if (I != E) - while (LastCallSiteIdx != I.getCallSiteIdx()) - AuxCallsList.splice(AuxCallsList.end(), TempFCs, LastCallSiteIdx++); - else - while (LastCallSiteIdx != TempFCs.end()) - AuxCallsList.splice(AuxCallsList.end(), TempFCs, LastCallSiteIdx++); + TempFCs.erase(TempFCs.begin()); + } else { + if (!Printed) + std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; + std::cerr << " calls " << CalledFuncs.size() + << " fns from site: " << CS.getCallSite().getInstruction() + << " " << *CS.getCallSite().getInstruction(); + unsigned NumToPrint = CalledFuncs.size(); + if (NumToPrint > 8) NumToPrint = 8; + std::cerr << " Fns ="; + for (std::set::iterator I = CalledFuncs.begin(), + E = CalledFuncs.end(); I != E && NumToPrint; ++I, --NumToPrint) + std::cerr << " " << (*I)->getName(); + std::cerr << "\n"; + + // Inline all of the called functions. + for (std::set::iterator I = CalledFuncs.begin(), + E = CalledFuncs.end(); I != E; ++I) { + Function *Callee = *I; + if (ReturnNodes.count(Callee)) { + // Self recursion... simply link up the formal arguments with the + // actual arguments. + DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n"); + + // Handle self recursion by resolving the arguments and return value + Graph.mergeInGraph(CS, *Callee, Graph, 0); + } else { + ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), + Callee)); + + // Get the data structure graph for the called function. + // + DSGraph &GI = getDSGraph(*Callee); // Graph to inline + + DEBUG(std::cerr << " Inlining graph for " << Callee->getName() + << "[" << GI.getGraphSize() << "+" + << GI.getAuxFunctionCalls().size() << "] into '" + << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" + << Graph.getAuxFunctionCalls().size() << "]\n"); + Graph.mergeInGraph(CS, *Callee, GI, + DSGraph::KeepModRefBits | + DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); + ++NumBUInlines; + +#if 0 + Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + + Callee->getName()); +#endif + } + } + TempFCs.erase(TempFCs.begin()); } } - TempFCs.clear(); - // Recompute the Incomplete markers assert(Graph.getInlinedGlobals().empty()); Graph.maskIncompleteMarkers(); From lattner at cs.uiuc.edu Tue Feb 1 15:49:58 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 1 Feb 2005 15:49:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200502012149.j11LnwTu031031@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.89 -> 1.90 --- Log message: Eliminate self-recursion as a special case. --- Diffs of the changes: (+38 -57) BottomUpClosure.cpp | 95 ++++++++++++++++++++-------------------------------- 1 files changed, 38 insertions(+), 57 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.89 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.90 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.89 Tue Feb 1 15:37:27 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Tue Feb 1 15:49:43 2005 @@ -313,41 +313,31 @@ if (CalledFuncs.empty()) { // Remember that we could not resolve this yet! AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); + continue; } else if (CalledFuncs.size() == 1) { Function *Callee = *CalledFuncs.begin(); - if (ReturnNodes.count(Callee)) { - // Self recursion... simply link up the formal arguments with the - // actual arguments. - DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n"); - - // Handle self recursion by resolving the arguments and return value - Graph.mergeInGraph(CS, *Callee, Graph, 0); - } else { - ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), - Callee)); - - // Get the data structure graph for the called function. - // - DSGraph &GI = getDSGraph(*Callee); // Graph to inline - - DEBUG(std::cerr << " Inlining graph for " << Callee->getName() - << "[" << GI.getGraphSize() << "+" - << GI.getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" - << Graph.getAuxFunctionCalls().size() << "]\n"); - Graph.mergeInGraph(CS, *Callee, GI, - DSGraph::KeepModRefBits | - DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); - ++NumBUInlines; + ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), + Callee)); + // Get the data structure graph for the called function. + // + DSGraph &GI = getDSGraph(*Callee); // Graph to inline + + DEBUG(std::cerr << " Inlining graph for " << Callee->getName() + << "[" << GI.getGraphSize() << "+" + << GI.getAuxFunctionCalls().size() << "] into '" + << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" + << Graph.getAuxFunctionCalls().size() << "]\n"); + Graph.mergeInGraph(CS, *Callee, GI, + DSGraph::KeepModRefBits | + DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); + ++NumBUInlines; + #if 0 - Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + - Callee->getName()); + Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + + Callee->getName()); #endif - } - - TempFCs.erase(TempFCs.begin()); } else { if (!Printed) std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; @@ -366,39 +356,30 @@ for (std::set::iterator I = CalledFuncs.begin(), E = CalledFuncs.end(); I != E; ++I) { Function *Callee = *I; - if (ReturnNodes.count(Callee)) { - // Self recursion... simply link up the formal arguments with the - // actual arguments. - DEBUG(std::cerr << " Self Inlining: " << Callee->getName() << "\n"); - - // Handle self recursion by resolving the arguments and return value - Graph.mergeInGraph(CS, *Callee, Graph, 0); - } else { - ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), - Callee)); - - // Get the data structure graph for the called function. - // - DSGraph &GI = getDSGraph(*Callee); // Graph to inline - - DEBUG(std::cerr << " Inlining graph for " << Callee->getName() - << "[" << GI.getGraphSize() << "+" - << GI.getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" - << Graph.getAuxFunctionCalls().size() << "]\n"); - Graph.mergeInGraph(CS, *Callee, GI, - DSGraph::KeepModRefBits | - DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); - ++NumBUInlines; + ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), + Callee)); + // Get the data structure graph for the called function. + // + DSGraph &GI = getDSGraph(*Callee); // Graph to inline + + DEBUG(std::cerr << " Inlining graph for " << Callee->getName() + << "[" << GI.getGraphSize() << "+" + << GI.getAuxFunctionCalls().size() << "] into '" + << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" + << Graph.getAuxFunctionCalls().size() << "]\n"); + Graph.mergeInGraph(CS, *Callee, GI, + DSGraph::KeepModRefBits | + DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); + ++NumBUInlines; + #if 0 - Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + - Callee->getName()); + Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + + Callee->getName()); #endif - } } - TempFCs.erase(TempFCs.begin()); } + TempFCs.erase(TempFCs.begin()); } // Recompute the Incomplete markers From lattner at cs.uiuc.edu Tue Feb 1 15:55:55 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 1 Feb 2005 15:55:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200502012155.j11Lttgl031392@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.90 -> 1.91 --- Log message: Eliminate some duplicated debug code --- Diffs of the changes: (+0 -21) BottomUpClosure.cpp | 21 --------------------- 1 files changed, 21 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.90 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.91 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.90 Tue Feb 1 15:49:43 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Tue Feb 1 15:55:40 2005 @@ -264,28 +264,7 @@ DSGraph::ReturnNodesTy &ReturnNodes = Graph.getReturnNodes(); - // Print out multi-call sites. bool Printed = false; - for (std::list::iterator I = TempFCs.begin(), E = TempFCs.end(); - I != E; ++I) { - if (!I->isDirectCall()) { - DSNode *Node = I->getCalleeNode(); - if (Node->getGlobals().size() > 1) { - if (!Printed) - std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; - std::cerr << " calls " << Node->getGlobals().size() - << " fns from site: " << I->getCallSite().getInstruction() - << " " << *I->getCallSite().getInstruction(); - unsigned NumToPrint = Node->getGlobals().size(); - if (NumToPrint > 5) NumToPrint = 5; - std::cerr << " Fns ="; - for (unsigned i = 0; i != NumToPrint; ++i) - std::cerr << " " << Node->getGlobals()[i]->getName(); - std::cerr << "\n"; - } - } - } - while (!TempFCs.empty()) { DSCallSite &CS = *TempFCs.begin(); From alkis at cs.uiuc.edu Tue Feb 1 18:40:25 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 1 Feb 2005 18:40:25 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200502020040.SAA30547@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.292 -> 1.293 --- Log message: Add variable for bugpoint. --- Diffs of the changes: (+4 -0) Makefile.rules | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.292 llvm/Makefile.rules:1.293 --- llvm/Makefile.rules:1.292 Fri Jan 28 13:52:32 2005 +++ llvm/Makefile.rules Tue Feb 1 18:40:15 2005 @@ -272,6 +272,10 @@ ifndef LOPT LOPT := $(LLVMToolDir)/opt$(EXEEXT) endif +ifndef LBUGPOINT +LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT) +endif + LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC) LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX) From alkis at cs.uiuc.edu Tue Feb 1 18:41:05 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 1 Feb 2005 18:41:05 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200502020041.SAA30582@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.205 -> 1.206 --- Log message: Use correct type for a pointer to a vtable. --- Diffs of the changes: (+1 -1) Compiler.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.205 llvm-java/lib/Compiler/Compiler.cpp:1.206 --- llvm-java/lib/Compiler/Compiler.cpp:1.205 Sat Jan 29 16:29:53 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Tue Feb 1 18:40:54 2005 @@ -47,7 +47,7 @@ Type* llvm::Java::ObjectBaseTy = OpaqueType::get(); Type* llvm::Java::ObjectBaseRefTy = PointerType::get(ObjectBaseTy); Type* llvm::Java::VTableBaseTy = OpaqueType::get(); -Type* llvm::Java::VTableBaseRefTy = PointerType::get(ObjectBaseTy); +Type* llvm::Java::VTableBaseRefTy = PointerType::get(VTableBaseRefTy); namespace llvm { namespace Java { namespace { From alkis at cs.uiuc.edu Tue Feb 1 18:46:33 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 1 Feb 2005 18:46:33 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200502020046.SAA30747@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.206 -> 1.207 --- Log message: Use correct type for a pointer to a vtable (correct fix this time). --- Diffs of the changes: (+1 -1) Compiler.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.206 llvm-java/lib/Compiler/Compiler.cpp:1.207 --- llvm-java/lib/Compiler/Compiler.cpp:1.206 Tue Feb 1 18:40:54 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Tue Feb 1 18:46:22 2005 @@ -47,7 +47,7 @@ Type* llvm::Java::ObjectBaseTy = OpaqueType::get(); Type* llvm::Java::ObjectBaseRefTy = PointerType::get(ObjectBaseTy); Type* llvm::Java::VTableBaseTy = OpaqueType::get(); -Type* llvm::Java::VTableBaseRefTy = PointerType::get(VTableBaseRefTy); +Type* llvm::Java::VTableBaseRefTy = PointerType::get(VTableBaseTy); namespace llvm { namespace Java { namespace { From alenhar2 at cs.uiuc.edu Tue Feb 1 18:51:30 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 18:51:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502020051.SAA02938@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.23 -> 1.24 --- Log message: better constant handling, should fix many remaining cases --- Diffs of the changes: (+11 -2) AlphaISelPattern.cpp | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.23 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.24 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.23 Tue Feb 1 14:40:27 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Feb 1 18:51:15 2005 @@ -1021,8 +1021,17 @@ case ISD::Constant: { - long val = cast(N)->getValue(); - BuildMI(BB, Alpha::LOAD_IMM, 1, Result).addImm(val); + unsigned long val = cast(N)->getValue(); + if (val < 32000 && (long)val > -32000) + BuildMI(BB, Alpha::LOAD_IMM, 1, Result).addImm(val); + else + { + MachineConstantPool *CP = BB->getParent()->getConstantPool(); + ConstantUInt *C = ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , val); + unsigned CPI = CP->getConstantPoolIndex(C); + AlphaLowering.restoreGP(BB); + BuildMI(BB, Alpha::LOAD, 1, Result).addConstantPoolIndex(CPI); + } return Result; } From alenhar2 at cs.uiuc.edu Tue Feb 1 21:36:50 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 21:36:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200502020336.VAA03074@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.24 -> 1.25 AlphaInstrInfo.td updated: 1.14 -> 1.15 --- Log message: try to make a bug bugpointable, add yet more constant pool stuff, fixup constant loads for FP --- Diffs of the changes: (+19 -13) AlphaISelPattern.cpp | 30 ++++++++++++++++++------------ AlphaInstrInfo.td | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.24 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.25 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.24 Tue Feb 1 18:51:15 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Feb 1 21:36:35 2005 @@ -351,7 +351,7 @@ { Select(Chain); AlphaLowering.restoreGP(BB); - Opc = DestType == MVT::f64 ? Alpha::LDS : Alpha::LDT; + Opc = DestType == MVT::f64 ? Alpha::LDS_SYM : Alpha::LDT_SYM; BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { @@ -1046,19 +1046,25 @@ SDOperand Chain = N.getOperand(0); SDOperand Address = N.getOperand(1); + assert(DestType == MVT::i64 && "unknown Load dest type"); + if (Address.getOpcode() == ISD::GlobalAddress) - { - Select(Chain); - AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LOAD, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); - } + { + Select(Chain); + AlphaLowering.restoreGP(BB); + BuildMI(BB, Alpha::LOAD, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); + } + else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Alpha::LOAD, 1, Result).addConstantPoolIndex(CP->getIndex()); + } else - { - Select(Chain); - Tmp2 = SelectExpr(Address); - BuildMI(BB, Alpha::LDQ, 2, Result).addImm(0).addReg(Tmp2); - } - return Result; + { + Select(Chain); + Tmp2 = SelectExpr(Address); + BuildMI(BB, Alpha::LDQ, 2, Result).addImm(0).addReg(Tmp2); + } + return Result; } } Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.14 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.15 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.14 Tue Feb 1 14:36:44 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Tue Feb 1 21:36:35 2005 @@ -266,7 +266,7 @@ def STQ : MForm<0x2D, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "stq $RA,$DISP($RB)">; //Store quadword //Loads, int -def LDL : MForm<0x28, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldq $RA,$DISP($RB)">; // Load sign-extended longword +def LDL : MForm<0x28, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldl $RA,$DISP($RB)">; // Load sign-extended longword def LDQ : MForm<0x29, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldq $RA,$DISP($RB)">; //Load quadword def LDBU : MForm<0x0A, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldbu $RA,$DISP($RB)">; //Load zero-extended byte def LDWU : MForm<0x0C, (ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldwu $RA,$DISP($RB)">; //Load zero-extended word From lattner at cs.uiuc.edu Tue Feb 1 21:44:57 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 1 Feb 2005 21:44:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200502020344.j123ivlk002659@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.58 -> 1.59 --- Log message: Fix yet another memset issue. --- Diffs of the changes: (+13 -4) LegalizeDAG.cpp | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.58 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.59 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.58 Tue Feb 1 12:38:28 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Feb 1 21:44:41 2005 @@ -726,16 +726,25 @@ } else { Tmp3 = LegalizeOp(Node->getOperand(2)); // memcpy/move = pointer, } - SDOperand Tmp4, Tmp5; - - switch (getTypeAction(Node->getOperand(3).getValueType())) { // uint + + SDOperand Tmp4; + switch (getTypeAction(Node->getOperand(3).getValueType())) { case Expand: assert(0 && "Cannot expand this yet!"); case Legal: Tmp4 = LegalizeOp(Node->getOperand(3)); - Tmp5 = LegalizeOp(Node->getOperand(4)); break; case Promote: Tmp4 = PromoteOp(Node->getOperand(3)); + break; + } + + SDOperand Tmp5; + switch (getTypeAction(Node->getOperand(4).getValueType())) { // uint + case Expand: assert(0 && "Cannot expand this yet!"); + case Legal: + Tmp5 = LegalizeOp(Node->getOperand(4)); + break; + case Promote: Tmp5 = PromoteOp(Node->getOperand(4)); break; } From alenhar2 at cs.uiuc.edu Tue Feb 1 22:35:57 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 22:35:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502020435.WAA08624@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.25 -> 1.26 --- Log message: fix Load bug --- Diffs of the changes: (+1 -1) AlphaISelPattern.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.25 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.26 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.25 Tue Feb 1 21:36:35 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Feb 1 22:35:44 2005 @@ -1046,7 +1046,7 @@ SDOperand Chain = N.getOperand(0); SDOperand Address = N.getOperand(1); - assert(DestType == MVT::i64 && "unknown Load dest type"); + assert(N.getValue(0).getValueType() == MVT::i64 && "unknown Load dest type"); if (Address.getOpcode() == ISD::GlobalAddress) { From alkis at cs.uiuc.edu Tue Feb 1 22:43:50 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 1 Feb 2005 22:43:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp Message-ID: <200502020443.WAA12527@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.102 -> 1.103 --- Log message: Fix crash on MallocInsts of unsized types. --- Diffs of the changes: (+2 -1) ExprTypeConvert.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.102 llvm/lib/Transforms/ExprTypeConvert.cpp:1.103 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.102 Mon Jan 31 19:22:56 2005 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Tue Feb 1 22:43:37 2005 @@ -47,7 +47,8 @@ // Deal with the type to allocate, not the pointer type... Ty = cast(Ty)->getElementType(); - if (!Ty->isSized()) return false; // Can only alloc something with a size + if (!Ty->isSized() || !MI->getType()->getElementType()->isSized()) + return false; // Can only alloc something with a size // Analyze the number of bytes allocated... ExprType Expr = ClassifyExpr(MI->getArraySize()); From alkis at cs.uiuc.edu Tue Feb 1 22:58:16 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 1 Feb 2005 22:58:16 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java Collections1.java Collections.java Message-ID: <200502020458.WAA06988@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Collections2.java updated: 1.2 -> 1.3 Collections1.java updated: 1.2 -> 1.3 Collections.java updated: 1.3 -> 1.4 --- Log message: Make tests a bit more interesting. --- Diffs of the changes: (+9 -6) Collections.java | 11 +++++++---- Collections1.java | 2 +- Collections2.java | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java:1.2 llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java:1.3 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java:1.2 Tue Jan 25 10:45:11 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java Tue Feb 1 22:58:05 2005 @@ -4,7 +4,7 @@ { public static void main(String[] args) { Collection c1 = new TreeSet(); - Collections.fillCollectionWithInts(c1); + Collections.fillCollectionWithRandomInts(c1); Collections.printIntCollection(c1); } } Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java:1.2 llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java:1.3 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java:1.2 Tue Jan 25 10:45:11 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java Tue Feb 1 22:58:05 2005 @@ -4,7 +4,7 @@ { public static void main(String[] args) { Collection c1 = new LinkedList(); - Collections.fillCollectionWithInts(c1); + Collections.fillCollectionWithRandomInts(c1); Collections.printIntCollection(c1); } } Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Collections.java:1.3 llvm-java/test/Programs/SingleSource/UnitTests/Collections.java:1.4 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections.java:1.3 Tue Jan 25 10:45:11 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Collections.java Tue Feb 1 22:58:05 2005 @@ -2,9 +2,12 @@ public class Collections { - public static void fillCollectionWithInts(Collection c) { - for (int i = 0; i < 10; ++i) - c.add(new Integer(i)); + public static Random rand = new Random(0); + + public static void fillCollectionWithRandomInts(Collection c) { + int size = rand.nextInt(45) + 5; + for (int i = 0; i < size; ++i) + c.add(new Integer(rand.nextInt())); } public static void printIntCollection(Collection c) { @@ -14,7 +17,7 @@ public static void main(String[] args) { Collection c1 = new TreeSet(); - fillCollectionWithInts(c1); + fillCollectionWithRandomInts(c1); Collection c2 = new TreeSet(c1); Test.println(c1.remove(new Integer(5))); From alkis at cs.uiuc.edu Tue Feb 1 23:06:03 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 1 Feb 2005 23:06:03 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200502020506.XAA07832@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.207 -> 1.208 --- Log message: Zero initialize allocated memory for each object. This fixes: Collections, Collections1, Collections2. --- Diffs of the changes: (+15 -1) Compiler.cpp | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletion(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.207 llvm-java/lib/Compiler/Compiler.cpp:1.208 --- llvm-java/lib/Compiler/Compiler.cpp:1.207 Tue Feb 1 18:46:22 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Tue Feb 1 23:05:52 2005 @@ -72,7 +72,8 @@ BasicBlock* currentBB_; Locals locals_; OperandStack opStack_; - Function *getObjectClass_, *setObjectClass_, *throw_, *isInstanceOf_; + Function *getObjectClass_, *setObjectClass_, *throw_, *isInstanceOf_, + *memset_; typedef SetVector FunctionSet; FunctionSet toCompileFunctions_; @@ -162,6 +163,10 @@ isInstanceOf_ = module_.getOrInsertFunction( "llvm_java_IsInstanceOf", Type::IntTy, ObjectBaseRefTy, VTableBaseRefTy, NULL); + memset_ = module_.getOrInsertFunction( + "llvm.memset", Type::VoidTy, + PointerType::get(Type::SByteTy), + Type::UByteTy, Type::ULongTy, Type::UIntTy, NULL); } private: @@ -2178,6 +2183,15 @@ const VTableInfo& vi = getVTableInfo(cf); Value* objRef = new MallocInst(ci.getType(), NULL, TMP, currentBB_); + std::vector params; + params.reserve(4); + params.push_back(new CastInst(objRef, PointerType::get(Type::SByteTy), + TMP, currentBB_)); // dest + params.push_back(ConstantUInt::get(Type::UByteTy, 0)); // value + params.push_back(ConstantExpr::getSizeOf(ci.getType())); // size + params.push_back(ConstantUInt::get(Type::UIntTy, 0)); // alignment + new CallInst(memset_, params, "", currentBB_); + Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, currentBB_); Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, From jeffc at jolt-lang.org Tue Feb 1 23:46:30 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 1 Feb 2005 23:46:30 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStartedVS.html Message-ID: <200502020546.XAA09104@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStartedVS.html updated: 1.2 -> 1.3 --- Log message: Add additional source of Win32 GNU utilities. --- Diffs of the changes: (+8 -6) GettingStartedVS.html | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/docs/GettingStartedVS.html diff -u llvm/docs/GettingStartedVS.html:1.2 llvm/docs/GettingStartedVS.html:1.3 --- llvm/docs/GettingStartedVS.html:1.2 Tue Feb 1 09:59:28 2005 +++ llvm/docs/GettingStartedVS.html Tue Feb 1 23:46:20 2005 @@ -170,11 +170,13 @@

    You will also need several open source packages: bison, flex, and sed. These must be installed in llvm/win32/tools. These can be found at - http://gnuwin32.sourceforge.net/ - . Bison prefers that m4 be in the path. You must add it to the Visual - Studio configuration under the menu Options -> Projects -> VC++ - Directories. Alternatively, you can set the environment variable M4 - to point to m4 executable.

    + http://gnuwin32.sourceforge.net + or + http://unxutils.sourceforge.net. + Bison prefers that m4 be in the path. You must add it to the Visual Studio + configuration under the menu Options -> Projects -> VC++ Directories. + Alternatively, you can set the environment variable M4 to point to + m4 executable.

    @@ -350,7 +352,7 @@ Jeff Cohen
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2005/02/01 15:59:28 $ + Last modified: $Date: 2005/02/02 05:46:20 $ From alenhar2 at cs.uiuc.edu Tue Feb 1 23:49:58 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 1 Feb 2005 23:49:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502020549.XAA12573@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.26 -> 1.27 --- Log message: marked mem* as not supported --- Diffs of the changes: (+4 -0) AlphaISelPattern.cpp | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.26 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.27 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.26 Tue Feb 1 22:35:44 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Feb 1 23:49:42 2005 @@ -61,6 +61,10 @@ setOperationAction(ISD::SREM, MVT::f32, Expand); setOperationAction(ISD::SREM, MVT::f64, Expand); + setOperationAction(ISD::MEMMOVE , MVT::Other, Expand); + setOperationAction(ISD::MEMSET , MVT::Other, Expand); + setOperationAction(ISD::MEMCPY , MVT::Other, Expand); + computeRegisterProperties(); addLegalFPImmediate(+0.0); //F31 From alkis at cs.uiuc.edu Tue Feb 1 23:53:35 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 1 Feb 2005 23:53:35 -0600 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.ll Message-ID: <200502020553.XAA09317@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.ll (r1.6) removed --- Log message: Remove unneeded file --- Diffs of the changes: (+0 -0) 0 files changed From alkis at cs.uiuc.edu Wed Feb 2 00:08:31 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 00:08:31 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200502020608.AAA09636@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.208 -> 1.209 --- Log message: Canonicalize runtime function names. --- Diffs of the changes: (+11 -11) Compiler.cpp | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.208 llvm-java/lib/Compiler/Compiler.cpp:1.209 --- llvm-java/lib/Compiler/Compiler.cpp:1.208 Tue Feb 1 23:05:52 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Feb 2 00:08:20 2005 @@ -72,7 +72,7 @@ BasicBlock* currentBB_; Locals locals_; OperandStack opStack_; - Function *getObjectClass_, *setObjectClass_, *throw_, *isInstanceOf_, + Function *getVtable_, *setVtable_, *throw_, *isInstanceOf_, *memset_; typedef SetVector FunctionSet; @@ -151,17 +151,17 @@ &module_); module_.addTypeName("llvm_java_object_base", ObjectBaseTy); module_.addTypeName("llvm_java_object_vtable", VTableBaseTy); - getObjectClass_ = module_.getOrInsertFunction( - "llvm_java_GetObjectClass", VTableBaseRefTy, + getVtable_ = module_.getOrInsertFunction( + "llvm_java_get_vtable", VTableBaseRefTy, ObjectBaseRefTy, NULL); - setObjectClass_ = module_.getOrInsertFunction( - "llvm_java_SetObjectClass", Type::VoidTy, + setVtable_ = module_.getOrInsertFunction( + "llvm_java_set_vtable", Type::VoidTy, ObjectBaseRefTy, VTableBaseRefTy, NULL); throw_ = module_.getOrInsertFunction( - "llvm_java_Throw", Type::IntTy, + "llvm_java_throw", Type::IntTy, ObjectBaseRefTy, NULL); isInstanceOf_ = module_.getOrInsertFunction( - "llvm_java_IsInstanceOf", Type::IntTy, + "llvm_java_is_instance_of", Type::IntTy, ObjectBaseRefTy, VTableBaseRefTy, NULL); memset_ = module_.getOrInsertFunction( "llvm.memset", Type::VoidTy, @@ -2063,7 +2063,7 @@ "this", currentBB_); Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, currentBB_); - Value* vtable = new CallInst(getObjectClass_, objBase, TMP, currentBB_); + Value* vtable = new CallInst(getVtable_, objBase, TMP, currentBB_); vtable = new CastInst(vtable, vi->vtable->getType(), className + "", currentBB_); std::vector indices(1, ConstantUInt::get(Type::UIntTy, 0)); @@ -2143,7 +2143,7 @@ "this", currentBB_); Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, currentBB_); - Value* vtable = new CallInst(getObjectClass_, objBase, TMP, currentBB_); + Value* vtable = new CallInst(getVtable_, objBase, TMP, currentBB_); vtable = new CastInst(vtable, PointerType::get(VTableInfo::VTableTy), TMP, currentBB_); // get the interfaces array of vtables @@ -2196,7 +2196,7 @@ Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, currentBB_); - new CallInst(setObjectClass_, objBase, vtable, "", currentBB_); + new CallInst(setVtable_, objBase, vtable, "", currentBB_); push(objRef); } @@ -2270,7 +2270,7 @@ Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, currentBB_); - new CallInst(setObjectClass_, objBase, vtable, "", currentBB_); + new CallInst(setVtable_, objBase, vtable, "", currentBB_); push(objRef); } From alkis at cs.uiuc.edu Wed Feb 2 00:08:31 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 00:08:31 -0600 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200502020608.AAA09640@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.16 -> 1.17 --- Log message: Canonicalize runtime function names. --- Diffs of the changes: (+5 -7) runtime.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.16 llvm-java/runtime/runtime.c:1.17 --- llvm-java/runtime/runtime.c:1.16 Sat Jan 15 21:01:22 2005 +++ llvm-java/runtime/runtime.c Wed Feb 2 00:08:20 2005 @@ -30,18 +30,16 @@ struct llvm_java_object_typeinfo typeinfo; }; -struct llvm_java_object_vtable* -llvm_java_GetObjectClass(jobject obj) { +struct llvm_java_object_vtable* llvm_java_get_vtable(jobject obj) { return obj->vtable; } -void llvm_java_SetObjectClass(jobject obj, - struct llvm_java_object_vtable* clazz) { +void llvm_java_set_vtable(jobject obj, struct llvm_java_object_vtable* clazz) { obj->vtable = clazz; } -jint llvm_java_IsInstanceOf(jobject obj, - struct llvm_java_object_vtable* clazz) { +jint llvm_java_is_instance_of(jobject obj, + struct llvm_java_object_vtable* clazz) { /* trivial case 1: a null object can be cast to any type */ if (!obj) return JNI_TRUE; @@ -66,7 +64,7 @@ } } -jint llvm_java_Throw(jobject obj) { +jint llvm_java_throw(jobject obj) { abort(); } From jeffc at jolt-lang.org Wed Feb 2 00:33:23 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 2 Feb 2005 00:33:23 -0600 Subject: [llvm-commits] CVS: llvm/win32/AsmParser/AsmParser.vcproj Message-ID: <200502020633.AAA10029@zion.cs.uiuc.edu> Changes in directory llvm/win32/AsmParser: AsmParser.vcproj updated: 1.4 -> 1.5 --- Log message: Put libraries in a common directory --- Diffs of the changes: (+2 -2) AsmParser.vcproj | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/win32/AsmParser/AsmParser.vcproj diff -u llvm/win32/AsmParser/AsmParser.vcproj:1.4 llvm/win32/AsmParser/AsmParser.vcproj:1.5 --- llvm/win32/AsmParser/AsmParser.vcproj:1.4 Sun Jan 30 11:54:11 2005 +++ llvm/win32/AsmParser/AsmParser.vcproj Wed Feb 2 00:33:11 2005 @@ -13,7 +13,7 @@ @@ -59,7 +59,7 @@ From jeffc at jolt-lang.org Wed Feb 2 00:33:23 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 2 Feb 2005 00:33:23 -0600 Subject: [llvm-commits] CVS: llvm/win32/Linker/Linker.vcproj Message-ID: <200502020633.AAA10033@zion.cs.uiuc.edu> Changes in directory llvm/win32/Linker: Linker.vcproj updated: 1.2 -> 1.3 --- Log message: Put libraries in a common directory --- Diffs of the changes: (+2 -2) Linker.vcproj | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/win32/Linker/Linker.vcproj diff -u llvm/win32/Linker/Linker.vcproj:1.2 llvm/win32/Linker/Linker.vcproj:1.3 --- llvm/win32/Linker/Linker.vcproj:1.2 Sun Jan 30 11:54:11 2005 +++ llvm/win32/Linker/Linker.vcproj Wed Feb 2 00:33:11 2005 @@ -12,7 +12,7 @@ @@ -58,7 +58,7 @@ From jeffc at jolt-lang.org Wed Feb 2 00:33:23 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 2 Feb 2005 00:33:23 -0600 Subject: [llvm-commits] CVS: llvm/win32/Bytecode/Bytecode.vcproj Message-ID: <200502020633.AAA10037@zion.cs.uiuc.edu> Changes in directory llvm/win32/Bytecode: Bytecode.vcproj updated: 1.3 -> 1.4 --- Log message: Put libraries in a common directory --- Diffs of the changes: (+2 -2) Bytecode.vcproj | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/win32/Bytecode/Bytecode.vcproj diff -u llvm/win32/Bytecode/Bytecode.vcproj:1.3 llvm/win32/Bytecode/Bytecode.vcproj:1.4 --- llvm/win32/Bytecode/Bytecode.vcproj:1.3 Sun Jan 30 11:54:11 2005 +++ llvm/win32/Bytecode/Bytecode.vcproj Wed Feb 2 00:33:11 2005 @@ -12,7 +12,7 @@ @@ -58,7 +58,7 @@ From jeffc at jolt-lang.org Wed Feb 2 00:33:24 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 2 Feb 2005 00:33:24 -0600 Subject: [llvm-commits] CVS: llvm/win32/TableGen/TableGen.vcproj Message-ID: <200502020633.AAA10045@zion.cs.uiuc.edu> Changes in directory llvm/win32/TableGen: TableGen.vcproj updated: 1.12 -> 1.13 --- Log message: Put libraries in a common directory --- Diffs of the changes: (+2 -2) TableGen.vcproj | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/win32/TableGen/TableGen.vcproj diff -u llvm/win32/TableGen/TableGen.vcproj:1.12 llvm/win32/TableGen/TableGen.vcproj:1.13 --- llvm/win32/TableGen/TableGen.vcproj:1.12 Sun Jan 30 11:54:11 2005 +++ llvm/win32/TableGen/TableGen.vcproj Wed Feb 2 00:33:11 2005 @@ -12,7 +12,7 @@ @@ -66,7 +66,7 @@ From jeffc at jolt-lang.org Wed Feb 2 00:33:24 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 2 Feb 2005 00:33:24 -0600 Subject: [llvm-commits] CVS: llvm/win32/CBackend/CBackend.vcproj Message-ID: <200502020633.AAA10041@zion.cs.uiuc.edu> Changes in directory llvm/win32/CBackend: CBackend.vcproj updated: 1.2 -> 1.3 --- Log message: Put libraries in a common directory --- Diffs of the changes: (+2 -2) CBackend.vcproj | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/win32/CBackend/CBackend.vcproj diff -u llvm/win32/CBackend/CBackend.vcproj:1.2 llvm/win32/CBackend/CBackend.vcproj:1.3 --- llvm/win32/CBackend/CBackend.vcproj:1.2 Sun Jan 30 11:54:11 2005 +++ llvm/win32/CBackend/CBackend.vcproj Wed Feb 2 00:33:11 2005 @@ -12,7 +12,7 @@ @@ -58,7 +58,7 @@ From alkis at cs.uiuc.edu Wed Feb 2 01:12:18 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 01:12:18 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java Message-ID: <200502020712.BAA10632@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: ArrayCopy.java added (r1.1) --- Log message: Add test --- Diffs of the changes: (+17 -0) ArrayCopy.java | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.1 *** /dev/null Wed Feb 2 01:12:18 2005 --- llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java Wed Feb 2 01:12:08 2005 *************** *** 0 **** --- 1,17 ---- + import java.util.*; + + public class ArrayCopy + { + public static void main(String[] args) { + int[] iarray1 = new int[10]; + for (int i = 0; i < iarray1.length; ++i) + iarray1[i] = i; + + int[] iarray2 = new int[123]; + for (int i = 0; i < iarray2.length; i += iarray1.length) + System.arraycopy(iarray1, 0, iarray2, i, Math.min(iarray2.length - i, iarray1.length)); + + for (int i = 0; i < iarray2.length; ++i) + Test.println(iarray2[i]); + } + } From alenhar2 at cs.uiuc.edu Wed Feb 2 09:05:48 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 2 Feb 2005 09:05:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502021505.JAA04537@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.27 -> 1.28 --- Log message: fix loading of floats --- Diffs of the changes: (+3 -1) AlphaISelPattern.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.27 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.28 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.27 Tue Feb 1 23:49:42 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Wed Feb 2 09:05:33 2005 @@ -486,7 +486,9 @@ } } - if (DestType == MVT::f64 || DestType == MVT::f32) + if (DestType == MVT::f64 || DestType == MVT::f32 || + (opcode == ISD::LOAD && + (N.getValue(0).getValueType() == MVT::f32 || N.getValue(0).getValueType() == MVT::f64))) return SelectExprFP(N, Result); switch (opcode) { From alkis at cs.uiuc.edu Wed Feb 2 09:54:28 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 09:54:28 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java Message-ID: <200502021554.JAA17447@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: ArrayCopy.java updated: 1.1 -> 1.2 --- Log message: java.lang.Math uses JNI calls that are not implemented yet. --- Diffs of the changes: (+5 -1) ArrayCopy.java | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.1 llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.2 --- llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.1 Wed Feb 2 01:12:08 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java Wed Feb 2 09:54:17 2005 @@ -2,6 +2,10 @@ public class ArrayCopy { + public static int min(int a, int b) { + return a < b ? a : b; + } + public static void main(String[] args) { int[] iarray1 = new int[10]; for (int i = 0; i < iarray1.length; ++i) @@ -9,7 +13,7 @@ int[] iarray2 = new int[123]; for (int i = 0; i < iarray2.length; i += iarray1.length) - System.arraycopy(iarray1, 0, iarray2, i, Math.min(iarray2.length - i, iarray1.length)); + System.arraycopy(iarray1, 0, iarray2, i, min(iarray2.length - i, iarray1.length)); for (int i = 0; i < iarray2.length; ++i) Test.println(iarray2[i]); From alkis at cs.uiuc.edu Wed Feb 2 10:18:59 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 10:18:59 -0600 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200502021618.KAA18051@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.17 -> 1.18 --- Log message: Implement ArrayCopy.java. --- Diffs of the changes: (+24 -3) runtime.c | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.17 llvm-java/runtime/runtime.c:1.18 --- llvm-java/runtime/runtime.c:1.17 Wed Feb 2 00:08:20 2005 +++ llvm-java/runtime/runtime.c Wed Feb 2 10:18:48 2005 @@ -17,13 +17,14 @@ }; struct llvm_java_object_typeinfo { - int depth; + jint depth; struct llvm_java_object_vtable** vtables; - int lastIface; + jint lastIface; union { - int interfaceFlag; + jint interfaceFlag; struct llvm_java_object_vtable** interfaces; }; + jint elementSize; /* The element size - 0 for classes */ }; struct llvm_java_object_vtable { @@ -356,3 +357,23 @@ llvm_java_main(argc, argv); return 0; } + +void Java_java_lang_VMSystem_arraycopy(JNIEnv *env, jobject clazz, + jobject srcObj, jint srcStart, + jobject dstObj, jint dstStart, + jint length) { + struct llvm_java_bytearray* srcArray = (struct llvm_java_bytearray*) srcObj; + struct llvm_java_bytearray* dstArray = (struct llvm_java_bytearray*) dstObj; + + jbyte* src = srcArray->data; + jbyte* dst = dstArray->data; + + if (srcObj->vtable->typeinfo.elementSize != + dstObj->vtable->typeinfo.elementSize) + llvm_java_throw(NULL); + + src += srcStart * srcObj->vtable->typeinfo.elementSize; + dst += dstStart * dstObj->vtable->typeinfo.elementSize; + + memcpy(dst, src, length * srcObj->vtable->typeinfo.elementSize); +} From alkis at cs.uiuc.edu Wed Feb 2 10:18:59 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 10:18:59 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200502021618.KAA18055@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.209 -> 1.210 --- Log message: Implement ArrayCopy.java. --- Diffs of the changes: (+19 -0) Compiler.cpp | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.209 llvm-java/lib/Compiler/Compiler.cpp:1.210 --- llvm-java/lib/Compiler/Compiler.cpp:1.209 Wed Feb 2 00:08:20 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Feb 2 10:18:48 2005 @@ -381,6 +381,9 @@ // interfaces vtable pointers elements.push_back(PointerType::get(PointerType::get(VTtype))); init.push_back(llvm::Constant::getNullValue(elements[3])); + // the element size (0 for classes) + elements.push_back(Type::IntTy); + init.push_back(llvm::ConstantSInt::get(elements[4], 0)); // This is a static variable. VTableInfo::TypeInfoTy = StructType::get(elements); @@ -750,6 +753,8 @@ typeInfoInit.push_back(ConstantSInt::get(Type::IntTy, lastInterface)); // The interfaces' vtables. typeInfoInit.push_back(interfacesVTables); + // the element size (0 for classes) + typeInfoInit.push_back(llvm::ConstantSInt::get(Type::IntTy, 0)); return ConstantStruct::get(VTableInfo::TypeInfoTy, typeInfoInit); } @@ -945,6 +950,10 @@ typeInfoInit.push_back( llvm::Constant::getNullValue( PointerType::get(PointerType::get(VTableInfo::VTableTy)))); + // the element size + typeInfoInit.push_back( + ConstantExpr::getCast( + ConstantExpr::getSizeOf(elementTy), Type::IntTy)); init[0] = ConstantStruct::get(VTableInfo::TypeInfoTy, typeInfoInit); vi.vtable->setInitializer(ConstantStruct::get(init)); @@ -1049,6 +1058,9 @@ init.push_back( llvm::Constant::getNullValue( PointerType::get(PointerType::get(VTableInfo::VTableTy)))); + // the element size + init.push_back(ConstantExpr::getCast( + ConstantExpr::getSizeOf(ObjectBaseRefTy), Type::IntTy)); llvm::Constant* typeInfoInit = ConstantStruct::get(VTableInfo::TypeInfoTy, init); @@ -1166,6 +1178,10 @@ typeInfoInit.push_back( llvm::Constant::getNullValue( PointerType::get(PointerType::get(VTableInfo::VTableTy)))); + // the element size + typeInfoInit.push_back( + ConstantExpr::getCast( + ConstantExpr::getSizeOf(ObjectBaseRefTy), Type::IntTy)); init[0] = ConstantStruct::get(VTableInfo::TypeInfoTy, typeInfoInit); vi.vtable->setInitializer(ConstantStruct::get(init)); @@ -1319,12 +1335,15 @@ classMethodDesc.find("java/lang/IllegalArgumentException") != 0 && classMethodDesc.find("java/lang/IndexOutOfBoundsException") != 0 && classMethodDesc.find("java/lang/RuntimeException") != 0 && + classMethodDesc.find("java/lang/Math") != 0 && classMethodDesc.find("java/lang/Number") != 0 && classMethodDesc.find("java/lang/Byte") != 0 && classMethodDesc.find("java/lang/Integer") != 0 && classMethodDesc.find("java/lang/Long") != 0 && classMethodDesc.find("java/lang/Short") != 0 && classMethodDesc.find("java/lang/StringBuffer") != 0 && + (classMethodDesc.find("java/lang/System") != 0 || + classMethodDesc.find("java/lang/System/ Changes in directory llvm-java/runtime: runtime.c updated: 1.18 -> 1.19 --- Log message: Make llvm-java compile on Windows. Patch contributed by Jeff Cohen! --- Diffs of the changes: (+4 -1) runtime.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.18 llvm-java/runtime/runtime.c:1.19 --- llvm-java/runtime/runtime.c:1.18 Wed Feb 2 10:18:48 2005 +++ llvm-java/runtime/runtime.c Wed Feb 2 10:26:54 2005 @@ -9,6 +9,7 @@ struct llvm_java_object_header { /* gc info, hash info, locking */ + int dummy; }; struct llvm_java_object_base { @@ -41,11 +42,13 @@ jint llvm_java_is_instance_of(jobject obj, struct llvm_java_object_vtable* clazz) { + struct llvm_java_object_vtable* objClazz; + /* trivial case 1: a null object can be cast to any type */ if (!obj) return JNI_TRUE; - struct llvm_java_object_vtable* objClazz = obj->vtable; + objClazz = obj->vtable; /* trivial case 2: this object is of class clazz */ if (objClazz == clazz) return JNI_TRUE; From alkis at cs.uiuc.edu Wed Feb 2 10:27:06 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 10:27:06 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/ClassFile/ClassFile.cpp Message-ID: <200502021627.KAA05954@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/ClassFile: ClassFile.cpp updated: 1.34 -> 1.35 --- Log message: Make llvm-java compile on Windows. Patch contributed by Jeff Cohen! --- Diffs of the changes: (+3 -1) ClassFile.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-java/lib/ClassFile/ClassFile.cpp diff -u llvm-java/lib/ClassFile/ClassFile.cpp:1.34 llvm-java/lib/ClassFile/ClassFile.cpp:1.35 --- llvm-java/lib/ClassFile/ClassFile.cpp:1.34 Mon Jan 24 11:37:16 2005 +++ llvm-java/lib/ClassFile/ClassFile.cpp Wed Feb 2 10:26:54 2005 @@ -18,7 +18,9 @@ #include #include #include +#include +#include #include #include #include @@ -517,7 +519,7 @@ : Constant(cp) { uint16_t length = readU2(is); - char buf[length]; + char *buf = (char *)alloca(length); std::streamsize s = is.rdbuf()->sgetn(buf, length); if (s != length) throw ClassFileParseError( From alkis at cs.uiuc.edu Wed Feb 2 10:27:06 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 10:27:06 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/OperandStack.cpp Locals.cpp Compiler.cpp Message-ID: <200502021627.KAA05962@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: OperandStack.cpp updated: 1.9 -> 1.10 Locals.cpp updated: 1.7 -> 1.8 Compiler.cpp updated: 1.210 -> 1.211 --- Log message: Make llvm-java compile on Windows. Patch contributed by Jeff Cohen! --- Diffs of the changes: (+5 -0) Compiler.cpp | 3 +++ Locals.cpp | 1 + OperandStack.cpp | 1 + 3 files changed, 5 insertions(+) Index: llvm-java/lib/Compiler/OperandStack.cpp diff -u llvm-java/lib/Compiler/OperandStack.cpp:1.9 llvm-java/lib/Compiler/OperandStack.cpp:1.10 --- llvm-java/lib/Compiler/OperandStack.cpp:1.9 Fri Jan 21 19:30:12 2005 +++ llvm-java/lib/Compiler/OperandStack.cpp Wed Feb 2 10:26:54 2005 @@ -22,6 +22,7 @@ #include #include +using namespace llvm; using namespace llvm::Java; void OperandStack::copySlots(const SlotMap& src, Index: llvm-java/lib/Compiler/Locals.cpp diff -u llvm-java/lib/Compiler/Locals.cpp:1.7 llvm-java/lib/Compiler/Locals.cpp:1.8 --- llvm-java/lib/Compiler/Locals.cpp:1.7 Fri Jan 21 07:53:27 2005 +++ llvm-java/lib/Compiler/Locals.cpp Wed Feb 2 10:26:54 2005 @@ -21,6 +21,7 @@ #include #include +using namespace llvm; using namespace llvm::Java; Locals::Locals(unsigned maxLocals) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.210 llvm-java/lib/Compiler/Compiler.cpp:1.211 --- llvm-java/lib/Compiler/Compiler.cpp:1.210 Wed Feb 2 10:18:48 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Wed Feb 2 10:26:54 2005 @@ -206,6 +206,7 @@ return ConstantFP::get(Type::DoubleTy, d->getValue()); else assert(0 && "Unknown llvm::Java::Constant!"); + return 0; // not reached } /// Given a JType returns the appropriate llvm::Type. @@ -268,6 +269,7 @@ // FIXME: Throw something default: assert(0 && "Cannot parse type descriptor!"); } + return 0; // not reached } /// Returns the type of the Java string descriptor for JNI. @@ -313,6 +315,7 @@ // FIXME: Throw something default: assert(0 && "Cannot parse type descriptor!"); } + return 0; // not reached } /// Initializes the class info map; in other words it adds the From alkis at cs.uiuc.edu Wed Feb 2 10:27:07 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 10:27:07 -0600 Subject: [llvm-commits] CVS: llvm-java/include/llvm/Java/ClassFile.h Bytecode.h Message-ID: <200502021627.KAA05968@zion.cs.uiuc.edu> Changes in directory llvm-java/include/llvm/Java: ClassFile.h updated: 1.27 -> 1.28 Bytecode.h updated: 1.13 -> 1.14 --- Log message: Make llvm-java compile on Windows. Patch contributed by Jeff Cohen! --- Diffs of the changes: (+8 -5) Bytecode.h | 2 +- ClassFile.h | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) Index: llvm-java/include/llvm/Java/ClassFile.h diff -u llvm-java/include/llvm/Java/ClassFile.h:1.27 llvm-java/include/llvm/Java/ClassFile.h:1.28 --- llvm-java/include/llvm/Java/ClassFile.h:1.27 Mon Dec 13 01:15:00 2004 +++ llvm-java/include/llvm/Java/ClassFile.h Wed Feb 2 10:26:54 2005 @@ -22,7 +22,7 @@ #include #include -#include +#include namespace llvm { namespace Java { @@ -193,17 +193,20 @@ std::ostream& dump(std::ostream& os) const; }; - struct ConstantFieldRef : public ConstantMemberRef { + class ConstantFieldRef : public ConstantMemberRef { + public: ConstantFieldRef(const ConstantPool& cp, std::istream& is) : ConstantMemberRef(cp, is) { } }; - struct ConstantMethodRef : public ConstantMemberRef { + class ConstantMethodRef : public ConstantMemberRef { + public: ConstantMethodRef(const ConstantPool& cp, std::istream& is) : ConstantMemberRef(cp, is) { } }; - struct ConstantInterfaceMethodRef : public ConstantMemberRef { + class ConstantInterfaceMethodRef : public ConstantMemberRef { + public: ConstantInterfaceMethodRef(const ConstantPool& cp, std::istream& is) : ConstantMemberRef(cp, is) { } }; Index: llvm-java/include/llvm/Java/Bytecode.h diff -u llvm-java/include/llvm/Java/Bytecode.h:1.13 llvm-java/include/llvm/Java/Bytecode.h:1.14 --- llvm-java/include/llvm/Java/Bytecode.h:1.13 Mon Nov 8 02:00:40 2004 +++ llvm-java/include/llvm/Java/Bytecode.h Wed Feb 2 10:26:54 2005 @@ -14,7 +14,7 @@ #ifndef LLVM_JAVA_BYTECODE_H #define LLVM_JAVA_BYTECODE_H -#include +#include namespace llvm { namespace Java { From alkis at cs.uiuc.edu Wed Feb 2 10:35:22 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 10:35:22 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Lists6.java Message-ID: <200502021635.KAA13917@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Lists6.java added (r1.1) --- Log message: Add test for ArrayList. --- Diffs of the changes: (+16 -0) Lists6.java | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) Index: llvm-java/test/Programs/SingleSource/UnitTests/Lists6.java diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/Lists6.java:1.1 *** /dev/null Wed Feb 2 10:35:21 2005 --- llvm-java/test/Programs/SingleSource/UnitTests/Lists6.java Wed Feb 2 10:35:11 2005 *************** *** 0 **** --- 1,16 ---- + import java.util.*; + + public class Lists6 + { + public static void main(String[] args) { + List llist = new ArrayList(); + for (int i = 0; i < 15; ++i) { + llist.add(new Integer(i)); + } + + for (Iterator i = llist.iterator(); i.hasNext(); ) { + Integer I = (Integer) i.next(); + Test.println(I.intValue()); + } + } + } From alenhar2 at cs.uiuc.edu Wed Feb 2 11:00:39 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 2 Feb 2005 11:00:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaRegisterInfo.td Message-ID: <200502021700.LAA09053@cypher.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.28 -> 1.29 AlphaRegisterInfo.td updated: 1.3 -> 1.4 --- Log message: prevent register allocator from using the stack pointer :) --- Diffs of the changes: (+3 -3) AlphaISelPattern.cpp | 4 ++-- AlphaRegisterInfo.td | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.28 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.29 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.28 Wed Feb 2 09:05:33 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Wed Feb 2 11:00:21 2005 @@ -40,8 +40,8 @@ AlphaTargetLowering(TargetMachine &TM) : TargetLowering(TM) { // Set up the TargetLowering object. //I am having problems with shr n ubyte 1 - setShiftAmountType(MVT::i64); //are these needed? - setSetCCResultType(MVT::i64); //are these needed? + setShiftAmountType(MVT::i64); + setSetCCResultType(MVT::i64); addRegisterClass(MVT::i64, Alpha::GPRCRegisterClass); addRegisterClass(MVT::f64, Alpha::FPRCRegisterClass); Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.td diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.3 llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.4 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.3 Tue Feb 1 14:34:29 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.td Wed Feb 2 11:00:21 2005 @@ -81,7 +81,7 @@ //Volitle [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R27, //Non-Volitile - R9, R10, R11, R12, R13, R14, R15, R26, /*R28,*/ R29, R30 /*, R31*/ ]>; + R9, R10, R11, R12, R13, R14, R15, R26, /*R28,*/ R29, /* R30, R31*/ ]>; //R28 is reserved for the assembler //Don't allocate 15, 29, 30, 31 From alenhar2 at cs.uiuc.edu Wed Feb 2 11:01:48 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 2 Feb 2005 11:01:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaRegisterInfo.td Message-ID: <200502021701.LAA09065@cypher.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaRegisterInfo.td updated: 1.4 -> 1.5 --- Log message: oops --- Diffs of the changes: (+1 -1) AlphaRegisterInfo.td | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.td diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.4 llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.5 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.4 Wed Feb 2 11:00:21 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.td Wed Feb 2 11:01:31 2005 @@ -81,7 +81,7 @@ //Volitle [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R27, //Non-Volitile - R9, R10, R11, R12, R13, R14, R15, R26, /*R28,*/ R29, /* R30, R31*/ ]>; + R9, R10, R11, R12, R13, R14, R15, R26, /* R28, */ R29 /* R30, R31*/ ]>; //R28 is reserved for the assembler //Don't allocate 15, 29, 30, 31 From alenhar2 at cs.uiuc.edu Wed Feb 2 11:33:00 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 2 Feb 2005 11:33:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200502021733.LAA09130@cypher.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.29 -> 1.30 AlphaInstrInfo.td updated: 1.15 -> 1.16 --- Log message: Store fix --- Diffs of the changes: (+37 -15) AlphaISelPattern.cpp | 46 +++++++++++++++++++++++++++++++++------------- AlphaInstrInfo.td | 6 ++++-- 2 files changed, 37 insertions(+), 15 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.29 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.30 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.29 Wed Feb 2 11:00:21 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Wed Feb 2 11:32:39 2005 @@ -1170,19 +1170,39 @@ return; case ISD::STORE: - Select(N.getOperand(0)); - Tmp1 = SelectExpr(N.getOperand(1)); //value - if (N.getOperand(2).getOpcode() == ISD::GlobalAddress) - { - AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::STORE, 2).addReg(Tmp1).addGlobalAddress(cast(N.getOperand(2))->getGlobal()); - } - else - { - Tmp2 = SelectExpr(N.getOperand(2)); //address - BuildMI(BB, Alpha::STQ, 3).addReg(Tmp1).addImm(0).addReg(Tmp2); - } - return; + { + Select(N.getOperand(0)); + Tmp1 = SelectExpr(N.getOperand(1)); //value + MVT::ValueType DestType = N.getOperand(1).getValueType(); + if (N.getOperand(2).getOpcode() == ISD::GlobalAddress) + { + AlphaLowering.restoreGP(BB); + if (DestType == MVT::i64) Opc = Alpha::STORE; + else if (DestType == MVT::f64) Opc = Alpha::STT_SYM; + else if (DestType == MVT::f32) Opc = Alpha::STS_SYM; + else assert(0 && "unknown Type in store"); + BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(N.getOperand(2))->getGlobal()); + } + else if (ConstantPoolSDNode *CP = dyn_cast(N.getOperand(2))) + { + AlphaLowering.restoreGP(BB); + if (DestType == MVT::i64) Opc = Alpha::STORE; + else if (DestType == MVT::f64) Opc = Alpha::STT_SYM; + else if (DestType == MVT::f32) Opc = Alpha::STS_SYM; + else assert(0 && "unknown Type in store"); + BuildMI(BB, Opc, 2).addReg(Tmp1).addConstantPoolIndex(CP->getIndex()); + } + else + { + Tmp2 = SelectExpr(N.getOperand(2)); //address + if (DestType == MVT::i64) Opc = Alpha::STQ; + else if (DestType == MVT::f64) Opc = Alpha::STT; + else if (DestType == MVT::f32) Opc = Alpha::STS; + else assert(0 && "unknown Type in store"); + BuildMI(BB, Opc, 3).addReg(Tmp1).addImm(0).addReg(Tmp2); + } + return; + } case ISD::EXTLOAD: case ISD::SEXTLOAD: Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.15 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.16 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.15 Tue Feb 1 21:36:35 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Wed Feb 2 11:32:39 2005 @@ -62,8 +62,10 @@ def LOAD : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldq $RA,$DISP">; //Load quadword def LDW : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldw $RA,$DISP($RB)">; // Load sign-extended word def LDB : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldb $RA,$DISP($RB)">; //Load byte - def LDS_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "lds $RA,$DISP">; //Load quadword - def LDT_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldt $RA,$DISP">; //Load quadword + def LDS_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "lds $RA,$DISP">; //Load float + def LDT_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldt $RA,$DISP">; //Load double + def STS_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "sts $RA,$DISP">; //store float + def STT_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "stt $RA,$DISP">; //store double } let Uses = [R28, R23, R24, R25, R26] in From brukman at cs.uiuc.edu Wed Feb 2 12:02:07 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Wed, 2 Feb 2005 12:02:07 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200502021802.MAA19786@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.101 -> 1.102 --- Log message: * Instead of fixing the version numbers before every release, mark them as x.y * Eliminate the redundant "This is the..." in released file listing * Fix grammar --- Diffs of the changes: (+17 -17) GettingStarted.html | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.101 llvm/docs/GettingStarted.html:1.102 --- llvm/docs/GettingStarted.html:1.101 Sat Dec 25 23:47:26 2004 +++ llvm/docs/GettingStarted.html Wed Feb 2 12:01:57 2005 @@ -587,29 +587,29 @@ compressed with the gzip program.

    -

    The files are as follows: +

    The files are as follows, with x.y marking the version number:

    -
    llvm-1.4.tar.gz
    -
    This is the source code for the LLVM libraries and tools.
    +
    llvm-x.y.tar.gz
    +
    Source release for the LLVM libraries and tools.
    -
    llvm-test-1.4.tar.gz
    -
    This is the source code for the LLVM test suite.
    +
    llvm-test-x.y.tar.gz
    +
    Source release for the LLVM test suite.
    -
    cfrontend-1.4.source.tar.gz
    -
    This is the source release of the GCC front end.
    +
    cfrontend-x.y.source.tar.gz
    +
    Source release of the GCC front end.
    -
    cfrontend-1.4.sparc-sun-solaris2.8.tar.gz
    -
    This is the binary release of the GCC front end for Solaris/Sparc. +
    cfrontend-x.y.sparc-sun-solaris2.8.tar.gz
    +
    Binary release of the GCC front end for Solaris/Sparc.
    -
    cfrontend-1.4.i686-redhat-linux-gnu.tar.gz
    -
    This is the binary release of the GCC front end for Linux/x86.
    +
    cfrontend-x.y.i686-redhat-linux-gnu.tar.gz
    +
    Binary release of the GCC front end for Linux/x86.
    -
    cfrontend-1.4.i386-unknown-freebsd5.1.tar.gz
    -
    This is the binary release of the GCC front end for FreeBSD/x86.
    +
    cfrontend-x.y.i386-unknown-freebsd5.1.tar.gz
    +
    Binary release of the GCC front end for FreeBSD/x86.
    -
    cfrontend-1.4.powerpc-apple-darwin7.6.0.tar.gz
    -
    This is the binary release of the GCC front end for MacOS X/PPC.
    +
    cfrontend-x.y.powerpc-apple-darwin7.6.0.tar.gz
    +
    Binary release of the GCC front end for MacOS X/PPC.
    @@ -639,7 +639,7 @@

    If you want to get a specific release (as opposed to the most recent revision), you can specify a label. The following releases have the following -label:

    +labels:

    • Release 1.4: RELEASE_14
    • @@ -1509,7 +1509,7 @@ Chris Lattner
      Reid Spencer
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2004/12/26 05:47:26 $ + Last modified: $Date: 2005/02/02 18:01:57 $ From alkis at cs.uiuc.edu Wed Feb 2 12:40:19 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 12:40:19 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java Message-ID: <200502021840.MAA31694@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: ArrayCopy.java updated: 1.2 -> 1.3 --- Log message: Make ArrayCopy more interesting --- Diffs of the changes: (+54 -9) ArrayCopy.java | 63 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 54 insertions(+), 9 deletions(-) Index: llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.2 llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.3 --- llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.2 Wed Feb 2 09:54:17 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java Wed Feb 2 12:40:08 2005 @@ -2,20 +2,65 @@ public class ArrayCopy { + public static Random rand = new Random(0); + public static int min(int a, int b) { return a < b ? a : b; } + public static void fillArray(Object dst, int dstLength, Object src, int srcLength) { + for (int i = 0; i < dstLength; i += srcLength) + System.arraycopy(src, 0, dst, i, min(dstLength - i, srcLength)); + } + public static void main(String[] args) { - int[] iarray1 = new int[10]; - for (int i = 0; i < iarray1.length; ++i) - iarray1[i] = i; - - int[] iarray2 = new int[123]; - for (int i = 0; i < iarray2.length; i += iarray1.length) - System.arraycopy(iarray1, 0, iarray2, i, min(iarray2.length - i, iarray1.length)); + int[] isrc = new int[10]; + byte[] bsrc = new byte[10]; + float[] fsrc = new float[10]; + double[] dsrc = new double[10]; + boolean[] zsrc = new boolean[10]; + long[] lsrc = new long[10]; + Object[] osrc = new Object[10]; + + for (int i = 0; i < 10; ++i) { + isrc[i] = rand.nextInt(); + bsrc[i] = (byte) rand.nextInt(); + fsrc[i] = rand.nextFloat(); + dsrc[i] = rand.nextDouble(); + zsrc[i] = rand.nextBoolean(); + lsrc[i] = rand.nextLong(); + osrc[i] = new Integer(rand.nextInt()); + } + + int[] idst = new int[7]; + byte[] bdst = new byte[19]; + float[] fdst = new float[28]; + double[] ddst = new double[23]; + boolean[] zdst = new boolean[17]; + long[] ldst = new long[6]; + Object[] odst = new Object[22]; + + fillArray(idst, idst.length, isrc, isrc.length); + fillArray(bdst, bdst.length, bsrc, bsrc.length); + fillArray(fdst, fdst.length, fsrc, fsrc.length); + fillArray(ddst, ddst.length, dsrc, dsrc.length); + fillArray(zdst, zdst.length, zsrc, zsrc.length); + fillArray(ldst, ldst.length, lsrc, lsrc.length); + fillArray(odst, odst.length, osrc, osrc.length); - for (int i = 0; i < iarray2.length; ++i) - Test.println(iarray2[i]); + for (int i = 0; i < idst.length; ++i) + Test.println(idst[i]); + for (int i = 0; i < bdst.length; ++i) + Test.println(bdst[i]); + for (int i = 0; i < fdst.length; ++i) + Test.println(fdst[i]); + for (int i = 0; i < ddst.length; ++i) + Test.println(ddst[i]); + for (int i = 0; i < zdst.length; ++i) + Test.println(zdst[i]); + for (int i = 0; i < ldst.length; ++i) + Test.println(ldst[i]); + for (int i = 0; i < odst.length; ++i) + Test.println(((Integer)odst[i]).intValue()); } } From alkis at cs.uiuc.edu Wed Feb 2 12:42:34 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 12:42:34 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java Message-ID: <200502021842.MAA31848@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Collections3.java added (r1.1) --- Log message: Add test for ArrayList as a Collection --- Diffs of the changes: (+10 -0) Collections3.java | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java:1.1 *** /dev/null Wed Feb 2 12:42:32 2005 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java Wed Feb 2 12:42:22 2005 *************** *** 0 **** --- 1,10 ---- + import java.util.*; + + public class Collections3 + { + public static void main(String[] args) { + Collection c1 = new ArrayList(); + Collections.fillCollectionWithRandomInts(c1); + Collections.printIntCollection(c1); + } + } From alkis at cs.uiuc.edu Wed Feb 2 12:53:32 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 12:53:32 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Maps.java Message-ID: <200502021853.MAA32615@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Maps.java updated: 1.1 -> 1.2 --- Log message: Pull some code out --- Diffs of the changes: (+15 -4) Maps.java | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) Index: llvm-java/test/Programs/SingleSource/UnitTests/Maps.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.1 llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.2 --- llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.1 Tue Jan 25 16:28:08 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Maps.java Wed Feb 2 12:53:21 2005 @@ -4,11 +4,22 @@ { public static Random rand = new Random(0); + public static void fillMapWithRandomInts(Map m) { + int size = rand.nextInt(45) + 5; + for (int i = 0; i < size; ++i) + m.put(new Integer(i), new Integer(rand.nextInt())); + } + + public static void printIntMap(Map m) { + for (int i = 0; i < m.size(); ++i) { + Integer I = (Integer) m.get(new Integer(i)); + Test.println(I.intValue()); + } + } + public static void main(String[] args) { TreeMap tmap = new TreeMap(); - for (int i = 0; i < 1000; ++i) - tmap.put(new Integer(i), new Integer(rand.nextInt())); - for (int i = 0; i < 1000; ++i) - Test.println(((Integer)tmap.get(new Integer(i))).intValue()); + fillMapWithRandomInts(tmap); + printIntMap(tmap); } } From alkis at cs.uiuc.edu Wed Feb 2 12:54:58 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 12:54:58 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java Maps.java Message-ID: <200502021854.MAA32654@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Maps1.java updated: 1.1 -> 1.2 Maps.java updated: 1.2 -> 1.3 --- Log message: Use code from Maps --- Diffs of the changes: (+7 -8) Maps.java | 6 +++--- Maps1.java | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) Index: llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java:1.1 llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java:1.2 --- llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java:1.1 Tue Jan 25 16:31:40 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java Wed Feb 2 12:54:47 2005 @@ -5,10 +5,9 @@ public static Random rand = new Random(0); public static void main(String[] args) { - HashMap tmap = new HashMap(); - for (int i = 0; i < 1000; ++i) - tmap.put(new Integer(i), new Integer(rand.nextInt())); - for (int i = 0; i < 1000; ++i) - Test.println(((Integer)tmap.get(new Integer(i))).intValue()); + HashMap map = new HashMap(); + fillMapWithRandomInts(map); + printIntMap(map); + } } } Index: llvm-java/test/Programs/SingleSource/UnitTests/Maps.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.2 llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.3 --- llvm-java/test/Programs/SingleSource/UnitTests/Maps.java:1.2 Wed Feb 2 12:53:21 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Maps.java Wed Feb 2 12:54:47 2005 @@ -18,8 +18,8 @@ } public static void main(String[] args) { - TreeMap tmap = new TreeMap(); - fillMapWithRandomInts(tmap); - printIntMap(tmap); + TreeMap map = new TreeMap(); + fillMapWithRandomInts(map); + printIntMap(map); } } From lattner at cs.uiuc.edu Wed Feb 2 14:51:06 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 2 Feb 2005 14:51:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200502022051.j12Kp6Jv006494@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.64 -> 1.65 --- Log message: This is no longer needed. Global variables with undef initializers can be initialized to anything, including garbage. --- Diffs of the changes: (+0 -2) ExecutionEngine.cpp | 2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.64 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.65 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.64 Sat Jan 8 14:13:19 2005 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Wed Feb 2 14:50:50 2005 @@ -450,8 +450,6 @@ // void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { if (isa(Init)) { - // FIXME: THIS SHOULD NOT BE NEEDED. - memset(Addr, 0, (size_t)getTargetData().getTypeSize(Init->getType())); return; } else if (Init->getType()->isFirstClassType()) { GenericValue Val = getConstantValue(Init); From alkis at cs.uiuc.edu Wed Feb 2 15:18:23 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Wed, 2 Feb 2005 15:18:23 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java Message-ID: <200502022118.PAA16848@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Maps1.java updated: 1.2 -> 1.3 --- Log message: Really call Maps' methods --- Diffs of the changes: (+2 -3) Maps1.java | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java:1.2 llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java:1.3 --- llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java:1.2 Wed Feb 2 12:54:47 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Maps1.java Wed Feb 2 15:18:12 2005 @@ -6,8 +6,7 @@ public static void main(String[] args) { HashMap map = new HashMap(); - fillMapWithRandomInts(map); - printIntMap(map); - } + Maps.fillMapWithRandomInts(map); + Maps.printIntMap(map); } } From alkis at cs.uiuc.edu Thu Feb 3 02:01:23 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 3 Feb 2005 02:01:23 -0600 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200502030801.CAA02538@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.19 -> 1.20 --- Log message: Eliminate warning about memcpy not being defined. --- Diffs of the changes: (+1 -1) runtime.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.19 llvm-java/runtime/runtime.c:1.20 --- llvm-java/runtime/runtime.c:1.19 Wed Feb 2 10:26:54 2005 +++ llvm-java/runtime/runtime.c Thu Feb 3 02:01:13 2005 @@ -1,5 +1,5 @@ - #include +#include #include struct llvm_java_object_base; From alkis at cs.uiuc.edu Thu Feb 3 02:01:58 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 3 Feb 2005 02:01:58 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200502030801.CAA02573@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.211 -> 1.212 --- Log message: Zero initialize arrays as well. This fixes Maps1.java. --- Diffs of the changes: (+7 -0) Compiler.cpp | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.211 llvm-java/lib/Compiler/Compiler.cpp:1.212 --- llvm-java/lib/Compiler/Compiler.cpp:1.211 Wed Feb 2 10:26:54 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Thu Feb 3 02:01:47 2005 @@ -2281,6 +2281,13 @@ Instruction::Add, size, arrayObjectSize, TMP, currentBB_); // Allocate memory for the object. Value* objRef = new MallocInst(Type::SByteTy, size, TMP, currentBB_); + std::vector params; + params.reserve(4); + params.push_back(objRef); // dest + params.push_back(ConstantUInt::get(Type::UByteTy, 0)); // value + params.push_back(new CastInst(size, Type::ULongTy, TMP, currentBB_)); // size + params.push_back(ConstantUInt::get(Type::UIntTy, 0)); // alignment + new CallInst(memset_, params, "", currentBB_); objRef = new CastInst(objRef, PointerType::get(ci.getType()), TMP, currentBB_); // Store the size. From alkis at cs.uiuc.edu Thu Feb 3 02:08:36 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 3 Feb 2005 02:08:36 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java Message-ID: <200502030808.CAA02765@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Collections4.java added (r1.1) --- Log message: Add new test case --- Diffs of the changes: (+20 -0) Collections4.java | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java:1.1 *** /dev/null Thu Feb 3 02:08:35 2005 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java Thu Feb 3 02:08:25 2005 *************** *** 0 **** --- 1,20 ---- + import java.util.*; + + public class Collections4 + { + public static void main(String[] args) { + Collection c1 = new ArrayList(); + Collections.fillCollectionWithRandomInts(c1); + Collection c2 = new TreeSet(c1); + Collection c3 = new LinkedList(); + Collections.fillCollectionWithRandomInts(c3); + Test.println(c1.containsAll(c2)); + Test.println(c1.containsAll(c3)); + Collections.fillCollectionWithRandomInts(c1); + Test.println(c1.containsAll(c2)); + Test.println(c1.containsAll(c3)); + Collections.printIntCollection(c1); + Collections.printIntCollection(c2); + Collections.printIntCollection(c3); + } + } From alkis at cs.uiuc.edu Thu Feb 3 02:11:18 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 3 Feb 2005 02:11:18 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Collections.java Collections1.java Collections2.java Collections3.java Collections4.java Message-ID: <200502030811.CAA02860@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Collections.java updated: 1.4 -> 1.5 Collections1.java updated: 1.3 -> 1.4 Collections2.java updated: 1.3 -> 1.4 Collections3.java updated: 1.1 -> 1.2 Collections4.java updated: 1.1 -> 1.2 --- Log message: Rename function --- Diffs of the changes: (+8 -8) Collections.java | 4 ++-- Collections1.java | 2 +- Collections2.java | 2 +- Collections3.java | 2 +- Collections4.java | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Collections.java:1.4 llvm-java/test/Programs/SingleSource/UnitTests/Collections.java:1.5 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections.java:1.4 Tue Feb 1 22:58:05 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Collections.java Thu Feb 3 02:11:07 2005 @@ -4,7 +4,7 @@ { public static Random rand = new Random(0); - public static void fillCollectionWithRandomInts(Collection c) { + public static void addRandomIntsToCollection(Collection c) { int size = rand.nextInt(45) + 5; for (int i = 0; i < size; ++i) c.add(new Integer(rand.nextInt())); @@ -17,7 +17,7 @@ public static void main(String[] args) { Collection c1 = new TreeSet(); - fillCollectionWithRandomInts(c1); + addRandomIntsToCollection(c1); Collection c2 = new TreeSet(c1); Test.println(c1.remove(new Integer(5))); Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java:1.3 llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java:1.4 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java:1.3 Tue Feb 1 22:58:05 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Collections1.java Thu Feb 3 02:11:07 2005 @@ -4,7 +4,7 @@ { public static void main(String[] args) { Collection c1 = new LinkedList(); - Collections.fillCollectionWithRandomInts(c1); + Collections.addRandomIntsToCollection(c1); Collections.printIntCollection(c1); } } Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java:1.3 llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java:1.4 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java:1.3 Tue Feb 1 22:58:05 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Collections2.java Thu Feb 3 02:11:07 2005 @@ -4,7 +4,7 @@ { public static void main(String[] args) { Collection c1 = new TreeSet(); - Collections.fillCollectionWithRandomInts(c1); + Collections.addRandomIntsToCollection(c1); Collections.printIntCollection(c1); } } Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java:1.1 llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java:1.2 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java:1.1 Wed Feb 2 12:42:22 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Collections3.java Thu Feb 3 02:11:07 2005 @@ -4,7 +4,7 @@ { public static void main(String[] args) { Collection c1 = new ArrayList(); - Collections.fillCollectionWithRandomInts(c1); + Collections.addRandomIntsToCollection(c1); Collections.printIntCollection(c1); } } Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java:1.1 llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java:1.2 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java:1.1 Thu Feb 3 02:08:25 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/Collections4.java Thu Feb 3 02:11:07 2005 @@ -4,13 +4,13 @@ { public static void main(String[] args) { Collection c1 = new ArrayList(); - Collections.fillCollectionWithRandomInts(c1); + Collections.addRandomIntsToCollection(c1); Collection c2 = new TreeSet(c1); Collection c3 = new LinkedList(); - Collections.fillCollectionWithRandomInts(c3); + Collections.addRandomIntsToCollection(c3); Test.println(c1.containsAll(c2)); Test.println(c1.containsAll(c3)); - Collections.fillCollectionWithRandomInts(c1); + Collections.addRandomIntsToCollection(c1); Test.println(c1.containsAll(c2)); Test.println(c1.containsAll(c3)); Collections.printIntCollection(c1); From lattner at cs.uiuc.edu Thu Feb 3 10:32:42 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 3 Feb 2005 10:32:42 -0600 Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi Message-ID: <200502031632.j13GWgal009858@apoc.cs.uiuc.edu> Changes in directory llvm-www/demo: index.cgi updated: 1.37 -> 1.38 --- Log message: Fix the demo script --- Diffs of the changes: (+4 -2) index.cgi | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm-www/demo/index.cgi diff -u llvm-www/demo/index.cgi:1.37 llvm-www/demo/index.cgi:1.38 --- llvm-www/demo/index.cgi:1.37 Wed Dec 15 11:00:37 2004 +++ llvm-www/demo/index.cgi Thu Feb 3 10:32:26 2005 @@ -5,7 +5,7 @@ # doing remote web JO99C compilations. (It could still be used for that # purpose, though the two scripts have diverged somewhat.) # -# Last modified $Date: 2004/12/15 17:00:37 $ +# Last modified $Date: 2005/02/03 16:32:26 $ # use strict; @@ -28,7 +28,9 @@ $ENV{'LD_LIBRARY_PATH'} = '/home/vadve/shared/localtools/fc1/lib/'; $ENV{'LLVM_LIB_SEARCH_PATH'} = '/home/llvm/install/bytecode-libs'; my @PREPENDPATHDIRS = - ( '/home/vadve/gaeke/llvm/Release/bin', '/home/vadve/gaeke/bin', + ( + '/home/vadve/lattner/local/x86/llvm-gcc/bin/', + '/home/vadve/gaeke/llvm/Release/bin', '/home/vadve/gaeke/bin', '/home/vadve/gaeke/llvm/projects/Stacker/Release/bin' ); sub getname { From brukman at cs.uiuc.edu Thu Feb 3 12:28:19 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu, 3 Feb 2005 12:28:19 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200502031828.MAA02931@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.102 -> 1.103 --- Log message: * Clearly mark LLVM_LIB_SEARCH_PATH as being optional * llvmgcc and llvmg++ aliases are no longer needed (binaries have llvm- prefix) --- Diffs of the changes: (+8 -14) GettingStarted.html | 22 ++++++++-------------- 1 files changed, 8 insertions(+), 14 deletions(-) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.102 llvm/docs/GettingStarted.html:1.103 --- llvm/docs/GettingStarted.html:1.102 Wed Feb 2 12:01:57 2005 +++ llvm/docs/GettingStarted.html Thu Feb 3 12:28:08 2005 @@ -552,22 +552,16 @@

      -In order to compile and use LLVM, you will need to set some environment -variables. There are also some shell aliases which you may find useful. -You can set these on the command line, or better yet, set them in your -.cshrc or .profile. +In order to compile and use LLVM, you may need to set some environment +variables.

      LLVM_LIB_SEARCH_PATH=/path/to/your/bytecode/libs
      -
      This environment variable helps LLVM linking tools find the locations - of your bytecode libraries. It is optional and provided only a convenience - since you can specify the paths using the -L options of the tools.
      - -
      alias llvmgcc='llvm-gcc'
      -
      alias llvmg++='llvm-g++'
      -
      These aliases allow you to use the LLVM C and C++ front ends - under alternative names. It is assumed that llvm-gcc and llvm-g++ are - in your path. The LLVM makefiles will use llvm-gcc and llvm-g++ directly.
      +
      [Optional] This environment variable helps LLVM linking tools find the + locations of your bytecode libraries. It is provided only a + convenience since you can specify the paths using the -L options of the + tools and the C/C++ front-end will use the bytecode files installed in its + lib directory.
      @@ -1509,7 +1503,7 @@ Chris Lattner
      Reid Spencer
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2005/02/02 18:01:57 $ + Last modified: $Date: 2005/02/03 18:28:08 $ From lattner at cs.uiuc.edu Thu Feb 3 12:40:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 3 Feb 2005 12:40:21 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200502031840.j13IeLp9010291@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.85 -> 1.86 --- Log message: Add a new method. --- Diffs of the changes: (+9 -0) DSGraph.h | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.85 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.86 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.85 Sun Jan 30 17:50:48 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Thu Feb 3 12:40:05 2005 @@ -375,6 +375,15 @@ ReturnNodesTy &OldReturnNodes, NodeMapTy &OldNodeMap, unsigned CloneFlags = 0); + /// getFunctionArgumentsForCall - Given a function that is currently in this + /// graph, return the DSNodeHandles that correspond to the pointer-compatible + /// function arguments. The vector is filled in with the return value (or + /// null if it is not pointer compatible), followed by all of the + /// pointer-compatible arguments. + void getFunctionArgumentsForCall(Function *F, + std::vector &Args) const; + + /// mergeInGraph - The method is used for merging graphs together. If the /// argument graph is not *this, it makes a clone of the specified graph, then /// merges the nodes specified in the call site with the formal arguments in From lattner at cs.uiuc.edu Thu Feb 3 12:40:38 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 3 Feb 2005 12:40:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200502031840.j13Iec75010302@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.188 -> 1.189 --- Log message: Refactor getFunctionArgumentsForCall out of mergeInGraph. --- Diffs of the changes: (+41 -29) DataStructure.cpp | 70 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 41 insertions(+), 29 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.188 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.189 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.188 Sun Jan 30 18:10:58 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Feb 3 12:40:25 2005 @@ -1242,6 +1242,21 @@ return false; } +/// getFunctionArgumentsForCall - Given a function that is currently in this +/// graph, return the DSNodeHandles that correspond to the pointer-compatible +/// function arguments. The vector is filled in with the return value (or +/// null if it is not pointer compatible), followed by all of the +/// pointer-compatible arguments. +void DSGraph::getFunctionArgumentsForCall(Function *F, + std::vector &Args) const { + Args.push_back(getReturnNodeFor(*F)); + for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI) + if (isPointerType(AI->getType())) { + Args.push_back(getNodeForValue(AI)); + assert(!Args.back().isNull() && "Pointer argument w/o scalarmap entry!?"); + } +} + /// mergeInGraph - The method is used for merging graphs together. If the /// argument graph is not *this, it makes a clone of the specified graph, then /// merges the nodes specified in the call site with the formal arguments in the @@ -1262,27 +1277,28 @@ // nodes of the old graph. ReachabilityCloner RC(*this, Graph, CloneFlags); - // Set up argument bindings - Function::aiterator AI = F.abegin(); - for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i, ++AI) { - // Advance the argument iterator to the first pointer argument... - while (AI != F.aend() && !isPointerType(AI->getType())) { - ++AI; + // Set up argument bindings. + std::vector Args; + Graph.getFunctionArgumentsForCall(&F, Args); + + // Map the return node pointer over. + if (!CS.getRetVal().isNull()) + RC.merge(CS.getRetVal(), Args[0]); + + // Map over all of the arguments. + for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) { + if (i == Args.size()-1) { #ifndef NDEBUG // FIXME: We should merge vararg arguments! - if (AI == F.aend() && !F.getFunctionType()->isVarArg()) + if (!F.getFunctionType()->isVarArg()) std::cerr << "Bad call to Function: " << F.getName() << "\n"; #endif + break; } - if (AI == F.aend()) break; // Add the link from the argument scalar to the provided value. - RC.merge(CS.getPtrArg(i), Graph.getNodeForValue(AI)); + RC.merge(CS.getPtrArg(i), Args[i+1]); } - // Map the return node pointer over. - if (!CS.getRetVal().isNull()) - RC.merge(CS.getRetVal(), Graph.getReturnNodeFor(F)); - // If requested, copy all of the calls. if (!(CloneFlags & DontCloneCallNodes)) { // Copy the function calls list. @@ -1341,29 +1357,25 @@ } } else { - DSNodeHandle RetVal = getReturnNodeFor(F); + // Set up argument bindings. + std::vector Args; + Graph.getFunctionArgumentsForCall(&F, Args); - // Merge the return value with the return value of the context... - RetVal.mergeWith(CS.getRetVal()); - - // Resolve all of the function arguments... - Function::aiterator AI = F.abegin(); + // Merge the return value with the return value of the context. + Args[0].mergeWith(CS.getRetVal()); - for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i, ++AI) { - // Advance the argument iterator to the first pointer argument... - while (AI != F.aend() && !isPointerType(AI->getType())) { - ++AI; + // Resolve all of the function arguments. + for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) { + if (i == Args.size()-1) { #ifndef NDEBUG // FIXME: We should merge varargs arguments!! - if (AI == F.aend() && !F.getFunctionType()->isVarArg()) + if (!F.getFunctionType()->isVarArg()) std::cerr << "Bad call to Function: " << F.getName() << "\n"; #endif + break; } - if (AI == F.aend()) break; - // Add the link from the argument scalar to the provided value - DSNodeHandle &NH = getNodeForValue(AI); - assert(!NH.isNull() && "Pointer argument without scalarmap entry?"); - NH.mergeWith(CS.getPtrArg(i)); + // Add the link from the argument scalar to the provided value. + Args[i+1].mergeWith(CS.getPtrArg(i)); } } } From alenhar2 at cs.uiuc.edu Thu Feb 3 15:01:31 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 3 Feb 2005 15:01:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502032101.PAA06688@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.30 -> 1.31 --- Log message: FP fixes --- Diffs of the changes: (+17 -12) AlphaISelPattern.cpp | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.30 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.31 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.30 Wed Feb 2 11:32:39 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Thu Feb 3 15:01:15 2005 @@ -68,6 +68,7 @@ computeRegisterProperties(); addLegalFPImmediate(+0.0); //F31 + addLegalFPImmediate(-0.0); //-F31 } /// LowerArguments - This hook must be implemented to indicate how we should @@ -347,7 +348,9 @@ ExprMap[N.getValue(1)] = notIn; // Generate the token else Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - + + //DestType = N.getValue(0).getValueType(); + SDOperand Chain = N.getOperand(0); SDOperand Address = N.getOperand(1); @@ -355,7 +358,7 @@ { Select(Chain); AlphaLowering.restoreGP(BB); - Opc = DestType == MVT::f64 ? Alpha::LDS_SYM : Alpha::LDT_SYM; + Opc = DestType == MVT::f64 ? Alpha::LDT_SYM : Alpha::LDS_SYM; BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { @@ -370,7 +373,7 @@ { Select(Chain); Tmp2 = SelectExpr(Address); - Opc = DestType == MVT::f64 ? Alpha::LDS : Alpha::LDT; + Opc = DestType == MVT::f64 ? Alpha::LDT : Alpha::LDS; BuildMI(BB, Opc, 2, Result).addImm(0).addReg(Tmp2); } return Result; @@ -379,6 +382,8 @@ if (ConstantFPSDNode *CN = dyn_cast(N)) { if (CN->isExactlyValue(+0.0)) { BuildMI(BB, Alpha::CPYS, 2, Result).addReg(Alpha::F31).addReg(Alpha::F31); + } else if ( CN->isExactlyValue(-0.0)) { + BuildMI(BB, Alpha::CPYSN, 2, Result).addReg(Alpha::F31).addReg(Alpha::F31); } else { abort(); } @@ -409,15 +414,15 @@ Tmp2 = MakeReg(MVT::f32); - if (ConstantPoolSDNode *CP = dyn_cast(N.getOperand(1))) - if (Node->getValueType(0) == MVT::f64) { - assert(cast(Node)->getExtraValueType() == MVT::f32 && - "Bad EXTLOAD!"); - AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LDS_SYM, 1, Tmp2).addConstantPoolIndex(CP->getIndex()); - BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); - return Result; - } + assert(cast(Node)->getExtraValueType() == MVT::f32 && "EXTLOAD not from f32"); + assert(Node->getValueType(0) == MVT::f64 && "EXTLOAD not to f64"); + + if (ConstantPoolSDNode *CP = dyn_cast(N.getOperand(1))) { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Alpha::LDS_SYM, 1, Tmp2).addConstantPoolIndex(CP->getIndex()); + BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); + return Result; + } Select(Node->getOperand(0)); // chain Tmp1 = SelectExpr(Node->getOperand(1)); BuildMI(BB, Alpha::LDS, 1, Tmp2).addReg(Tmp1); From alkis at cs.uiuc.edu Thu Feb 3 15:29:47 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 3 Feb 2005 15:29:47 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Util.java Message-ID: <200502032129.PAA23616@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Util.java added (r1.1) --- Log message: Add Util.java - utility functions for testing --- Diffs of the changes: (+184 -0) Util.java | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 184 insertions(+) Index: llvm-java/test/Programs/SingleSource/UnitTests/Util.java diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/Util.java:1.1 *** /dev/null Thu Feb 3 15:29:46 2005 --- llvm-java/test/Programs/SingleSource/UnitTests/Util.java Thu Feb 3 15:29:36 2005 *************** *** 0 **** --- 1,184 ---- + import java.util.*; + + public class Util + { + private static Random rand = new Random(0); + + public static void randomFill(boolean[] a) { + randomFill(a, 0, a.length); + } + + public static void randomFill(boolean[] a, int from, int to) { + for (; from < to; ++from) + a[from] = rand.nextBoolean(); + } + + public static void randomFill(byte[] a) { + randomFill(a, 0, a.length); + } + + public static void randomFill(byte[] a, int from, int to) { + for (; from < to; ++from) + a[from] = (byte) rand.nextInt(); + } + + public static void randomFill(char[] a) { + randomFill(a, 0, a.length); + } + + public static void randomFill(char[] a, int from, int to) { + for (; from < to; ++from) + a[from] = (char) rand.nextInt(); + } + + public static void randomFill(double[] a) { + randomFill(a, 0, a.length); + } + + public static void randomFill(double[] a, int from, int to) { + for (; from < to; ++from) + a[from] = rand.nextDouble(); + } + + public static void randomFill(float[] a) { + randomFill(a, 0, a.length); + } + + public static void randomFill(float[] a, int from, int to) { + for (; from < to; ++from) + a[from] = rand.nextFloat(); + } + + public static void randomFill(int[] a) { + randomFill(a, 0, a.length); + } + + public static void randomFill(int[] a, int from, int to) { + for (; from < to; ++from) + a[from] = rand.nextInt(); + } + + public static void randomFill(long[] a) { + randomFill(a, 0, a.length); + } + + public static void randomFill(long[] a, int from, int to) { + for (; from < to; ++from) + a[from] = rand.nextLong(); + } + + public static void randomFill(short[] a) { + randomFill(a, 0, a.length); + } + + public static void randomFill(short[] a, int from, int to) { + for (; from < to; ++from) + a[from] = (short) rand.nextInt(); + } + + public static void printlnElements(boolean[] a) { + printlnElements(a, 0, a.length); + } + + public static void printlnElements(boolean[] a, int from, int to) { + for (; from < to; ++from) + Test.println(a[from]); + } + + public static void printlnElements(byte[] a) { + printlnElements(a, 0, a.length); + } + + public static void printlnElements(byte[] a, int from, int to) { + for (; from < to; ++from) + Test.println(a[from]); + } + + public static void printlnElements(char[] a) { + printlnElements(a, 0, a.length); + } + + public static void printlnElements(char[] a, int from, int to) { + for (; from < to; ++from) + Test.println(a[from]); + } + + public static void printlnElements(double[] a) { + printlnElements(a, 0, a.length); + } + + public static void printlnElements(double[] a, int from, int to) { + for (; from < to; ++from) + Test.println(a[from]); + } + + public static void printlnElements(float[] a) { + printlnElements(a, 0, a.length); + } + + public static void printlnElements(float[] a, int from, int to) { + for (; from < to; ++from) + Test.println(a[from]); + } + + public static void printlnElements(int[] a) { + printlnElements(a, 0, a.length); + } + + public static void printlnElements(int[] a, int from, int to) { + for (; from < to; ++from) + Test.println(a[from]); + } + + public static void printlnElements(long[] a) { + printlnElements(a, 0, a.length); + } + + public static void printlnElements(long[] a, int from, int to) { + for (; from < to; ++from) + Test.println(a[from]); + } + + public static void printlnElements(short[] a) { + printlnElements(a, 0, a.length); + } + + public static void printlnElements(short[] a, int from, int to) { + for (; from < to; ++from) + Test.println(a[from]); + } + + public static void main(String[] args) { + boolean[] az = new boolean[rand.nextInt(100)]; + randomFill(az); + printlnElements(az); + + byte[] ab = new byte[rand.nextInt(100)]; + randomFill(ab); + printlnElements(ab); + + char[] ac = new char[rand.nextInt(100)]; + randomFill(ac); + printlnElements(ac); + + double[] ad = new double[rand.nextInt(100)]; + randomFill(ad); + printlnElements(ad); + + float[] af = new float[rand.nextInt(100)]; + randomFill(af); + printlnElements(af); + + int[] ai = new int[rand.nextInt(100)]; + randomFill(ai); + printlnElements(ai); + + long[] al = new long[rand.nextInt(100)]; + randomFill(al); + printlnElements(al); + + short[] as = new short[rand.nextInt(100)]; + randomFill(as); + printlnElements(as); + } + } From alkis at cs.uiuc.edu Thu Feb 3 15:36:09 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 3 Feb 2005 15:36:09 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/OperandStack.cpp Locals.h Locals.cpp Compiler.cpp BasicBlockBuilder.h Message-ID: <200502032136.PAA23742@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: OperandStack.cpp updated: 1.10 -> 1.11 Locals.h updated: 1.3 -> 1.4 Locals.cpp updated: 1.8 -> 1.9 Compiler.cpp updated: 1.212 -> 1.213 BasicBlockBuilder.h updated: 1.2 -> 1.3 --- Log message: Create an entry block to hold all allocas for the operand stack and locals. This also fixes the problem where the bb0 block is a loop (and has a predecessor) which results in illegal llvm code. --- Diffs of the changes: (+63 -32) BasicBlockBuilder.h | 16 ++++++++++++++-- Compiler.cpp | 24 +++++++++++++----------- Locals.cpp | 38 ++++++++++++++++++++++++++------------ Locals.h | 6 ++++++ OperandStack.cpp | 11 ++++------- 5 files changed, 63 insertions(+), 32 deletions(-) Index: llvm-java/lib/Compiler/OperandStack.cpp diff -u llvm-java/lib/Compiler/OperandStack.cpp:1.10 llvm-java/lib/Compiler/OperandStack.cpp:1.11 --- llvm-java/lib/Compiler/OperandStack.cpp:1.10 Wed Feb 2 10:26:54 2005 +++ llvm-java/lib/Compiler/OperandStack.cpp Thu Feb 3 15:35:58 2005 @@ -20,7 +20,6 @@ #include #include #include -#include using namespace llvm; using namespace llvm::Java; @@ -48,12 +47,10 @@ if (it == slotMap.end()) { // Insert the alloca at the beginning of the entry block. - BasicBlock* entry = &bb->getParent()->getEntryBlock(); - AllocaInst* alloca; - if (entry->empty()) - alloca = new AllocaInst(type, NULL, "opStack", entry); - else - alloca = new AllocaInst(type, NULL, "opStack", &entry->front()); + BasicBlock& entry = bb->getParent()->getEntryBlock(); + assert(entry.getTerminator() && "Entry block must have a terminator!"); + AllocaInst* alloca = + new AllocaInst(type, NULL, "opStack", entry.getTerminator()); it = slotMap.insert(it, std::make_pair(type, alloca)); } Index: llvm-java/lib/Compiler/Locals.h diff -u llvm-java/lib/Compiler/Locals.h:1.3 llvm-java/lib/Compiler/Locals.h:1.4 --- llvm-java/lib/Compiler/Locals.h:1.3 Fri Jan 21 05:41:38 2005 +++ llvm-java/lib/Compiler/Locals.h Thu Feb 3 15:35:58 2005 @@ -23,6 +23,7 @@ class AllocaInst; class BasicBlock; + class Instruction; class Type; class Value; @@ -42,6 +43,11 @@ /// insertAtEnd BasicBlock void store(unsigned i, Value* value, BasicBlock* insertAtEnd); + /// @brief - Stores the value \c value on the \c i'th local + /// variable and prepends any instructions to implement this before \c + /// insertBefore Instruction + void store(unsigned i, Value* value, Instruction* insertBefore); + /// @brief - Loads the value of the \c i'th local variable of type /// \c type and appends any instructions to implement this to \c /// insertAtEnd BasicBlock Index: llvm-java/lib/Compiler/Locals.cpp diff -u llvm-java/lib/Compiler/Locals.cpp:1.8 llvm-java/lib/Compiler/Locals.cpp:1.9 --- llvm-java/lib/Compiler/Locals.cpp:1.8 Wed Feb 2 10:26:54 2005 +++ llvm-java/lib/Compiler/Locals.cpp Thu Feb 3 15:35:58 2005 @@ -42,24 +42,38 @@ if (it == slotMap.end()) { // Insert the alloca at the beginning of the entry block. - BasicBlock* entry = &insertAtEnd->getParent()->getEntryBlock(); - AllocaInst* alloca; - if (entry->empty()) - alloca = new AllocaInst(storageTy, - NULL, - "local" + utostr(i), - entry); - else - alloca = new AllocaInst(storageTy, - NULL, - "local" + utostr(i), - &entry->front()); + BasicBlock& entry = insertAtEnd->getParent()->getEntryBlock(); + assert(entry.getTerminator() && "Entry block must have a terminator!"); + AllocaInst* alloca = + new AllocaInst(storageTy, NULL, "local"+utostr(i), entry.getTerminator()); it = slotMap.insert(it, std::make_pair(storageTy, alloca)); } new StoreInst(value, it->second, insertAtEnd); } +void Locals::store(unsigned i, Value* value, Instruction* insertBefore) +{ + const Type* valueTy = value->getType(); + const Type* storageTy = getStorageType(valueTy); + if (valueTy != storageTy) + value = new CastInst(value, storageTy, "to-storage-type", insertBefore); + + SlotMap& slotMap = TheLocals[i]; + SlotMap::iterator it = slotMap.find(storageTy); + + if (it == slotMap.end()) { + // Insert the alloca at the beginning of the entry block. + BasicBlock& entry = insertBefore->getParent()->getParent()->getEntryBlock(); + assert(entry.getTerminator() && "Entry block must have a terminator!"); + AllocaInst* alloca = + new AllocaInst(storageTy, NULL, "local"+utostr(i), entry.getTerminator()); + it = slotMap.insert(it, std::make_pair(storageTy, alloca)); + } + + new StoreInst(value, it->second, insertBefore); +} + llvm::Value* Locals::load(unsigned i, const Type* valueTy, BasicBlock* insertAtEnd) { Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.212 llvm-java/lib/Compiler/Compiler.cpp:1.213 --- llvm-java/lib/Compiler/Compiler.cpp:1.212 Thu Feb 3 02:01:47 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Thu Feb 3 15:35:58 2005 @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -1366,20 +1365,23 @@ unsigned index = 0; for (Function::aiterator a = function->abegin(), ae = function->aend(); a != ae; ++a) { - locals_.store(index, a, &function->getEntryBlock()); + locals_.store(index, a, function->getEntryBlock().getTerminator()); index += isTwoSlotType(a->getType()) ? 2 : 1; } - // For the entry block the operand stack is empty and the locals - // contain the arguments to the function. + + BasicBlock* bb0 = bbBuilder_->getBasicBlock(0); + + // For bb0 the operand stack is empty and the locals contain the + // arguments to the function. // // NOTE: We create an operand stack one size too big because we // push extra values on the stack to simplify code generation // (see implementation of ifne). opStack_ = OperandStack(codeAttr->getMaxStack()+2); - opStackDepthMap_.insert(std::make_pair(&function->getEntryBlock(), 0)); + opStackDepthMap_.insert(std::make_pair(bb0, 0)); - // Insert the entry block to the work list. - bbWorkList_.push_back(&function->getEntryBlock()); + // Insert bb0 in the work list. + bbWorkList_.push_back(bb0); // Process the work list until we compile the whole function. while (!bbWorkList_.empty()) { @@ -1406,10 +1408,10 @@ new BranchInst(bbBuilder_->getBasicBlock(end), currentBB_); // For each successor of this basic block we can compute its - // entry operand stack and locals, do so, and add it to the - // work list. If a successor already has an entry operand - // stack and locals we assume the computation was correct and - // do not add it to the work list. + // entry operand stack depth. We do so, and add it to the work + // list. If a successor already has an entry operand stack and + // locals we assume the computation was correct and do not add + // it to the work list. for (succ_iterator SI = succ_begin(currentBB_), SE = succ_end(currentBB_); SI != SE; ++SI) { Index: llvm-java/lib/Compiler/BasicBlockBuilder.h diff -u llvm-java/lib/Compiler/BasicBlockBuilder.h:1.2 llvm-java/lib/Compiler/BasicBlockBuilder.h:1.3 --- llvm-java/lib/Compiler/BasicBlockBuilder.h:1.2 Thu Oct 28 03:26:32 2004 +++ llvm-java/lib/Compiler/BasicBlockBuilder.h Thu Feb 3 15:35:58 2005 @@ -17,6 +17,7 @@ #include #include #include +#include #include namespace llvm { namespace Java { @@ -44,14 +45,25 @@ BasicBlockBuilder(Function* f, CodeAttribute* c) : function_(f) { + // Create the entry block. + BasicBlock* entry = new BasicBlock("entry", function_); + + // Create the block for bytecode 0 (bb0). BasicBlock* bb = getOrCreateBasicBlockAt(0); + // Add an unconditional branch from the entry block to bb0. + new BranchInst(bb, entry); + + // Create basic blocks for exception handlers. const CodeAttribute::Exceptions& exceptions = c->getExceptions(); for (unsigned i = 0, e = exceptions.size(); i != e; ++i) getOrCreateBasicBlockAt(exceptions[i]->getHandlerPc()); + // Parse the bytecode and create basic blocks for all targets of + // control flow instructions. parse(c->getCode(), 0, c->getCodeSize()); + // Build the bytecode->basic block map. for (BC2BBMap::const_iterator i = bc2bbMap_.begin(), e = bc2bbMap_.end(); i != e; ++i) { unsigned end = next(i) != e ? next(i)->first : c->getCodeSize(); @@ -59,8 +71,8 @@ std::make_pair(i->second, std::make_pair(i->first, end))); } - assert(function_->getEntryBlock().getName() == "bc0"); - assert(bb2bcMap_.find(&function_->getEntryBlock()) != bb2bcMap_.end()); + assert(function_->getEntryBlock().getName() == "entry"); + assert(bb2bcMap_.find(&function_->getEntryBlock()) == bb2bcMap_.end()); } BasicBlock* getBasicBlock(unsigned bcI) const { From alkis at cs.uiuc.edu Thu Feb 3 15:41:16 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 3 Feb 2005 15:41:16 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/Array.java ArrayCopy.java Message-ID: <200502032141.PAA23853@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Array.java updated: 1.2 -> 1.3 ArrayCopy.java updated: 1.3 -> 1.4 --- Log message: Use methods from Util.java --- Diffs of the changes: (+8 -16) Array.java | 6 ++---- ArrayCopy.java | 18 ++++++------------ 2 files changed, 8 insertions(+), 16 deletions(-) Index: llvm-java/test/Programs/SingleSource/UnitTests/Array.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/Array.java:1.2 llvm-java/test/Programs/SingleSource/UnitTests/Array.java:1.3 --- llvm-java/test/Programs/SingleSource/UnitTests/Array.java:1.2 Sat Dec 11 17:31:49 2004 +++ llvm-java/test/Programs/SingleSource/UnitTests/Array.java Thu Feb 3 15:41:05 2005 @@ -6,8 +6,7 @@ for (int i = 0, e = intArray.length; i != e; ++i) intArray[i] = intArray.length - i; - for (int i = 0, e = intArray.length; i != e; ++i) - Test.println(intArray[i]); + Util.printlnElements(intArray); Object[] objectArray = new Object[10]; @@ -16,7 +15,6 @@ objectArray[i] = intArray; intArray = (int[]) objectArray[4]; - for (int i = 0, e = intArray.length; i != e; ++i) - Test.println(intArray[i]); + Util.printlnElements(intArray); } } Index: llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java diff -u llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.3 llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.4 --- llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java:1.3 Wed Feb 2 12:40:08 2005 +++ llvm-java/test/Programs/SingleSource/UnitTests/ArrayCopy.java Thu Feb 3 15:41:05 2005 @@ -48,18 +48,12 @@ fillArray(ldst, ldst.length, lsrc, lsrc.length); fillArray(odst, odst.length, osrc, osrc.length); - for (int i = 0; i < idst.length; ++i) - Test.println(idst[i]); - for (int i = 0; i < bdst.length; ++i) - Test.println(bdst[i]); - for (int i = 0; i < fdst.length; ++i) - Test.println(fdst[i]); - for (int i = 0; i < ddst.length; ++i) - Test.println(ddst[i]); - for (int i = 0; i < zdst.length; ++i) - Test.println(zdst[i]); - for (int i = 0; i < ldst.length; ++i) - Test.println(ldst[i]); + Util.printlnElements(idst); + Util.printlnElements(bdst); + Util.printlnElements(fdst); + Util.printlnElements(ddst); + Util.printlnElements(zdst); + Util.printlnElements(ldst); for (int i = 0; i < odst.length; ++i) Test.println(((Integer)odst[i]).intValue()); } From brukman at cs.uiuc.edu Thu Feb 3 16:25:34 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu, 3 Feb 2005 16:25:34 -0600 Subject: [llvm-commits] CVS: llvm/docs/GettingStarted.html Message-ID: <200502032225.QAA24856@zion.cs.uiuc.edu> Changes in directory llvm/docs: GettingStarted.html updated: 1.103 -> 1.104 --- Log message: * Fix broken link to directions to get llvm, llvm-gcc, and llvm-test from CVS * Remove duplicated CVS directions and refer reader to the CVS section * Clean up directions to be brief --- Diffs of the changes: (+16 -38) GettingStarted.html | 54 +++++++++++++++------------------------------------- 1 files changed, 16 insertions(+), 38 deletions(-) Index: llvm/docs/GettingStarted.html diff -u llvm/docs/GettingStarted.html:1.103 llvm/docs/GettingStarted.html:1.104 --- llvm/docs/GettingStarted.html:1.103 Thu Feb 3 12:28:08 2005 +++ llvm/docs/GettingStarted.html Thu Feb 3 16:25:23 2005 @@ -111,7 +111,7 @@
    • Read the documentation.
    • Read the documentation.
    • Remember that you were warned twice about reading the documentation.
    • -
    • Install the GCC front end: +
    • Install the GCC front end if you intend to compile C or C++:
      1. cd where-you-want-the-C-front-end-to-live
      2. gunzip --stdout cfrontend.platform.tar.gz | tar -xvf - @@ -121,63 +121,39 @@
      3. Add the cfrontend's "bin" directory to your PATH variable
    • -
    • Get the Source Code +
    • Get the LLVM Source Code
        -
      • With the distributed files: +
      • With the distributed files (or use CVS):
        1. cd where-you-want-llvm-to-live
        2. gunzip --stdout llvm-version.tar.gz | tar -xvf - -
        3. cd llvm
      • -
      • With anonymous CVS access (or use a mirror): -
          -
        1. cd where-you-want-llvm-to-live
        2. -
        3. cvs -d - :pserver:anon at llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login
        4. -
        5. Hit the return key when prompted for the password. -
        6. cvs -z3 -d :pserver:anon at llvm-cvs.cs.uiuc.edu:/var/cvs/llvm - co llvm
        7. -
        8. cd llvm
        9. -
        10. cvs up -P -d
        11. -
    • -
    • Get the Test Suite Source Code (optional) +
    • [Optional] Get the Test Suite Source Code
        -
      • With the distributed files: +
      • With the distributed files (or use CVS):
        1. cd where-you-want-llvm-to-live
        2. cd llvm/projects
        3. gunzip --stdout llvm-test-version.tar.gz | tar -xvf - -
        4. cd ..
      • -
      • With anonymous CVS access (or use a mirror): -
          -
        1. cd where-you-want-llvm-to-live
        2. -
        3. cd llvm/projects -
        4. cvs -d - :pserver:anon at llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login
        5. -
        6. Hit the return key when prompted for the password. -
        7. cvs -z3 -d :pserver:anon at llvm-cvs.cs.uiuc.edu:/var/cvs/llvm - co llvm-test
        8. -
        9. cd llvm-test
        10. -
        11. cvs up -P -d
        12. -
        13. cd ..
        14. -
    • Configure the LLVM Build Environment
        -
      1. Change directory to where you want to store the LLVM object - files and run configure to configure the Makefiles and - header files for the default platform. Useful options include: +
      2. cd where-you-want-to-build-llvm
      3. +
      4. /path/to/llvm/configure [options]
        + Some common options: +
        • --prefix=directory

          Specify for directory the full pathname of where you - want the LLVM tools and libraries to be installed.

        • + want the LLVM tools and libraries to be installed (default + /usr/local).

        • --with-llvmgccdir=directory

          Optionally, specify for directory the full pathname of the C/C++ FrontEnd installation to use with this LLVM configuration. If @@ -1003,19 +979,21 @@

          -If you're running on a linux system that supports the " binfmt_misc" module, and you have root access on the system, you can set your system up to execute LLVM bytecode files directly. To do this, use commands like this (the first command may not be required if you are already using the module):

          +
              $ mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
          -   $ echo ':llvm:M::llvm::/path/to/lli:' > /proc/sys/fs/binfmt_misc/register
          +   $ echo ':llvm:M::llvm::/path/to/lli:' > /proc/sys/fs/binfmt_misc/register
              $ chmod u+x hello.bc                (if needed)
              $ ./hello.bc
           
          +

          This allows you to execute LLVM bytecode files directly. Thanks to Jack @@ -1503,7 +1481,7 @@ Chris Lattner
          Reid Spencer
          The LLVM Compiler Infrastructure
          - Last modified: $Date: 2005/02/03 18:28:08 $ + Last modified: $Date: 2005/02/03 22:25:23 $ From alkis at cs.uiuc.edu Thu Feb 3 16:37:43 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Thu, 3 Feb 2005 16:37:43 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/OperandStack.cpp Locals.h Locals.cpp Compiler.cpp BasicBlockBuilder.h Message-ID: <200502032237.QAA25132@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: OperandStack.cpp updated: 1.11 -> 1.12 Locals.h updated: 1.4 -> 1.5 Locals.cpp updated: 1.9 -> 1.10 Compiler.cpp updated: 1.213 -> 1.214 BasicBlockBuilder.h updated: 1.3 -> 1.4 --- Log message: Simplify code by adding the branch from the entry block to the first bytecode block after compilation of a function is done. --- Diffs of the changes: (+9 -39) BasicBlockBuilder.h | 3 --- Compiler.cpp | 5 ++++- Locals.cpp | 29 +++-------------------------- Locals.h | 5 ----- OperandStack.cpp | 6 ++---- 5 files changed, 9 insertions(+), 39 deletions(-) Index: llvm-java/lib/Compiler/OperandStack.cpp diff -u llvm-java/lib/Compiler/OperandStack.cpp:1.11 llvm-java/lib/Compiler/OperandStack.cpp:1.12 --- llvm-java/lib/Compiler/OperandStack.cpp:1.11 Thu Feb 3 15:35:58 2005 +++ llvm-java/lib/Compiler/OperandStack.cpp Thu Feb 3 16:37:32 2005 @@ -47,10 +47,8 @@ if (it == slotMap.end()) { // Insert the alloca at the beginning of the entry block. - BasicBlock& entry = bb->getParent()->getEntryBlock(); - assert(entry.getTerminator() && "Entry block must have a terminator!"); - AllocaInst* alloca = - new AllocaInst(type, NULL, "opStack", entry.getTerminator()); + BasicBlock* entry = &bb->getParent()->getEntryBlock(); + AllocaInst* alloca = new AllocaInst(type, NULL, "opStack", entry); it = slotMap.insert(it, std::make_pair(type, alloca)); } Index: llvm-java/lib/Compiler/Locals.h diff -u llvm-java/lib/Compiler/Locals.h:1.4 llvm-java/lib/Compiler/Locals.h:1.5 --- llvm-java/lib/Compiler/Locals.h:1.4 Thu Feb 3 15:35:58 2005 +++ llvm-java/lib/Compiler/Locals.h Thu Feb 3 16:37:32 2005 @@ -43,11 +43,6 @@ /// insertAtEnd BasicBlock void store(unsigned i, Value* value, BasicBlock* insertAtEnd); - /// @brief - Stores the value \c value on the \c i'th local - /// variable and prepends any instructions to implement this before \c - /// insertBefore Instruction - void store(unsigned i, Value* value, Instruction* insertBefore); - /// @brief - Loads the value of the \c i'th local variable of type /// \c type and appends any instructions to implement this to \c /// insertAtEnd BasicBlock Index: llvm-java/lib/Compiler/Locals.cpp diff -u llvm-java/lib/Compiler/Locals.cpp:1.9 llvm-java/lib/Compiler/Locals.cpp:1.10 --- llvm-java/lib/Compiler/Locals.cpp:1.9 Thu Feb 3 15:35:58 2005 +++ llvm-java/lib/Compiler/Locals.cpp Thu Feb 3 16:37:32 2005 @@ -41,39 +41,16 @@ SlotMap::iterator it = slotMap.find(storageTy); if (it == slotMap.end()) { - // Insert the alloca at the beginning of the entry block. - BasicBlock& entry = insertAtEnd->getParent()->getEntryBlock(); - assert(entry.getTerminator() && "Entry block must have a terminator!"); + // Insert the alloca at the end of the entry block. + BasicBlock* entry = &insertAtEnd->getParent()->getEntryBlock(); AllocaInst* alloca = - new AllocaInst(storageTy, NULL, "local"+utostr(i), entry.getTerminator()); + new AllocaInst(storageTy, NULL, "local"+utostr(i), entry); it = slotMap.insert(it, std::make_pair(storageTy, alloca)); } new StoreInst(value, it->second, insertAtEnd); } -void Locals::store(unsigned i, Value* value, Instruction* insertBefore) -{ - const Type* valueTy = value->getType(); - const Type* storageTy = getStorageType(valueTy); - if (valueTy != storageTy) - value = new CastInst(value, storageTy, "to-storage-type", insertBefore); - - SlotMap& slotMap = TheLocals[i]; - SlotMap::iterator it = slotMap.find(storageTy); - - if (it == slotMap.end()) { - // Insert the alloca at the beginning of the entry block. - BasicBlock& entry = insertBefore->getParent()->getParent()->getEntryBlock(); - assert(entry.getTerminator() && "Entry block must have a terminator!"); - AllocaInst* alloca = - new AllocaInst(storageTy, NULL, "local"+utostr(i), entry.getTerminator()); - it = slotMap.insert(it, std::make_pair(storageTy, alloca)); - } - - new StoreInst(value, it->second, insertBefore); -} - llvm::Value* Locals::load(unsigned i, const Type* valueTy, BasicBlock* insertAtEnd) { Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.213 llvm-java/lib/Compiler/Compiler.cpp:1.214 --- llvm-java/lib/Compiler/Compiler.cpp:1.213 Thu Feb 3 15:35:58 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Thu Feb 3 16:37:32 2005 @@ -1365,7 +1365,7 @@ unsigned index = 0; for (Function::aiterator a = function->abegin(), ae = function->aend(); a != ae; ++a) { - locals_.store(index, a, function->getEntryBlock().getTerminator()); + locals_.store(index, a, &function->getEntryBlock()); index += isTwoSlotType(a->getType()) ? 2 : 1; } @@ -1427,6 +1427,9 @@ } } + // Add an unconditional branch from the entry block to bb0. + new BranchInst(bb0, &function->getEntryBlock()); + // FIXME: remove empty basic blocks (we have empty basic blocks // because of our lack of exception support). for (Function::iterator bb = function->begin(), be = function->end(); Index: llvm-java/lib/Compiler/BasicBlockBuilder.h diff -u llvm-java/lib/Compiler/BasicBlockBuilder.h:1.3 llvm-java/lib/Compiler/BasicBlockBuilder.h:1.4 --- llvm-java/lib/Compiler/BasicBlockBuilder.h:1.3 Thu Feb 3 15:35:58 2005 +++ llvm-java/lib/Compiler/BasicBlockBuilder.h Thu Feb 3 16:37:32 2005 @@ -51,9 +51,6 @@ // Create the block for bytecode 0 (bb0). BasicBlock* bb = getOrCreateBasicBlockAt(0); - // Add an unconditional branch from the entry block to bb0. - new BranchInst(bb, entry); - // Create basic blocks for exception handlers. const CodeAttribute::Exceptions& exceptions = c->getExceptions(); for (unsigned i = 0, e = exceptions.size(); i != e; ++i) From alkis at cs.uiuc.edu Fri Feb 4 00:36:33 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 4 Feb 2005 00:36:33 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200502040636.AAA04108@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.214 -> 1.215 --- Log message: Make monitorenter and monitorexit pop the object reference off the operand stack (they are still noops but we have a correct operand stack now). --- Diffs of the changes: (+4 -2) Compiler.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.214 llvm-java/lib/Compiler/Compiler.cpp:1.215 --- llvm-java/lib/Compiler/Compiler.cpp:1.214 Thu Feb 3 16:37:32 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Fri Feb 4 00:36:22 2005 @@ -2357,11 +2357,13 @@ } void do_monitorenter() { - // assert(0 && "not implemented"); + // FIXME: This is currently a noop + pop(ObjectBaseRefTy); } void do_monitorexit() { - // assert(0 && "not implemented"); + // FIXME: This is currently a noop + pop(ObjectBaseRefTy); } void do_multianewarray(unsigned index, unsigned dims) { From alenhar2 at cs.uiuc.edu Fri Feb 4 07:47:32 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 4 Feb 2005 07:47:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200502041347.HAA00637@niobe.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.13 -> 1.14 --- Log message: fix constant pointer outputing on 64 bit machines --- Diffs of the changes: (+5 -0) AsmPrinter.cpp | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.13 llvm/lib/CodeGen/AsmPrinter.cpp:1.14 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.13 Sat Jan 8 13:59:10 2005 +++ llvm/lib/CodeGen/AsmPrinter.cpp Fri Feb 4 07:47:16 2005 @@ -284,6 +284,11 @@ O << Data16bitsDirective; break; case Type::PointerTyID: + if (TD.getPointerSize() == 8) { + O << Data64bitsDirective; + break; + } + //Fall through for pointer size == int size case Type::UIntTyID: case Type::IntTyID: O << Data32bitsDirective; break; From alenhar2 at cs.uiuc.edu Fri Feb 4 08:01:37 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 4 Feb 2005 08:01:37 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Message-ID: <200502041401.IAA02361@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.4 -> 1.5 --- Log message: get alignment printing correctly and get rid of __main hack --- Diffs of the changes: (+2 -7) AlphaAsmPrinter.cpp | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.4 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.5 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.4 Tue Feb 1 14:38:53 2005 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Fri Feb 4 08:01:21 2005 @@ -37,7 +37,7 @@ unsigned LabelNumber; AlphaAsmPrinter(std::ostream &o, TargetMachine &tm) - : AsmPrinter(o, tm), LabelNumber(0) + : AsmPrinter(o, tm), LabelNumber(0), AlignmentIsInBytes(false) { } /// We name each basic block in a Function with a unique number, so @@ -162,17 +162,12 @@ setupMachineFunction(MF); O << "\n\n"; - if (CurrentFnName.compare("main") == 0) - { - // O << "\n\n#HACK\n\t.text\n\t.ent __main\n__main:\n\tret $31,($26),1\n\t.end __main\n#ENDHACK\n\n"; - } - // Print out constants referenced by the function printConstantPool(MF.getConstantPool()); // Print out labels for the function. O << "\t.text\n"; - emitAlignment(2); + emitAlignment(4); O << "\t.globl\t" << CurrentFnName << "\n"; O << "\t.ent\t" << CurrentFnName << "\n"; From alenhar2 at cs.uiuc.edu Fri Feb 4 08:09:51 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 4 Feb 2005 08:09:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Message-ID: <200502041409.IAA03001@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.5 -> 1.6 --- Log message: alignment --- Diffs of the changes: (+4 -2) AlphaAsmPrinter.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.5 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.6 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.5 Fri Feb 4 08:01:21 2005 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Fri Feb 4 08:09:38 2005 @@ -37,8 +37,10 @@ unsigned LabelNumber; AlphaAsmPrinter(std::ostream &o, TargetMachine &tm) - : AsmPrinter(o, tm), LabelNumber(0), AlignmentIsInBytes(false) - { } + : AsmPrinter(o, tm), LabelNumber(0) + { + AlignmentIsInBytes = false; + } /// We name each basic block in a Function with a unique number, so /// that we can consistently refer to them later. This is cleared From alkis at cs.uiuc.edu Fri Feb 4 10:15:05 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 4 Feb 2005 10:15:05 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/Makefile.singlesrc Message-ID: <200502041615.KAA14726@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource: Makefile.singlesrc updated: 1.17 -> 1.18 --- Log message: Allow any combination of raw/traced binaries. --- Diffs of the changes: (+0 -5) Makefile.singlesrc | 5 ----- 1 files changed, 5 deletions(-) Index: llvm-java/test/Programs/SingleSource/Makefile.singlesrc diff -u llvm-java/test/Programs/SingleSource/Makefile.singlesrc:1.17 llvm-java/test/Programs/SingleSource/Makefile.singlesrc:1.18 --- llvm-java/test/Programs/SingleSource/Makefile.singlesrc:1.17 Tue Jan 25 15:40:12 2005 +++ llvm-java/test/Programs/SingleSource/Makefile.singlesrc Fri Feb 4 10:14:54 2005 @@ -25,9 +25,4 @@ $(Echo) Optimizing $< -$(Verb)$(LOPT) $(OPT_PASSES) -f -o=$@ $< -# add function trace code -%.tracef.linked.bc: %.linked.bc $(LOPT) - $(Echo) Adding function trace code to $< - $(Verb)$(LOPT) -tracem -tracedisablehashdisable -f -o=$@ $< - include $(LEVEL)/test/Makefile.test From alkis at cs.uiuc.edu Fri Feb 4 10:15:05 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 4 Feb 2005 10:15:05 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Makefile.test Message-ID: <200502041615.KAA14730@zion.cs.uiuc.edu> Changes in directory llvm-java/test: Makefile.test updated: 1.36 -> 1.37 --- Log message: Allow any combination of raw/traced binaries. --- Diffs of the changes: (+11 -0) Makefile.test | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm-java/test/Makefile.test diff -u llvm-java/test/Makefile.test:1.36 llvm-java/test/Makefile.test:1.37 --- llvm-java/test/Makefile.test:1.36 Tue Jan 25 10:01:52 2005 +++ llvm-java/test/Makefile.test Fri Feb 4 10:14:54 2005 @@ -22,6 +22,17 @@ $(Echo) Linking $< with the Java runtime -$(Verb)$(GCCLD) -o=$*.llvm $< -L $(CFERuntimeLibDir) -L $(LibDir) $(EXTRA_OBJS) +# rule to link raw bytecode with runtime +%.raw.llvm %.raw.llvm.bc: %.raw.bc $(LibDir)/libjrt.bca $(EXTRA_OBJS) $(LOPT) + $(Echo) Linking $< with the Java runtime + -$(Verb)$(GCCLD) -disable-opt -o=$*.raw.llvm $< -L $(CFERuntimeLibDir) -L $(LibDir) $(EXTRA_OBJS) + +# add function trace code +%.tracef.llvm %.tracef.llvm.bc: %.llvm %.llvm.bc $(LOPT) + $(Echo) Adding function trace code to $< + $(Verb)$(CP) $*.llvm $*.tracef.llvm + $(Verb)$(LOPT) -tracem -tracedisablehashdisable -f -o=$*.tracef.llvm.bc $*.llvm.bc + # rule to make assembly from bytecode %.dis-ll: %.bc $(Echo) Disassembling $< From lattner at cs.uiuc.edu Fri Feb 4 12:39:35 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 12:39:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200502041839.j14IdZJo016576@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.59 -> 1.60 --- Log message: Fix a case where were incorrectly compiled cast from short to int on 64-bit targets. --- Diffs of the changes: (+4 -2) LegalizeDAG.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.59 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.60 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.59 Tue Feb 1 21:44:41 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Feb 4 12:39:19 2005 @@ -1071,9 +1071,11 @@ Result = PromoteOp(Node->getOperand(0)); // The high bits are not guaranteed to be anything. Insert an extend. if (Node->getOpcode() == ISD::SIGN_EXTEND) - Result = DAG.getNode(ISD::SIGN_EXTEND_INREG, NVT, Result, VT); + Result = DAG.getNode(ISD::SIGN_EXTEND_INREG, NVT, Result, + Node->getOperand(0).getValueType()); else - Result = DAG.getNode(ISD::ZERO_EXTEND_INREG, NVT, Result, VT); + Result = DAG.getNode(ISD::ZERO_EXTEND_INREG, NVT, Result, + Node->getOperand(0).getValueType()); break; } break; From lattner at cs.uiuc.edu Fri Feb 4 12:58:20 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 12:58:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Message-ID: <200502041858.j14IwKJD017642@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.73 -> 1.74 --- Log message: Fix the Regression/Transforms/DSAnalysis/recursion.ll regression. --- Diffs of the changes: (+3 -4) TopDownClosure.cpp | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.73 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.74 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.73 Sun Jan 30 18:10:45 2005 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Fri Feb 4 12:58:04 2005 @@ -241,10 +241,9 @@ for (BUDataStructures::ActualCalleesTy::const_iterator I = IP.first; I != IP.second; ++I) { DSGraph& CalleeGraph = getDSGraph(*I->second); - assert(&CalleeGraph != &Graph && "TD need not inline graph into self!"); - - CallSites.insert(std::make_pair(&CalleeGraph, - std::make_pair(I->second, &*CI))); + if (&CalleeGraph != &Graph) + CallSites.insert(std::make_pair(&CalleeGraph, + std::make_pair(I->second, &*CI))); } } From alkis at cs.uiuc.edu Fri Feb 4 13:53:02 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 4 Feb 2005 13:53:02 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp BasicBlockBuilder.h Message-ID: <200502041953.NAA10276@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.215 -> 1.216 BasicBlockBuilder.h updated: 1.4 -> 1.5 --- Log message: Pass the return address to the do_jsr call when parsing the bytecode. Modify the basic block builder to build basic blocks for jsr/rets as well. On a jsr push a dummy value on the operand stack so that we have a valid operand stack. --- Diffs of the changes: (+11 -7) BasicBlockBuilder.h | 5 +++++ Compiler.cpp | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.215 llvm-java/lib/Compiler/Compiler.cpp:1.216 --- llvm-java/lib/Compiler/Compiler.cpp:1.215 Fri Feb 4 00:36:22 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Fri Feb 4 13:52:50 2005 @@ -1938,14 +1938,13 @@ new ReturnInst(NULL, currentBB_); } - void do_jsr(unsigned target) { - // assert(0 && "not implemented"); - std::cerr << "WARNING: jsr is not implemented and ignored!\n"; + void do_jsr(unsigned target, unsigned retAddress) { + // FIXME: this is currently a noop. + push(llvm::Constant::getNullValue(Type::IntTy)); } void do_ret(unsigned index) { - // assert(0 && "not implemented"); - std::cerr << "WARNING: ret is not implemented and ignored!\n"; + // FIXME: this is currently a noop. } void do_switch(unsigned defTarget, const SwitchCases& sw) { @@ -2357,12 +2356,12 @@ } void do_monitorenter() { - // FIXME: This is currently a noop + // FIXME: This is currently a noop. pop(ObjectBaseRefTy); } void do_monitorexit() { - // FIXME: This is currently a noop + // FIXME: This is currently a noop. pop(ObjectBaseRefTy); } Index: llvm-java/lib/Compiler/BasicBlockBuilder.h diff -u llvm-java/lib/Compiler/BasicBlockBuilder.h:1.4 llvm-java/lib/Compiler/BasicBlockBuilder.h:1.5 --- llvm-java/lib/Compiler/BasicBlockBuilder.h:1.4 Thu Feb 3 16:37:32 2005 +++ llvm-java/lib/Compiler/BasicBlockBuilder.h Fri Feb 4 13:52:50 2005 @@ -156,6 +156,11 @@ getOrCreateBasicBlockAt(f); } + void do_jsr(unsigned t, unsigned r) { + getOrCreateBasicBlockAt(t); + getOrCreateBasicBlockAt(r); + } + void do_switch(unsigned defTarget, const SwitchCases& sw) { for (unsigned i = 0, e = sw.size(); i != e; ++i) { unsigned target = sw[i].second; From alkis at cs.uiuc.edu Fri Feb 4 13:53:02 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 4 Feb 2005 13:53:02 -0600 Subject: [llvm-commits] CVS: llvm-java/include/llvm/Java/BytecodeParser.h Message-ID: <200502041953.NAA10278@zion.cs.uiuc.edu> Changes in directory llvm-java/include/llvm/Java: BytecodeParser.h updated: 1.14 -> 1.15 --- Log message: Pass the return address to the do_jsr call when parsing the bytecode. Modify the basic block builder to build basic blocks for jsr/rets as well. On a jsr push a dummy value on the operand stack so that we have a valid operand stack. --- Diffs of the changes: (+9 -5) BytecodeParser.h | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) Index: llvm-java/include/llvm/Java/BytecodeParser.h diff -u llvm-java/include/llvm/Java/BytecodeParser.h:1.14 llvm-java/include/llvm/Java/BytecodeParser.h:1.15 --- llvm-java/include/llvm/Java/BytecodeParser.h:1.14 Fri Dec 3 19:44:05 2004 +++ llvm-java/include/llvm/Java/BytecodeParser.h Fri Feb 4 13:52:50 2005 @@ -500,9 +500,11 @@ case GOTO: THIS->do_goto(curBC + readSShort(code, i)); break; - case JSR: - THIS->do_jsr(curBC + readSShort(code, i)); + case JSR: { + unsigned t = curBC + readSShort(code, i); + THIS->do_jsr(t, i + 1); break; + } case RET: THIS->do_ret(readUByte(code, i)); break; @@ -630,9 +632,11 @@ case GOTO_W: THIS->do_goto(curBC + readSInt(code, i)); break; - case JSR_W: - THIS->do_jsr(curBC + readSInt(code, i)); + case JSR_W: { + unsigned t = curBC + readSInt(code, i); + THIS->do_jsr(t, i + 1); break; + } case BREAKPOINT: case IMPDEP1: case IMPDEP2: @@ -878,7 +882,7 @@ /// @brief called on GOTO and GOTO_W void do_goto(unsigned target) { } /// @brief called on JSR and JSR_W - void do_jsr(unsigned target) { } + void do_jsr(unsigned target, unsigned retAddress) { } /// @brief called on RET void do_ret(unsigned index) { } /// @brief called on TABLESWITCH and LOOKUPSWITCH From lattner at cs.uiuc.edu Fri Feb 4 13:58:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 13:58:12 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DataStructure.h Message-ID: <200502041958.j14JwCoR008915@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DataStructure.h updated: 1.83 -> 1.84 --- Log message: add new member --- Diffs of the changes: (+5 -0) DataStructure.h | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/include/llvm/Analysis/DataStructure/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.83 llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.84 --- llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.83 Tue Feb 1 15:37:06 2005 +++ llvm/include/llvm/Analysis/DataStructure/DataStructure.h Fri Feb 4 13:57:57 2005 @@ -25,6 +25,7 @@ class Instruction; class DSGraph; class DSNode; +class DSNodeHandle; // FIXME: move this stuff to a private header namespace DataStructureAnalysis { @@ -93,6 +94,10 @@ hash_map DSInfo; DSGraph *GlobalsGraph; hash_multimap ActualCallees; + + // This map is only maintained during construction of BU Graphs + std::map, + std::pair > > IndCallGraphMap; public: ~BUDataStructures() { releaseMemory(); } From lattner at cs.uiuc.edu Fri Feb 4 13:58:19 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 13:58:19 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200502041958.j14JwJKY008926@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.86 -> 1.87 --- Log message: Add some new members --- Diffs of the changes: (+16 -5) DSGraph.h | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.86 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.87 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.86 Thu Feb 3 12:40:05 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Fri Feb 4 13:58:06 2005 @@ -286,6 +286,12 @@ return I->second; } + /// containsFunction - Return true if this DSGraph contains information for + /// the specified function. + bool containsFunction(Function *F) const { + return ReturnNodes.count(F); + } + /// getGraphSize - Return the number of nodes in this graph. /// unsigned getGraphSize() const { @@ -383,12 +389,17 @@ void getFunctionArgumentsForCall(Function *F, std::vector &Args) const; + /// mergeInGraph - This graph merges in the minimal number of + /// nodes from G2 into 'this' graph, merging the bindings specified by the + /// call site (in this graph) with the bindings specified by the vector in G2. + /// If the StripAlloca's argument is 'StripAllocaBit' then Alloca markers are + /// removed from nodes. + /// + void mergeInGraph(const DSCallSite &CS, std::vector &Args, + const DSGraph &G2, unsigned CloneFlags); - /// mergeInGraph - The method is used for merging graphs together. If the - /// argument graph is not *this, it makes a clone of the specified graph, then - /// merges the nodes specified in the call site with the formal arguments in - /// the graph. If the StripAlloca's argument is 'StripAllocaBit' then Alloca - /// markers are removed from nodes. + /// mergeInGraph - This method is the same as the above method, but the + /// argument bindings are provided by using the formal arguments of F. /// void mergeInGraph(const DSCallSite &CS, Function &F, const DSGraph &Graph, unsigned CloneFlags); From lattner at cs.uiuc.edu Fri Feb 4 13:58:41 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 13:58:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200502041958.j14JwfB4008940@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.189 -> 1.190 --- Log message: Split mergeInGraph into two methods. --- Diffs of the changes: (+28 -29) DataStructure.cpp | 57 ++++++++++++++++++++++++++---------------------------- 1 files changed, 28 insertions(+), 29 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.189 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.190 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.189 Thu Feb 3 12:40:25 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Fri Feb 4 13:58:28 2005 @@ -1257,19 +1257,16 @@ } } -/// mergeInGraph - The method is used for merging graphs together. If the -/// argument graph is not *this, it makes a clone of the specified graph, then -/// merges the nodes specified in the call site with the formal arguments in the -/// graph. +/// mergeInCallFromOtherGraph - This graph merges in the minimal number of +/// nodes from G2 into 'this' graph, merging the bindings specified by the +/// call site (in this graph) with the bindings specified by the vector in G2. +/// The two DSGraphs must be different. /// -void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F, +void DSGraph::mergeInGraph(const DSCallSite &CS, + std::vector &Args, const DSGraph &Graph, unsigned CloneFlags) { TIME_REGION(X, "mergeInGraph"); - // Fastpath for a noop inline. - if (CS.getNumPtrArgs() == 0 && CS.getRetVal().isNull()) - return; - // If this is not a recursive call, clone the graph into this graph... if (&Graph != this) { // Clone the callee's graph into the current graph, keeping track of where @@ -1277,23 +1274,14 @@ // nodes of the old graph. ReachabilityCloner RC(*this, Graph, CloneFlags); - // Set up argument bindings. - std::vector Args; - Graph.getFunctionArgumentsForCall(&F, Args); - // Map the return node pointer over. if (!CS.getRetVal().isNull()) RC.merge(CS.getRetVal(), Args[0]); // Map over all of the arguments. for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) { - if (i == Args.size()-1) { -#ifndef NDEBUG // FIXME: We should merge vararg arguments! - if (!F.getFunctionType()->isVarArg()) - std::cerr << "Bad call to Function: " << F.getName() << "\n"; -#endif + if (i == Args.size()-1) break; - } // Add the link from the argument scalar to the provided value. RC.merge(CS.getPtrArg(i), Args[i+1]); @@ -1357,22 +1345,13 @@ } } else { - // Set up argument bindings. - std::vector Args; - Graph.getFunctionArgumentsForCall(&F, Args); - // Merge the return value with the return value of the context. Args[0].mergeWith(CS.getRetVal()); // Resolve all of the function arguments. for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i) { - if (i == Args.size()-1) { -#ifndef NDEBUG // FIXME: We should merge varargs arguments!! - if (!F.getFunctionType()->isVarArg()) - std::cerr << "Bad call to Function: " << F.getName() << "\n"; -#endif + if (i == Args.size()-1) break; - } // Add the link from the argument scalar to the provided value. Args[i+1].mergeWith(CS.getPtrArg(i)); @@ -1380,6 +1359,26 @@ } } + + +/// mergeInGraph - The method is used for merging graphs together. If the +/// argument graph is not *this, it makes a clone of the specified graph, then +/// merges the nodes specified in the call site with the formal arguments in the +/// graph. +/// +void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F, + const DSGraph &Graph, unsigned CloneFlags) { + // Fastpath for a noop inline. + if (CS.getNumPtrArgs() == 0 && CS.getRetVal().isNull()) + return; + + // Set up argument bindings. + std::vector Args; + Graph.getFunctionArgumentsForCall(&F, Args); + + mergeInGraph(CS, Args, Graph, CloneFlags); +} + /// getCallSiteForArguments - Get the arguments and return value bindings for /// the specified function in the current graph. /// From lattner at cs.uiuc.edu Fri Feb 4 14:00:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 14:00:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200502042000.j14K02jY008964@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.91 -> 1.92 --- Log message: If we have an indirect call site that calls N functions, inline the N functions into a temporary graph, remember it for later, then inline the tmp graph into the call site. In the case where there are other call sites to the same set of functions, this permits us to just inline the temporary graph instead of all of the callees. This turns N*M inlining situations into an N+M inlining situation. --- Diffs of the changes: (+98 -57) BottomUpClosure.cpp | 155 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 98 insertions(+), 57 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.91 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.92 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.91 Tue Feb 1 15:55:40 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Fri Feb 4 13:59:49 2005 @@ -61,6 +61,15 @@ NumCallEdges += ActualCallees.size(); + // If we computed any temporary indcallgraphs, free them now. + for (std::map, + std::pair > >::iterator I = + IndCallGraphMap.begin(), E = IndCallGraphMap.end(); I != E; ++I) { + I->second.second.clear(); // Drop arg refs into the graph. + delete I->second.first; + } + IndCallGraphMap.clear(); + // At the end of the bottom-up pass, the globals graph becomes complete. // FIXME: This is not the right way to do this, but it is sorta better than // nothing! In particular, externally visible globals and unresolvable call @@ -265,10 +274,11 @@ DSGraph::ReturnNodesTy &ReturnNodes = Graph.getReturnNodes(); bool Printed = false; + std::vector CalledFuncs; while (!TempFCs.empty()) { DSCallSite &CS = *TempFCs.begin(); - std::set CalledFuncs; + CalledFuncs.clear(); if (CS.isDirectCall()) { Function *F = CS.getCalleeFunc(); @@ -277,7 +287,7 @@ TempFCs.erase(TempFCs.begin()); continue; } else { - CalledFuncs.insert(F); + CalledFuncs.push_back(F); } } else { DSNode *Node = CS.getCalleeNode(); @@ -286,76 +296,107 @@ for (unsigned i = 0, e = Node->getGlobals().size(); i != e; ++i) if (Function *CF = dyn_cast(Node->getGlobals()[i])) if (isResolvableFunc(CF) && !CF->isExternal()) - CalledFuncs.insert(CF); + CalledFuncs.push_back(CF); } if (CalledFuncs.empty()) { // Remember that we could not resolve this yet! AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); continue; - } else if (CalledFuncs.size() == 1) { - Function *Callee = *CalledFuncs.begin(); - - ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), - Callee)); - - // Get the data structure graph for the called function. - // - DSGraph &GI = getDSGraph(*Callee); // Graph to inline - - DEBUG(std::cerr << " Inlining graph for " << Callee->getName() - << "[" << GI.getGraphSize() << "+" - << GI.getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" - << Graph.getAuxFunctionCalls().size() << "]\n"); - Graph.mergeInGraph(CS, *Callee, GI, - DSGraph::KeepModRefBits | - DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); - ++NumBUInlines; - -#if 0 - Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + - Callee->getName()); -#endif } else { - if (!Printed) - std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; - std::cerr << " calls " << CalledFuncs.size() - << " fns from site: " << CS.getCallSite().getInstruction() - << " " << *CS.getCallSite().getInstruction(); - unsigned NumToPrint = CalledFuncs.size(); - if (NumToPrint > 8) NumToPrint = 8; - std::cerr << " Fns ="; - for (std::set::iterator I = CalledFuncs.begin(), - E = CalledFuncs.end(); I != E && NumToPrint; ++I, --NumToPrint) - std::cerr << " " << (*I)->getName(); - std::cerr << "\n"; - - // Inline all of the called functions. - for (std::set::iterator I = CalledFuncs.begin(), - E = CalledFuncs.end(); I != E; ++I) { - Function *Callee = *I; + DSGraph *GI; + + if (CalledFuncs.size() == 1) { + Function *Callee = CalledFuncs[0]; ActualCallees.insert(std::make_pair(CS.getCallSite().getInstruction(), Callee)); - + // Get the data structure graph for the called function. - // - DSGraph &GI = getDSGraph(*Callee); // Graph to inline - - DEBUG(std::cerr << " Inlining graph for " << Callee->getName() - << "[" << GI.getGraphSize() << "+" - << GI.getAuxFunctionCalls().size() << "] into '" + GI = &getDSGraph(*Callee); // Graph to inline + DEBUG(std::cerr << " Inlining graph for " << Callee->getName()); + + DEBUG(std::cerr << "[" << GI->getGraphSize() << "+" + << GI->getAuxFunctionCalls().size() << "] into '" << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" << Graph.getAuxFunctionCalls().size() << "]\n"); - Graph.mergeInGraph(CS, *Callee, GI, + Graph.mergeInGraph(CS, *Callee, *GI, DSGraph::KeepModRefBits | DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); ++NumBUInlines; - -#if 0 - Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" + - Callee->getName()); -#endif + } else { + if (!Printed) + std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; + std::cerr << " calls " << CalledFuncs.size() + << " fns from site: " << CS.getCallSite().getInstruction() + << " " << *CS.getCallSite().getInstruction(); + unsigned NumToPrint = CalledFuncs.size(); + if (NumToPrint > 8) NumToPrint = 8; + std::cerr << " Fns ="; + for (std::vector::iterator I = CalledFuncs.begin(), + E = CalledFuncs.end(); I != E && NumToPrint; ++I, --NumToPrint) + std::cerr << " " << (*I)->getName(); + std::cerr << "\n"; + + // See if we already computed a graph for this set of callees. + std::sort(CalledFuncs.begin(), CalledFuncs.end()); + std::pair > &IndCallGraph = + IndCallGraphMap[CalledFuncs]; + + if (IndCallGraph.first == 0) { + std::vector::iterator I = CalledFuncs.begin(), + E = CalledFuncs.end(); + + // Start with a copy of the first graph. + GI = IndCallGraph.first = new DSGraph(getDSGraph(**I)); + GI->setGlobalsGraph(Graph.getGlobalsGraph()); + std::vector &Args = IndCallGraph.second; + + // Get the argument nodes for the first callee. The return value is + // the 0th index in the vector. + GI->getFunctionArgumentsForCall(*I, Args); + + // Merge all of the other callees into this graph. + for (++I; I != E; ++I) { + // If the graph already contains the nodes for the function, don't + // bother merging it in again. + if (!GI->containsFunction(*I)) { + DSGraph::NodeMapTy NodeMap; + GI->cloneInto(getDSGraph(**I), GI->getScalarMap(), + GI->getReturnNodes(), NodeMap); + ++NumBUInlines; + } + + std::vector NextArgs; + GI->getFunctionArgumentsForCall(*I, NextArgs); + unsigned i = 0, e = Args.size(); + for (; i != e; ++i) { + if (i == NextArgs.size()) break; + Args[i].mergeWith(NextArgs[i]); + } + for (e = NextArgs.size(); i != e; ++i) + Args.push_back(NextArgs[i]); + } + + // Clean up the final graph! + GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals); + } else { + std::cerr << "***\n*** RECYCLED GRAPH ***\n***\n"; + } + + GI = IndCallGraph.first; + + // Merge the unified graph into this graph now. + DEBUG(std::cerr << " Inlining multi callee graph " + << "[" << GI->getGraphSize() << "+" + << GI->getAuxFunctionCalls().size() << "] into '" + << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" + << Graph.getAuxFunctionCalls().size() << "]\n"); + + Graph.mergeInGraph(CS, IndCallGraph.second, *GI, + DSGraph::KeepModRefBits | + DSGraph::StripAllocaBit | + DSGraph::DontCloneCallNodes); + ++NumBUInlines; } } TempFCs.erase(TempFCs.begin()); From lattner at cs.uiuc.edu Fri Feb 4 14:21:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 14:21:12 -0600 Subject: [llvm-commits] CVS: poolalloc/Makefile.common.in Message-ID: <200502042021.j14KLCYa014093@apoc.cs.uiuc.edu> Changes in directory poolalloc: Makefile.common.in updated: 1.8 -> 1.9 --- Log message: More changes for the modified project system --- Diffs of the changes: (+5 -4) Index: poolalloc/Makefile.common.in diff -u poolalloc/Makefile.common.in:1.8 poolalloc/Makefile.common.in:1.9 --- poolalloc/Makefile.common.in:1.8 Thu Jan 20 13:20:52 2005 +++ poolalloc/Makefile.common.in Fri Feb 4 14:21:02 2005 @@ -8,14 +8,15 @@ # (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config). LLVM_OBJ_ROOT = @LLVM_OBJ@ -# Include LLVM's Master Makefile. -#include $(LLVM_OBJ_ROOT)/Makefile.config - # Set the source root and source directory pathnames -PROJ_SRC_DIR := $(subst //,/, at abs_top_srcdir@/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))) +####PROJ_SRC_DIR := $(subst //,/, at abs_top_srcdir@/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))) PROJ_SRC_ROOT := $(subst //,/, at abs_top_srcdir@) +# Set the root directory of this project's object files +PROJ_OBJ_ROOT := $(subst //,/, at abs_top_objdir@) + +# Set the root directory of this project's install prefix PROJ_INSTALL_ROOT := @prefix@ # Include LLVM's Master Makefile. From lattner at cs.uiuc.edu Fri Feb 4 14:21:37 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 14:21:37 -0600 Subject: [llvm-commits] CVS: poolalloc/test/Makefile TEST.poolalloc.Makefile Message-ID: <200502042021.j14KLbdP014125@apoc.cs.uiuc.edu> Changes in directory poolalloc/test: Makefile updated: 1.27 -> 1.28 TEST.poolalloc.Makefile updated: 1.35 -> 1.36 --- Log message: More changes to work with the modified project system (thanks to Misha for the help!) --- Diffs of the changes: (+24 -24) Index: poolalloc/test/Makefile diff -u poolalloc/test/Makefile:1.27 poolalloc/test/Makefile:1.28 --- poolalloc/test/Makefile:1.27 Thu Nov 11 04:13:00 2004 +++ poolalloc/test/Makefile Fri Feb 4 14:21:27 2005 @@ -44,22 +44,22 @@ progtest:: for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ LARGE_PROBLEM_SIZE=1 report.html) \ done for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ report.html) \ done @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -s -j1 TEST=poolalloc \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=poolalloc \ LARGE_PROBLEM_SIZE=1 report) \ done @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -s -j1 TEST=poolalloc \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=poolalloc \ report) \ done @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" @@ -67,22 +67,22 @@ progperf:: for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ LARGE_PROBLEM_SIZE=1 report.html report.csv) \ done for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ report.html report.csv) \ done @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -s -j1 TEST=perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=perf \ LARGE_PROBLEM_SIZE=1 report report.csv) \ done @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -s -j1 TEST=perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=perf \ report report.csv) \ done @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" @@ -90,22 +90,22 @@ progp4perf:: for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ LARGE_PROBLEM_SIZE=1 report.html report.csv) \ done for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ report.html report.csv) \ done @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -s -j1 TEST=p4perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=p4perf \ LARGE_PROBLEM_SIZE=1 report report.csv) \ done @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -s -j1 TEST=p4perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=p4perf \ report report.csv) \ done @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" @@ -113,22 +113,22 @@ progcputrack:: for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ LARGE_PROBLEM_SIZE=1 report.html report.csv) \ done for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ report.html report.csv) \ done @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -s -j1 TEST=cputrack \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=cputrack \ LARGE_PROBLEM_SIZE=1 report report.csv) \ done @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ (cd $$dir; \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -s -j1 TEST=cputrack \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=cputrack \ report report.csv) \ done @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" @@ -142,43 +142,43 @@ # tests... test:: (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=poolalloc \ GET_STABLE_NUMBERS=1 report report.html) @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" vtl:: (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=pavtl \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=pavtl \ test report report.csv) @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" perf:: (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=perf \ test report report.csv) @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" optzn:: (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=optzn \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=optzn \ GET_STABLE_NUMBERS=1 test report report.csv) @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" p4perf:: (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=p4perf \ test report report.csv) @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" strace:: (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=strace \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=strace \ test) @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" cputrack:: (cd $(LLVM_OBJ_ROOT)/projects/llvm-test/$(SUBDIR); \ - PROJECT_DIR=$(BUILD_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=cputrack \ report report.csv) @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" Index: poolalloc/test/TEST.poolalloc.Makefile diff -u poolalloc/test/TEST.poolalloc.Makefile:1.35 poolalloc/test/TEST.poolalloc.Makefile:1.36 --- poolalloc/test/TEST.poolalloc.Makefile:1.35 Tue Dec 14 14:15:36 2004 +++ poolalloc/test/TEST.poolalloc.Makefile Fri Feb 4 14:21:27 2005 @@ -26,7 +26,7 @@ # Pool allocator runtime library #PA_RT := $(PROJECT_DIR)/lib/Bytecode/libpoolalloc_fl_rt.bc #PA_RT_O := $(PROJECT_DIR)/lib/$(CONFIGURATION)/poolalloc_rt.o -PA_RT_O := $(PROJECT_DIR)/lib/Release/poolalloc_rt.o +PA_RT_O := $(PROJECT_DIR)/Release/lib/poolalloc_rt.o #PA_RT_O := $(PROJECT_DIR)/lib/Release/poolalloc_fl_rt.o # Command to run opt with the pool allocator pass loaded From brukman at cs.uiuc.edu Fri Feb 4 14:26:03 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 4 Feb 2005 14:26:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.h AlphaInstrInfo.td AlphaRegisterInfo.h AlphaRegisterInfo.td AlphaTargetMachine.h Message-ID: <200502042026.OAA14432@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.h updated: 1.1 -> 1.2 AlphaInstrInfo.td updated: 1.16 -> 1.17 AlphaRegisterInfo.h updated: 1.1 -> 1.2 AlphaRegisterInfo.td updated: 1.5 -> 1.6 AlphaTargetMachine.h updated: 1.4 -> 1.5 --- Log message: Make file header comment consistent: extend the whole 80 cols to fill the line --- Diffs of the changes: (+5 -5) AlphaInstrInfo.h | 2 +- AlphaInstrInfo.td | 2 +- AlphaRegisterInfo.h | 2 +- AlphaRegisterInfo.td | 2 +- AlphaTargetMachine.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.h diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.1 llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.2 --- llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.1 Sat Jan 22 17:41:55 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.h Fri Feb 4 14:25:52 2005 @@ -1,4 +1,4 @@ -//===- AlphaInstrInfo.h - Alpha Instruction Information -----*- C++ -*-===// +//===- AlphaInstrInfo.h - Alpha Instruction Information ---------*- C++ -*-===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.16 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.17 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.16 Wed Feb 2 11:32:39 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Fri Feb 4 14:25:52 2005 @@ -1,4 +1,4 @@ -//===- AlphaInstrInfo.td - The Alpha Instruction Set -----*- tablegen -*-=// +//===- AlphaInstrInfo.td - The Alpha Instruction Set -------*- tablegen -*-===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.h diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.1 llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.2 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.1 Sat Jan 22 17:41:55 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.h Fri Feb 4 14:25:52 2005 @@ -1,4 +1,4 @@ -//===- AlphaRegisterInfo.h - Alpha Register Information Impl -*- C++ -*-==// +//===- AlphaRegisterInfo.h - Alpha Register Information Impl -----*- C++ -*-==// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.td diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.5 llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.6 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.5 Wed Feb 2 11:01:31 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.td Fri Feb 4 14:25:52 2005 @@ -1,4 +1,4 @@ -//===- AlphaRegisterInfo.td - The Alpha Register File --*- tablegen -*-===// +//===- AlphaRegisterInfo.td - The Alpha Register File ------*- tablegen -*-===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaTargetMachine.h diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.4 llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.5 --- llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.4 Tue Feb 1 14:35:11 2005 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.h Fri Feb 4 14:25:52 2005 @@ -1,4 +1,4 @@ -//===-- AlphaTargetMachine.h - Define TargetMachine for Alpha -*- C++ -*-----=// +//===-- AlphaTargetMachine.h - Define TargetMachine for Alpha ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // From alkis at cs.uiuc.edu Fri Feb 4 14:57:02 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Fri, 4 Feb 2005 14:57:02 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200502042057.OAA15026@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.216 -> 1.217 --- Log message: Add class used in Collections.shuffle. --- Diffs of the changes: (+1 -0) Compiler.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.216 llvm-java/lib/Compiler/Compiler.cpp:1.217 --- llvm-java/lib/Compiler/Compiler.cpp:1.216 Fri Feb 4 13:52:50 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Fri Feb 4 14:56:51 2005 @@ -1335,6 +1335,7 @@ classMethodDesc.find("java/lang/Throwable$StaticData/ Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: Collections5.java added (r1.1) --- Log message: Add another test case --- Diffs of the changes: (+16 -0) Collections5.java | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) Index: llvm-java/test/Programs/SingleSource/UnitTests/Collections5.java diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/Collections5.java:1.1 *** /dev/null Fri Feb 4 15:22:11 2005 --- llvm-java/test/Programs/SingleSource/UnitTests/Collections5.java Fri Feb 4 15:22:01 2005 *************** *** 0 **** --- 1,16 ---- + import java.util.*; + + public class Collections5 + { + public static void main(String[] args) { + List l1 = new ArrayList(); + Collections.addRandomIntsToCollection(l1); + Collections.printIntCollection(l1); + java.util.Collections.rotate(l1, Collections.rand.nextInt(50000)); + Collections.printIntCollection(l1); + java.util.Collections.shuffle(l1, Collections.rand); + Collections.printIntCollection(l1); + java.util.Collections.sort(l1); + Collections.printIntCollection(l1); + } + } From lattner at cs.uiuc.edu Fri Feb 4 15:29:05 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 15:29:05 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200502042129.j14LT55k014510@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.293 -> 1.294 --- Log message: Add support for .cc and .hpp files. Patch contributed by Vladimir Merzliakov! --- Diffs of the changes: (+33 -2) Makefile.rules | 35 +++++++++++++++++++++++++++++++++-- 1 files changed, 33 insertions(+), 2 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.293 llvm/Makefile.rules:1.294 --- llvm/Makefile.rules:1.293 Tue Feb 1 18:40:15 2005 +++ llvm/Makefile.rules Fri Feb 4 15:28:50 2005 @@ -41,7 +41,7 @@ # Reset the list of suffixes we know how to build #-------------------------------------------------------------------- .SUFFIXES: -.SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a .bc .td .ps .dot +.SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot .SUFFIXES: $(SHLIBEXT) $(SUFFIXES) #-------------------------------------------------------------------- @@ -910,6 +910,12 @@ then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \ else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi +$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) + $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)" + $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \ + then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \ + else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi + $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)" $(Verb) if $(LTCompile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \ @@ -927,6 +933,12 @@ then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \ else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi +$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) + $(Echo) "Compiling $*.cc for $(BuildMode) build" + $(Verb) if $(Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.CXXd $< -o $@ ; \ + then $(MV) -f "$(ObjDir)/$*.CXXd" "$(ObjDir)/$*.d"; \ + else $(RM) -f "$(ObjDir)/$*.CXXd"; exit 1; fi + $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build" $(Verb) if $(Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.Cd $< -o $@ ; \ @@ -936,7 +948,7 @@ endif #--------------------------------------------------------- -# Create .bc files in the ObjDir directory from .cpp and .c files... +# Create .bc files in the ObjDir directory from .cpp .cc and .c files... #--------------------------------------------------------- $(ObjDir)/%.bc: %.cpp $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" @@ -944,6 +956,12 @@ then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \ else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi +$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) + $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)" + $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ ; \ + then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \ + else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi + $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)" $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ ; \ @@ -959,6 +977,10 @@ $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)" $(LTCompile.CXX) $< -o $@ +$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) + $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)" + $(LTCompile.CXX) $< -o $@ + $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build (PIC)" $(LTCompile.C) $< -o $@ @@ -969,6 +991,10 @@ $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(Compile.CXX) $< -o $@ +$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) + $(Echo) "Compiling $*.cc for $(BuildMode) build" + $(Compile.CXX) $< -o $@ + $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build" $(Compile.C) $< -o $@ @@ -978,6 +1004,10 @@ $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" $(BCCompile.CXX) $< -o $@ +$(ObjDir)/%.bc: %.cc $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) + $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)" + $(BCCompile.CXX) $< -o $@ + $(ObjDir)/%.bc: %.c $(ObjDir)/.dir $(GCCAS) $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)" $(BCCompile.C) $< -o $@ @@ -1142,6 +1172,7 @@ # which they can be "generated." This allows make to ignore them and # reproduce the dependency lists. %.h:: ; +%.hpp:: ; # Define clean-local to clean the current directory. Note that this uses a # very conservative approach ensuring that empty variables do not cause From lattner at cs.uiuc.edu Fri Feb 4 19:37:59 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 19:37:59 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Value.h Message-ID: <200502050137.j151bxnr017893@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Value.h updated: 1.69 -> 1.70 --- Log message: SubclassID is really a small field. Split it into half and let subclasses play with the unused part. --- Diffs of the changes: (+7 -1) Value.h | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Value.h diff -u llvm/include/llvm/Value.h:1.69 llvm/include/llvm/Value.h:1.70 --- llvm/include/llvm/Value.h:1.69 Mon Jan 31 19:21:51 2005 +++ llvm/include/llvm/Value.h Fri Feb 4 19:37:44 2005 @@ -41,7 +41,13 @@ /// as operands to other values. /// class Value { - unsigned SubclassID; // Subclass identifier (for isa/dyn_cast) + unsigned short SubclassID; // Subclass identifier (for isa/dyn_cast) +protected: + /// SubclassData - This member is defined by this class, but is not used for + /// anything. Subclasses can use it to hold whatever state they find useful. + /// This field is initialized to zero by the ctor. + unsigned short SubclassData; +private: PATypeHolder Ty; Use *UseList; std::string Name; From lattner at cs.uiuc.edu Fri Feb 4 19:38:11 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 19:38:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Value.cpp Message-ID: <200502050138.j151cBtF018016@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Value.cpp updated: 1.52 -> 1.53 --- Log message: Initialize new field. --- Diffs of the changes: (+2 -1) Value.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Value.cpp diff -u llvm/lib/VMCore/Value.cpp:1.52 llvm/lib/VMCore/Value.cpp:1.53 --- llvm/lib/VMCore/Value.cpp:1.52 Mon Jan 31 19:24:21 2005 +++ llvm/lib/VMCore/Value.cpp Fri Feb 4 19:37:58 2005 @@ -31,7 +31,8 @@ } Value::Value(const Type *ty, unsigned scid, const std::string &name) - : SubclassID(scid), Ty(checkType(ty)), UseList(0), Name(name) { + : SubclassID(scid), SubclassData(0), Ty(checkType(ty)), + UseList(0), Name(name) { if (!isa(this) && !isa(this)) assert((Ty->isFirstClassType() || Ty == Type::VoidTy || isa(ty)) && From lattner at cs.uiuc.edu Fri Feb 4 19:38:52 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 19:38:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp Message-ID: <200502050138.j151cquI018555@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Instructions.cpp updated: 1.10 -> 1.11 --- Log message: Instead of initializing the volatile field, use accessors to set it. --- Diffs of the changes: (+16 -11) Instructions.cpp | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.10 llvm/lib/VMCore/Instructions.cpp:1.11 --- llvm/lib/VMCore/Instructions.cpp:1.10 Fri Jan 28 19:05:12 2005 +++ llvm/lib/VMCore/Instructions.cpp Fri Feb 4 19:38:38 2005 @@ -498,27 +498,31 @@ LoadInst::LoadInst(Value *Ptr, const std::string &Name, Instruction *InsertBef) : UnaryInstruction(cast(Ptr->getType())->getElementType(), - Load, Ptr, Name, InsertBef), Volatile(false) { + Load, Ptr, Name, InsertBef) { + setVolatile(false); AssertOK(); } LoadInst::LoadInst(Value *Ptr, const std::string &Name, BasicBlock *InsertAE) : UnaryInstruction(cast(Ptr->getType())->getElementType(), - Load, Ptr, Name, InsertAE), Volatile(false) { + Load, Ptr, Name, InsertAE) { + setVolatile(false); AssertOK(); } LoadInst::LoadInst(Value *Ptr, const std::string &Name, bool isVolatile, Instruction *InsertBef) : UnaryInstruction(cast(Ptr->getType())->getElementType(), - Load, Ptr, Name, InsertBef), Volatile(isVolatile) { + Load, Ptr, Name, InsertBef) { + setVolatile(isVolatile); AssertOK(); } LoadInst::LoadInst(Value *Ptr, const std::string &Name, bool isVolatile, BasicBlock *InsertAE) : UnaryInstruction(cast(Ptr->getType())->getElementType(), - Load, Ptr, Name, InsertAE), Volatile(isVolatile) { + Load, Ptr, Name, InsertAE) { + setVolatile(isVolatile); AssertOK(); } @@ -537,35 +541,36 @@ StoreInst::StoreInst(Value *val, Value *addr, Instruction *InsertBefore) - : Instruction(Type::VoidTy, Store, Ops, 2, "", InsertBefore), - Volatile(false) { + : Instruction(Type::VoidTy, Store, Ops, 2, "", InsertBefore) { Ops[0].init(val, this); Ops[1].init(addr, this); + setVolatile(false); AssertOK(); } StoreInst::StoreInst(Value *val, Value *addr, BasicBlock *InsertAtEnd) - : Instruction(Type::VoidTy, Store, Ops, 2, "", InsertAtEnd), Volatile(false) { + : Instruction(Type::VoidTy, Store, Ops, 2, "", InsertAtEnd) { Ops[0].init(val, this); Ops[1].init(addr, this); + setVolatile(false); AssertOK(); } StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Instruction *InsertBefore) - : Instruction(Type::VoidTy, Store, Ops, 2, "", InsertBefore), - Volatile(isVolatile) { + : Instruction(Type::VoidTy, Store, Ops, 2, "", InsertBefore) { Ops[0].init(val, this); Ops[1].init(addr, this); + setVolatile(isVolatile); AssertOK(); } StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, BasicBlock *InsertAtEnd) - : Instruction(Type::VoidTy, Store, Ops, 2, "", InsertAtEnd), - Volatile(isVolatile) { + : Instruction(Type::VoidTy, Store, Ops, 2, "", InsertAtEnd) { Ops[0].init(val, this); Ops[1].init(addr, this); + setVolatile(isVolatile); AssertOK(); } From lattner at cs.uiuc.edu Fri Feb 4 19:44:30 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 19:44:30 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Instructions.h Message-ID: <200502050144.j151iUhR020763@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instructions.h updated: 1.12 -> 1.13 --- Log message: Eliminate the explicit volatile fields in LoadInst and StoreInst. This shrinks LoadInst from 60 -> 56 bytes and StoreInst from 76 -> 72 bytes. Note however, that this doesn't actually save any memory on common systems where 'malloc' returns 8-byte aligned memory, as the saved space is replaced by useless alignment padding. :( --- Diffs of the changes: (+11 -12) Instructions.h | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.12 llvm/include/llvm/Instructions.h:1.13 --- llvm/include/llvm/Instructions.h:1.12 Fri Jan 28 18:31:36 2005 +++ llvm/include/llvm/Instructions.h Fri Feb 4 19:44:18 2005 @@ -167,14 +167,14 @@ // LoadInst Class //===----------------------------------------------------------------------===// -/// LoadInst - an instruction for reading from memory +/// LoadInst - an instruction for reading from memory. This uses the +/// SubclassData field in Value to store whether or not the load is volatile. /// class LoadInst : public UnaryInstruction { - bool Volatile; // True if this is a volatile load - LoadInst(const LoadInst &LI) - : UnaryInstruction(LI.getType(), Load, LI.getOperand(0)), - Volatile(LI.isVolatile()) { + : UnaryInstruction(LI.getType(), Load, LI.getOperand(0)) { + setVolatile(LI.isVolatile()); + #ifndef NDEBUG AssertOK(); #endif @@ -191,11 +191,11 @@ /// isVolatile - Return true if this is a load from a volatile memory /// location. /// - bool isVolatile() const { return Volatile; } + bool isVolatile() const { return SubclassData; } /// setVolatile - Specify whether this is a volatile load or not. /// - void setVolatile(bool V) { Volatile = V; } + void setVolatile(bool V) { SubclassData = V; } virtual LoadInst *clone() const; @@ -224,11 +224,10 @@ /// class StoreInst : public Instruction { Use Ops[2]; - bool Volatile; // True if this is a volatile store - StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store, Ops, 2), - Volatile(SI.isVolatile()) { + StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store, Ops, 2) { Ops[0].init(SI.Ops[0], this); Ops[1].init(SI.Ops[1], this); + setVolatile(SI.isVolatile()); #ifndef NDEBUG AssertOK(); #endif @@ -245,11 +244,11 @@ /// isVolatile - Return true if this is a load from a volatile memory /// location. /// - bool isVolatile() const { return Volatile; } + bool isVolatile() const { return SubclassData; } /// setVolatile - Specify whether this is a volatile load or not. /// - void setVolatile(bool V) { Volatile = V; } + void setVolatile(bool V) { SubclassData = V; } /// Transparently provide more efficient getOperand methods. Value *getOperand(unsigned i) const { From lattner at cs.uiuc.edu Fri Feb 4 20:00:27 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 4 Feb 2005 20:00:27 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200502050200.j1520R9v030447@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.67 -> 1.68 --- Log message: Eliminate the explicit opcode field in ConstantExpr, using the SubclassData field to hold it instead. This shrinks memory usage for 176.gcc from 57628728 to 57598144 bytes, a small reduction of about 30K. --- Diffs of the changes: (+9 -13) Constants.h | 22 +++++++++------------- 1 files changed, 9 insertions(+), 13 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.67 llvm/include/llvm/Constants.h:1.68 --- llvm/include/llvm/Constants.h:1.67 Fri Jan 28 18:32:29 2005 +++ llvm/include/llvm/Constants.h Fri Feb 4 20:00:12 2005 @@ -510,26 +510,22 @@ /// ConstantExpr - a constant value that is initialized with an expression using -/// other constant values. This is only used to represent values that cannot be -/// evaluated at compile-time (e.g., something derived from an address) because -/// it does not have a mechanism to store the actual value. Use the appropriate -/// Constant subclass above for known constants. +/// other constant values. /// +/// This class uses the standard Instruction opcodes to define the various +/// constant expressions. The Opcode field for the ConstantExpr class is +/// maintained in the Value::SubclassData field. class ConstantExpr : public Constant { - unsigned iType; // Operation type (an Instruction opcode) friend struct ConstantCreator > >; friend struct ConvertConstantType; protected: ConstantExpr(const Type *Ty, unsigned Opcode, Use *Ops, unsigned NumOps) - : Constant(Ty, ConstantExprVal, Ops, NumOps), iType(Opcode) {} - - // Select instruction creation ctor - ConstantExpr(Constant *C, Constant *V1, Constant *V2); - // GEP instruction creation ctor - ConstantExpr(Constant *C, const std::vector &IdxList, - const Type *DestTy); + : Constant(Ty, ConstantExprVal, Ops, NumOps) { + // Operation type (an Instruction opcode) is stored as the SubclassData. + SubclassData = Opcode; + } // These private methods are used by the type resolution code to create // ConstantExprs in intermediate forms. @@ -609,7 +605,7 @@ virtual bool isNullValue() const { return false; } /// getOpcode - Return the opcode at the root of this constant expression - unsigned getOpcode() const { return iType; } + unsigned getOpcode() const { return SubclassData; } /// getOpcodeName - Return a string representation for an opcode. const char *getOpcodeName() const; From brukman at cs.uiuc.edu Fri Feb 4 20:24:38 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Fri, 4 Feb 2005 20:24:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/Alpha.h Alpha.td AlphaISelPattern.cpp AlphaInstrFormats.td AlphaInstrInfo.cpp AlphaRegisterInfo.cpp AlphaRegisterInfo.h Message-ID: <200502050224.UAA21459@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: Alpha.h updated: 1.1 -> 1.2 Alpha.td updated: 1.1 -> 1.2 AlphaISelPattern.cpp updated: 1.31 -> 1.32 AlphaInstrFormats.td updated: 1.3 -> 1.4 AlphaInstrInfo.cpp updated: 1.3 -> 1.4 AlphaRegisterInfo.cpp updated: 1.10 -> 1.11 AlphaRegisterInfo.h updated: 1.2 -> 1.3 --- Log message: Make the rest of file header comments consistent in format and style --- Diffs of the changes: (+7 -7) Alpha.h | 2 +- Alpha.td | 2 +- AlphaISelPattern.cpp | 2 +- AlphaInstrFormats.td | 2 +- AlphaInstrInfo.cpp | 2 +- AlphaRegisterInfo.cpp | 2 +- AlphaRegisterInfo.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/Target/Alpha/Alpha.h diff -u llvm/lib/Target/Alpha/Alpha.h:1.1 llvm/lib/Target/Alpha/Alpha.h:1.2 --- llvm/lib/Target/Alpha/Alpha.h:1.1 Sat Jan 22 17:41:55 2005 +++ llvm/lib/Target/Alpha/Alpha.h Fri Feb 4 20:24:26 2005 @@ -1,4 +1,4 @@ -//===-- Alpha.h - Top-level interface for Alpha representation -*- C++ -*-// +//===-- Alpha.h - Top-level interface for Alpha representation --*- C++ -*-===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/Alpha.td diff -u llvm/lib/Target/Alpha/Alpha.td:1.1 llvm/lib/Target/Alpha/Alpha.td:1.2 --- llvm/lib/Target/Alpha/Alpha.td:1.1 Sat Jan 22 17:41:55 2005 +++ llvm/lib/Target/Alpha/Alpha.td Fri Feb 4 20:24:26 2005 @@ -1,4 +1,4 @@ -//===- Alpha.td - Describe the Alpha Target Machine ----*- tablegen -*-===// +//===- Alpha.td - Describe the Alpha Target Machine --------*- tablegen -*-===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.31 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.32 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.31 Thu Feb 3 15:01:15 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Fri Feb 4 20:24:26 2005 @@ -1,4 +1,4 @@ -//===- AlphaISelPattern.cpp - A pattern matching inst selector for Alpha -===// +//===- AlphaISelPattern.cpp - A pattern matching inst selector for Alpha --===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaInstrFormats.td diff -u llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.3 llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.4 --- llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.3 Wed Jan 26 15:54:08 2005 +++ llvm/lib/Target/Alpha/AlphaInstrFormats.td Fri Feb 4 20:24:26 2005 @@ -1,4 +1,4 @@ -//===- AlphaInstrFormats.td - Alpha Instruction Formats --*- tablegen -*-=// +//===- AlphaInstrFormats.td - Alpha Instruction Formats ----*- tablegen -*-===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaInstrInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.3 llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.4 --- llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.3 Wed Jan 26 15:54:09 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.cpp Fri Feb 4 20:24:26 2005 @@ -1,4 +1,4 @@ -//===- AlphaInstrInfo.cpp - Alpha Instruction Information ---*- C++ -*-----===// +//===- AlphaInstrInfo.cpp - Alpha Instruction Information -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.10 llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.11 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.10 Tue Feb 1 14:35:57 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Fri Feb 4 20:24:26 2005 @@ -1,4 +1,4 @@ -//===- AlphaRegisterInfo.cpp - Alpha Register Information ---*- C++ -*-----===// +//===- AlphaRegisterInfo.cpp - Alpha Register Information -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.h diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.2 llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.3 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.h:1.2 Fri Feb 4 14:25:52 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.h Fri Feb 4 20:24:26 2005 @@ -1,4 +1,4 @@ -//===- AlphaRegisterInfo.h - Alpha Register Information Impl -----*- C++ -*-==// +//===- AlphaRegisterInfo.h - Alpha Register Information Impl ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // From alenhar2 at cs.uiuc.edu Sat Feb 5 07:19:28 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sat, 5 Feb 2005 07:19:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200502051319.HAA26931@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.32 -> 1.33 AlphaInstrInfo.td updated: 1.17 -> 1.18 --- Log message: added ugly support for fp compares --- Diffs of the changes: (+71 -23) AlphaISelPattern.cpp | 84 ++++++++++++++++++++++++++++++++++++++++----------- AlphaInstrInfo.td | 10 +++--- 2 files changed, 71 insertions(+), 23 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.32 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.33 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.32 Fri Feb 4 20:24:26 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sat Feb 5 07:19:12 2005 @@ -58,12 +58,14 @@ setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand); //what is the sign expansion of 1? 1 or -1? - setOperationAction(ISD::SREM, MVT::f32, Expand); - setOperationAction(ISD::SREM, MVT::f64, Expand); + setOperationAction(ISD::SREM , MVT::f32 , Expand); + setOperationAction(ISD::SREM , MVT::f64 , Expand); setOperationAction(ISD::MEMMOVE , MVT::Other, Expand); - setOperationAction(ISD::MEMSET , MVT::Other, Expand); - setOperationAction(ISD::MEMCPY , MVT::Other, Expand); + setOperationAction(ISD::MEMSET , MVT::Other, Expand); + setOperationAction(ISD::MEMCPY , MVT::Other, Expand); + + setOperationAction(ISD::SETCC , MVT::f32 , Promote); computeRegisterProperties(); @@ -312,6 +314,16 @@ Node->dump(); assert(0 && "Node not handled!\n"); + case ISD::SELECT: + { + Tmp1 = SelectExpr(N.getOperand(0)); //Cond + Tmp2 = SelectExpr(N.getOperand(1)); //Use if TRUE + Tmp3 = SelectExpr(N.getOperand(2)); //Use if FALSE + // Get the condition into the zero flag. + BuildMI(BB, Alpha::CMOVEQ, 2, Result).addReg(Tmp2).addReg(Tmp3).addReg(Tmp1); + return Result; + } + case ISD::FP_ROUND: assert (DestType == MVT::f32 && N.getOperand(0).getValueType() == MVT::f64 && "only f64 to f32 conversion supported here"); Tmp1 = SelectExpr(N.getOperand(0)); @@ -797,7 +809,7 @@ bool isConst1 = false; bool isConst2 = false; int dir; - + //Tmp1 = SelectExpr(N.getOperand(0)); if(N.getOperand(0).getOpcode() == ISD::Constant && cast(N.getOperand(0))->getValue() <= 255) @@ -862,19 +874,54 @@ Tmp2 = SelectExpr(N.getOperand(1)); BuildMI(BB, Alpha::CMPEQ, 2, Result).addReg(Tmp1).addReg(Tmp2); } - } - } - else - { - Node->dump(); - assert(0 && "only integer"); - } + } + } else { + bool rev = false; + bool inv = false; + + switch (SetCC->getCondition()) { + default: Node->dump(); assert(0 && "Unknown FP comparison!"); + case ISD::SETEQ: Opc = Alpha::CMPTEQ; break; + case ISD::SETLT: Opc = Alpha::CMPTLT; break; + case ISD::SETLE: Opc = Alpha::CMPTLE; break; + case ISD::SETGT: Opc = Alpha::CMPTLT; rev = true; break; + case ISD::SETGE: Opc = Alpha::CMPTLE; rev = true; break; + case ISD::SETNE: Opc = Alpha::CMPTEQ; inv = true; break; + } + + Tmp1 = SelectExpr(N.getOperand(0)); + Tmp2 = SelectExpr(N.getOperand(1)); + if (rev) std::swap(Tmp1, Tmp2); + Tmp3 = MakeReg(MVT::f64); + //do the comparison + BuildMI(BB, Opc, 2, Tmp3).addReg(Tmp1).addReg(Tmp2); + + //now arrange for Result (int) to have a 1 or 0 + + // Spill the FP to memory and reload it from there. + unsigned Size = MVT::getSizeInBits(MVT::f64)/8; + MachineFunction *F = BB->getParent(); + int FrameIdx = F->getFrameInfo()->CreateStackObject(Size, 8); + unsigned Tmp4 = MakeReg(MVT::f64); + BuildMI(BB, Alpha::CVTTQ, 1, Tmp4).addReg(Tmp3); + BuildMI(BB, Alpha::STT, 3).addReg(Tmp4).addFrameIndex(FrameIdx).addReg(Alpha::F31); + unsigned Tmp5 = MakeReg(MVT::i64); + BuildMI(BB, Alpha::LDQ, 2, Tmp5).addFrameIndex(FrameIdx).addReg(Alpha::F31); + + //now, set result based on Tmp5 + //Set Tmp6 if fp cmp was false + unsigned Tmp6 = MakeReg(MVT::i64); + BuildMI(BB, Alpha::CMPEQ, 2, Tmp6).addReg(Tmp5).addReg(Alpha::R31); + //and invert + BuildMI(BB, Alpha::CMPEQ, 2, Result).addReg(Tmp6).addReg(Alpha::R31); + + } +// else +// { +// Node->dump(); +// assert(0 && "Not a setcc in setcc"); +// } } - else - { - Node->dump(); - assert(0 && "Not a setcc in setcc"); - } return Result; } @@ -1101,7 +1148,8 @@ MachineBasicBlock *Dest = cast(N.getOperand(2))->getBasicBlock(); - Select(N.getOperand(0)); + Select(N.getOperand(0)); //chain + Tmp1 = SelectExpr(N.getOperand(1)); BuildMI(BB, Alpha::BNE, 2).addReg(Tmp1).addMBB(Dest); return; Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.17 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.18 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.17 Fri Feb 4 14:25:52 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Sat Feb 5 07:19:12 2005 @@ -224,6 +224,11 @@ def CMPULT : OForm< 0x10, 0x1D, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), "CMPULT $RA,$RB,$RC">; //Compare unsigned quadword less than def CMPULTi : OFormL<0x10, 0x1D, (ops GPRC:$RC, GPRC:$RA, u8imm:$L), "CMPULT $RA,$L,$RC">; //Compare unsigned quadword less than +//Comparison, FP +def CMPTEQ : FPForm<0x16, 0x0A5, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "cmpteq $RA,$RB,$RC">; //Compare T_floating equal +def CMPTLE : FPForm<0x16, 0x0A7, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "cmptle $RA,$RB,$RC">; //Compare T_floating less than or equal +def CMPTLT : FPForm<0x16, 0x0A6, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "cmptlt $RA,$RB,$RC">; //Compare T_floating less than +def CMPTUN : FPForm<0x16, 0x0A4, (ops FPRC:$RC, FPRC:$RA, FPRC:$RB), "cmptun $RA,$RB,$RC">; //Compare T_floating unordered //There are in the Multimedia extentions, so let's not use them yet def MAXSB8 : OForm<0x1C, 0x3E, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), "MAXSB8 $RA,$RB,$RC">; //Vector signed byte maximum @@ -363,11 +368,6 @@ //WH64 Mfc 18.F800 Write hint  64 bytes //WMB Mfc 18.4400 Write memory barrier -//CMPTEQ F-P 16.0A5 Compare T_floating equal -//CMPTLE F-P 16.0A7 Compare T_floating less than or equal -//CMPTLT F-P 16.0A6 Compare T_floating less than -//CMPTUN F-P 16.0A4 Compare T_floating unordered - //FCMOVEQ F-P 17.02A FCMOVE if = zero //FCMOVGE F-P 17.02D FCMOVE if >= zero //FCMOVGT F-P 17.02F FCMOVE if > zero From alenhar2 at cs.uiuc.edu Sat Feb 5 10:41:18 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sat, 5 Feb 2005 10:41:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200502051641.KAA00680@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.33 -> 1.34 AlphaInstrInfo.td updated: 1.18 -> 1.19 --- Log message: fix f32 setcc, and fp select --- Diffs of the changes: (+100 -73) AlphaISelPattern.cpp | 157 +++++++++++++++++++++++++++++---------------------- AlphaInstrInfo.td | 16 +++-- 2 files changed, 100 insertions(+), 73 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.33 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.34 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.33 Sat Feb 5 07:19:12 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sat Feb 5 10:41:03 2005 @@ -65,8 +65,6 @@ setOperationAction(ISD::MEMSET , MVT::Other, Expand); setOperationAction(ISD::MEMCPY , MVT::Other, Expand); - setOperationAction(ISD::SETCC , MVT::f32 , Promote); - computeRegisterProperties(); addLegalFPImmediate(+0.0); //F31 @@ -319,8 +317,18 @@ Tmp1 = SelectExpr(N.getOperand(0)); //Cond Tmp2 = SelectExpr(N.getOperand(1)); //Use if TRUE Tmp3 = SelectExpr(N.getOperand(2)); //Use if FALSE + + + // Spill the cond to memory and reload it from there. + unsigned Size = MVT::getSizeInBits(MVT::f64)/8; + MachineFunction *F = BB->getParent(); + int FrameIdx = F->getFrameInfo()->CreateStackObject(Size, 8); + unsigned Tmp4 = MakeReg(MVT::f64); + BuildMI(BB, Alpha::STQ, 3).addReg(Tmp1).addFrameIndex(FrameIdx).addReg(Alpha::F31); + BuildMI(BB, Alpha::LDT, 2, Tmp4).addFrameIndex(FrameIdx).addReg(Alpha::F31); + //now ideally, we don't have to do anything to the flag... // Get the condition into the zero flag. - BuildMI(BB, Alpha::CMOVEQ, 2, Result).addReg(Tmp2).addReg(Tmp3).addReg(Tmp1); + BuildMI(BB, Alpha::FCMOVEQ, 2, Result).addReg(Tmp2).addReg(Tmp3).addReg(Tmp4); return Result; } @@ -367,27 +375,27 @@ SDOperand Address = N.getOperand(1); if (Address.getOpcode() == ISD::GlobalAddress) - { - Select(Chain); - AlphaLowering.restoreGP(BB); - Opc = DestType == MVT::f64 ? Alpha::LDT_SYM : Alpha::LDS_SYM; - BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); - } + { + Select(Chain); + AlphaLowering.restoreGP(BB); + Opc = DestType == MVT::f64 ? Alpha::LDT_SYM : Alpha::LDS_SYM; + BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); + } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { - AlphaLowering.restoreGP(BB); - if (DestType == MVT::f64) { - BuildMI(BB, Alpha::LDT_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); - } else { - BuildMI(BB, Alpha::LDS_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); - } + AlphaLowering.restoreGP(BB); + if (DestType == MVT::f64) { + BuildMI(BB, Alpha::LDT_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); + } else { + BuildMI(BB, Alpha::LDS_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); + } } else - { - Select(Chain); - Tmp2 = SelectExpr(Address); - Opc = DestType == MVT::f64 ? Alpha::LDT : Alpha::LDS; - BuildMI(BB, Opc, 2, Result).addImm(0).addReg(Tmp2); - } + { + Select(Chain); + Tmp2 = SelectExpr(Address); + Opc = DestType == MVT::f64 ? Alpha::LDT : Alpha::LDS; + BuildMI(BB, Opc, 2, Result).addImm(0).addReg(Tmp2); + } return Result; } case ISD::ConstantFP: @@ -874,53 +882,68 @@ Tmp2 = SelectExpr(N.getOperand(1)); BuildMI(BB, Alpha::CMPEQ, 2, Result).addReg(Tmp1).addReg(Tmp2); } - } - } else { - bool rev = false; - bool inv = false; - - switch (SetCC->getCondition()) { - default: Node->dump(); assert(0 && "Unknown FP comparison!"); - case ISD::SETEQ: Opc = Alpha::CMPTEQ; break; - case ISD::SETLT: Opc = Alpha::CMPTLT; break; - case ISD::SETLE: Opc = Alpha::CMPTLE; break; - case ISD::SETGT: Opc = Alpha::CMPTLT; rev = true; break; - case ISD::SETGE: Opc = Alpha::CMPTLE; rev = true; break; - case ISD::SETNE: Opc = Alpha::CMPTEQ; inv = true; break; - } - - Tmp1 = SelectExpr(N.getOperand(0)); - Tmp2 = SelectExpr(N.getOperand(1)); - if (rev) std::swap(Tmp1, Tmp2); - Tmp3 = MakeReg(MVT::f64); - //do the comparison - BuildMI(BB, Opc, 2, Tmp3).addReg(Tmp1).addReg(Tmp2); - - //now arrange for Result (int) to have a 1 or 0 - - // Spill the FP to memory and reload it from there. - unsigned Size = MVT::getSizeInBits(MVT::f64)/8; - MachineFunction *F = BB->getParent(); - int FrameIdx = F->getFrameInfo()->CreateStackObject(Size, 8); - unsigned Tmp4 = MakeReg(MVT::f64); - BuildMI(BB, Alpha::CVTTQ, 1, Tmp4).addReg(Tmp3); - BuildMI(BB, Alpha::STT, 3).addReg(Tmp4).addFrameIndex(FrameIdx).addReg(Alpha::F31); - unsigned Tmp5 = MakeReg(MVT::i64); - BuildMI(BB, Alpha::LDQ, 2, Tmp5).addFrameIndex(FrameIdx).addReg(Alpha::F31); - - //now, set result based on Tmp5 - //Set Tmp6 if fp cmp was false - unsigned Tmp6 = MakeReg(MVT::i64); - BuildMI(BB, Alpha::CMPEQ, 2, Tmp6).addReg(Tmp5).addReg(Alpha::R31); - //and invert - BuildMI(BB, Alpha::CMPEQ, 2, Result).addReg(Tmp6).addReg(Alpha::R31); + } + } else { + //assert(SetCC->getOperand(0).getValueType() != MVT::f32 && "SetCC f32 should have been promoted"); + bool rev = false; + bool inv = false; + + switch (SetCC->getCondition()) { + default: Node->dump(); assert(0 && "Unknown FP comparison!"); + case ISD::SETEQ: Opc = Alpha::CMPTEQ; break; + case ISD::SETLT: Opc = Alpha::CMPTLT; break; + case ISD::SETLE: Opc = Alpha::CMPTLE; break; + case ISD::SETGT: Opc = Alpha::CMPTLT; rev = true; break; + case ISD::SETGE: Opc = Alpha::CMPTLE; rev = true; break; + case ISD::SETNE: Opc = Alpha::CMPTEQ; inv = true; break; + } + + Tmp1 = SelectExpr(N.getOperand(0)); + Tmp2 = SelectExpr(N.getOperand(1)); + //Can only compare doubles, and dag won't promote for me + if (SetCC->getOperand(0).getValueType() == MVT::f32) + { + Tmp3 = MakeReg(MVT::f64); + BuildMI(BB, Alpha::CVTST, 1, Tmp3).addReg(Tmp1); + Tmp1 = Tmp3; + } + if (SetCC->getOperand(1).getValueType() == MVT::f32) + { + Tmp3 = MakeReg(MVT::f64); + BuildMI(BB, Alpha::CVTST, 1, Tmp3).addReg(Tmp2); + Tmp1 = Tmp2; + } - } -// else -// { -// Node->dump(); -// assert(0 && "Not a setcc in setcc"); -// } + if (rev) std::swap(Tmp1, Tmp2); + Tmp3 = MakeReg(MVT::f64); + //do the comparison + BuildMI(BB, Opc, 2, Tmp3).addReg(Tmp1).addReg(Tmp2); + + //now arrange for Result (int) to have a 1 or 0 + + // Spill the FP to memory and reload it from there. + unsigned Size = MVT::getSizeInBits(MVT::f64)/8; + MachineFunction *F = BB->getParent(); + int FrameIdx = F->getFrameInfo()->CreateStackObject(Size, 8); + unsigned Tmp4 = MakeReg(MVT::f64); + BuildMI(BB, Alpha::CVTTQ, 1, Tmp4).addReg(Tmp3); + BuildMI(BB, Alpha::STT, 3).addReg(Tmp4).addFrameIndex(FrameIdx).addReg(Alpha::F31); + unsigned Tmp5 = MakeReg(MVT::i64); + BuildMI(BB, Alpha::LDQ, 2, Tmp5).addFrameIndex(FrameIdx).addReg(Alpha::F31); + + //now, set result based on Tmp5 + //Set Tmp6 if fp cmp was false + unsigned Tmp6 = MakeReg(MVT::i64); + BuildMI(BB, Alpha::CMPEQ, 2, Tmp6).addReg(Tmp5).addReg(Alpha::R31); + //and invert + BuildMI(BB, Alpha::CMPEQ, 2, Result).addReg(Tmp6).addReg(Alpha::R31); + + } + // else + // { + // Node->dump(); + // assert(0 && "Not a setcc in setcc"); + // } } return Result; } Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.18 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.19 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.18 Sat Feb 5 07:19:12 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Sat Feb 5 10:41:03 2005 @@ -83,6 +83,7 @@ //Operation Form: let isTwoAddress = 1 in { +//conditional moves, int def CMOVEQ : OForm< 0x11, 0x24, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "cmoveq $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND = zero def CMOVEQi : OFormL< 0x11, 0x24, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "cmoveq $RCOND,$L,$RDEST">; //CMOVE if RCOND = zero def CMOVGE : OForm< 0x11, 0x46, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "CMOVGE $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND >= zero @@ -99,6 +100,15 @@ def CMOVLTi : OFormL< 0x11, 0x44, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "CMOVLT $RCOND,$L,$RDEST">; //CMOVE if RCOND < zero def CMOVNE : OForm< 0x11, 0x26, (ops GPRC:$RDEST, GPRC:$RSRC2, GPRC:$RSRC, GPRC:$RCOND), "cmovne $RCOND,$RSRC,$RDEST">; //CMOVE if RCOND != zero def CMOVNEi : OFormL< 0x11, 0x26, (ops GPRC:$RDEST, GPRC:$RSRC2, u8imm:$L, GPRC:$RCOND), "cmovne $RCOND,$L,$RDEST">; //CMOVE if RCOND != zero + +//conditional moves, fp + def FCMOVEQ : FPForm<0x17, 0x02A, (ops FPRC:$RDEST, FPRC:$RSRC2, FPRC:$RSRC, FPRC:$RCOND), "fcmoveq $RCOND,$RSRC,$RDEST">; //FCMOVE if = zero + def FCMOVGE : FPForm<0x17, 0x02D, (ops FPRC:$RDEST, FPRC:$RSRC2, FPRC:$RSRC, FPRC:$RCOND), "fcmovge $RCOND,$RSRC,$RDEST">; //FCMOVE if >= zero + def FCMOVGT : FPForm<0x17, 0x02F, (ops FPRC:$RDEST, FPRC:$RSRC2, FPRC:$RSRC, FPRC:$RCOND), "fcmovge $RCOND,$RSRC,$RDEST">; //FCMOVE if > zero + def FCMOVLE : FPForm<0x17, 0x02E, (ops FPRC:$RDEST, FPRC:$RSRC2, FPRC:$RSRC, FPRC:$RCOND), "fcmovle $RCOND,$RSRC,$RDEST">; //FCMOVE if <= zero + def FCMOVLT : FPForm<0x17, 0x02, (ops FPRC:$RDEST, FPRC:$RSRC2, FPRC:$RSRC, FPRC:$RCOND), "fcmovlt $RCOND,$RSRC,$RDEST">; // FCMOVE if < zero + def FCMOVNE : FPForm<0x17, 0x02B, (ops FPRC:$RDEST, FPRC:$RSRC2, FPRC:$RSRC, FPRC:$RCOND), "fcmovne $RCOND,$RSRC,$RDEST">; //FCMOVE if != zero + } def ADDL : OForm< 0x10, 0x00, (ops GPRC:$RC, GPRC:$RA, GPRC:$RB), "addl $RA,$RB,$RC">; //Add longword @@ -368,12 +378,6 @@ //WH64 Mfc 18.F800 Write hint  64 bytes //WMB Mfc 18.4400 Write memory barrier -//FCMOVEQ F-P 17.02A FCMOVE if = zero -//FCMOVGE F-P 17.02D FCMOVE if >= zero -//FCMOVGT F-P 17.02F FCMOVE if > zero -//FCMOVLE F-P 17.02E FCMOVE if <= zero -//FCMOVLT F-P 17.02C FCMOVE if < zero -//FCMOVNE F-P 17.02B FCMOVE if != zero //MF_FPCR F-P 17.025 Move from FPCR //MT_FPCR F-P 17.024 Move to FPCR From alenhar2 at cs.uiuc.edu Sat Feb 5 11:41:54 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sat, 5 Feb 2005 11:41:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502051741.LAA00748@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.34 -> 1.35 --- Log message: clean up --- Diffs of the changes: (+2 -5) AlphaISelPattern.cpp | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.34 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.35 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.34 Sat Feb 5 10:41:03 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sat Feb 5 11:41:39 2005 @@ -383,10 +383,8 @@ } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { AlphaLowering.restoreGP(BB); - if (DestType == MVT::f64) { - BuildMI(BB, Alpha::LDT_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); - } else { - BuildMI(BB, Alpha::LDS_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); + Opc = DestType == MVT::f64 ? Alpha::LDT_SYM : Alpha::LDS_SYM; + BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } } else @@ -846,7 +844,6 @@ BuildMI(BB, Alpha::CMPEQ, 2, Tmp3).addReg(Tmp1).addReg(Tmp2); //and invert BuildMI(BB, Alpha::CMPEQ, 2, Result).addReg(Alpha::R31).addReg(Tmp3); - //BuildMI(BB,Alpha::ORNOT, 2, Result).addReg(Alpha::R31).addReg(Tmp3); return Result; } } From alkis at cs.uiuc.edu Sat Feb 5 12:45:32 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 5 Feb 2005 12:45:32 -0600 Subject: [llvm-commits] CVS: llvm-java/docs/object-layout.txt Message-ID: <200502051845.MAA20897@zion.cs.uiuc.edu> Changes in directory llvm-java/docs: object-layout.txt updated: 1.8 -> 1.9 --- Log message: Update docs on object layout. --- Diffs of the changes: (+6 -4) object-layout.txt | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) Index: llvm-java/docs/object-layout.txt diff -u llvm-java/docs/object-layout.txt:1.8 llvm-java/docs/object-layout.txt:1.9 --- llvm-java/docs/object-layout.txt:1.8 Thu Oct 28 03:54:49 2004 +++ llvm-java/docs/object-layout.txt Sat Feb 5 12:45:21 2005 @@ -45,16 +45,18 @@ is for an interface and the lastIface field is the unique number of this interface in the objects interfaces array. The field lastIface is the max index of all implemented interfaces. For a class that doesn't -implement any it is -1. +implement any it is -1. An additional field describes the elementSize +of an array. This allows us to implement System.arraycopy(). struct llvm_java_object_typeinfo { - unsigned depth; + jint depth; struct llvm_java_object_vtable** vtables; - int lastIface; + jint lastIface; union { struct llvm_java_object_vtable** interfaces; - int interfaceFlag; + jint interfaceFlag; }; + jint elementSize; }; The structure of llvm_java_object_typeinfo allows constant time From alenhar2 at cs.uiuc.edu Sat Feb 5 13:47:07 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sat, 5 Feb 2005 13:47:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502051947.NAA09580@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.35 -> 1.36 --- Log message: fix build --- Diffs of the changes: (+0 -1) AlphaISelPattern.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.35 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.36 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.35 Sat Feb 5 11:41:39 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sat Feb 5 13:46:51 2005 @@ -385,7 +385,6 @@ AlphaLowering.restoreGP(BB); Opc = DestType == MVT::f64 ? Alpha::LDT_SYM : Alpha::LDS_SYM; BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); - } } else { From alkis at cs.uiuc.edu Sat Feb 5 15:11:08 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 5 Feb 2005 15:11:08 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/BasicBlockBuilder.h Message-ID: <200502052111.PAA03914@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: BasicBlockBuilder.h updated: 1.5 -> 1.6 --- Log message: Make false branches come first in the bytecode so that the generated LLVM is more readable. --- Diffs of the changes: (+17 -17) BasicBlockBuilder.h | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) Index: llvm-java/lib/Compiler/BasicBlockBuilder.h diff -u llvm-java/lib/Compiler/BasicBlockBuilder.h:1.5 llvm-java/lib/Compiler/BasicBlockBuilder.h:1.6 --- llvm-java/lib/Compiler/BasicBlockBuilder.h:1.5 Fri Feb 4 13:52:50 2005 +++ llvm-java/lib/Compiler/BasicBlockBuilder.h Sat Feb 5 15:10:57 2005 @@ -87,78 +87,78 @@ } void do_ifeq(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_ifne(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_iflt(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_ifge(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_ifgt(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_ifle(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_if_icmpeq(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_if_icmpne(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_if_icmplt(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_if_icmpgt(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_if_icmpge(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_if_icmple(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_if_acmpeq(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_if_acmpne(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_jsr(unsigned t, unsigned r) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(r); + getOrCreateBasicBlockAt(t); } void do_switch(unsigned defTarget, const SwitchCases& sw) { @@ -174,13 +174,13 @@ } void do_ifnull(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } void do_ifnonnull(unsigned t, unsigned f) { - getOrCreateBasicBlockAt(t); getOrCreateBasicBlockAt(f); + getOrCreateBasicBlockAt(t); } }; From alenhar2 at cs.uiuc.edu Sun Feb 6 09:40:56 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 6 Feb 2005 09:40:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200502061540.JAA19069@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.36 -> 1.37 AlphaInstrInfo.td updated: 1.19 -> 1.20 --- Log message: smarter loads and stores. can now handle base+offset. --- Diffs of the changes: (+269 -171) AlphaISelPattern.cpp | 431 +++++++++++++++++++++++++++++++-------------------- AlphaInstrInfo.td | 9 - 2 files changed, 269 insertions(+), 171 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.36 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.37 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.36 Sat Feb 5 13:46:51 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sun Feb 6 09:40:40 2005 @@ -296,9 +296,34 @@ unsigned SelectExpr(SDOperand N); unsigned SelectExprFP(SDOperand N, unsigned Result); void Select(SDOperand N); + + void SelectAddr(SDOperand N, unsigned& Reg, long& offset); }; } +//Check to see if the load is a constant offset from a base register +void ISel::SelectAddr(SDOperand N, unsigned& Reg, long& offset) +{ + unsigned opcode = N.getOpcode(); + if (opcode == ISD::ADD) { + if(N.getOperand(1).getOpcode() == ISD::Constant && cast(N.getOperand(1))->getValue() <= 32767) + { //Normal imm add + Reg = SelectExpr(N.getOperand(0)); + offset = cast(N.getOperand(1))->getValue(); + return; + } + else if(N.getOperand(0).getOpcode() == ISD::Constant && cast(N.getOperand(0))->getValue() <= 32767) + { + Reg = SelectExpr(N.getOperand(1)); + offset = cast(N.getOperand(0))->getValue(); + return; + } + } + Reg = SelectExpr(N); + offset = 0; + return; +} + unsigned ISel::SelectExprFP(SDOperand N, unsigned Result) { unsigned Tmp1, Tmp2, Tmp3; @@ -373,10 +398,10 @@ SDOperand Chain = N.getOperand(0); SDOperand Address = N.getOperand(1); - + Select(Chain); + if (Address.getOpcode() == ISD::GlobalAddress) { - Select(Chain); AlphaLowering.restoreGP(BB); Opc = DestType == MVT::f64 ? Alpha::LDT_SYM : Alpha::LDS_SYM; BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); @@ -388,10 +413,10 @@ } else { - Select(Chain); - Tmp2 = SelectExpr(Address); + long offset; + SelectAddr(Address, Tmp1, offset); Opc = DestType == MVT::f64 ? Alpha::LDT : Alpha::LDS; - BuildMI(BB, Opc, 2, Result).addImm(0).addReg(Tmp2); + BuildMI(BB, Opc, 2, Result).addImm(offset).addReg(Tmp1); } return Result; } @@ -423,29 +448,42 @@ return Result; case ISD::EXTLOAD: - //include a conversion sequence for float loads to double - if (Result != notIn) - ExprMap[N.getValue(1)] = notIn; // Generate the token - else - Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - - Tmp2 = MakeReg(MVT::f32); - - assert(cast(Node)->getExtraValueType() == MVT::f32 && "EXTLOAD not from f32"); - assert(Node->getValueType(0) == MVT::f64 && "EXTLOAD not to f64"); - - if (ConstantPoolSDNode *CP = dyn_cast(N.getOperand(1))) { - AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LDS_SYM, 1, Tmp2).addConstantPoolIndex(CP->getIndex()); - BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); + { + //include a conversion sequence for float loads to double + if (Result != notIn) + ExprMap[N.getValue(1)] = notIn; // Generate the token + else + Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); + + Tmp2 = MakeReg(MVT::f32); + + assert(cast(Node)->getExtraValueType() == MVT::f32 && "EXTLOAD not from f32"); + assert(Node->getValueType(0) == MVT::f64 && "EXTLOAD not to f64"); + + SDOperand Chain = N.getOperand(0); + SDOperand Address = N.getOperand(1); + Select(Chain); + + if (Address.getOpcode() == ISD::GlobalAddress) + { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Alpha::LDS_SYM, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); + } + else if (ConstantPoolSDNode *CP = dyn_cast(N.getOperand(1))) + { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Alpha::LDS_SYM, 1, Tmp2).addConstantPoolIndex(CP->getIndex()); + BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); + } + else + { + long offset; + SelectAddr(Address, Tmp1, offset); + BuildMI(BB, Alpha::LDS, 1, Tmp2).addImm(offset).addReg(Tmp1); + BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); + } return Result; } - Select(Node->getOperand(0)); // chain - Tmp1 = SelectExpr(Node->getOperand(1)); - BuildMI(BB, Alpha::LDS, 1, Tmp2).addReg(Tmp1); - BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); - return Result; - case ISD::UINT_TO_FP: case ISD::SINT_TO_FP: @@ -521,7 +559,7 @@ case ISD::ConstantPool: Tmp1 = cast(N)->getIndex(); AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LOAD, 1, Result).addConstantPoolIndex(Tmp1); + BuildMI(BB, Alpha::LDQ_SYM, 1, Result).addConstantPoolIndex(Tmp1); return Result; case ISD::FrameIndex: @@ -530,91 +568,129 @@ return Result; case ISD::EXTLOAD: - // Make sure we generate both values. - if (Result != notIn) - ExprMap[N.getValue(1)] = notIn; // Generate the token - else - Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - - Select(Node->getOperand(0)); // chain - Tmp1 = SelectExpr(Node->getOperand(1)); - - switch(Node->getValueType(0)) { - default: Node->dump(); assert(0 && "Unknown type to sign extend to."); - case MVT::i64: - switch (cast(Node)->getExtraValueType()) { - default: - Node->dump(); - assert(0 && "Bad extend load!"); + { + // Make sure we generate both values. + if (Result != notIn) + ExprMap[N.getValue(1)] = notIn; // Generate the token + else + Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); + + SDOperand Chain = N.getOperand(0); + SDOperand Address = N.getOperand(1); + Select(Chain); + + switch(Node->getValueType(0)) { + default: Node->dump(); assert(0 && "Unknown type to sign extend to."); case MVT::i64: - BuildMI(BB, Alpha::LDQ, 2, Result).addImm(0).addReg(Tmp1); - break; - case MVT::i32: - BuildMI(BB, Alpha::LDL, 2, Result).addImm(0).addReg(Tmp1); - break; - case MVT::i16: - BuildMI(BB, Alpha::LDWU, 2, Result).addImm(0).addReg(Tmp1); - break; - case MVT::i1: //FIXME: Treat i1 as i8 since there are problems otherwise - case MVT::i8: - BuildMI(BB, Alpha::LDBU, 2, Result).addImm(0).addReg(Tmp1); - break; + switch (cast(Node)->getExtraValueType()) { + default: + Node->dump(); + assert(0 && "Bad extend load!"); + case MVT::i64: Opc = Alpha::LDQ; break; + case MVT::i32: Opc = Alpha::LDL; break; + case MVT::i16: Opc = Alpha::LDWU; break; + case MVT::i1: //FIXME: Treat i1 as i8 since there are problems otherwise + case MVT::i8: Opc = Alpha::LDBU; break; + } } - break; + + if (Address.getOpcode() == ISD::GlobalAddress) + { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); + } + else if (ConstantPoolSDNode *CP = dyn_cast(Address)) + { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); + } + else + { + long offset; + SelectAddr(Address, Tmp1, offset); + BuildMI(BB, Opc, 2, Result).addImm(offset).addReg(Tmp1); + } + return Result; } - return Result; - + case ISD::SEXTLOAD: - // Make sure we generate both values. - if (Result != notIn) - ExprMap[N.getValue(1)] = notIn; // Generate the token - else - Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); + { + // Make sure we generate both values. + if (Result != notIn) + ExprMap[N.getValue(1)] = notIn; // Generate the token + else + Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - Select(Node->getOperand(0)); // chain - Tmp1 = SelectExpr(Node->getOperand(1)); - switch(Node->getValueType(0)) { - default: Node->dump(); assert(0 && "Unknown type to sign extend to."); - case MVT::i64: - switch (cast(Node)->getExtraValueType()) { - default: - Node->dump(); - assert(0 && "Bad sign extend!"); - case MVT::i32: - BuildMI(BB, Alpha::LDL, 2, Result).addImm(0).addReg(Tmp1); - break; + SDOperand Chain = N.getOperand(0); + SDOperand Address = N.getOperand(1); + Select(Chain); + + switch(Node->getValueType(0)) { + default: Node->dump(); assert(0 && "Unknown type to sign extend to."); + case MVT::i64: + switch (cast(Node)->getExtraValueType()) { + default: Node->dump(); assert(0 && "Bad sign extend!"); + case MVT::i32: Opc = Alpha::LDL; break; + } } - break; + + if (Address.getOpcode() == ISD::GlobalAddress) + { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); + } + else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); + } + else + { + long offset; + SelectAddr(Address, Tmp1, offset); + BuildMI(BB, Opc, 2, Result).addImm(offset).addReg(Tmp1); + } + return Result; } - return Result; case ISD::ZEXTLOAD: - // Make sure we generate both values. - if (Result != notIn) - ExprMap[N.getValue(1)] = notIn; // Generate the token - else - Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - - Select(Node->getOperand(0)); // chain - Tmp1 = SelectExpr(Node->getOperand(1)); - switch(Node->getValueType(0)) { - default: Node->dump(); assert(0 && "Unknown type to zero extend to."); - case MVT::i64: - switch (cast(Node)->getExtraValueType()) { - default: - Node->dump(); - assert(0 && "Bad sign extend!"); - case MVT::i16: - BuildMI(BB, Alpha::LDWU, 2, Result).addImm(0).addReg(Tmp1); - break; - case MVT::i8: - BuildMI(BB, Alpha::LDBU, 2, Result).addImm(0).addReg(Tmp1); - break; + { + // Make sure we generate both values. + if (Result != notIn) + ExprMap[N.getValue(1)] = notIn; // Generate the token + else + Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); + + SDOperand Chain = N.getOperand(0); + SDOperand Address = N.getOperand(1); + Select(Chain); + + switch(Node->getValueType(0)) { + default: Node->dump(); assert(0 && "Unknown type to zero extend to."); + case MVT::i64: + switch (cast(Node)->getExtraValueType()) { + default: Node->dump(); assert(0 && "Bad sign extend!"); + case MVT::i16: Opc = Alpha::LDWU; break; + case MVT::i8: Opc = Alpha::LDBU; break; + } } - break; - } - return Result; + if (Address.getOpcode() == ISD::GlobalAddress) + { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); + } + else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { + AlphaLowering.restoreGP(BB); + BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); + } + else + { + long offset; + SelectAddr(Address, Tmp1, offset); + BuildMI(BB, Opc, 2, Result).addImm(offset).addReg(Tmp1); + } + return Result; + } case ISD::GlobalAddress: AlphaLowering.restoreGP(BB); @@ -1099,19 +1175,19 @@ case ISD::Constant: { unsigned long val = cast(N)->getValue(); - if (val < 32000 && (long)val > -32000) - BuildMI(BB, Alpha::LOAD_IMM, 1, Result).addImm(val); - else - { - MachineConstantPool *CP = BB->getParent()->getConstantPool(); - ConstantUInt *C = ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , val); - unsigned CPI = CP->getConstantPoolIndex(C); - AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LOAD, 1, Result).addConstantPoolIndex(CPI); - } - return Result; + if (val < 32000 && (long)val > -32000) + BuildMI(BB, Alpha::LOAD_IMM, 1, Result).addImm(val); + else + { + MachineConstantPool *CP = BB->getParent()->getConstantPool(); + ConstantUInt *C = ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , val); + unsigned CPI = CP->getConstantPoolIndex(C); + AlphaLowering.restoreGP(BB); + BuildMI(BB, Alpha::LDQ_SYM, 1, Result).addConstantPoolIndex(CPI); + } + return Result; } - + case ISD::LOAD: { // Make sure we generate both values. @@ -1122,24 +1198,24 @@ SDOperand Chain = N.getOperand(0); SDOperand Address = N.getOperand(1); - + Select(Chain); + assert(N.getValue(0).getValueType() == MVT::i64 && "unknown Load dest type"); - + if (Address.getOpcode() == ISD::GlobalAddress) { - Select(Chain); AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LOAD, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); + BuildMI(BB, Alpha::LDQ_SYM, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LOAD, 1, Result).addConstantPoolIndex(CP->getIndex()); + BuildMI(BB, Alpha::LDQ_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); } else { - Select(Chain); - Tmp2 = SelectExpr(Address); - BuildMI(BB, Alpha::LDQ, 2, Result).addImm(0).addReg(Tmp2); + long offset; + SelectAddr(Address, Tmp1, offset); + BuildMI(BB, Alpha::LDQ, 2, Result).addImm(offset).addReg(Tmp1); } return Result; } @@ -1243,36 +1319,37 @@ case ISD::STORE: { - Select(N.getOperand(0)); - Tmp1 = SelectExpr(N.getOperand(1)); //value - MVT::ValueType DestType = N.getOperand(1).getValueType(); - if (N.getOperand(2).getOpcode() == ISD::GlobalAddress) - { - AlphaLowering.restoreGP(BB); - if (DestType == MVT::i64) Opc = Alpha::STORE; - else if (DestType == MVT::f64) Opc = Alpha::STT_SYM; - else if (DestType == MVT::f32) Opc = Alpha::STS_SYM; - else assert(0 && "unknown Type in store"); - BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(N.getOperand(2))->getGlobal()); - } - else if (ConstantPoolSDNode *CP = dyn_cast(N.getOperand(2))) - { - AlphaLowering.restoreGP(BB); - if (DestType == MVT::i64) Opc = Alpha::STORE; - else if (DestType == MVT::f64) Opc = Alpha::STT_SYM; - else if (DestType == MVT::f32) Opc = Alpha::STS_SYM; - else assert(0 && "unknown Type in store"); - BuildMI(BB, Opc, 2).addReg(Tmp1).addConstantPoolIndex(CP->getIndex()); - } + SDOperand Chain = N.getOperand(0); + SDOperand Value = N.getOperand(1); + SDOperand Address = N.getOperand(2); + Select(Chain); + + Tmp1 = SelectExpr(Value); //value + MVT::ValueType DestType = Value.getValueType(); + + if (Address.getOpcode() == ISD::GlobalAddress) + { + AlphaLowering.restoreGP(BB); + switch(DestType) { + default: assert(0 && "unknown Type in store"); + case MVT::i64: Opc = Alpha::STQ_SYM; break; + case MVT::f64: Opc = Alpha::STT_SYM; break; + case MVT::f32: Opc = Alpha::STS_SYM; break; + } + BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(Address)->getGlobal()); + } else - { - Tmp2 = SelectExpr(N.getOperand(2)); //address - if (DestType == MVT::i64) Opc = Alpha::STQ; - else if (DestType == MVT::f64) Opc = Alpha::STT; - else if (DestType == MVT::f32) Opc = Alpha::STS; - else assert(0 && "unknown Type in store"); - BuildMI(BB, Opc, 3).addReg(Tmp1).addImm(0).addReg(Tmp2); - } + { + switch(DestType) { + default: assert(0 && "unknown Type in store"); + case MVT::i64: Opc = Alpha::STQ; break; + case MVT::f64: Opc = Alpha::STT; break; + case MVT::f32: Opc = Alpha::STS; break; + } + long offset; + SelectAddr(Address, Tmp2, offset); + BuildMI(BB, Opc, 3).addReg(Tmp1).addImm(offset).addReg(Tmp2); + } return; } @@ -1288,28 +1365,44 @@ return; - case ISD::TRUNCSTORE: { // truncstore chain, val, ptr :storety - MVT::ValueType StoredTy = cast(Node)->getExtraValueType(); - if (StoredTy == MVT::i64) { - Node->dump(); - assert(StoredTy != MVT::i64 && "Unsupported TRUNCSTORE for this target!"); - } + case ISD::TRUNCSTORE: + { + SDOperand Chain = N.getOperand(0); + SDOperand Value = N.getOperand(1); + SDOperand Address = N.getOperand(2); + Select(Chain); - Select(N.getOperand(0)); - Tmp1 = SelectExpr(N.getOperand(1)); - Tmp2 = SelectExpr(N.getOperand(2)); + MVT::ValueType DestType = cast(Node)->getExtraValueType(); - switch (StoredTy) { - default: Node->dump(); assert(0 && "Unhandled Type"); - case MVT::i1: //FIXME: DAG does not promote this load - case MVT::i8: Opc = Alpha::STB; break; - case MVT::i16: Opc = Alpha::STW; break; - case MVT::i32: Opc = Alpha::STL; break; - } + Tmp1 = SelectExpr(Value); //value - BuildMI(BB, Opc, 2).addReg(Tmp1).addImm(0).addReg(Tmp2); - return; - } + if (Address.getOpcode() == ISD::GlobalAddress) + { + AlphaLowering.restoreGP(BB); + switch(DestType) { + default: assert(0 && "unknown Type in store"); + case MVT::i1: //FIXME: DAG does not promote this load + case MVT::i8: Opc = Alpha::STB; break; + case MVT::i16: Opc = Alpha::STW; break; + case MVT::i32: Opc = Alpha::STL; break; + } + BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(Address)->getGlobal()); + } + else + { + switch(DestType) { + default: assert(0 && "unknown Type in store"); + case MVT::i1: //FIXME: DAG does not promote this load + case MVT::i8: Opc = Alpha::STB; break; + case MVT::i16: Opc = Alpha::STW; break; + case MVT::i32: Opc = Alpha::STL; break; + } + long offset; + SelectAddr(Address, Tmp2, offset); + BuildMI(BB, Opc, 3).addReg(Tmp1).addImm(offset).addReg(Tmp2); + } + return; + } case ISD::ADJCALLSTACKDOWN: case ISD::ADJCALLSTACKUP: Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.19 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.20 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.19 Sat Feb 5 10:41:03 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Sun Feb 6 09:40:40 2005 @@ -57,13 +57,18 @@ def LOAD_IMM : PseudoInstAlpha<(ops GPRC:$RC, s64imm:$IMM), "ldiq $RC,$IMM">; //Load Immediate Quadword let Uses = [R29, R28] in { - def STORE : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "stq $RA,$DISP">; //Store quadword def LOAD_ADDR : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "lda $RA,$DISP">; //Load address - def LOAD : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldq $RA,$DISP">; //Load quadword + def LDQ_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldq $RA,$DISP">; //Load quadword def LDW : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldw $RA,$DISP($RB)">; // Load sign-extended word def LDB : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldb $RA,$DISP($RB)">; //Load byte def LDS_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "lds $RA,$DISP">; //Load float def LDT_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldt $RA,$DISP">; //Load double + + def STB_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "stb $RA,$DISP">; // Store byte + def STW_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "stw $RA,$DISP">; // Store word + def STL_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "stl $RA,$DISP">; // Store longword + def STQ_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "stq $RA,$DISP">; //Store quadword + def STS_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "sts $RA,$DISP">; //store float def STT_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "stt $RA,$DISP">; //store double } From alenhar2 at cs.uiuc.edu Sun Feb 6 10:22:32 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 6 Feb 2005 10:22:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200502061622.KAA19125@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.37 -> 1.38 AlphaInstrInfo.td updated: 1.20 -> 1.21 --- Log message: fix oopso --- Diffs of the changes: (+56 -35) AlphaISelPattern.cpp | 81 ++++++++++++++++++++++++++++++--------------------- AlphaInstrInfo.td | 10 +++++- 2 files changed, 56 insertions(+), 35 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.37 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.38 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.37 Sun Feb 6 09:40:40 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sun Feb 6 10:22:15 2005 @@ -301,6 +301,27 @@ }; } +static unsigned GetSymVersion(unsigned opcode) +{ + switch (opcode) { + default: assert(0 && "unknown load or store"); return 0; + case Alpha::LDQ: return Alpha::LDQ_SYM; + case Alpha::LDS: return Alpha::LDS_SYM; + case Alpha::LDT: return Alpha::LDT_SYM; + case Alpha::LDL: return Alpha::LDL_SYM; + case Alpha::LDBU: return Alpha::LDBU_SYM; + case Alpha::LDWU: return Alpha::LDWU_SYM; + case Alpha::LDW: return Alpha::LDW_SYM; + case Alpha::LDB: return Alpha::LDB_SYM; + case Alpha::STQ: return Alpha::STQ_SYM; + case Alpha::STS: return Alpha::STS_SYM; + case Alpha::STT: return Alpha::STT_SYM; + case Alpha::STL: return Alpha::STL_SYM; + case Alpha::STW: return Alpha::STW_SYM; + case Alpha::STB: return Alpha::STB_SYM; + } +} + //Check to see if the load is a constant offset from a base register void ISel::SelectAddr(SDOperand N, unsigned& Reg, long& offset) { @@ -399,23 +420,23 @@ SDOperand Chain = N.getOperand(0); SDOperand Address = N.getOperand(1); Select(Chain); - + Opc = DestType == MVT::f64 ? Alpha::LDT : Alpha::LDS; + if (Address.getOpcode() == ISD::GlobalAddress) { AlphaLowering.restoreGP(BB); - Opc = DestType == MVT::f64 ? Alpha::LDT_SYM : Alpha::LDS_SYM; + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { AlphaLowering.restoreGP(BB); - Opc = DestType == MVT::f64 ? Alpha::LDT_SYM : Alpha::LDS_SYM; + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } else { long offset; SelectAddr(Address, Tmp1, offset); - Opc = DestType == MVT::f64 ? Alpha::LDT : Alpha::LDS; BuildMI(BB, Opc, 2, Result).addImm(offset).addReg(Tmp1); } return Result; @@ -597,11 +618,13 @@ if (Address.getOpcode() == ISD::GlobalAddress) { AlphaLowering.restoreGP(BB); + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { AlphaLowering.restoreGP(BB); + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } else @@ -637,11 +660,13 @@ if (Address.getOpcode() == ISD::GlobalAddress) { AlphaLowering.restoreGP(BB); + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { AlphaLowering.restoreGP(BB); - BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); + Opc = GetSymVersion(Opc); + BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } else { @@ -677,10 +702,12 @@ if (Address.getOpcode() == ISD::GlobalAddress) { AlphaLowering.restoreGP(BB); + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); } else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { AlphaLowering.restoreGP(BB); + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } else @@ -1326,26 +1353,20 @@ Tmp1 = SelectExpr(Value); //value MVT::ValueType DestType = Value.getValueType(); - + switch(DestType) { + default: assert(0 && "unknown Type in store"); + case MVT::i64: Opc = Alpha::STQ; break; + case MVT::f64: Opc = Alpha::STT; break; + case MVT::f32: Opc = Alpha::STS; break; + } if (Address.getOpcode() == ISD::GlobalAddress) { AlphaLowering.restoreGP(BB); - switch(DestType) { - default: assert(0 && "unknown Type in store"); - case MVT::i64: Opc = Alpha::STQ_SYM; break; - case MVT::f64: Opc = Alpha::STT_SYM; break; - case MVT::f32: Opc = Alpha::STS_SYM; break; - } + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(Address)->getGlobal()); } else { - switch(DestType) { - default: assert(0 && "unknown Type in store"); - case MVT::i64: Opc = Alpha::STQ; break; - case MVT::f64: Opc = Alpha::STT; break; - case MVT::f32: Opc = Alpha::STS; break; - } long offset; SelectAddr(Address, Tmp2, offset); BuildMI(BB, Opc, 3).addReg(Tmp1).addImm(offset).addReg(Tmp2); @@ -1373,30 +1394,24 @@ Select(Chain); MVT::ValueType DestType = cast(Node)->getExtraValueType(); - + switch(DestType) { + default: assert(0 && "unknown Type in store"); + case MVT::i1: //FIXME: DAG does not promote this load + case MVT::i8: Opc = Alpha::STB; break; + case MVT::i16: Opc = Alpha::STW; break; + case MVT::i32: Opc = Alpha::STL; break; + } + Tmp1 = SelectExpr(Value); //value if (Address.getOpcode() == ISD::GlobalAddress) { AlphaLowering.restoreGP(BB); - switch(DestType) { - default: assert(0 && "unknown Type in store"); - case MVT::i1: //FIXME: DAG does not promote this load - case MVT::i8: Opc = Alpha::STB; break; - case MVT::i16: Opc = Alpha::STW; break; - case MVT::i32: Opc = Alpha::STL; break; - } + Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(Address)->getGlobal()); } else { - switch(DestType) { - default: assert(0 && "unknown Type in store"); - case MVT::i1: //FIXME: DAG does not promote this load - case MVT::i8: Opc = Alpha::STB; break; - case MVT::i16: Opc = Alpha::STW; break; - case MVT::i32: Opc = Alpha::STL; break; - } long offset; SelectAddr(Address, Tmp2, offset); BuildMI(BB, Opc, 3).addReg(Tmp1).addImm(offset).addReg(Tmp2); Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.20 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.21 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.20 Sun Feb 6 09:40:40 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Sun Feb 6 10:22:15 2005 @@ -59,10 +59,16 @@ let Uses = [R29, R28] in { def LOAD_ADDR : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "lda $RA,$DISP">; //Load address def LDQ_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldq $RA,$DISP">; //Load quadword - def LDW : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldw $RA,$DISP($RB)">; // Load sign-extended word - def LDB : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldb $RA,$DISP($RB)">; //Load byte def LDS_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "lds $RA,$DISP">; //Load float def LDT_SYM : PseudoInstAlpha<(ops GPRC:$RA, s64imm:$DISP), "ldt $RA,$DISP">; //Load double + def LDL_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "ldl $RA,$DISP">; // Load sign-extended longword + def LDBU_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "ldbu $RA,$DISP">; //Load zero-extended byte + def LDWU_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "ldwu $RA,$DISP">; //Load zero-extended word + def LDW_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "ldw $RA,$DISP">; // Load sign-extended word + def LDB_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "ldb $RA,$DISP">; //Load byte + + def LDW : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldw $RA,$DISP($RB)">; // Load sign-extended word + def LDB : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP, GPRC:$RB), "ldb $RA,$DISP($RB)">; //Load byte def STB_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "stb $RA,$DISP">; // Store byte def STW_SYM : PseudoInstAlpha<(ops GPRC:$RA, s16imm:$DISP), "stw $RA,$DISP">; // Store word From alenhar2 at cs.uiuc.edu Sun Feb 6 15:07:46 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 6 Feb 2005 15:07:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaRegisterInfo.td Message-ID: <200502062107.PAA19260@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.38 -> 1.39 AlphaRegisterInfo.td updated: 1.6 -> 1.7 --- Log message: prefer FP scratch registers and more check in LowerArguments --- Diffs of the changes: (+27 -15) AlphaISelPattern.cpp | 33 +++++++++++++++++++++------------ AlphaRegisterInfo.td | 9 ++++++--- 2 files changed, 27 insertions(+), 15 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.38 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.39 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.38 Sun Feb 6 10:22:15 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sun Feb 6 15:07:31 2005 @@ -137,10 +137,12 @@ Alpha::R19, Alpha::R20, Alpha::R21}; unsigned args_float[] = {Alpha::F16, Alpha::F17, Alpha::F18, Alpha::F19, Alpha::F20, Alpha::F21}; - std::vector argVreg; - std::vector argPreg; - std::vector argOpc; + unsigned argVreg[6]; + unsigned argPreg[6]; + unsigned argOpc[6]; + int count = 0; + for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) { SDOperand newroot, argt; @@ -150,9 +152,9 @@ case MVT::f64: case MVT::f32: BuildMI(&BB, Alpha::IDEF, 0, args_float[count]); - argVreg.push_back(MF.getSSARegMap()->createVirtualRegister(getRegClassFor(getValueType(I->getType())))); - argPreg.push_back(args_float[count]); - argOpc.push_back(Alpha::CPYS); + argVreg[count] = MF.getSSARegMap()->createVirtualRegister(getRegClassFor(getValueType(I->getType()))); + argPreg[count] = args_float[count]; + argOpc[count] = Alpha::CPYS; argt = newroot = DAG.getCopyFromReg(argVreg[count], getValueType(I->getType()), DAG.getRoot()); break; case MVT::i1: @@ -161,14 +163,15 @@ case MVT::i32: case MVT::i64: BuildMI(&BB, Alpha::IDEF, 0, args_int[count]); - argVreg.push_back(MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::i64))); - argPreg.push_back(args_int[count]); - argOpc.push_back(Alpha::BIS); + argVreg[count] =MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::i64)); + argPreg[count] = args_int[count]; + argOpc[count] = Alpha::BIS; argt = newroot = DAG.getCopyFromReg(argVreg[count], MVT::i64, DAG.getRoot()); if (getValueType(I->getType()) != MVT::i64) argt = DAG.getNode(ISD::TRUNCATE, getValueType(I->getType()), newroot); break; } + ++count; } else { //more args // Create the frame index object for this incoming parameter... int FI = MFI->CreateFixedObject(8, 8 * (count - 6)); @@ -179,13 +182,19 @@ } DAG.setRoot(newroot.getValue(1)); ArgValues.push_back(argt); - ++count; } BuildMI(&BB, Alpha::IDEF, 0, Alpha::R29); BuildMI(&BB, Alpha::BIS, 2, GP).addReg(Alpha::R29).addReg(Alpha::R29); - for (int i = 0; i < std::min(count,6); ++i) - BuildMI(&BB, argOpc[i], 2, argVreg[i]).addReg(argPreg[i]).addReg(argPreg[i]); + for (int i = 0; i < count; ++i) + { + if (argPreg[i] == Alpha::F16 || argPreg[i] == Alpha::F17 || argPreg[i] == Alpha::F18 || + argPreg[i] == Alpha::F19 || argPreg[i] == Alpha::F20 || argPreg[i] == Alpha::F21) + { + assert(argOpc[i] == Alpha::CPYS && "Using BIS for a float??"); + } + BuildMI(&BB, argOpc[i], 2, argVreg[i]).addReg(argPreg[i]).addReg(argPreg[i]); + } return ArgValues; } Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.td diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.6 llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.7 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.td:1.6 Fri Feb 4 14:25:52 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.td Sun Feb 6 15:07:31 2005 @@ -86,8 +86,11 @@ //Don't allocate 15, 29, 30, 31 //Allocation volatiles only for now -def FPRC : RegisterClass; +def FPRC : RegisterClass; From alenhar2 at cs.uiuc.edu Sun Feb 6 23:07:15 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 6 Feb 2005 23:07:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502070507.XAA19513@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.39 -> 1.40 --- Log message: teach all loads and stores about the stack --- Diffs of the changes: (+41 -1) AlphaISelPattern.cpp | 42 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 41 insertions(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.39 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.40 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.39 Sun Feb 6 15:07:31 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sun Feb 6 23:07:00 2005 @@ -125,7 +125,7 @@ // assert(0 && "TODO"); MachineFunction &MF = DAG.getMachineFunction(); - MachineFrameInfo *MFI = MF.getFrameInfo(); + MachineFrameInfo*MFI = MF.getFrameInfo(); GP = MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::i64)); MachineBasicBlock& BB = MF.front(); @@ -442,6 +442,11 @@ Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } + else if(Address.getOpcode() == ISD::FrameIndex) + { + Tmp1 = cast(Address)->getIndex(); + BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + } else { long offset; @@ -505,6 +510,11 @@ BuildMI(BB, Alpha::LDS_SYM, 1, Tmp2).addConstantPoolIndex(CP->getIndex()); BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); } + else if(Address.getOpcode() == ISD::FrameIndex) + { + Tmp1 = cast(Address)->getIndex(); + BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + } else { long offset; @@ -636,6 +646,11 @@ Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } + else if(Address.getOpcode() == ISD::FrameIndex) + { + Tmp1 = cast(Address)->getIndex(); + BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + } else { long offset; @@ -677,6 +692,11 @@ Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } + else if(Address.getOpcode() == ISD::FrameIndex) + { + Tmp1 = cast(Address)->getIndex(); + BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + } else { long offset; @@ -719,6 +739,11 @@ Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); } + else if(Address.getOpcode() == ISD::FrameIndex) + { + Tmp1 = cast(Address)->getIndex(); + BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + } else { long offset; @@ -1247,6 +1272,11 @@ AlphaLowering.restoreGP(BB); BuildMI(BB, Alpha::LDQ_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); } + else if(Address.getOpcode() == ISD::FrameIndex) + { + Tmp1 = cast(Address)->getIndex(); + BuildMI(BB, Alpha::LDQ, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + } else { long offset; @@ -1374,6 +1404,11 @@ Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(Address)->getGlobal()); } + else if(Address.getOpcode() == ISD::FrameIndex) + { + Tmp1 = cast(Address)->getIndex(); + BuildMI(BB, Opc, 3).addReg(Tmp1).addFrameIndex(Tmp1).addReg(Alpha::F31); + } else { long offset; @@ -1419,6 +1454,11 @@ Opc = GetSymVersion(Opc); BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(Address)->getGlobal()); } + else if(Address.getOpcode() == ISD::FrameIndex) + { + Tmp1 = cast(Address)->getIndex(); + BuildMI(BB, Opc, 3).addReg(Tmp1).addFrameIndex(Tmp1).addReg(Alpha::F31); + } else { long offset; From alenhar2 at cs.uiuc.edu Sun Feb 6 23:18:15 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 6 Feb 2005 23:18:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502070518.XAA19531@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.40 -> 1.41 --- Log message: clean up load and stores alot --- Diffs of the changes: (+13 -143) AlphaISelPattern.cpp | 156 ++++----------------------------------------------- 1 files changed, 13 insertions(+), 143 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.40 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.41 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.40 Sun Feb 6 23:07:00 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sun Feb 6 23:18:02 2005 @@ -608,58 +608,7 @@ return Result; case ISD::EXTLOAD: - { - // Make sure we generate both values. - if (Result != notIn) - ExprMap[N.getValue(1)] = notIn; // Generate the token - else - Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - - SDOperand Chain = N.getOperand(0); - SDOperand Address = N.getOperand(1); - Select(Chain); - - switch(Node->getValueType(0)) { - default: Node->dump(); assert(0 && "Unknown type to sign extend to."); - case MVT::i64: - switch (cast(Node)->getExtraValueType()) { - default: - Node->dump(); - assert(0 && "Bad extend load!"); - case MVT::i64: Opc = Alpha::LDQ; break; - case MVT::i32: Opc = Alpha::LDL; break; - case MVT::i16: Opc = Alpha::LDWU; break; - case MVT::i1: //FIXME: Treat i1 as i8 since there are problems otherwise - case MVT::i8: Opc = Alpha::LDBU; break; - } - } - - if (Address.getOpcode() == ISD::GlobalAddress) - { - AlphaLowering.restoreGP(BB); - Opc = GetSymVersion(Opc); - BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); - } - else if (ConstantPoolSDNode *CP = dyn_cast(Address)) - { - AlphaLowering.restoreGP(BB); - Opc = GetSymVersion(Opc); - BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); - } - else if(Address.getOpcode() == ISD::FrameIndex) - { - Tmp1 = cast(Address)->getIndex(); - BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); - } - else - { - long offset; - SelectAddr(Address, Tmp1, offset); - BuildMI(BB, Opc, 2, Result).addImm(offset).addReg(Tmp1); - } - return Result; - } - + case ISD::ZEXTLOAD: case ISD::SEXTLOAD: { // Make sure we generate both values. @@ -677,7 +626,10 @@ case MVT::i64: switch (cast(Node)->getExtraValueType()) { default: Node->dump(); assert(0 && "Bad sign extend!"); - case MVT::i32: Opc = Alpha::LDL; break; + case MVT::i32: Opc = Alpha::LDL; assert(opcode != ISD::ZEXTLOAD && "Not sext"); break; + case MVT::i16: Opc = Alpha::LDWU; assert(opcode != ISD::SEXTLOAD && "Not zext"); break; + case MVT::i1: //FIXME: Treat i1 as i8 since there are problems otherwise + case MVT::i8: Opc = Alpha::LDBU; assert(opcode != ISD::SEXTLOAD && "Not zext"); break; } } @@ -706,53 +658,6 @@ return Result; } - case ISD::ZEXTLOAD: - { - // Make sure we generate both values. - if (Result != notIn) - ExprMap[N.getValue(1)] = notIn; // Generate the token - else - Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - - SDOperand Chain = N.getOperand(0); - SDOperand Address = N.getOperand(1); - Select(Chain); - - switch(Node->getValueType(0)) { - default: Node->dump(); assert(0 && "Unknown type to zero extend to."); - case MVT::i64: - switch (cast(Node)->getExtraValueType()) { - default: Node->dump(); assert(0 && "Bad sign extend!"); - case MVT::i16: Opc = Alpha::LDWU; break; - case MVT::i8: Opc = Alpha::LDBU; break; - } - } - - if (Address.getOpcode() == ISD::GlobalAddress) - { - AlphaLowering.restoreGP(BB); - Opc = GetSymVersion(Opc); - BuildMI(BB, Opc, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); - } - else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { - AlphaLowering.restoreGP(BB); - Opc = GetSymVersion(Opc); - BuildMI(BB, Opc, 1, Result).addConstantPoolIndex(CP->getIndex()); - } - else if(Address.getOpcode() == ISD::FrameIndex) - { - Tmp1 = cast(Address)->getIndex(); - BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); - } - else - { - long offset; - SelectAddr(Address, Tmp1, offset); - BuildMI(BB, Opc, 2, Result).addImm(offset).addReg(Tmp1); - } - return Result; - } - case ISD::GlobalAddress: AlphaLowering.restoreGP(BB); BuildMI(BB, Alpha::LOAD_ADDR, 1, Result) @@ -1383,6 +1288,7 @@ BuildMI(BB, Alpha::RETURN, 0); // Just emit a 'ret' instruction return; + case ISD::TRUNCSTORE: case ISD::STORE: { SDOperand Chain = N.getOperand(0); @@ -1391,12 +1297,15 @@ Select(Chain); Tmp1 = SelectExpr(Value); //value - MVT::ValueType DestType = Value.getValueType(); - switch(DestType) { + switch(Value.getValueType()) { default: assert(0 && "unknown Type in store"); case MVT::i64: Opc = Alpha::STQ; break; case MVT::f64: Opc = Alpha::STT; break; case MVT::f32: Opc = Alpha::STS; break; + case MVT::i1: //FIXME: DAG does not promote this load + case MVT::i8: Opc = Alpha::STB; break; + case MVT::i16: Opc = Alpha::STW; break; + case MVT::i32: Opc = Alpha::STL; break; } if (Address.getOpcode() == ISD::GlobalAddress) { @@ -1406,8 +1315,8 @@ } else if(Address.getOpcode() == ISD::FrameIndex) { - Tmp1 = cast(Address)->getIndex(); - BuildMI(BB, Opc, 3).addReg(Tmp1).addFrameIndex(Tmp1).addReg(Alpha::F31); + Tmp2 = cast(Address)->getIndex(); + BuildMI(BB, Opc, 3).addReg(Tmp1).addFrameIndex(Tmp2).addReg(Alpha::F31); } else { @@ -1429,45 +1338,6 @@ SelectExpr(N); return; - - case ISD::TRUNCSTORE: - { - SDOperand Chain = N.getOperand(0); - SDOperand Value = N.getOperand(1); - SDOperand Address = N.getOperand(2); - Select(Chain); - - MVT::ValueType DestType = cast(Node)->getExtraValueType(); - switch(DestType) { - default: assert(0 && "unknown Type in store"); - case MVT::i1: //FIXME: DAG does not promote this load - case MVT::i8: Opc = Alpha::STB; break; - case MVT::i16: Opc = Alpha::STW; break; - case MVT::i32: Opc = Alpha::STL; break; - } - - Tmp1 = SelectExpr(Value); //value - - if (Address.getOpcode() == ISD::GlobalAddress) - { - AlphaLowering.restoreGP(BB); - Opc = GetSymVersion(Opc); - BuildMI(BB, Opc, 2).addReg(Tmp1).addGlobalAddress(cast(Address)->getGlobal()); - } - else if(Address.getOpcode() == ISD::FrameIndex) - { - Tmp1 = cast(Address)->getIndex(); - BuildMI(BB, Opc, 3).addReg(Tmp1).addFrameIndex(Tmp1).addReg(Alpha::F31); - } - else - { - long offset; - SelectAddr(Address, Tmp2, offset); - BuildMI(BB, Opc, 3).addReg(Tmp1).addImm(offset).addReg(Tmp2); - } - return; - } - case ISD::ADJCALLSTACKDOWN: case ISD::ADJCALLSTACKUP: Select(N.getOperand(0)); From alenhar2 at cs.uiuc.edu Sun Feb 6 23:33:28 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 6 Feb 2005 23:33:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502070533.XAA19576@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.41 -> 1.42 --- Log message: more FP load store fixes and Load store simplifications --- Diffs of the changes: (+14 -47) AlphaISelPattern.cpp | 61 +++++++++++---------------------------------------- 1 files changed, 14 insertions(+), 47 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.41 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.42 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.41 Sun Feb 6 23:18:02 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sun Feb 6 23:33:15 2005 @@ -490,7 +490,7 @@ else Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - Tmp2 = MakeReg(MVT::f32); + Tmp1 = MakeReg(MVT::f32); assert(cast(Node)->getExtraValueType() == MVT::f32 && "EXTLOAD not from f32"); assert(Node->getValueType(0) == MVT::f64 && "EXTLOAD not to f64"); @@ -502,25 +502,27 @@ if (Address.getOpcode() == ISD::GlobalAddress) { AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LDS_SYM, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); - } + BuildMI(BB, Alpha::LDS_SYM, 1, Tmp1).addGlobalAddress(cast(Address)->getGlobal()); + BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp1); + } else if (ConstantPoolSDNode *CP = dyn_cast(N.getOperand(1))) { AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LDS_SYM, 1, Tmp2).addConstantPoolIndex(CP->getIndex()); - BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); + BuildMI(BB, Alpha::LDS_SYM, 1, Tmp1).addConstantPoolIndex(CP->getIndex()); + BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp1); } else if(Address.getOpcode() == ISD::FrameIndex) { - Tmp1 = cast(Address)->getIndex(); - BuildMI(BB, Opc, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); + Tmp2 = cast(Address)->getIndex(); + BuildMI(BB, Alpha::LDS, 2, Tmp1).addFrameIndex(Tmp2).addReg(Alpha::F31); + BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp1); } else { long offset; - SelectAddr(Address, Tmp1, offset); - BuildMI(BB, Alpha::LDS, 1, Tmp2).addImm(offset).addReg(Tmp1); - BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp2); + SelectAddr(Address, Tmp2, offset); + BuildMI(BB, Alpha::LDS, 1, Tmp1).addImm(offset).addReg(Tmp2); + BuildMI(BB, Alpha::CVTST, 1, Result).addReg(Tmp1); } return Result; } @@ -610,6 +612,7 @@ case ISD::EXTLOAD: case ISD::ZEXTLOAD: case ISD::SEXTLOAD: + case ISD::LOAD: { // Make sure we generate both values. if (Result != notIn) @@ -626,6 +629,7 @@ case MVT::i64: switch (cast(Node)->getExtraValueType()) { default: Node->dump(); assert(0 && "Bad sign extend!"); + case MVT::i64: Opc = Alpha::LDQ; assert(opcode == ISD::LOAD && "Not Load"); break; case MVT::i32: Opc = Alpha::LDL; assert(opcode != ISD::ZEXTLOAD && "Not sext"); break; case MVT::i16: Opc = Alpha::LDWU; assert(opcode != ISD::SEXTLOAD && "Not zext"); break; case MVT::i1: //FIXME: Treat i1 as i8 since there are problems otherwise @@ -1153,43 +1157,6 @@ } return Result; } - - case ISD::LOAD: - { - // Make sure we generate both values. - if (Result != notIn) - ExprMap[N.getValue(1)] = notIn; // Generate the token - else - Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType()); - - SDOperand Chain = N.getOperand(0); - SDOperand Address = N.getOperand(1); - Select(Chain); - - assert(N.getValue(0).getValueType() == MVT::i64 && "unknown Load dest type"); - - if (Address.getOpcode() == ISD::GlobalAddress) - { - AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LDQ_SYM, 1, Result).addGlobalAddress(cast(Address)->getGlobal()); - } - else if (ConstantPoolSDNode *CP = dyn_cast(Address)) { - AlphaLowering.restoreGP(BB); - BuildMI(BB, Alpha::LDQ_SYM, 1, Result).addConstantPoolIndex(CP->getIndex()); - } - else if(Address.getOpcode() == ISD::FrameIndex) - { - Tmp1 = cast(Address)->getIndex(); - BuildMI(BB, Alpha::LDQ, 2, Result).addFrameIndex(Tmp1).addReg(Alpha::F31); - } - else - { - long offset; - SelectAddr(Address, Tmp1, offset); - BuildMI(BB, Alpha::LDQ, 2, Result).addImm(offset).addReg(Tmp1); - } - return Result; - } } return 0; From alenhar2 at cs.uiuc.edu Sun Feb 6 23:56:10 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 6 Feb 2005 23:56:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp Message-ID: <200502070556.XAA19629@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.42 -> 1.43 --- Log message: fix load bug --- Diffs of the changes: (+5 -5) AlphaISelPattern.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.42 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.43 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.42 Sun Feb 6 23:33:15 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Sun Feb 6 23:55:55 2005 @@ -624,18 +624,17 @@ SDOperand Address = N.getOperand(1); Select(Chain); - switch(Node->getValueType(0)) { - default: Node->dump(); assert(0 && "Unknown type to sign extend to."); - case MVT::i64: + assert(Node->getValueType(0) == MVT::i64 && "Unknown type to sign extend to."); + if (opcode == ISD::LOAD) + Opc = Alpha::LDQ; + else switch (cast(Node)->getExtraValueType()) { default: Node->dump(); assert(0 && "Bad sign extend!"); - case MVT::i64: Opc = Alpha::LDQ; assert(opcode == ISD::LOAD && "Not Load"); break; case MVT::i32: Opc = Alpha::LDL; assert(opcode != ISD::ZEXTLOAD && "Not sext"); break; case MVT::i16: Opc = Alpha::LDWU; assert(opcode != ISD::SEXTLOAD && "Not zext"); break; case MVT::i1: //FIXME: Treat i1 as i8 since there are problems otherwise case MVT::i8: Opc = Alpha::LDBU; assert(opcode != ISD::SEXTLOAD && "Not zext"); break; } - } if (Address.getOpcode() == ISD::GlobalAddress) { @@ -1106,6 +1105,7 @@ { assert (DestType == MVT::i64 && "only quads can be loaded to"); MVT::ValueType SrcType = N.getOperand(0).getValueType(); + assert (SrcType == MVT::f32 || SrcType == MVT::f64); Tmp1 = SelectExpr(N.getOperand(0)); // Get the operand register //The hard way: