From lattner at cs.uiuc.edu Mon Mar 14 13:22:49 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 13:22:49 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200503141922.j2EJMnIH031320@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.88 -> 1.89 --- Log message: Add a useful method. --- Diffs of the changes: (+4 -0) DSGraph.h | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.88 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.89 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.88 Tue Feb 15 12:40:38 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Mon Mar 14 13:22:33 2005 @@ -376,6 +376,10 @@ const DSNodeHandle &NH2, NodeMapTy &NodeMap, bool StrictChecking = true); + /// computeGlobalGraphMapping - Compute the mapping of nodes in the global + /// graph to nodes in this graph. + void computeGlobalGraphMapping(NodeMapTy &NodeMap); + /// cloneInto - Clone the specified DSGraph into the current graph. The /// translated ScalarMap for the old function is filled into the OldValMap From lattner at cs.uiuc.edu Mon Mar 14 13:23:01 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 13:23:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp EquivClassGraphs.cpp Message-ID: <200503141923.j2EJN1Ji031331@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.199 -> 1.200 EquivClassGraphs.cpp updated: 1.24 -> 1.25 --- Log message: add a method to compute a commonly used mapping. --- Diffs of the changes: (+16 -5) DataStructure.cpp | 13 +++++++++++++ EquivClassGraphs.cpp | 8 +++----- 2 files changed, 16 insertions(+), 5 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.199 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.200 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.199 Sun Mar 13 14:36:01 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Mar 14 13:22:47 2005 @@ -2082,3 +2082,16 @@ computeNodeMapping(N1->getLink(i), N2->getLink(unsigned(N2Idx+i) % N2Size), NodeMap); } + + +/// computeGlobalGraphMapping - Compute the mapping of nodes in the global +/// graph to nodes in this graph. +void DSGraph::computeGlobalGraphMapping(NodeMapTy &NodeMap) { + DSGraph &GG = *getGlobalsGraph(); + + DSScalarMap &SM = getScalarMap(); + for (DSScalarMap::global_iterator I = SM.global_begin(), + E = SM.global_end(); I != E; ++I) + DSGraph::computeNodeMapping(SM[*I], GG.getNodeForValue(*I), NodeMap); +} + Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.24 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.25 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.24 Sun Mar 13 14:32:26 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Mon Mar 14 13:22:47 2005 @@ -45,13 +45,11 @@ for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (!I->isExternal()) { DSGraph &G = ECGraphs.getDSGraph(*I); + if (G.getReturnNodes().begin()->first != I) + continue; // Only check a graph once. DSGraph::NodeMapTy GlobalsGraphNodeMapping; - for (DSScalarMap::global_iterator I = G.getScalarMap().global_begin(), - E = G.getScalarMap().global_end(); I != E; ++I) - DSGraph::computeNodeMapping(G.getNodeForValue(*I), - GG.getNodeForValue(*I), - GlobalsGraphNodeMapping); + G.computeGlobalGraphMapping(GlobalsGraphNodeMapping); } } #endif From alenhar2 at cs.uiuc.edu Mon Mar 14 13:23:58 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 14 Mar 2005 13:23:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200503141923.j2EJNw9A031372@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.61 -> 1.62 AlphaInstrInfo.td updated: 1.31 -> 1.32 --- Log message: FP 0.0 setcc optimization, and generate short branch sequence for setcc(FP) rather than stack usage --- Diffs of the changes: (+37 -19) AlphaISelPattern.cpp | 48 +++++++++++++++++++++++++++++++----------------- AlphaInstrInfo.td | 8 ++++++-- 2 files changed, 37 insertions(+), 19 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.61 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.62 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.61 Fri Mar 11 11:48:04 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Mon Mar 14 13:23:45 2005 @@ -1253,8 +1253,20 @@ case ISD::SETNE: Opc = Alpha::CMPTEQ; inv = true; break; } - Tmp1 = SelectExpr(N.getOperand(0)); - Tmp2 = SelectExpr(N.getOperand(1)); + //FIXME: check for constant 0.0 + ConstantFPSDNode *CN; + if ((CN = dyn_cast(SetCC->getOperand(0))) + && (CN->isExactlyValue(+0.0) || CN->isExactlyValue(-0.0))) + Tmp1 = Alpha::F31; + else + Tmp1 = SelectExpr(N.getOperand(0)); + + if ((CN = dyn_cast(SetCC->getOperand(1))) + && (CN->isExactlyValue(+0.0) || CN->isExactlyValue(-0.0))) + Tmp2 = Alpha::F31; + else + Tmp2 = SelectExpr(N.getOperand(1)); + //Can only compare doubles, and dag won't promote for me if (SetCC->getOperand(0).getValueType() == MVT::f32) { @@ -1280,22 +1292,24 @@ //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); + BuildMI(BB, Alpha::CC2INT, 1, Result).addReg(Tmp3); + +// // 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); +// //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 Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.31 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.32 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.31 Fri Mar 11 11:48:05 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Mon Mar 14 13:23:45 2005 @@ -43,11 +43,11 @@ let isCall = 1, Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, - R20, R21, R22, R23, R24, R25, R26, R27, R29, + R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, 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 CALL : PseudoInstAlpha< (ops s64imm:$TARGET), "jsr $TARGET">; //Jump to subroutine let isReturn = 1, isTerminator = 1 in @@ -87,6 +87,10 @@ def DIVQ : PseudoInstAlpha<(ops GPRC:$RA, GPRC:$RB), "divq $RA,$RB,$$27">; //signed division } +//This is an improvement on the old style setcc (FP) +def CC2INT : PseudoInstAlpha<(ops GPRC:$RES, FPRC:$COND), + "lda $RES,1($$31)\n\tfbeq $COND, 42f\n\tbis $$31,$$31,$RES\n42:\n">; + //*********************** //Real instructions //*********************** From lattner at cs.uiuc.edu Mon Mar 14 13:27:46 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 13:27:46 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp PoolAllocate.cpp Message-ID: <200503141927.j2EJRko6032334@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.54 -> 1.55 PoolAllocate.cpp updated: 1.108 -> 1.109 --- Log message: Use the new computeGlobalGraphMapping method --- Diffs of the changes: (+6 -14) PointerCompress.cpp | 10 +++------- PoolAllocate.cpp | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.54 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.55 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.54 Sat Mar 12 06:10:52 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Mon Mar 14 13:27:35 2005 @@ -1110,14 +1110,10 @@ // from a global, we check to see if the global pool is compressed. DSGraph &GG = ECG->getGlobalsGraph(); + // Map all node reachable from this global to the corresponding nodes in the + // globals graph. DSGraph::NodeMapTy GlobalsGraphNodeMapping; - for (DSScalarMap::global_iterator I = DSG.getScalarMap().global_begin(), - E = DSG.getScalarMap().global_end(); I != E; ++I) { - // Map all node reachable from this global to the corresponding nodes in - // the globals graph. - DSGraph::computeNodeMapping(DSG.getNodeForValue(*I), GG.getNodeForValue(*I), - GlobalsGraphNodeMapping); - } + DSG.computeGlobalGraphMapping(GlobalsGraphNodeMapping); // See if there are nodes in this graph that correspond to nodes in the // globals graph, and if so, if it is compressed. Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.108 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.109 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.108 Sat Mar 12 05:55:30 2005 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Mon Mar 14 13:27:35 2005 @@ -541,14 +541,10 @@ // is required. DSGraph &GG = ECGraphs->getGlobalsGraph(); + // Map all node reachable from this global to the corresponding nodes in + // the globals graph. DSGraph::NodeMapTy GlobalsGraphNodeMapping; - for (DSScalarMap::global_iterator I = G.getScalarMap().global_begin(), - E = G.getScalarMap().global_end(); I != E; ++I) { - // Map all node reachable from this global to the corresponding nodes in - // the globals graph. - DSGraph::computeNodeMapping(G.getNodeForValue(*I), GG.getNodeForValue(*I), - GlobalsGraphNodeMapping); - } + G.computeGlobalGraphMapping(GlobalsGraphNodeMapping); // Loop over all of the nodes which are non-escaping, adding pool-allocatable // ones to the NodesToPA vector. From lattner at cs.uiuc.edu Mon Mar 14 17:50:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 17:50:03 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Function.h Module.h Message-ID: <200503142350.j2ENo3UQ014551@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Function.h updated: 1.61 -> 1.62 Module.h updated: 1.58 -> 1.59 --- Log message: Remove the reverse iterators for arguments and global vars. Rename argument iterators arg_* instead of a* Remove global variable iterators global_* instead of g*. Keep the old names for temporary compatibility. Patch contributed by Gabor Greif! --- Diffs of the changes: (+89 -40) Function.h | 64 +++++++++++++++++++++++++++++++++++++++++------------------- Module.h | 65 ++++++++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 89 insertions(+), 40 deletions(-) Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.61 llvm/include/llvm/Function.h:1.62 --- llvm/include/llvm/Function.h:1.61 Sat Mar 5 13:51:20 2005 +++ llvm/include/llvm/Function.h Mon Mar 14 17:49:40 2005 @@ -57,10 +57,14 @@ typedef std::reverse_iterator const_reverse_iterator; typedef std::reverse_iterator reverse_iterator; - typedef ArgumentListType::iterator aiterator; - typedef ArgumentListType::const_iterator const_aiterator; - typedef std::reverse_iterator const_reverse_aiterator; - typedef std::reverse_iterator reverse_aiterator; + typedef ArgumentListType::iterator arg_iterator; + typedef ArgumentListType::const_iterator const_arg_iterator; + typedef std::reverse_iterator const_reverse_arg_iterator; + typedef std::reverse_iterator reverse_arg_iterator; + typedef arg_iterator aiterator; // legacy, deprecated + typedef const_arg_iterator const_aiterator; // legacy, deprecated + typedef const_reverse_arg_iterator const_reverse_aiterator; // legacy, deprecated + typedef reverse_arg_iterator reverse_aiterator; // legacy, deprecated private: // Important things that make up a function! @@ -187,22 +191,42 @@ //===--------------------------------------------------------------------===// // Argument iterator forwarding functions // - aiterator abegin() { return ArgumentList.begin(); } - const_aiterator abegin() const { return ArgumentList.begin(); } - aiterator aend () { return ArgumentList.end(); } - const_aiterator aend () const { return ArgumentList.end(); } - - reverse_aiterator arbegin() { return ArgumentList.rbegin(); } - const_reverse_aiterator arbegin() const { return ArgumentList.rbegin(); } - reverse_aiterator arend () { return ArgumentList.rend(); } - const_reverse_aiterator arend () const { return ArgumentList.rend(); } - - size_t asize() const { return ArgumentList.size(); } - bool aempty() const { return ArgumentList.empty(); } - const Argument &afront() const { return ArgumentList.front(); } - Argument &afront() { return ArgumentList.front(); } - const Argument &aback() const { return ArgumentList.back(); } - Argument &aback() { return ArgumentList.back(); } + arg_iterator arg_begin() { return ArgumentList.begin(); } + const_arg_iterator arg_begin() const { return ArgumentList.begin(); } + arg_iterator arg_end () { return ArgumentList.end(); } + const_arg_iterator arg_end () const { return ArgumentList.end(); } + + reverse_arg_iterator arg_rbegin() { return ArgumentList.rbegin(); } + const_reverse_arg_iterator arg_rbegin() const { return ArgumentList.rbegin(); } + reverse_arg_iterator arg_rend () { return ArgumentList.rend(); } + const_reverse_arg_iterator arg_rend () const { return ArgumentList.rend(); } + + size_t arg_size () const { return ArgumentList.size(); } + bool arg_empty() const { return ArgumentList.empty(); } + const Argument &arg_front() const { return ArgumentList.front(); } + Argument &arg_front() { return ArgumentList.front(); } + const Argument &arg_back () const { return ArgumentList.back(); } + Argument &arg_back () { return ArgumentList.back(); } + + //===--------------------------------------------------------------------===// + // Argument iterator forwarding functions (legacy, deprecated, will be removed) + // + arg_iterator abegin() { return ArgumentList.begin(); } + const_arg_iterator abegin() const { return ArgumentList.begin(); } + arg_iterator aend () { return ArgumentList.end(); } + const_arg_iterator aend () const { return ArgumentList.end(); } + + reverse_arg_iterator arbegin() { return ArgumentList.rbegin(); } + const_reverse_arg_iterator arbegin() const { return ArgumentList.rbegin(); } + reverse_arg_iterator arend () { return ArgumentList.rend(); } + const_reverse_arg_iterator arend () const { return ArgumentList.rend(); } + + size_t asize() const { return ArgumentList.size(); } + bool aempty() const { return ArgumentList.empty(); } + const Argument &afront() const { return ArgumentList.front(); } + Argument &afront() { return ArgumentList.front(); } + const Argument &aback() const { return ArgumentList.back(); } + Argument &aback() { return ArgumentList.back(); } virtual void print(std::ostream &OS) const { print(OS, 0); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.58 llvm/include/llvm/Module.h:1.59 --- llvm/include/llvm/Module.h:1.58 Sun Feb 13 13:15:01 2005 +++ llvm/include/llvm/Module.h Mon Mar 14 17:49:40 2005 @@ -52,10 +52,14 @@ typedef SetVector LibraryListType; // Global Variable iterators... - typedef GlobalListType::iterator giterator; - typedef GlobalListType::const_iterator const_giterator; - typedef std::reverse_iterator reverse_giterator; - typedef std::reverse_iterator const_reverse_giterator; + typedef GlobalListType::iterator global_iterator; + typedef GlobalListType::const_iterator const_global_iterator; + typedef std::reverse_iterator reverse_global_iterator; + typedef std::reverse_iterator const_reverse_global_iterator; + typedef global_iterator giterator; // these are legacy, deprecated + typedef const_global_iterator const_giterator; + typedef reverse_global_iterator reverse_giterator; + typedef const_reverse_global_iterator const_reverse_giterator; // Function iterators... typedef FunctionListType::iterator iterator; @@ -188,22 +192,43 @@ // Module iterator forwarding functions // // Globals list interface - inline giterator gbegin() { return GlobalList.begin(); } - inline const_giterator gbegin() const { return GlobalList.begin(); } - inline giterator gend () { return GlobalList.end(); } - inline const_giterator gend () const { return GlobalList.end(); } - - inline reverse_giterator grbegin() { return GlobalList.rbegin(); } - inline const_reverse_giterator grbegin() const { return GlobalList.rbegin(); } - inline reverse_giterator grend () { return GlobalList.rend(); } - inline const_reverse_giterator grend () const { return GlobalList.rend(); } - - inline size_t gsize() const { return GlobalList.size(); } - inline bool gempty() const { return GlobalList.empty(); } - inline const GlobalVariable &gfront() const { return GlobalList.front(); } - inline GlobalVariable &gfront() { return GlobalList.front(); } - inline const GlobalVariable &gback() const { return GlobalList.back(); } - inline GlobalVariable &gback() { return GlobalList.back(); } + inline global_iterator global_begin() { return GlobalList.begin(); } + inline const_global_iterator global_begin() const { return GlobalList.begin(); } + inline global_iterator global_end () { return GlobalList.end(); } + inline const_global_iterator global_end () const { return GlobalList.end(); } + + inline reverse_global_iterator global_rbegin() { return GlobalList.rbegin(); } + inline const_reverse_global_iterator global_rbegin() const { return GlobalList.rbegin(); } + inline reverse_global_iterator global_rend () { return GlobalList.rend(); } + inline const_reverse_global_iterator global_rend () const { return GlobalList.rend(); } + + inline size_t global_size () const { return GlobalList.size(); } + inline bool global_empty() const { return GlobalList.empty(); } + inline const GlobalVariable &global_front() const { return GlobalList.front(); } + inline GlobalVariable &global_front() { return GlobalList.front(); } + inline const GlobalVariable &global_back () const { return GlobalList.back(); } + inline GlobalVariable &global_back () { return GlobalList.back(); } + + //===--------------------------------------------------------------------===// + // Module iterator forwarding functions (legacy, deprecated, will be removed) + // + // Globals list interface + inline global_iterator gbegin() { return GlobalList.begin(); } + inline const_global_iterator gbegin() const { return GlobalList.begin(); } + inline global_iterator gend () { return GlobalList.end(); } + inline const_global_iterator gend () const { return GlobalList.end(); } + + inline reverse_global_iterator grbegin() { return GlobalList.rbegin(); } + inline const_reverse_global_iterator grbegin() const { return GlobalList.rbegin(); } + inline reverse_global_iterator grend () { return GlobalList.rend(); } + inline const_reverse_global_iterator grend () const { return GlobalList.rend(); } + + inline size_t gsize() const { return GlobalList.size(); } + inline bool gempty() const { return GlobalList.empty(); } + inline const GlobalVariable &gfront() const { return GlobalList.front(); } + inline GlobalVariable &gfront() { return GlobalList.front(); } + inline const GlobalVariable &gback() const { return GlobalList.back(); } + inline GlobalVariable &gback() { return GlobalList.back(); } // FunctionList interface inline iterator begin() { return FunctionList.begin(); } From lattner at cs.uiuc.edu Mon Mar 14 18:58:25 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 18:58:25 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200503150058.j2F0wPT2018874@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.89 -> 1.90 --- Log message: Rename method, add counterpart. --- Diffs of the changes: (+8 -2) DSGraph.h | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.89 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.90 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.89 Mon Mar 14 13:22:33 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Mon Mar 14 18:58:09 2005 @@ -376,9 +376,15 @@ const DSNodeHandle &NH2, NodeMapTy &NodeMap, bool StrictChecking = true); - /// computeGlobalGraphMapping - Compute the mapping of nodes in the global + /// computeGGToGMapping - Compute the mapping of nodes in the global /// graph to nodes in this graph. - void computeGlobalGraphMapping(NodeMapTy &NodeMap); + void computeGGToGMapping(NodeMapTy &NodeMap); + + /// computeGToGGMapping - Compute the mapping of nodes in the graph to nodes + /// in the globals graph. Note that any uses of this method are probably + /// bugs, unless it is known that the globals graph has been merged into this + /// graph! + void computeGToGGMapping(NodeMapTy &NodeMap); /// cloneInto - Clone the specified DSGraph into the current graph. The From lattner at cs.uiuc.edu Mon Mar 14 18:58:30 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 18:58:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp EquivClassGraphs.cpp Message-ID: <200503150058.j2F0wULf019096@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.200 -> 1.201 EquivClassGraphs.cpp updated: 1.25 -> 1.26 --- Log message: rename method, add counterpart --- Diffs of the changes: (+16 -4) DataStructure.cpp | 18 +++++++++++++++--- EquivClassGraphs.cpp | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.200 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.201 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.200 Mon Mar 14 13:22:47 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Mar 14 18:58:16 2005 @@ -2084,9 +2084,10 @@ } -/// computeGlobalGraphMapping - Compute the mapping of nodes in the global -/// graph to nodes in this graph. -void DSGraph::computeGlobalGraphMapping(NodeMapTy &NodeMap) { +/// computeGToGGMapping - Compute the mapping of nodes in the global graph to +/// nodes in this graph. Note that any uses of this method are probably bugs, +/// unless it is known that the globals graph has been merged into this graph! +void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) { DSGraph &GG = *getGlobalsGraph(); DSScalarMap &SM = getScalarMap(); @@ -2095,3 +2096,14 @@ DSGraph::computeNodeMapping(SM[*I], GG.getNodeForValue(*I), NodeMap); } +/// computeGGToGMapping - Compute the mapping of nodes in the global graph to +/// nodes in this graph. +void DSGraph::computeGGToGMapping(NodeMapTy &NodeMap) { + DSGraph &GG = *getGlobalsGraph(); + + DSScalarMap &SM = getScalarMap(); + for (DSScalarMap::global_iterator I = SM.global_begin(), + E = SM.global_end(); I != E; ++I) + DSGraph::computeNodeMapping(GG.getNodeForValue(*I), SM[*I], NodeMap); +} + Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.25 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.26 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.25 Mon Mar 14 13:22:47 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Mon Mar 14 18:58:16 2005 @@ -49,7 +49,7 @@ continue; // Only check a graph once. DSGraph::NodeMapTy GlobalsGraphNodeMapping; - G.computeGlobalGraphMapping(GlobalsGraphNodeMapping); + G.computeGToGGMapping(GlobalsGraphNodeMapping); } } #endif From lattner at cs.uiuc.edu Mon Mar 14 19:00:43 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 19:00:43 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp PoolAllocate.cpp Message-ID: <200503150100.j2F10hkE020067@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.55 -> 1.56 PoolAllocate.cpp updated: 1.109 -> 1.110 --- Log message: rename method. --- Diffs of the changes: (+2 -2) PointerCompress.cpp | 2 +- PoolAllocate.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.55 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.56 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.55 Mon Mar 14 13:27:35 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Mon Mar 14 19:00:30 2005 @@ -1113,7 +1113,7 @@ // Map all node reachable from this global to the corresponding nodes in the // globals graph. DSGraph::NodeMapTy GlobalsGraphNodeMapping; - DSG.computeGlobalGraphMapping(GlobalsGraphNodeMapping); + DSG.computeGToGGMapping(GlobalsGraphNodeMapping); // See if there are nodes in this graph that correspond to nodes in the // globals graph, and if so, if it is compressed. Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.109 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.110 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.109 Mon Mar 14 13:27:35 2005 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Mon Mar 14 19:00:30 2005 @@ -544,7 +544,7 @@ // Map all node reachable from this global to the corresponding nodes in // the globals graph. DSGraph::NodeMapTy GlobalsGraphNodeMapping; - G.computeGlobalGraphMapping(GlobalsGraphNodeMapping); + G.computeGToGGMapping(GlobalsGraphNodeMapping); // Loop over all of the nodes which are non-escaping, adding pool-allocatable // ones to the NodesToPA vector. From lattner at cs.uiuc.edu Mon Mar 14 22:40:40 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:40:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503150440.j2F4eeTx021966@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.201 -> 1.202 --- Log message: Don't crash if computing a mapping to a node with zero size --- Diffs of the changes: (+2 -0) DataStructure.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.201 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.202 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.201 Mon Mar 14 18:58:16 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Mar 14 22:40:24 2005 @@ -2075,6 +2075,8 @@ // mapping the edges together now. int N2Idx = NH2.getOffset()-NH1.getOffset(); unsigned N2Size = N2->getSize(); + if (N2Size == 0) return; // No edges to map to. + for (unsigned i = 0, e = N1->getSize(); i < e; i += DS::PointerSize) if (unsigned(N2Idx)+i < N2Size) computeNodeMapping(N1->getLink(i), N2->getLink(N2Idx+i), NodeMap); From lattner at cs.uiuc.edu Mon Mar 14 22:46:47 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:46:47 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp PoolAllocate.cpp TransformFunctionBody.cpp Message-ID: <200503150446.j2F4kllH024156@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PointerCompress.cpp updated: 1.56 -> 1.57 PoolAllocate.cpp updated: 1.110 -> 1.111 TransformFunctionBody.cpp updated: 1.39 -> 1.40 --- Log message: switch from a* to arg_* and g* to global_* for argument/global var iterators --- Diffs of the changes: (+17 -11) PointerCompress.cpp | 11 ++++++----- PoolAllocate.cpp | 15 ++++++++++----- TransformFunctionBody.cpp | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.56 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.57 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.56 Mon Mar 14 19:00:30 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Mon Mar 14 22:46:30 2005 @@ -973,7 +973,7 @@ unsigned NumPoolArgs = FI ? FI->ArgNodes.size() : 0; for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) if (isa(CI.getOperand(i)->getType()) && i > NumPoolArgs) { - Argument *FormalArg = next(FI->F.abegin(), i-1-NumPoolArgs); + Argument *FormalArg = next(FI->F.arg_begin(), i-1-NumPoolArgs); DSGraph::computeNodeMapping(CG->getNodeForValue(FormalArg), getMappedNodeHandle(CI.getOperand(i)), @@ -1004,7 +1004,7 @@ std::vector Operands; Operands.reserve(CI.getNumOperands()-1); - Function::aiterator AI = FI->F.abegin(); + Function::arg_iterator AI = FI->F.arg_begin(); // Pass pool descriptors. for (unsigned i = 1; i != NumPoolArgs+1; ++i) @@ -1290,7 +1290,7 @@ for (unsigned i = 0; i != NumPoolArgs; ++i) ParamTypes.push_back(FTy->getParamType(i)); - Function::aiterator AI = FI.F.abegin(); + Function::arg_iterator AI = FI.F.arg_begin(); for (unsigned i = NumPoolArgs, e = FTy->getNumParams(); i != e; ++i, ++AI) if (isa(FTy->getParamType(i)) && PoolsToCompress.count(CG.getNodeForValue(AI).getNode())) { @@ -1327,8 +1327,9 @@ std::vector > RemappedArgs; // Process arguments, setting up the ValueMap for them. - Function::aiterator CI = Clone->abegin(); // Iterator over cloned fn args. - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++CI) { + Function::arg_iterator CI = Clone->arg_begin();// Iterate over cloned fn args. + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); + I != E; ++I, ++CI) { // Transfer the argument names over. CI->setName(I->getName()); Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.110 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.111 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.110 Mon Mar 14 19:00:30 2005 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Mon Mar 14 22:46:30 2005 @@ -232,7 +232,8 @@ // Mark globals and incomplete nodes as live... (this handles arguments) if (F.getName() != "main") { // All DSNodes reachable from arguments must be passed in. - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) { + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); + I != E; ++I) { DSGraph::ScalarMapTy::iterator AI = G.getScalarMap().find(I); if (AI != G.getScalarMap().end()) if (DSNode *N = AI->second.getNode()) @@ -320,7 +321,7 @@ // Set the rest of the new arguments names to be PDa and add entries to the // pool descriptors map std::map &PoolDescriptors = FI.PoolDescriptors; - Function::aiterator NI = New->abegin(); + Function::arg_iterator NI = New->arg_begin(); for (unsigned i = 0, e = FI.ArgNodes.size(); i != e; ++i, ++NI) { NI->setName("PDa"); @@ -330,7 +331,8 @@ // Map the existing arguments of the old function to the corresponding // arguments of the new function, and copy over the names. std::map ValueMap; - for (Function::aiterator I = F.abegin(); NI != New->aend(); ++I, ++NI) { + for (Function::arg_iterator I = F.arg_begin(); + NI != New->arg_end(); ++I, ++NI) { ValueMap[I] = NI; NI->setName(I->getName()); } @@ -338,8 +340,11 @@ // Populate the value map with all of the globals in the program. // FIXME: This should be unnecessary! Module &M = *F.getParent(); - for (Module::iterator I = M.begin(), E=M.end(); I!=E; ++I) ValueMap[I] = I; - for (Module::giterator I = M.gbegin(), E=M.gend(); I!=E; ++I) ValueMap[I] = I; + for (Module::iterator I = M.begin(), E=M.end(); I!=E; ++I) + ValueMap[I] = I; + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) + ValueMap[I] = I; // Perform the cloning. std::vector Returns; Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.39 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.40 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.39 Sat Mar 12 05:55:30 2005 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Mon Mar 14 22:46:30 2005 @@ -484,7 +484,7 @@ NewCallee = new CastInst(CS.getCalledValue(), PFTy, "tmp", TheCall); } - Function::aiterator FAI = CF->abegin(), E = CF->aend(); + Function::arg_iterator FAI = CF->arg_begin(), E = CF->arg_end(); CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end(); for ( ; FAI != E && AI != AE; ++FAI, ++AI) if (!isa(*AI)) From lattner at cs.uiuc.edu Mon Mar 14 22:48:48 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:48:48 -0600 Subject: [llvm-commits] CVS: llvm/docs/ProgrammersManual.html Message-ID: <200503150448.j2F4mmJU026161@apoc.cs.uiuc.edu> Changes in directory llvm/docs: ProgrammersManual.html updated: 1.77 -> 1.78 --- Log message: switch from a* to arg_* and g* to global_* for argument/global var iterators --- Diffs of the changes: (+9 -9) ProgrammersManual.html | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm/docs/ProgrammersManual.html diff -u llvm/docs/ProgrammersManual.html:1.77 llvm/docs/ProgrammersManual.html:1.78 --- llvm/docs/ProgrammersManual.html:1.77 Sun Mar 6 00:00:13 2005 +++ llvm/docs/ProgrammersManual.html Mon Mar 14 22:48:32 2005 @@ -1423,12 +1423,12 @@ is necessary to use when you need to update the list or perform a complex action that doesn't have a forwarding method.

-
  • Function::aiterator - Typedef for the argument list +
  • Function::arg_iterator - Typedef for the argument list iterator
    - Function::const_aiterator - Typedef for const_iterator.
    + Function::const_arg_iterator - Typedef for const_iterator.
    - abegin(), aend(), afront(), aback(), - asize(), aempty(), arbegin(), arend() + arg_begin(), arg_end(), arg_front(), arg_back(), + arg_size(), arg_empty()

    These are forwarding methods that make it easy to access the contents of a Function object's Argument @@ -1591,12 +1591,12 @@


      -
    • Module::giterator - Typedef for global variable list iterator
      +
    • Module::global_iterator - Typedef for global variable list iterator
      - Module::const_giterator - Typedef for const_iterator.
      + Module::const_global_iterator - Typedef for const_iterator.
      - gbegin(), gend(), gfront(), gback(), - gsize(), gempty(), grbegin(), grend() + global_begin(), global_end(), global_front(), global_back(), + global_size(), global_empty()

      These are forwarding methods that make it easy to access the contents of a Module object's Dinakar Dhurjati and Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2005/03/06 06:00:13 $ + Last modified: $Date: 2005/03/15 04:48:32 $ From lattner at cs.uiuc.edu Mon Mar 14 22:54:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:54:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/AliasAnalysisEvaluator.cpp Message-ID: <200503150454.j2F4sYZb031080@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: AliasAnalysisEvaluator.cpp updated: 1.21 -> 1.22 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+1 -1) AliasAnalysisEvaluator.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/AliasAnalysisEvaluator.cpp diff -u llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.21 llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.22 --- llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.21 Sat Jan 8 16:01:16 2005 +++ llvm/lib/Analysis/AliasAnalysisEvaluator.cpp Mon Mar 14 22:54:15 2005 @@ -102,7 +102,7 @@ std::set Pointers; std::set CallSites; - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) if (isa(I->getType())) // Add all pointer arguments Pointers.insert(I); From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp FindUsedTypes.cpp GlobalsModRef.cpp Message-ID: <200503150455.j2F4t3J2031196@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: Andersens.cpp updated: 1.10 -> 1.11 FindUsedTypes.cpp updated: 1.30 -> 1.31 GlobalsModRef.cpp updated: 1.10 -> 1.11 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+9 -9) Andersens.cpp | 14 +++++++------- FindUsedTypes.cpp | 2 +- GlobalsModRef.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) Index: llvm/lib/Analysis/IPA/Andersens.cpp diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.10 llvm/lib/Analysis/IPA/Andersens.cpp:1.11 --- llvm/lib/Analysis/IPA/Andersens.cpp:1.10 Sat Jan 8 16:01:16 2005 +++ llvm/lib/Analysis/IPA/Andersens.cpp Mon Mar 14 22:54:18 2005 @@ -433,7 +433,7 @@ ++NumObjects; // Add all the globals first. - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) { + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { ObjectNodes[I] = NumObjects++; ValueNodes[I] = NumObjects++; } @@ -449,7 +449,7 @@ VarargNodes[F] = NumObjects++; // Add nodes for all of the incoming pointer arguments. - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (isa(I->getType())) ValueNodes[I] = NumObjects++; @@ -550,7 +550,7 @@ } void Andersens::AddConstraintsForNonInternalLinkage(Function *F) { - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (isa(I->getType())) // If this is an argument of an externally accessible function, the // incoming pointer might point to anything. @@ -571,7 +571,7 @@ GraphNodes[NullPtr].addPointerTo(&GraphNodes[NullObject]); // Next, add any constraints on global variables and their initializers. - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) { + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { // Associate the address of the global object as pointing to the memory for // the global: &G = Node *Object = getObject(I); @@ -599,7 +599,7 @@ getVarargNode(F)->setValue(F); // Set up incoming argument nodes. - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (isa(I->getType())) getNodeValue(*I); @@ -620,7 +620,7 @@ // Any pointers that are passed into the function have the universal set // stored into them. - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (isa(I->getType())) { // Pointers passed into external functions could have anything stored // through them. @@ -772,7 +772,7 @@ getReturnNode(F))); } - Function::aiterator AI = F->abegin(), AE = F->aend(); + Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end(); CallSite::arg_iterator ArgI = CS.arg_begin(), ArgE = CS.arg_end(); for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI) if (isa(AI->getType())) { Index: llvm/lib/Analysis/IPA/FindUsedTypes.cpp diff -u llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.30 llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.31 --- llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.30 Sun Sep 19 23:45:09 2004 +++ llvm/lib/Analysis/IPA/FindUsedTypes.cpp Mon Mar 14 22:54:18 2005 @@ -62,7 +62,7 @@ UsedTypes.clear(); // reset if run multiple times... // Loop over global variables, incorporating their types - for (Module::const_giterator I = m.gbegin(), E = m.gend(); I != E; ++I) { + for (Module::const_global_iterator I = m.global_begin(), E = m.global_end(); I != E; ++I) { IncorporateType(I->getType()); if (I->hasInitializer()) IncorporateValue(I->getInitializer()); Index: llvm/lib/Analysis/IPA/GlobalsModRef.cpp diff -u llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.10 llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.11 --- llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.10 Fri Dec 17 11:12:24 2004 +++ llvm/lib/Analysis/IPA/GlobalsModRef.cpp Mon Mar 14 22:54:18 2005 @@ -159,7 +159,7 @@ Readers.clear(); Writers.clear(); } - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (I->hasInternalLinkage()) { if (!AnalyzeUsesOfGlobal(I, Readers, Writers)) { // Remember that we are tracking this global, and the mod/ref fns From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp AlphaISelPattern.cpp Message-ID: <200503150455.j2F4t2HT031171@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.8 -> 1.9 AlphaISelPattern.cpp updated: 1.62 -> 1.63 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+2 -2) AlphaAsmPrinter.cpp | 2 +- AlphaISelPattern.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.8 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.9 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.8 Thu Mar 10 13:02:02 2005 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Mon Mar 14 22:54:19 2005 @@ -241,7 +241,7 @@ const TargetData &TD = TM.getTargetData(); std::string CurSection; - for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (I->hasInitializer()) { // External global require no code O << "\n\n"; std::string name = Mang->getValueName(I); Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.62 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.63 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.62 Mon Mar 14 13:23:45 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Mon Mar 14 22:54:19 2005 @@ -146,7 +146,7 @@ int count = 0; - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) { SDOperand newroot, argt; if (count < 6) { From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp SparcV9AsmPrinter.cpp SparcV9RegInfo.cpp Message-ID: <200503150455.j2F4t2H9031120@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: InternalGlobalMapper.cpp updated: 1.5 -> 1.6 SparcV9AsmPrinter.cpp updated: 1.125 -> 1.126 SparcV9RegInfo.cpp updated: 1.138 -> 1.139 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+4 -4) InternalGlobalMapper.cpp | 2 +- SparcV9AsmPrinter.cpp | 2 +- SparcV9RegInfo.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp diff -u llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp:1.5 llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp:1.6 --- llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp:1.5 Mon Nov 29 18:22:59 2004 +++ llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp Mon Mar 14 22:54:20 2005 @@ -52,7 +52,7 @@ GVVectorTy gvvector; // Populate the vector with internal global values and their names. - for (Module::giterator i = M.gbegin (), e = M.gend (); i != e; ++i) + for (Module::global_iterator i = M.global_begin (), e = M.global_end (); i != e; ++i) maybeAddInternalValueToVector (gvvector, *i); // Add an extra global for _llvm_internalGlobals itself (null, // because it's not internal) Index: llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp diff -u llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.125 llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.126 --- llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.125 Thu Dec 16 10:47:03 2004 +++ llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp Mon Mar 14 22:54:20 2005 @@ -768,7 +768,7 @@ void SparcV9AsmPrinter::emitGlobals(const Module &M) { // Output global variables... - for (Module::const_giterator GI = M.gbegin(), GE = M.gend(); GI != GE; ++GI) + for (Module::const_global_iterator GI = M.global_begin(), GE = M.global_end(); GI != GE; ++GI) if (! GI->isExternal()) { assert(GI->hasInitializer()); if (GI->isConstant()) Index: llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp diff -u llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.138 llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.139 --- llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.138 Tue Aug 24 01:41:40 2004 +++ llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp Mon Mar 14 22:54:20 2005 @@ -374,7 +374,7 @@ // Count the arguments, *ignoring* whether they are int or FP args. // Use this common arg numbering to pick the right int or fp register. unsigned argNo=0; - for(Function::const_aiterator I = Meth->abegin(), E = Meth->aend(); + for(Function::const_arg_iterator I = Meth->arg_begin(), E = Meth->arg_end(); I != E; ++I, ++argNo) { LiveRange *LR = LRI.getLiveRangeForValue(I); assert(LR && "No live range found for method arg"); @@ -410,7 +410,7 @@ // for each argument // for each argument. count INT and FP arguments separately. unsigned argNo=0, intArgNo=0, fpArgNo=0; - for(Function::const_aiterator I = Meth->abegin(), E = Meth->aend(); + for(Function::const_arg_iterator I = Meth->arg_begin(), E = Meth->arg_end(); I != E; ++I, ++argNo) { // get the LR of arg LiveRange *LR = LRI.getLiveRangeForValue(I); From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Mangler.cpp Module.cpp Verifier.cpp Message-ID: <200503150455.j2F4t30K031179@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.173 -> 1.174 Mangler.cpp updated: 1.15 -> 1.16 Module.cpp updated: 1.59 -> 1.60 Verifier.cpp updated: 1.127 -> 1.128 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+10 -10) AsmWriter.cpp | 12 ++++++------ Mangler.cpp | 2 +- Module.cpp | 2 +- Verifier.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.173 llvm/lib/VMCore/AsmWriter.cpp:1.174 --- llvm/lib/VMCore/AsmWriter.cpp:1.173 Wed Mar 2 17:17:31 2005 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Mar 14 22:54:21 2005 @@ -801,7 +801,7 @@ // Loop over the symbol table, emitting all named constants. printSymbolTable(M->getSymbolTable()); - for (Module::const_giterator I = M->gbegin(), E = M->gend(); I != E; ++I) + for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) printGlobal(I); Out << "\nimplementation ; Functions:\n"; @@ -926,7 +926,7 @@ // Loop over the arguments, printing them... const FunctionType *FT = F->getFunctionType(); - for(Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for(Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) printArgument(I); // Finish printing arguments... @@ -956,7 +956,7 @@ /// void AssemblyWriter::printArgument(const Argument *Arg) { // Insert commas as we go... the first arg doesn't get a comma - if (Arg != &Arg->getParent()->afront()) Out << ", "; + if (Arg != &Arg->getParent()->arg_front()) Out << ", "; // Output type... printType(Arg->getType()); @@ -1361,7 +1361,7 @@ SC_DEBUG("begin processModule!\n"); // Add all of the global variables to the value table... - for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend(); + for (Module::const_global_iterator I = TheModule->global_begin(), E = TheModule->global_end(); I != E; ++I) createSlot(I); @@ -1379,8 +1379,8 @@ SC_DEBUG("begin processFunction!\n"); // Add all the function arguments - for(Function::const_aiterator AI = TheFunction->abegin(), - AE = TheFunction->aend(); AI != AE; ++AI) + for(Function::const_arg_iterator AI = TheFunction->arg_begin(), + AE = TheFunction->arg_end(); AI != AE; ++AI) createSlot(AI); SC_DEBUG("Inserting Instructions:\n"); Index: llvm/lib/VMCore/Mangler.cpp diff -u llvm/lib/VMCore/Mangler.cpp:1.15 llvm/lib/VMCore/Mangler.cpp:1.16 --- llvm/lib/VMCore/Mangler.cpp:1.15 Wed Sep 1 17:55:37 2004 +++ llvm/lib/VMCore/Mangler.cpp Mon Mar 14 22:54:21 2005 @@ -121,6 +121,6 @@ std::map Names; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) InsertName(I, Names); - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) InsertName(I, Names); } Index: llvm/lib/VMCore/Module.cpp diff -u llvm/lib/VMCore/Module.cpp:1.59 llvm/lib/VMCore/Module.cpp:1.60 --- llvm/lib/VMCore/Module.cpp:1.59 Sat Jan 29 18:08:49 2005 +++ llvm/lib/VMCore/Module.cpp Mon Mar 14 22:54:21 2005 @@ -286,7 +286,7 @@ for(Module::iterator I = begin(), E = end(); I != E; ++I) I->dropAllReferences(); - for(Module::giterator I = gbegin(), E = gend(); I != E; ++I) + for(Module::global_iterator I = global_begin(), E = global_end(); I != E; ++I) I->dropAllReferences(); } Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.127 llvm/lib/VMCore/Verifier.cpp:1.128 --- llvm/lib/VMCore/Verifier.cpp:1.127 Mon Feb 28 13:27:42 2005 +++ llvm/lib/VMCore/Verifier.cpp Mon Mar 14 22:54:21 2005 @@ -127,7 +127,7 @@ if (I->isExternal()) visitFunction(*I); } - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) visitGlobalVariable(*I); // If the module is broken, abort at this time. @@ -307,7 +307,7 @@ // Check that the argument values match the function type for this function... unsigned i = 0; - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I, ++i) { + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++i) { Assert2(I->getType() == FT->getParamType(i), "Argument value does not match function argument type!", I, FT->getParamType(i)); From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200503150455.j2F4t3KG031188@apoc.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.215 -> 1.216 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+6 -6) llvmAsmParser.y | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.215 llvm/lib/AsmParser/llvmAsmParser.y:1.216 --- llvm/lib/AsmParser/llvmAsmParser.y:1.215 Sat Mar 5 13:04:07 2005 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Mar 14 22:54:18 2005 @@ -759,7 +759,7 @@ // Check to see if they called va_start but not va_arg.. if (!ObsoleteVarArgs) if (Function *F = Result->getNamedFunction("llvm.va_start")) - if (F->asize() == 1) { + if (F->arg_size() == 1) { std::cerr << "WARNING: this file uses obsolete features. " << "Assemble and disassemble to update it.\n"; ObsoleteVarArgs = true; @@ -769,7 +769,7 @@ // If the user is making use of obsolete varargs intrinsics, adjust them for // the user. if (Function *F = Result->getNamedFunction("llvm.va_start")) { - assert(F->asize() == 1 && "Obsolete va_start takes 1 argument!"); + assert(F->arg_size() == 1 && "Obsolete va_start takes 1 argument!"); const Type *RetTy = F->getFunctionType()->getParamType(0); RetTy = cast(RetTy)->getElementType(); @@ -785,7 +785,7 @@ } if (Function *F = Result->getNamedFunction("llvm.va_end")) { - assert(F->asize() == 1 && "Obsolete va_end takes 1 argument!"); + assert(F->arg_size() == 1 && "Obsolete va_end takes 1 argument!"); const Type *ArgTy = F->getFunctionType()->getParamType(0); ArgTy = cast(ArgTy)->getElementType(); Function *NF = Result->getOrInsertFunction("llvm.va_end", Type::VoidTy, @@ -801,7 +801,7 @@ } if (Function *F = Result->getNamedFunction("llvm.va_copy")) { - assert(F->asize() == 2 && "Obsolete va_copy takes 2 argument!"); + assert(F->arg_size() == 2 && "Obsolete va_copy takes 2 argument!"); const Type *ArgTy = F->getFunctionType()->getParamType(0); ArgTy = cast(ArgTy)->getElementType(); Function *NF = Result->getOrInsertFunction("llvm.va_copy", ArgTy, @@ -1623,7 +1623,7 @@ // Make sure to strip off any argument names so we can't get conflicts. if (Fn->isExternal()) - for (Function::aiterator AI = Fn->abegin(), AE = Fn->aend(); + for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) AI->setName(""); @@ -1643,7 +1643,7 @@ delete $4->back().first; $4->pop_back(); // Delete the last entry } - Function::aiterator ArgIt = Fn->abegin(); + Function::arg_iterator ArgIt = Fn->arg_begin(); for (std::vector >::iterator I =$4->begin(); I != $4->end(); ++I, ++ArgIt) { delete I->first; // Delete the typeholder... From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Message-ID: <200503150455.j2F4t2CF031176@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.135 -> 1.136 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+3 -3) Execution.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.135 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.136 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.135 Sat Jan 8 14:05:34 2005 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Mon Mar 14 22:54:19 2005 @@ -1065,13 +1065,13 @@ StackFrame.CurInst = StackFrame.CurBB->begin(); // Run through the function arguments and initialize their values... - assert((ArgVals.size() == F->asize() || - (ArgVals.size() > F->asize() && F->getFunctionType()->isVarArg())) && + assert((ArgVals.size() == F->arg_size() || + (ArgVals.size() > F->arg_size() && F->getFunctionType()->isVarArg())) && "Invalid number of values passed to function invocation!"); // Handle non-varargs arguments... unsigned i = 0; - for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI, ++i) + for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI, ++i) SetValue(AI, ArgVals[i], StackFrame); // Handle varargs arguments... From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/CloneFunction.cpp CloneModule.cpp CodeExtractor.cpp InlineFunction.cpp Message-ID: <200503150455.j2F4t2Rv031150@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: CloneFunction.cpp updated: 1.23 -> 1.24 CloneModule.cpp updated: 1.10 -> 1.11 CodeExtractor.cpp updated: 1.36 -> 1.37 InlineFunction.cpp updated: 1.29 -> 1.30 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+15 -15) CloneFunction.cpp | 8 ++++---- CloneModule.cpp | 8 ++++---- CodeExtractor.cpp | 8 ++++---- InlineFunction.cpp | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) Index: llvm/lib/Transforms/Utils/CloneFunction.cpp diff -u llvm/lib/Transforms/Utils/CloneFunction.cpp:1.23 llvm/lib/Transforms/Utils/CloneFunction.cpp:1.24 --- llvm/lib/Transforms/Utils/CloneFunction.cpp:1.23 Thu Jul 29 12:24:20 2004 +++ llvm/lib/Transforms/Utils/CloneFunction.cpp Mon Mar 14 22:54:21 2005 @@ -49,7 +49,7 @@ assert(NameSuffix && "NameSuffix cannot be null!"); #ifndef NDEBUG - for (Function::const_aiterator I = OldFunc->abegin(), E = OldFunc->aend(); + for (Function::const_arg_iterator I = OldFunc->arg_begin(), E = OldFunc->arg_end(); I != E; ++I) assert(ValueMap.count(I) && "No mapping from source argument specified!"); #endif @@ -95,7 +95,7 @@ // The user might be deleting arguments to the function by specifying them in // the ValueMap. If so, we need to not add the arguments to the arg ty vector // - for (Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (ValueMap.count(I) == 0) // Haven't mapped the argument to anything yet? ArgTypes.push_back(I->getType()); @@ -107,8 +107,8 @@ Function *NewF = new Function(FTy, F->getLinkage(), F->getName()); // Loop over the arguments, copying the names of the mapped arguments over... - Function::aiterator DestI = NewF->abegin(); - for (Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + Function::arg_iterator DestI = NewF->arg_begin(); + for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (ValueMap.count(I) == 0) { // Is this argument preserved? DestI->setName(I->getName()); // Copy the name over... ValueMap[I] = DestI++; // Add mapping to ValueMap Index: llvm/lib/Transforms/Utils/CloneModule.cpp diff -u llvm/lib/Transforms/Utils/CloneModule.cpp:1.10 llvm/lib/Transforms/Utils/CloneModule.cpp:1.11 --- llvm/lib/Transforms/Utils/CloneModule.cpp:1.10 Tue May 25 03:51:47 2004 +++ llvm/lib/Transforms/Utils/CloneModule.cpp Mon Mar 14 22:54:21 2005 @@ -47,7 +47,7 @@ // new module. Here we add them to the ValueMap and to the new Module. We // don't worry about attributes or initializers, they will come later. // - for (Module::const_giterator I = M->gbegin(), E = M->gend(); I != E; ++I) + for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) ValueMap[I] = new GlobalVariable(I->getType()->getElementType(), false, GlobalValue::ExternalLinkage, 0, I->getName(), New); @@ -61,7 +61,7 @@ // have been created, loop through and copy the global variable referrers // over... We also set the attributes on the global now. // - for (Module::const_giterator I = M->gbegin(), E = M->gend(); I != E; ++I) { + for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) { GlobalVariable *GV = cast(ValueMap[I]); if (I->hasInitializer()) GV->setInitializer(cast(MapValue(I->getInitializer(), @@ -74,8 +74,8 @@ for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) { Function *F = cast(ValueMap[I]); if (!I->isExternal()) { - Function::aiterator DestI = F->abegin(); - for (Function::const_aiterator J = I->abegin(); J != I->aend(); ++J) { + Function::arg_iterator DestI = F->arg_begin(); + for (Function::const_arg_iterator J = I->arg_begin(); J != I->arg_end(); ++J) { DestI->setName(J->getName()); ValueMap[J] = DestI++; } Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.36 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.37 --- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.36 Fri Jan 28 18:38:26 2005 +++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Mon Mar 14 22:54:21 2005 @@ -295,7 +295,7 @@ newFunction->getBasicBlockList().push_back(newRootNode); // Create an iterator to name all of the arguments we inserted. - Function::aiterator AI = newFunction->abegin(); + Function::arg_iterator AI = newFunction->arg_begin(); // Rewrite all users of the inputs in the extracted region to use the // arguments (or appropriate addressing into struct) instead. @@ -322,7 +322,7 @@ // Set names for input and output arguments. if (!AggregateArgs) { - AI = newFunction->abegin(); + AI = newFunction->arg_begin(); for (unsigned i = 0, e = inputs.size(); i != e; ++i, ++AI) AI->setName(inputs[i]->getName()); for (unsigned i = 0, e = outputs.size(); i != e; ++i, ++AI) @@ -406,7 +406,7 @@ NumExitBlocks > 1 ? "targetBlock" : ""); codeReplacer->getInstList().push_back(call); - Function::aiterator OutputArgBegin = newFunction->abegin(); + Function::arg_iterator OutputArgBegin = newFunction->arg_begin(); unsigned FirstOut = inputs.size(); if (!AggregateArgs) std::advance(OutputArgBegin, inputs.size()); @@ -483,7 +483,7 @@ OldTarget); // Restore values just before we exit - Function::aiterator OAI = OutputArgBegin; + Function::arg_iterator OAI = OutputArgBegin; for (unsigned out = 0, e = outputs.size(); out != e; ++out) { // For an invoke, the normal destination is the only one that is // dominated by the result of the invocation Index: llvm/lib/Transforms/Utils/InlineFunction.cpp diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.29 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.30 --- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.29 Sat Dec 11 10:59:54 2004 +++ llvm/lib/Transforms/Utils/InlineFunction.cpp Mon Mar 14 22:54:21 2005 @@ -60,13 +60,13 @@ { // Scope to destroy ValueMap after cloning. // Calculate the vector of arguments to pass into the function cloner... std::map ValueMap; - assert(std::distance(CalledFunc->abegin(), CalledFunc->aend()) == + assert(std::distance(CalledFunc->arg_begin(), CalledFunc->arg_end()) == std::distance(CS.arg_begin(), CS.arg_end()) && "No varargs calls can be inlined!"); CallSite::arg_iterator AI = CS.arg_begin(); - for (Function::const_aiterator I = CalledFunc->abegin(), - E = CalledFunc->aend(); I != E; ++I, ++AI) + for (Function::const_arg_iterator I = CalledFunc->arg_begin(), + E = CalledFunc->arg_end(); I != E; ++I, ++AI) ValueMap[I] = *AI; // Clone the entire body of the callee into the caller. From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp LinkModules.cpp Message-ID: <200503150455.j2F4t270031145@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.46 -> 1.47 LinkModules.cpp updated: 1.103 -> 1.104 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+8 -8) LinkArchives.cpp | 4 ++-- LinkModules.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.46 llvm/lib/Linker/LinkArchives.cpp:1.47 --- llvm/lib/Linker/LinkArchives.cpp:1.46 Sun Feb 13 11:50:16 2005 +++ llvm/lib/Linker/LinkArchives.cpp Mon Mar 14 22:54:19 2005 @@ -33,7 +33,7 @@ for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage()) DefinedSymbols.insert(I->getName()); - for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage()) DefinedSymbols.insert(I->getName()); } @@ -62,7 +62,7 @@ else if (!I->hasInternalLinkage()) DefinedSymbols.insert(I->getName()); } - for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) if (I->hasName()) { if (I->isExternal()) UndefinedSymbols.insert(I->getName()); Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.103 llvm/lib/Linker/LinkModules.cpp:1.104 --- llvm/lib/Linker/LinkModules.cpp:1.103 Sat Feb 19 11:52:37 2005 +++ llvm/lib/Linker/LinkModules.cpp Mon Mar 14 22:54:19 2005 @@ -425,7 +425,7 @@ SymbolTable *ST = (SymbolTable*)&Dest->getSymbolTable(); // Loop over all of the globals in the src module, mapping them over as we go - for (Module::giterator I = Src->gbegin(), E = Src->gend(); I != E; ++I) { + for (Module::global_iterator I = Src->global_begin(), E = Src->global_end(); I != E; ++I) { GlobalVariable *SGV = I; GlobalVariable *DGV = 0; // Check to see if may have to link the global. @@ -533,7 +533,7 @@ std::string *Err) { // Loop over all of the globals in the src module, mapping them over as we go - for (Module::const_giterator I = Src->gbegin(), E = Src->gend(); I != E; ++I){ + for (Module::const_global_iterator I = Src->global_begin(), E = Src->global_end(); I != E; ++I){ const GlobalVariable *SGV = I; if (SGV->hasInitializer()) { // Only process initialized GV's @@ -656,8 +656,8 @@ assert(Src && Dest && Dest->isExternal() && !Src->isExternal()); // Go through and convert function arguments over, remembering the mapping. - Function::aiterator DI = Dest->abegin(); - for (Function::aiterator I = Src->abegin(), E = Src->aend(); + Function::arg_iterator DI = Dest->arg_begin(); + for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end(); I != E; ++I, ++DI) { DI->setName(I->getName()); // Copy the name information over... @@ -681,7 +681,7 @@ *OI = RemapOperand(*OI, GlobalMap); // There is no need to map the arguments anymore. - for (Function::aiterator I = Src->abegin(), E = Src->aend(); I != E; ++I) + for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end(); I != E; ++I) GlobalMap.erase(I); return false; @@ -854,7 +854,7 @@ // it's functionality here. std::map GlobalsByName; - for (Module::giterator I = Dest->gbegin(), E = Dest->gend(); I != E; ++I) { + for (Module::global_iterator I = Dest->global_begin(), E = Dest->global_end(); I != E; ++I) { // Add all of the appending globals already in the Dest module to // AppendingVars. if (I->hasAppendingLinkage()) From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp PPC64ISelSimple.cpp PowerPCAsmPrinter.cpp Message-ID: <200503150455.j2F4t3ai031216@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC32ISelSimple.cpp updated: 1.122 -> 1.123 PPC64ISelSimple.cpp updated: 1.16 -> 1.17 PowerPCAsmPrinter.cpp updated: 1.71 -> 1.72 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+7 -7) PPC32ISelSimple.cpp | 2 +- PPC64ISelSimple.cpp | 2 +- PowerPCAsmPrinter.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.122 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.123 --- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.122 Tue Mar 8 16:53:09 2005 +++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp Mon Mar 14 22:54:19 2005 @@ -734,7 +734,7 @@ MachineFrameInfo *MFI = F->getFrameInfo(); - for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) { + for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I) { bool ArgLive = !I->use_empty(); unsigned Reg = ArgLive ? getReg(*I) : 0; int FI; // Frame object index Index: llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp diff -u llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.16 llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.17 --- llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.16 Thu Oct 7 17:30:03 2004 +++ llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp Mon Mar 14 22:54:19 2005 @@ -590,7 +590,7 @@ MachineFrameInfo *MFI = F->getFrameInfo(); - for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) { + for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I) { bool ArgLive = !I->use_empty(); unsigned Reg = ArgLive ? getReg(*I) : 0; int FI; // Frame object index Index: llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.71 llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.72 --- llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.71 Sun Dec 12 14:36:19 2004 +++ llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp Mon Mar 14 22:54:19 2005 @@ -459,7 +459,7 @@ std::string CurSection; // Print out module-level global variables here. - for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (I->hasInitializer()) { // External global require no code O << '\n'; std::string name = Mang->getValueName(I); @@ -646,7 +646,7 @@ << "\t.csect .text[PR]\n"; // Print out module-level global variables - for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) { + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { if (!I->hasInitializer()) continue; @@ -664,8 +664,8 @@ } // Output labels for globals - if (M.gbegin() != M.gend()) O << "\t.toc\n"; - for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) { + if (M.global_begin() != M.global_end()) O << "\t.toc\n"; + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { const GlobalVariable *GV = I; // Do not output labels for unused variables if (GV->isExternal() && GV->use_begin() == GV->use_end()) @@ -687,7 +687,7 @@ bool AIXAsmPrinter::doFinalization(Module &M) { const TargetData &TD = TM.getTargetData(); // Print out module-level global variables - for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) { + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { if (I->hasInitializer() || I->hasExternalLinkage()) continue; From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp DataStructureOpt.cpp EquivClassGraphs.cpp Local.cpp Steensgaard.cpp Message-ID: <200503150455.j2F4t2B8031129@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.202 -> 1.203 DataStructureOpt.cpp updated: 1.9 -> 1.10 EquivClassGraphs.cpp updated: 1.26 -> 1.27 Local.cpp updated: 1.125 -> 1.126 Steensgaard.cpp updated: 1.45 -> 1.46 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+10 -10) DataStructure.cpp | 8 ++++---- DataStructureOpt.cpp | 2 +- EquivClassGraphs.cpp | 4 ++-- Local.cpp | 4 ++-- Steensgaard.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.202 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.203 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.202 Mon Mar 14 22:40:24 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Mar 14 22:54:18 2005 @@ -1270,7 +1270,7 @@ 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) + for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI) if (isPointerType(AI->getType())) { Args.push_back(getNodeForValue(AI)); assert(!Args.back().isNull() && "Pointer argument w/o scalarmap entry!?"); @@ -1405,7 +1405,7 @@ DSCallSite DSGraph::getCallSiteForArguments(Function &F) const { std::vector Args; - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) if (isPointerType(I->getType())) Args.push_back(getNodeForValue(I)); @@ -1482,7 +1482,7 @@ for (ReturnNodesTy::iterator FI = ReturnNodes.begin(), E =ReturnNodes.end(); FI != E; ++FI) { Function &F = *FI->first; - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) if (isPointerType(I->getType())) markIncompleteNode(getNodeForValue(I).getNode()); markIncompleteNode(FI->second.getNode()); @@ -2038,7 +2038,7 @@ E = ReturnNodes.end(); RI != E; ++RI) { Function &F = *RI->first; - for (Function::aiterator AI = F.abegin(); AI != F.aend(); ++AI) + for (Function::arg_iterator AI = F.arg_begin(); AI != F.arg_end(); ++AI) if (isPointerType(AI->getType())) assert(!getNodeForValue(AI).isNull() && "Pointer argument must be in the scalar map!"); Index: llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.9 llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.10 --- llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.9 Sun Jan 9 14:42:52 2005 +++ llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp Mon Mar 14 22:54:18 2005 @@ -59,7 +59,7 @@ const DSGraph::ScalarMapTy &SM = GG.getScalarMap(); bool Changed = false; - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (!I->isExternal()) { // Loop over all of the non-external globals... // Look up the node corresponding to this global, if it exists. DSNode *GNode = 0; Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.26 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.27 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.26 Mon Mar 14 18:58:16 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Mon Mar 14 22:54:18 2005 @@ -215,7 +215,7 @@ // Record the argument nodes for use in merging later below. std::vector ArgNodes; - for (Function::aiterator AI1 = LF->abegin(); AI1 != LF->aend(); ++AI1) + for (Function::arg_iterator AI1 = LF->arg_begin(); AI1 != LF->arg_end(); ++AI1) if (DS::isPointerType(AI1->getType())) ArgNodes.push_back(MergedG.getNodeForValue(AI1)); @@ -254,7 +254,7 @@ // Merge the function arguments with all argument nodes found so far. // If there are extra function args, add them to the vector of argNodes - Function::aiterator AI2 = F->abegin(), AI2end = F->aend(); + Function::arg_iterator AI2 = F->arg_begin(), AI2end = F->arg_end(); for (unsigned arg=0, numArgs = ArgNodes.size(); arg != numArgs && AI2 != AI2end; ++AI2, ++arg) if (DS::isPointerType(AI2->getType())) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.125 llvm/lib/Analysis/DataStructure/Local.cpp:1.126 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.125 Sat Mar 5 13:04:31 2005 +++ llvm/lib/Analysis/DataStructure/Local.cpp Mon Mar 14 22:54:18 2005 @@ -82,7 +82,7 @@ FunctionCalls(&fc) { // Create scalar nodes for all pointer arguments... - for (Function::aiterator I = f.abegin(), E = f.aend(); I != E; ++I) + for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end(); I != E; ++I) if (isPointerType(I->getType())) getValueDest(*I); @@ -1076,7 +1076,7 @@ GraphBuilder GGB(*GlobalsGraph); // Add initializers for all of the globals to the globals graph... - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (!I->isExternal()) GGB.mergeInGlobalInitializer(I); } Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.45 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.46 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.45 Sun Jan 30 17:51:02 2005 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Mon Mar 14 22:54:18 2005 @@ -94,7 +94,7 @@ // Loop over all pointer arguments, resolving them to their provided pointers unsigned PtrArgIdx = 0; - for (Function::aiterator AI = F->abegin(), AE = F->aend(); + for (Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end(); AI != AE && PtrArgIdx < Call.getNumPtrArgs(); ++AI) { DSGraph::ScalarMapTy::iterator I = ValMap.find(AI); if (I != ValMap.end()) // If its a pointer argument... From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp X86ISelPattern.cpp X86ISelSimple.cpp Message-ID: <200503150455.j2F4t31a031207@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.133 -> 1.134 X86ISelPattern.cpp updated: 1.90 -> 1.91 X86ISelSimple.cpp updated: 1.308 -> 1.309 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+3 -3) X86AsmPrinter.cpp | 2 +- X86ISelPattern.cpp | 2 +- X86ISelSimple.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.133 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.134 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.133 Tue Mar 8 11:02:05 2005 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Mar 14 22:54:20 2005 @@ -123,7 +123,7 @@ std::string CurSection; // Print out module-level global variables here. - for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (I->hasInitializer()) { // External global require no code O << "\n\n"; std::string name = Mang->getValueName(I); Index: llvm/lib/Target/X86/X86ISelPattern.cpp diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.90 llvm/lib/Target/X86/X86ISelPattern.cpp:1.91 --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.90 Tue Feb 22 23:57:21 2005 +++ llvm/lib/Target/X86/X86ISelPattern.cpp Mon Mar 14 22:54:20 2005 @@ -117,7 +117,7 @@ MachineFrameInfo *MFI = MF.getFrameInfo(); unsigned ArgOffset = 0; // Frame mechanisms handle retaddr slot - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) { + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) { MVT::ValueType ObjectVT = getValueType(I->getType()); unsigned ArgIncrement = 4; unsigned ObjSize; Index: llvm/lib/Target/X86/X86ISelSimple.cpp diff -u llvm/lib/Target/X86/X86ISelSimple.cpp:1.308 llvm/lib/Target/X86/X86ISelSimple.cpp:1.309 --- llvm/lib/Target/X86/X86ISelSimple.cpp:1.308 Sat Jan 8 19:49:29 2005 +++ llvm/lib/Target/X86/X86ISelSimple.cpp Mon Mar 14 22:54:20 2005 @@ -618,7 +618,7 @@ unsigned ArgOffset = 0; // Frame mechanisms handle retaddr slot MachineFrameInfo *MFI = F->getFrameInfo(); - for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) { + for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I) { bool ArgLive = !I->use_empty(); unsigned Reg = ArgLive ? getReg(*I) : 0; int FI; // Frame object index From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp SparcV8ISelSimple.cpp Message-ID: <200503150455.j2F4t2HT031124@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV8: SparcV8AsmPrinter.cpp updated: 1.30 -> 1.31 SparcV8ISelSimple.cpp updated: 1.88 -> 1.89 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+3 -3) SparcV8AsmPrinter.cpp | 2 +- SparcV8ISelSimple.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp diff -u llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp:1.30 llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp:1.31 --- llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp:1.30 Thu Dec 9 12:51:01 2004 +++ llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp Mon Mar 14 22:54:20 2005 @@ -580,7 +580,7 @@ std::string CurSection; // Print out module-level global variables here. - for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (I->hasInitializer()) { // External global require no code O << "\n\n"; std::string name = Mang->getValueName(I); Index: llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp diff -u llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp:1.88 llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp:1.89 --- llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp:1.88 Sat Jan 1 10:06:57 2005 +++ llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp Mon Mar 14 22:54:20 2005 @@ -335,7 +335,7 @@ // Add IMPLICIT_DEFs of input regs. unsigned ArgNo = 0; - for (Function::aiterator I = LF->abegin(), E = LF->aend(); + for (Function::arg_iterator I = LF->arg_begin(), E = LF->arg_end(); I != E && ArgNo < 6; ++I, ++ArgNo) { switch (getClassB(I->getType())) { case cByte: @@ -382,7 +382,7 @@ } // Copy args out of their incoming hard regs or stack slots into virtual regs. - for (Function::aiterator I = LF->abegin(), E = LF->aend(); I != E; ++I) { + for (Function::arg_iterator I = LF->arg_begin(), E = LF->arg_end(); I != E; ++I) { Argument &A = *I; unsigned ArgReg = getReg (A); if (getClassB (A.getType ()) < cLong) { From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200503150455.j2F4t2U5031183@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.230 -> 1.231 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+13 -13) Writer.cpp | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.230 llvm/lib/Target/CBackend/Writer.cpp:1.231 --- llvm/lib/Target/CBackend/Writer.cpp:1.230 Tue Mar 8 10:19:59 2005 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Mar 14 22:54:19 2005 @@ -851,9 +851,9 @@ printModuleTypes(M.getSymbolTable()); // Global variable declarations... - if (!M.gempty()) { + if (!M.global_empty()) { Out << "\n/* External Global Variable Declarations */\n"; - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) { + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { if (I->hasExternalLinkage()) { Out << "extern "; printType(Out, I->getType()->getElementType(), Mang->getValueName(I)); @@ -878,9 +878,9 @@ } // Output the global variable declarations - if (!M.gempty()) { + if (!M.global_empty()) { Out << "\n\n/* Global Variable Declarations */\n"; - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (!I->isExternal()) { if (I->hasInternalLinkage()) Out << "static "; @@ -897,9 +897,9 @@ } // Output the global variable definitions and contents... - if (!M.gempty()) { + if (!M.global_empty()) { Out << "\n\n/* Global Variable Definitions and Initialization */\n"; - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (!I->isExternal()) { if (I->hasInternalLinkage()) Out << "static "; @@ -1075,12 +1075,12 @@ FunctionInnards << Mang->getValueName(F) << '('; if (!F->isExternal()) { - if (!F->aempty()) { + if (!F->arg_empty()) { std::string ArgName; - if (F->abegin()->hasName() || !Prototype) - ArgName = Mang->getValueName(F->abegin()); - printType(FunctionInnards, F->afront().getType(), ArgName); - for (Function::const_aiterator I = ++F->abegin(), E = F->aend(); + if (F->arg_begin()->hasName() || !Prototype) + ArgName = Mang->getValueName(F->arg_begin()); + printType(FunctionInnards, F->arg_front().getType(), ArgName); + for (Function::const_arg_iterator I = ++F->arg_begin(), E = F->arg_end(); I != E; ++I) { FunctionInnards << ", "; if (I->hasName() || !Prototype) @@ -1466,13 +1466,13 @@ Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", "; // Output the last argument to the enclosing function... - if (I.getParent()->getParent()->aempty()) { + if (I.getParent()->getParent()->arg_empty()) { std::cerr << "The C backend does not currently support zero " << "argument varargs functions, such as '" << I.getParent()->getParent()->getName() << "'!\n"; abort(); } - writeOperand(&I.getParent()->getParent()->aback()); + writeOperand(&I.getParent()->getParent()->arg_back()); Out << ')'; return; case Intrinsic::vaend: From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp GCSE.cpp Reassociate.cpp SCCP.cpp TailRecursionElimination.cpp Message-ID: <200503150455.j2F4t34N031267@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.27 -> 1.28 GCSE.cpp updated: 1.44 -> 1.45 Reassociate.cpp updated: 1.34 -> 1.35 SCCP.cpp updated: 1.120 -> 1.121 TailRecursionElimination.cpp updated: 1.14 -> 1.15 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+10 -10) CorrelatedExprs.cpp | 2 +- GCSE.cpp | 2 +- Reassociate.cpp | 2 +- SCCP.cpp | 10 +++++----- TailRecursionElimination.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.27 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.28 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.27 Mon Jan 31 19:23:49 2005 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Mon Mar 14 22:54:21 2005 @@ -757,7 +757,7 @@ unsigned Rank = 1; // Skip rank zero. // Number the arguments... - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) RankMap[I] = Rank++; // Number the instructions in reverse post order... Index: llvm/lib/Transforms/Scalar/GCSE.cpp diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.44 llvm/lib/Transforms/Scalar/GCSE.cpp:1.45 --- llvm/lib/Transforms/Scalar/GCSE.cpp:1.44 Sun Dec 12 12:23:20 2004 +++ llvm/lib/Transforms/Scalar/GCSE.cpp Mon Mar 14 22:54:21 2005 @@ -73,7 +73,7 @@ // Check for value numbers of arguments. If the value numbering // implementation can prove that an incoming argument is a constant or global // value address, substitute it, making the argument dead. - for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI) + for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI) if (!AI->use_empty()) { VN.getEqualNumberNodes(AI, EqualValues); if (!EqualValues.empty()) { Index: llvm/lib/Transforms/Scalar/Reassociate.cpp diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.34 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.35 --- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.34 Wed Sep 1 17:55:36 2004 +++ llvm/lib/Transforms/Scalar/Reassociate.cpp Mon Mar 14 22:54:21 2005 @@ -66,7 +66,7 @@ unsigned i = 2; // Assign distinct ranks to function arguments - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) ValueRankMap[I] = ++i; ReversePostOrderTraversal RPOT(&F); Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.120 llvm/lib/Transforms/Scalar/SCCP.cpp:1.121 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.120 Sat Jan 8 13:34:41 2005 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Mar 14 22:54:21 2005 @@ -865,7 +865,7 @@ MarkBlockExecutable(F->begin()); CallSite::arg_iterator CAI = CS.arg_begin(); - for (Function::aiterator AI = F->abegin(), E = F->aend(); + for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI, ++CAI) { LatticeVal &IV = ValueState[AI]; if (!IV.isOverdefined()) @@ -1044,7 +1044,7 @@ // Mark all arguments to the function as being overdefined. hash_map &Values = Solver.getValueMapping(); - for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI) + for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI) Values[AI].markOverdefined(); // Solve for constants. @@ -1173,7 +1173,7 @@ if (!F->hasInternalLinkage() || AddressIsTaken(F)) { if (!F->isExternal()) Solver.MarkBlockExecutable(F->begin()); - for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI) + for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI) Values[AI].markOverdefined(); } else { Solver.AddTrackedFunction(F); @@ -1182,7 +1182,7 @@ // Loop over global variables. We inform the solver about any internal global // variables that do not have their 'addresses taken'. If they don't have // their addresses taken, we can propagate constants through them. - for (Module::giterator G = M.gbegin(), E = M.gend(); G != E; ++G) + for (Module::global_iterator G = M.global_begin(), E = M.global_end(); G != E; ++G) if (!G->isConstant() && G->hasInternalLinkage() && !AddressIsTaken(G)) Solver.TrackValueOfGlobalVariable(G); @@ -1204,7 +1204,7 @@ // std::set &ExecutableBBs = Solver.getExecutableBlocks(); for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { - for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI) + for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI) if (!AI->use_empty()) { LatticeVal &IV = Values[AI]; if (IV.isConstant() || IV.isUndefined()) { Index: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp diff -u llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.14 llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.15 --- llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:1.14 Wed Sep 1 17:55:36 2004 +++ llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp Mon Mar 14 22:54:21 2005 @@ -161,7 +161,7 @@ // Figure out which argument number this is... unsigned ArgNo = 0; Function *F = CI->getParent()->getParent(); - for (Function::aiterator AI = F->abegin(); &*AI != Arg; ++AI) + for (Function::arg_iterator AI = F->arg_begin(); &*AI != Arg; ++AI) ++ArgNo; // If we are passing this argument into call as the corresponding @@ -298,7 +298,7 @@ // For now, we initialize each PHI to only have the real arguments // which are passed in. Instruction *InsertPos = OldEntry->begin(); - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) { + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) { PHINode *PN = new PHINode(I->getType(), I->getName()+".tr", InsertPos); I->replaceAllUsesWith(PN); // Everyone use the PHI node now! PN->addIncoming(I, NewEntry); From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp PhyRegAlloc.cpp Message-ID: <200503150455.j2F4t2lH031109@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9/RegAlloc: LiveRangeInfo.cpp updated: 1.56 -> 1.57 PhyRegAlloc.cpp updated: 1.165 -> 1.166 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+3 -3) LiveRangeInfo.cpp | 2 +- PhyRegAlloc.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp diff -u llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp:1.56 llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp:1.57 --- llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp:1.56 Wed Sep 1 17:55:36 2004 +++ llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp Mon Mar 14 22:54:20 2005 @@ -150,7 +150,7 @@ // first find the live ranges for all incoming args of the function since // those LRs start from the start of the function - for (Function::const_aiterator AI = Meth->abegin(); AI != Meth->aend(); ++AI) + for (Function::const_arg_iterator AI = Meth->arg_begin(); AI != Meth->arg_end(); ++AI) createNewLiveRange(AI, /*isCC*/ false); // Now suggest hardware registers for these function args Index: llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.165 llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.166 --- llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp:1.165 Wed Sep 1 17:55:36 2004 +++ llvm/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp Mon Mar 14 22:54:20 2005 @@ -317,7 +317,7 @@ // get the InSet of root BB const ValueSet &InSet = LVI->getInSetOfBB(&Fn->front()); - for (Function::const_aiterator AI = Fn->abegin(); AI != Fn->aend(); ++AI) { + for (Function::const_arg_iterator AI = Fn->arg_begin(); AI != Fn->arg_end(); ++AI) { // add interferences between args and LVars at start addInterference(AI, &InSet, false); @@ -1148,7 +1148,7 @@ std::vector &state = FnAllocState[Fn]; unsigned ArgNum = 0; // Arguments encoded as instruction # -1 - for (Function::const_aiterator i=Fn->abegin (), e=Fn->aend (); i != e; ++i) { + for (Function::const_arg_iterator i=Fn->arg_begin (), e=Fn->arg_end (); i != e; ++i) { const Argument *Arg = &*i; saveStateForValue (state, Arg, -1, ArgNum); ++ArgNum; From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200503150455.j2F4t39Z031214@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.32 -> 1.33 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+3 -3) SelectionDAGISel.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.32 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.33 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.32 Thu Feb 17 15:39:27 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Mar 14 22:54:19 2005 @@ -128,7 +128,7 @@ // Initialize the mapping of values to registers. This is only set up for // instruction values that are used outside of the block that defines // them. - for (Function::aiterator AI = Fn.abegin(), E = Fn.aend(); AI != E; ++AI) + for (Function::arg_iterator AI = Fn.arg_begin(), E = Fn.arg_end(); AI != E; ++AI) InitializeRegForValue(AI); Function::iterator BB = Fn.begin(), E = Fn.end(); @@ -881,7 +881,7 @@ // anything special. if (OldRoot != SDL.DAG.getRoot()) { unsigned a = 0; - for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI,++a) + for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI,++a) if (!AI->use_empty()) { SDL.setValue(AI, Args[a]); SDOperand Copy = @@ -892,7 +892,7 @@ // Otherwise, if any argument is only accessed in a single basic block, // emit that argument only to that basic block. unsigned a = 0; - for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI,++a) + for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI,++a) if (!AI->use_empty()) { if (BasicBlock *BBU = IsOnlyUsedInOneBasicBlock(AI)) { FuncInfo.BlockLocalArguments.insert(std::make_pair(BBU, From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp Writer.cpp Message-ID: <200503150455.j2F4t3I8031204@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: SlotCalculator.cpp updated: 1.66 -> 1.67 Writer.cpp updated: 1.95 -> 1.96 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+5 -5) SlotCalculator.cpp | 8 ++++---- Writer.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.66 llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.67 --- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.66 Sat Dec 4 15:28:47 2004 +++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Mon Mar 14 22:54:19 2005 @@ -121,7 +121,7 @@ // Add all of the global variables to the value table... // - for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend(); + for (Module::const_global_iterator I = TheModule->global_begin(), E = TheModule->global_end(); I != E; ++I) getOrCreateSlot(I); @@ -134,7 +134,7 @@ // Add all of the module level constants used as initializers // - for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend(); + for (Module::const_global_iterator I = TheModule->global_begin(), E = TheModule->global_end(); I != E; ++I) if (I->hasInitializer()) getOrCreateSlot(I->getInitializer()); @@ -285,7 +285,7 @@ ModuleTypeLevel = Types.size(); // Iterate over function arguments, adding them to the value table... - for(Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for(Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) getOrCreateSlot(I); if ( !ModuleContainsAllFunctionConstants ) { @@ -461,7 +461,7 @@ } // Next, include any types used by function arguments. - for (Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) getOrCreateCompactionTableSlot(I->getType()); // Next, find all of the types and values that are referred to by the Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.95 llvm/lib/Bytecode/Writer/Writer.cpp:1.96 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.95 Sun Mar 6 20:59:36 2005 +++ llvm/lib/Bytecode/Writer/Writer.cpp Mon Mar 14 22:54:19 2005 @@ -894,7 +894,7 @@ BytecodeBlock ModuleInfoBlock(BytecodeFormat::ModuleGlobalInfoBlockID, *this); // Output the types for the global variables in the module... - for (Module::const_giterator I = M->gbegin(), End = M->gend(); I != End;++I) { + for (Module::const_global_iterator I = M->global_begin(), End = M->global_end(); I != End;++I) { int Slot = Table.getSlot(I->getType()); assert(Slot != -1 && "Module global vars is broken!"); From lattner at cs.uiuc.edu Mon Mar 14 22:59:31 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:59:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200503150459.j2F4xVo9013391@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.231 -> 1.232 --- Log message: stop using arg_back --- 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.231 llvm/lib/Target/CBackend/Writer.cpp:1.232 --- llvm/lib/Target/CBackend/Writer.cpp:1.231 Mon Mar 14 22:54:19 2005 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Mar 14 22:59:17 2005 @@ -1472,7 +1472,7 @@ << I.getParent()->getParent()->getName() << "'!\n"; abort(); } - writeOperand(&I.getParent()->getParent()->arg_back()); + writeOperand(--I.getParent()->getParent()->arg_end()); Out << ')'; return; case Intrinsic::vaend: From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp TraceValues.cpp Message-ID: <200503150455.j2F4t2ne031191@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: ProfilingUtils.cpp updated: 1.4 -> 1.5 TraceValues.cpp updated: 1.71 -> 1.72 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+5 -5) ProfilingUtils.cpp | 8 ++++---- TraceValues.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.4 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.5 --- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.4 Sat Jul 17 19:21:14 2004 +++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp Mon Mar 14 22:54:21 2005 @@ -55,11 +55,11 @@ Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos); // If argc or argv are not available in main, just pass null values in. - Function::aiterator AI; - switch (MainFn->asize()) { + Function::arg_iterator AI; + switch (MainFn->arg_size()) { default: case 2: - AI = MainFn->abegin(); ++AI; + AI = MainFn->arg_begin(); ++AI; if (AI->getType() != ArgVTy) { InitCall->setOperand(2, new CastInst(AI, ArgVTy, "argv.cast", InitCall)); } else { @@ -67,7 +67,7 @@ } case 1: - AI = MainFn->abegin(); + AI = MainFn->arg_begin(); // If the program looked at argc, have it look at the return value of the // init call instead. if (AI->getType() != Type::IntTy) { Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.71 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.72 --- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.71 Tue Jan 25 10:23:57 2005 +++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp Mon Mar 14 22:54:21 2005 @@ -367,7 +367,7 @@ // Now print all the incoming arguments unsigned ArgNo = 0; - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I, ++ArgNo){ + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++ArgNo){ InsertVerbosePrintInst(I, &BB, InsertPos, " Arg #" + utostr(ArgNo) + ": ", Printf, HashPtrToSeqNum); From lattner at cs.uiuc.edu Mon Mar 14 22:55:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp ConstantMerge.cpp DeadArgumentElimination.cpp ExtractFunction.cpp FunctionResolution.cpp GlobalDCE.cpp GlobalOpt.cpp IPConstantPropagation.cpp InlineSimple.cpp Internalize.cpp StripSymbols.cpp Message-ID: <200503150455.j2F4t2BP031165@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: ArgumentPromotion.cpp updated: 1.16 -> 1.17 ConstantMerge.cpp updated: 1.28 -> 1.29 DeadArgumentElimination.cpp updated: 1.19 -> 1.20 ExtractFunction.cpp updated: 1.10 -> 1.11 FunctionResolution.cpp updated: 1.55 -> 1.56 GlobalDCE.cpp updated: 1.35 -> 1.36 GlobalOpt.cpp updated: 1.37 -> 1.38 IPConstantPropagation.cpp updated: 1.16 -> 1.17 InlineSimple.cpp updated: 1.68 -> 1.69 Internalize.cpp updated: 1.23 -> 1.24 StripSymbols.cpp updated: 1.2 -> 1.3 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+32 -32) ArgumentPromotion.cpp | 14 +++++++------- ConstantMerge.cpp | 2 +- DeadArgumentElimination.cpp | 16 ++++++++-------- ExtractFunction.cpp | 2 +- FunctionResolution.cpp | 4 ++-- GlobalDCE.cpp | 4 ++-- GlobalOpt.cpp | 8 ++++---- IPConstantPropagation.cpp | 8 ++++---- InlineSimple.cpp | 2 +- Internalize.cpp | 2 +- StripSymbols.cpp | 2 +- 11 files changed, 32 insertions(+), 32 deletions(-) Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.16 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.17 --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.16 Sat Jan 8 13:45:31 2005 +++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Mon Mar 14 22:54:20 2005 @@ -106,7 +106,7 @@ // First check: see if there are any pointer arguments! If not, quick exit. std::vector PointerArgs; - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (isa(I->getType())) PointerArgs.push_back(I); if (PointerArgs.empty()) return false; @@ -163,7 +163,7 @@ static bool AllCalleesPassInValidPointerForArgument(Argument *Arg) { Function *Callee = Arg->getParent(); - unsigned ArgNo = std::distance(Callee->abegin(), Function::aiterator(Arg)); + unsigned ArgNo = std::distance(Callee->arg_begin(), Function::arg_iterator(Arg)); // Look at all call sites of the function. At this pointer we know we only // have direct callees. @@ -347,7 +347,7 @@ // what the new GEP/Load instructions we are inserting look like. std::map, LoadInst*> OriginalLoads; - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (!ArgsToPromote.count(I)) { Params.push_back(I->getType()); } else if (I->use_empty()) { @@ -411,7 +411,7 @@ // Loop over the operands, inserting GEP and loads in the caller as // appropriate. CallSite::arg_iterator AI = CS.arg_begin(); - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++AI) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I, ++AI) if (!ArgsToPromote.count(I)) Args.push_back(*AI); // Unmodified argument else if (!I->use_empty()) { @@ -470,7 +470,7 @@ // Loop over the argument list, transfering uses of the old arguments over to // the new arguments, also transfering over the names as well. // - for (Function::aiterator I = F->abegin(), E = F->aend(), I2 = NF->abegin(); + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), I2 = NF->arg_begin(); I != E; ++I) if (!ArgsToPromote.count(I)) { // If this is an unmodified argument, move the name and users over to the @@ -502,7 +502,7 @@ std::vector Operands(GEP->op_begin()+1, GEP->op_end()); unsigned ArgNo = 0; - Function::aiterator TheArg = I2; + Function::arg_iterator TheArg = I2; for (ScalarizeTable::iterator It = ArgIndices.begin(); *It != Operands; ++It, ++TheArg) { assert(It != ArgIndices.end() && "GEP not handled??"); @@ -539,7 +539,7 @@ // Notify the alias analysis implementation that we inserted a new argument. if (ExtraArgHack) - AA.copyValue(Constant::getNullValue(Type::IntTy), NF->abegin()); + AA.copyValue(Constant::getNullValue(Type::IntTy), NF->arg_begin()); // Tell the alias analysis that the old function is about to disappear. Index: llvm/lib/Transforms/IPO/ConstantMerge.cpp diff -u llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.28 llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.29 --- llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.28 Sun Sep 19 23:43:34 2004 +++ llvm/lib/Transforms/IPO/ConstantMerge.cpp Mon Mar 14 22:54:20 2005 @@ -56,7 +56,7 @@ // because doing so may cause initializers of other globals to be rewritten, // invalidating the Constant* pointers in CMap. // - for (Module::giterator GV = M.gbegin(), E = M.gend(); GV != E; ++GV) + for (Module::global_iterator GV = M.global_begin(), E = M.global_end(); GV != E; ++GV) // Only process constants with initializers if (GV->isConstant() && GV->hasInitializer()) { Constant *Init = GV->getInitializer(); Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.19 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.20 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.19 Sun Sep 19 23:43:34 2004 +++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon Mar 14 22:54:20 2005 @@ -210,7 +210,7 @@ if (FunctionIntrinsicallyLive) { DEBUG(std::cerr << " Intrinsically live fn: " << F.getName() << "\n"); - for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI) + for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI) LiveArguments.insert(AI); LiveRetVal.insert(&F); return; @@ -230,7 +230,7 @@ // if there are any arguments we assume that are dead. // bool AnyMaybeLiveArgs = false; - for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI) + for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI) switch (getArgumentLiveness(*AI)) { case Live: DEBUG(std::cerr << " Arg live by use: " << AI->getName() << "\n"); @@ -284,7 +284,7 @@ // Loop over all of the arguments (because Arg may be passed into the call // multiple times) and check to see if any are now alive... CallSite::arg_iterator CSAI = CS.arg_begin(); - for (Function::aiterator AI = Callee->abegin(), E = Callee->aend(); + for (Function::arg_iterator AI = Callee->arg_begin(), E = Callee->arg_end(); AI != E; ++AI, ++CSAI) // If this is the argument we are looking for, check to see if it's alive if (*CSAI == Arg && LiveArguments.count(AI)) @@ -309,7 +309,7 @@ // passed in to provide a value for this argument live as necessary. // Function *Fn = Arg->getParent(); - unsigned ArgNo = std::distance(Fn->abegin(), Function::aiterator(Arg)); + unsigned ArgNo = std::distance(Fn->arg_begin(), Function::arg_iterator(Arg)); std::multimap::iterator I = CallSites.lower_bound(Fn); for (; I != CallSites.end() && I->first == Fn; ++I) { @@ -373,7 +373,7 @@ const FunctionType *FTy = F->getFunctionType(); std::vector Params; - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (!DeadArguments.count(I)) Params.push_back(I->getType()); @@ -410,7 +410,7 @@ // Loop over the operands, deleting dead ones... CallSite::arg_iterator AI = CS.arg_begin(); - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++AI) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I, ++AI) if (!DeadArguments.count(I)) // Remove operands for dead arguments Args.push_back(*AI); @@ -455,7 +455,7 @@ // the new arguments, also transfering over the names as well. While we're at // it, remove the dead arguments from the DeadArguments list. // - for (Function::aiterator I = F->abegin(), E = F->aend(), I2 = NF->abegin(); + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), I2 = NF->arg_begin(); I != E; ++I) if (!DeadArguments.count(I)) { // If this is a live argument, move the name and users over to the new @@ -519,7 +519,7 @@ // live, then the return value of the called instruction is now live. // CallSite::arg_iterator AI = CS.arg_begin(); // ActualIterator - for (Function::aiterator FI = Callee->abegin(), E = Callee->aend(); + for (Function::arg_iterator FI = Callee->arg_begin(), E = Callee->arg_end(); FI != E; ++AI, ++FI) { // If this argument is another call... CallSite ArgCS = CallSite::get(*AI); Index: llvm/lib/Transforms/IPO/ExtractFunction.cpp diff -u llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.10 llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.11 --- llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.10 Sun Sep 19 23:43:34 2004 +++ llvm/lib/Transforms/IPO/ExtractFunction.cpp Mon Mar 14 22:54:20 2005 @@ -52,7 +52,7 @@ Named->setLinkage(GlobalValue::ExternalLinkage); // Mark all global variables internal - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (!I->isExternal()) { I->setInitializer(0); // Make all variables external I->setLinkage(GlobalValue::ExternalLinkage); Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.55 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.56 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.55 Mon Jan 31 19:23:31 2005 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Mon Mar 14 22:54:20 2005 @@ -311,7 +311,7 @@ Globals[F->getName()].push_back(F); } - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) { + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ) { GlobalVariable *GV = I++; if (GV->use_empty() && GV->isExternal()) { M.getGlobalList().erase(GV); @@ -343,7 +343,7 @@ ++I; } - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ) if (I->isExternal() && I->use_empty()) { GlobalVariable *GV = I; ++I; Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.35 llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.36 --- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.35 Sun Sep 19 23:43:34 2004 +++ llvm/lib/Transforms/IPO/GlobalDCE.cpp Mon Mar 14 22:54:20 2005 @@ -60,7 +60,7 @@ GlobalIsNeeded(I); } - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) { + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { Changed |= RemoveUnusedGlobalValue(*I); // Externally visible & appending globals are needed, if they have an // initializer. @@ -76,7 +76,7 @@ // The first pass is to drop initializers of global variables which are dead. std::vector DeadGlobalVars; // Keep track of dead globals - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (!AliveGlobals.count(I)) { DeadGlobalVars.push_back(I); // Keep track of dead globals I->setInitializer(0); Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.37 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.38 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.37 Sun Feb 27 12:58:52 2005 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Mon Mar 14 22:54:20 2005 @@ -51,7 +51,7 @@ bool runOnModule(Module &M); private: - bool ProcessInternalGlobal(GlobalVariable *GV, Module::giterator &GVI); + bool ProcessInternalGlobal(GlobalVariable *GV, Module::global_iterator &GVI); }; RegisterOpt X("globalopt", "Global Variable Optimizer"); @@ -792,7 +792,7 @@ // OptimizeOnceStoredGlobal - Try to optimize globals based on the knowledge // that only one value (besides its initializer) is ever stored to the global. static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal, - Module::giterator &GVI, TargetData &TD) { + Module::global_iterator &GVI, TargetData &TD) { if (CastInst *CI = dyn_cast(StoredOnceVal)) StoredOnceVal = CI->getOperand(0); else if (GetElementPtrInst *GEPI =dyn_cast(StoredOnceVal)){ @@ -915,7 +915,7 @@ /// ProcessInternalGlobal - Analyze the specified global variable and optimize /// it if possible. If we make a change, return true. bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV, - Module::giterator &GVI) { + Module::global_iterator &GVI) { std::set PHIUsers; GlobalStatus GS; PHIUsers.clear(); @@ -1063,7 +1063,7 @@ LocalChange = true; while (LocalChange) { LocalChange = false; - for (Module::giterator GVI = M.gbegin(), E = M.gend(); GVI != E;) { + for (Module::global_iterator GVI = M.global_begin(), E = M.global_end(); GVI != E;) { GlobalVariable *GV = GVI++; if (!GV->isConstant() && GV->hasInternalLinkage() && GV->hasInitializer()) Index: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp diff -u llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.16 llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.17 --- llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.16 Sat Dec 11 11:00:14 2004 +++ llvm/lib/Transforms/IPO/IPConstantPropagation.cpp Mon Mar 14 22:54:20 2005 @@ -69,10 +69,10 @@ /// constant in for an argument, propagate that constant in as the argument. /// bool IPCP::PropagateConstantsIntoArguments(Function &F) { - if (F.aempty() || F.use_empty()) return false; // No arguments? Early exit. + if (F.arg_empty() || F.use_empty()) return false; // No arguments? Early exit. std::vector > ArgumentConstants; - ArgumentConstants.resize(F.asize()); + ArgumentConstants.resize(F.arg_size()); unsigned NumNonconstant = 0; @@ -87,7 +87,7 @@ // Check out all of the potentially constant arguments CallSite::arg_iterator AI = CS.arg_begin(); - Function::aiterator Arg = F.abegin(); + Function::arg_iterator Arg = F.arg_begin(); for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI, ++Arg) { if (*AI == &F) return false; // Passes the function into itself @@ -115,7 +115,7 @@ // If we got to this point, there is a constant argument! assert(NumNonconstant != ArgumentConstants.size()); - Function::aiterator AI = F.abegin(); + Function::arg_iterator AI = F.arg_begin(); bool MadeChange = false; for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) // Do we have a constant argument!? Index: llvm/lib/Transforms/IPO/InlineSimple.cpp diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.68 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.69 --- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.68 Mon Nov 22 11:21:44 2004 +++ llvm/lib/Transforms/IPO/InlineSimple.cpp Mon Mar 14 22:54:20 2005 @@ -167,7 +167,7 @@ // Check out all of the arguments to the function, figuring out how much // code can be eliminated if one of the arguments is a constant. - for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I) + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) ArgumentWeights.push_back(ArgInfo(CountCodeReductionForConstant(I), CountCodeReductionForAlloca(I))); } Index: llvm/lib/Transforms/IPO/Internalize.cpp diff -u llvm/lib/Transforms/IPO/Internalize.cpp:1.23 llvm/lib/Transforms/IPO/Internalize.cpp:1.24 --- llvm/lib/Transforms/IPO/Internalize.cpp:1.23 Sun Sep 19 23:43:34 2004 +++ llvm/lib/Transforms/IPO/Internalize.cpp Mon Mar 14 22:54:21 2005 @@ -93,7 +93,7 @@ } // Mark all global variables with initializers as internal as well... - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (!I->isExternal() && !I->hasInternalLinkage() && !ExternalNames.count(I->getName())) { // Special case handling of the global ctor and dtor list. When we Index: llvm/lib/Transforms/IPO/StripSymbols.cpp diff -u llvm/lib/Transforms/IPO/StripSymbols.cpp:1.2 llvm/lib/Transforms/IPO/StripSymbols.cpp:1.3 --- llvm/lib/Transforms/IPO/StripSymbols.cpp:1.2 Fri Dec 3 10:22:08 2004 +++ llvm/lib/Transforms/IPO/StripSymbols.cpp Mon Mar 14 22:54:21 2005 @@ -75,7 +75,7 @@ // If we're not just stripping debug info, strip all symbols from the // functions and the names from any internal globals. if (!OnlyDebugInfo) { - for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (I->hasInternalLinkage()) I->setName(""); // Internal symbols can't participate in linkage From lattner at cs.uiuc.edu Mon Mar 14 22:55:01 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderWrappers.cpp Message-ID: <200503150455.j2F4t1Ek031095@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.155 -> 1.156 ReaderWrappers.cpp updated: 1.43 -> 1.44 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+5 -5) Reader.cpp | 2 +- ReaderWrappers.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.155 llvm/lib/Bytecode/Reader/Reader.cpp:1.156 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.155 Sat Mar 5 13:05:00 2005 +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Mar 14 22:54:18 2005 @@ -536,7 +536,7 @@ /// Insert the arguments of a function as new values in the reader. void BytecodeReader::insertArguments(Function* F) { const FunctionType *FT = F->getFunctionType(); - Function::aiterator AI = F->abegin(); + Function::arg_iterator AI = F->arg_begin(); for (FunctionType::param_iterator It = FT->param_begin(); It != FT->param_end(); ++It, ++AI) insertValue(AI, getTypeSlot(AI->getType()), FunctionValues); Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.43 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.44 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.43 Sun Feb 13 12:12:20 2005 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Mon Mar 14 22:54:18 2005 @@ -171,7 +171,7 @@ // If the user is making use of obsolete varargs intrinsics, adjust them for // the user. if (Function *F = M->getNamedFunction("llvm.va_start")) { - assert(F->asize() == 1 && "Obsolete va_start takes 1 argument!"); + assert(F->arg_size() == 1 && "Obsolete va_start takes 1 argument!"); const Type *RetTy = F->getFunctionType()->getParamType(0); RetTy = cast(RetTy)->getElementType(); @@ -187,7 +187,7 @@ } if (Function *F = M->getNamedFunction("llvm.va_end")) { - assert(F->asize() == 1 && "Obsolete va_end takes 1 argument!"); + assert(F->arg_size() == 1 && "Obsolete va_end takes 1 argument!"); const Type *ArgTy = F->getFunctionType()->getParamType(0); ArgTy = cast(ArgTy)->getElementType(); Function *NF = M->getOrInsertFunction("llvm.va_end", Type::VoidTy, @@ -203,7 +203,7 @@ } if (Function *F = M->getNamedFunction("llvm.va_copy")) { - assert(F->asize() == 2 && "Obsolete va_copy takes 2 argument!"); + assert(F->arg_size() == 2 && "Obsolete va_copy takes 2 argument!"); const Type *ArgTy = F->getFunctionType()->getParamType(0); ArgTy = cast(ArgTy)->getElementType(); Function *NF = M->getOrInsertFunction("llvm.va_copy", ArgTy, @@ -330,7 +330,7 @@ static void getSymbols(Module*M, std::vector& symbols) { // Loop over global variables - for (Module::giterator GI = M->gbegin(), GE=M->gend(); GI != GE; ++GI) + for (Module::global_iterator GI = M->global_begin(), GE=M->global_end(); GI != GE; ++GI) if (!GI->isExternal() && !GI->hasInternalLinkage()) if (!GI->getName().empty()) symbols.push_back(GI->getName()); From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200503150455.j2F4t3q2031168@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.23 -> 1.24 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+10 -10) IntrinsicLowering.cpp | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.23 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.24 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.23 Mon Feb 28 20:07:58 2005 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Mar 14 22:54:19 2005 @@ -87,28 +87,28 @@ switch (I->getIntrinsicID()) { default: break; case Intrinsic::setjmp: - EnsureFunctionExists(M, "setjmp", I->abegin(), I->aend(), Type::IntTy); + EnsureFunctionExists(M, "setjmp", I->arg_begin(), I->arg_end(), Type::IntTy); break; case Intrinsic::longjmp: - EnsureFunctionExists(M, "longjmp", I->abegin(), I->aend(),Type::VoidTy); + EnsureFunctionExists(M, "longjmp", I->arg_begin(), I->arg_end(),Type::VoidTy); break; case Intrinsic::siglongjmp: - EnsureFunctionExists(M, "abort", I->aend(), I->aend(), Type::VoidTy); + EnsureFunctionExists(M, "abort", I->arg_end(), I->arg_end(), Type::VoidTy); break; case Intrinsic::memcpy: - EnsureFunctionExists(M, "memcpy", I->abegin(), --I->aend(), - I->abegin()->getType()); + EnsureFunctionExists(M, "memcpy", I->arg_begin(), --I->arg_end(), + I->arg_begin()->getType()); break; case Intrinsic::memmove: - EnsureFunctionExists(M, "memmove", I->abegin(), --I->aend(), - I->abegin()->getType()); + EnsureFunctionExists(M, "memmove", I->arg_begin(), --I->arg_end(), + I->arg_begin()->getType()); break; case Intrinsic::memset: - EnsureFunctionExists(M, "memset", I->abegin(), --I->aend(), - I->abegin()->getType()); + EnsureFunctionExists(M, "memset", I->arg_begin(), --I->arg_end(), + I->arg_begin()->getType()); break; case Intrinsic::isunordered: - EnsureFunctionExists(M, "isunordered", I->abegin(), I->aend(), Type::BoolTy); + EnsureFunctionExists(M, "isunordered", I->arg_begin(), I->arg_end(), Type::BoolTy); break; } From lattner at cs.uiuc.edu Mon Mar 14 23:00:07 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 23:00:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200503150500.j2F507j7016446@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.232 -> 1.233 --- Log message: stop using arg_front --- 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.232 llvm/lib/Target/CBackend/Writer.cpp:1.233 --- llvm/lib/Target/CBackend/Writer.cpp:1.232 Mon Mar 14 22:59:17 2005 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Mar 14 22:59:54 2005 @@ -1079,7 +1079,7 @@ std::string ArgName; if (F->arg_begin()->hasName() || !Prototype) ArgName = Mang->getValueName(F->arg_begin()); - printType(FunctionInnards, F->arg_front().getType(), ArgName); + printType(FunctionInnards, F->arg_begin()->getType(), ArgName); for (Function::const_arg_iterator I = ++F->arg_begin(), E = F->arg_end(); I != E; ++I) { FunctionInnards << ", "; From lattner at cs.uiuc.edu Mon Mar 14 22:55:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 22:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200503150455.j2F4t36A031209@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.66 -> 1.67 --- Log message: This mega patch converts us from using Function::a{iterator|begin|end} to using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! --- Diffs of the changes: (+2 -2) ExecutionEngine.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.66 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.67 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.66 Sun Feb 27 13:06:10 2005 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Mon Mar 14 22:54:19 2005 @@ -494,7 +494,7 @@ // Loop over all of the global variables in the program, allocating the memory // to hold them. - for (Module::const_giterator I = getModule().gbegin(), E = getModule().gend(); + for (Module::const_global_iterator I = getModule().global_begin(), E = getModule().global_end(); I != E; ++I) if (!I->isExternal()) { // Get the type of the global... @@ -518,7 +518,7 @@ // Now that all of the globals are set up in memory, loop through them all and // initialize their contents. - for (Module::const_giterator I = getModule().gbegin(), E = getModule().gend(); + for (Module::const_global_iterator I = getModule().global_begin(), E = getModule().global_end(); I != E; ++I) if (!I->isExternal()) EmitGlobalVariable(I); From lattner at cs.uiuc.edu Mon Mar 14 23:03:49 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 23:03:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200503150503.j2F53n2O026218@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.174 -> 1.175 --- Log message: stop using arg_front --- 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.174 llvm/lib/VMCore/AsmWriter.cpp:1.175 --- llvm/lib/VMCore/AsmWriter.cpp:1.174 Mon Mar 14 22:54:21 2005 +++ llvm/lib/VMCore/AsmWriter.cpp Mon Mar 14 23:03:36 2005 @@ -956,7 +956,7 @@ /// void AssemblyWriter::printArgument(const Argument *Arg) { // Insert commas as we go... the first arg doesn't get a comma - if (Arg != &Arg->getParent()->arg_front()) Out << ", "; + if (Arg != Arg->getParent()->arg_begin()) Out << ", "; // Output type... printType(Arg->getType()); From lattner at cs.uiuc.edu Mon Mar 14 23:14:00 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 23:14:00 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Function.h Module.h Message-ID: <200503150514.j2F5E0wZ013115@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: Function.h updated: 1.62 -> 1.63 Module.h updated: 1.59 -> 1.60 --- Log message: remove a whole bunch of dead methods. Noone should use reverse iterators anyway. --- Diffs of the changes: (+0 -66) Function.h | 29 ----------------------------- Module.h | 37 ------------------------------------- 2 files changed, 66 deletions(-) Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.62 llvm/include/llvm/Function.h:1.63 --- llvm/include/llvm/Function.h:1.62 Mon Mar 14 17:49:40 2005 +++ llvm/include/llvm/Function.h Mon Mar 14 23:13:47 2005 @@ -54,17 +54,11 @@ // BasicBlock iterators... typedef BasicBlockListType::iterator iterator; typedef BasicBlockListType::const_iterator const_iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef std::reverse_iterator reverse_iterator; typedef ArgumentListType::iterator arg_iterator; typedef ArgumentListType::const_iterator const_arg_iterator; - typedef std::reverse_iterator const_reverse_arg_iterator; - typedef std::reverse_iterator reverse_arg_iterator; typedef arg_iterator aiterator; // legacy, deprecated typedef const_arg_iterator const_aiterator; // legacy, deprecated - typedef const_reverse_arg_iterator const_reverse_aiterator; // legacy, deprecated - typedef reverse_arg_iterator reverse_aiterator; // legacy, deprecated private: // Important things that make up a function! @@ -176,11 +170,6 @@ iterator end () { return BasicBlocks.end(); } const_iterator end () const { return BasicBlocks.end(); } - reverse_iterator rbegin() { return BasicBlocks.rbegin(); } - const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); } - reverse_iterator rend () { return BasicBlocks.rend(); } - const_reverse_iterator rend () const { return BasicBlocks.rend(); } - size_t size() const { return BasicBlocks.size(); } bool empty() const { return BasicBlocks.empty(); } const BasicBlock &front() const { return BasicBlocks.front(); } @@ -196,17 +185,8 @@ arg_iterator arg_end () { return ArgumentList.end(); } const_arg_iterator arg_end () const { return ArgumentList.end(); } - reverse_arg_iterator arg_rbegin() { return ArgumentList.rbegin(); } - const_reverse_arg_iterator arg_rbegin() const { return ArgumentList.rbegin(); } - reverse_arg_iterator arg_rend () { return ArgumentList.rend(); } - const_reverse_arg_iterator arg_rend () const { return ArgumentList.rend(); } - size_t arg_size () const { return ArgumentList.size(); } bool arg_empty() const { return ArgumentList.empty(); } - const Argument &arg_front() const { return ArgumentList.front(); } - Argument &arg_front() { return ArgumentList.front(); } - const Argument &arg_back () const { return ArgumentList.back(); } - Argument &arg_back () { return ArgumentList.back(); } //===--------------------------------------------------------------------===// // Argument iterator forwarding functions (legacy, deprecated, will be removed) @@ -216,17 +196,8 @@ arg_iterator aend () { return ArgumentList.end(); } const_arg_iterator aend () const { return ArgumentList.end(); } - reverse_arg_iterator arbegin() { return ArgumentList.rbegin(); } - const_reverse_arg_iterator arbegin() const { return ArgumentList.rbegin(); } - reverse_arg_iterator arend () { return ArgumentList.rend(); } - const_reverse_arg_iterator arend () const { return ArgumentList.rend(); } - size_t asize() const { return ArgumentList.size(); } bool aempty() const { return ArgumentList.empty(); } - const Argument &afront() const { return ArgumentList.front(); } - Argument &afront() { return ArgumentList.front(); } - const Argument &aback() const { return ArgumentList.back(); } - Argument &aback() { return ArgumentList.back(); } virtual void print(std::ostream &OS) const { print(OS, 0); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.59 llvm/include/llvm/Module.h:1.60 --- llvm/include/llvm/Module.h:1.59 Mon Mar 14 17:49:40 2005 +++ llvm/include/llvm/Module.h Mon Mar 14 23:13:47 2005 @@ -54,18 +54,12 @@ // Global Variable iterators... typedef GlobalListType::iterator global_iterator; typedef GlobalListType::const_iterator const_global_iterator; - typedef std::reverse_iterator reverse_global_iterator; - typedef std::reverse_iterator const_reverse_global_iterator; typedef global_iterator giterator; // these are legacy, deprecated typedef const_global_iterator const_giterator; - typedef reverse_global_iterator reverse_giterator; - typedef const_reverse_global_iterator const_reverse_giterator; // Function iterators... typedef FunctionListType::iterator iterator; typedef FunctionListType::const_iterator const_iterator; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; // Library list iterators typedef LibraryListType::const_iterator lib_iterator; @@ -196,18 +190,7 @@ inline const_global_iterator global_begin() const { return GlobalList.begin(); } inline global_iterator global_end () { return GlobalList.end(); } inline const_global_iterator global_end () const { return GlobalList.end(); } - - inline reverse_global_iterator global_rbegin() { return GlobalList.rbegin(); } - inline const_reverse_global_iterator global_rbegin() const { return GlobalList.rbegin(); } - inline reverse_global_iterator global_rend () { return GlobalList.rend(); } - inline const_reverse_global_iterator global_rend () const { return GlobalList.rend(); } - - inline size_t global_size () const { return GlobalList.size(); } inline bool global_empty() const { return GlobalList.empty(); } - inline const GlobalVariable &global_front() const { return GlobalList.front(); } - inline GlobalVariable &global_front() { return GlobalList.front(); } - inline const GlobalVariable &global_back () const { return GlobalList.back(); } - inline GlobalVariable &global_back () { return GlobalList.back(); } //===--------------------------------------------------------------------===// // Module iterator forwarding functions (legacy, deprecated, will be removed) @@ -217,18 +200,7 @@ inline const_global_iterator gbegin() const { return GlobalList.begin(); } inline global_iterator gend () { return GlobalList.end(); } inline const_global_iterator gend () const { return GlobalList.end(); } - - inline reverse_global_iterator grbegin() { return GlobalList.rbegin(); } - inline const_reverse_global_iterator grbegin() const { return GlobalList.rbegin(); } - inline reverse_global_iterator grend () { return GlobalList.rend(); } - inline const_reverse_global_iterator grend () const { return GlobalList.rend(); } - - inline size_t gsize() const { return GlobalList.size(); } inline bool gempty() const { return GlobalList.empty(); } - inline const GlobalVariable &gfront() const { return GlobalList.front(); } - inline GlobalVariable &gfront() { return GlobalList.front(); } - inline const GlobalVariable &gback() const { return GlobalList.back(); } - inline GlobalVariable &gback() { return GlobalList.back(); } // FunctionList interface inline iterator begin() { return FunctionList.begin(); } @@ -236,17 +208,8 @@ inline iterator end () { return FunctionList.end(); } inline const_iterator end () const { return FunctionList.end(); } - inline reverse_iterator rbegin() { return FunctionList.rbegin(); } - inline const_reverse_iterator rbegin() const { return FunctionList.rbegin(); } - inline reverse_iterator rend () { return FunctionList.rend(); } - inline const_reverse_iterator rend () const { return FunctionList.rend(); } - inline size_t size() const { return FunctionList.size(); } inline bool empty() const { return FunctionList.empty(); } - inline const Function &front() const { return FunctionList.front(); } - inline Function &front() { return FunctionList.front(); } - inline const Function &back() const { return FunctionList.back(); } - inline Function &back() { return FunctionList.back(); } //===--------------------------------------------------------------------===// // List of dependent library access functions From lattner at cs.uiuc.edu Mon Mar 14 23:18:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 23:18:02 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/BasicBlock.h Message-ID: <200503150518.j2F5I2wc014926@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: BasicBlock.h updated: 1.50 -> 1.51 --- Log message: remove reverse BB iterators. --- Diffs of the changes: (+0 -7) BasicBlock.h | 7 ------- 1 files changed, 7 deletions(-) Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.50 llvm/include/llvm/BasicBlock.h:1.51 --- llvm/include/llvm/BasicBlock.h:1.50 Sat Mar 5 13:51:20 2005 +++ llvm/include/llvm/BasicBlock.h Mon Mar 14 23:17:48 2005 @@ -65,8 +65,6 @@ /// Instruction iterators... typedef InstListType::iterator iterator; typedef InstListType::const_iterator const_iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef std::reverse_iterator reverse_iterator; /// BasicBlock ctor - If the function parameter is specified, the basic block /// is automatically inserted at either the end of the function (if @@ -119,11 +117,6 @@ inline iterator end () { return InstList.end(); } inline const_iterator end () const { return InstList.end(); } - inline reverse_iterator rbegin() { return InstList.rbegin(); } - inline const_reverse_iterator rbegin() const { return InstList.rbegin(); } - inline reverse_iterator rend () { return InstList.rend(); } - inline const_reverse_iterator rend () const { return InstList.rend(); } - inline size_t size() const { return InstList.size(); } inline bool empty() const { return InstList.empty(); } inline const Instruction &front() const { return InstList.front(); } From lattner at cs.uiuc.edu Mon Mar 14 23:19:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 23:19:34 -0600 Subject: [llvm-commits] CVS: llvm/docs/ProgrammersManual.html Message-ID: <200503150519.j2F5JYof015546@apoc.cs.uiuc.edu> Changes in directory llvm/docs: ProgrammersManual.html updated: 1.78 -> 1.79 --- Log message: methods removed. --- Diffs of the changes: (+8 -8) ProgrammersManual.html | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/docs/ProgrammersManual.html diff -u llvm/docs/ProgrammersManual.html:1.78 llvm/docs/ProgrammersManual.html:1.79 --- llvm/docs/ProgrammersManual.html:1.78 Mon Mar 14 22:48:32 2005 +++ llvm/docs/ProgrammersManual.html Mon Mar 14 23:19:20 2005 @@ -1222,7 +1222,7 @@

    • BasicBlock::iterator - Typedef for instruction list iterator
      BasicBlock::const_iterator - Typedef for const_iterator.
      begin(), end(), front(), back(), -size(), empty(), rbegin(), rend() - +size(), empty() STL-style functions for accessing the instruction list.

      These methods and typedefs are forwarding functions that have the same @@ -1410,8 +1410,8 @@

    • Function::iterator - Typedef for basic block list iterator
      Function::const_iterator - Typedef for const_iterator.
      - begin(), end(), front(), back(), - size(), empty(), rbegin(), rend() + begin(), end() + size(), empty()

      These are forwarding methods that make it easy to access the contents of a Function object's BasicBlock @@ -1427,7 +1427,7 @@ iterator
      Function::const_arg_iterator - Typedef for const_iterator.
      - arg_begin(), arg_end(), arg_front(), arg_back(), + arg_begin(), arg_end() arg_size(), arg_empty()

      These are forwarding methods that make it easy to access the contents of @@ -1572,8 +1572,8 @@

    • Module::iterator - Typedef for function list iterator
      Module::const_iterator - Typedef for const_iterator.
      - begin(), end(), front(), back(), - size(), empty(), rbegin(), rend() + begin(), end() + size(), empty()

      These are forwarding methods that make it easy to access the contents of a Module object's Function @@ -1595,7 +1595,7 @@ Module::const_global_iterator - Typedef for const_iterator.
      - global_begin(), global_end(), global_front(), global_back(), + global_begin(), global_end() global_size(), global_empty()

      These are forwarding methods that make it easy to access the contents of @@ -2049,7 +2049,7 @@ Dinakar Dhurjati and Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2005/03/15 04:48:32 $ + Last modified: $Date: 2005/03/15 05:19:20 $ From lattner at cs.uiuc.edu Mon Mar 14 23:20:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 14 Mar 2005 23:20:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/ExtractFunction.cpp Message-ID: <200503150520.j2F5K2Mk015899@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: ExtractFunction.cpp updated: 1.11 -> 1.12 --- Log message: stop using method. --- Diffs of the changes: (+1 -1) ExtractFunction.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/ExtractFunction.cpp diff -u llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.11 llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.12 --- llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.11 Mon Mar 14 22:54:20 2005 +++ llvm/lib/Transforms/IPO/ExtractFunction.cpp Mon Mar 14 23:19:49 2005 @@ -63,7 +63,7 @@ // can be "used", instead of ones with bodies. std::vector NewFunctions; - Function *Last = &M.back(); // Figure out where the last real fn is... + Function *Last = --M.end(); // Figure out where the last real fn is. for (Module::iterator I = M.begin(); ; ++I) { if (&*I != Named) { From jeffc at jolt-lang.org Tue Mar 15 00:15:19 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 15 Mar 2005 00:15:19 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h Message-ID: <200503150615.AAA24867@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: EquivClassGraphs.h updated: 1.16 -> 1.17 --- Log message: Fix VC++ breakage. --- Diffs of the changes: (+1 -1) EquivClassGraphs.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h diff -u llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.16 llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.17 --- llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.16 Sun Mar 13 13:50:40 2005 +++ llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h Tue Mar 15 00:15:08 2005 @@ -18,9 +18,9 @@ #include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/STLExtras.h" +#include #include #include -#include namespace llvm { class Module; From jeffc at jolt-lang.org Tue Mar 15 00:21:51 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 15 Mar 2005 00:21:51 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h Message-ID: <200503150621.AAA24958@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: EquivClassGraphs.h updated: 1.17 -> 1.18 --- Log message: Do it right... --- Diffs of the changes: (+1 -1) EquivClassGraphs.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h diff -u llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.17 llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.18 --- llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.17 Tue Mar 15 00:15:08 2005 +++ llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h Tue Mar 15 00:21:40 2005 @@ -18,7 +18,7 @@ #include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/STLExtras.h" -#include +#include "llvm/ADT/hash_map" #include #include From lattner at cs.uiuc.edu Tue Mar 15 00:29:29 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 00:29:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Message-ID: <200503150629.j2F6TTvj026395@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: EquivClassGraphs.cpp updated: 1.27 -> 1.28 --- Log message: avoid varialbe name collisions --- Diffs of the changes: (+3 -2) EquivClassGraphs.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.27 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.28 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.27 Mon Mar 14 22:54:18 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Tue Mar 15 00:29:12 2005 @@ -311,7 +311,8 @@ Stack.push_back(&FG); // The edges out of the current node are the call site targets... - for (DSGraph::fc_iterator CI = FG.fc_begin(), E = FG.fc_end(); CI != E; ++CI){ + for (DSGraph::fc_iterator CI = FG.fc_begin(), CE = FG.fc_end(); + CI != CE; ++CI) { Instruction *Call = CI->getCallSite().getInstruction(); // Loop over all of the actually called functions... @@ -375,7 +376,7 @@ // Else we need to inline some callee graph. Visit all call sites. // The edges out of the current node are the call site targets... unsigned i = 0; - for (DSGraph::fc_iterator CI = G.fc_begin(), E = G.fc_end(); CI != E; + for (DSGraph::fc_iterator CI = G.fc_begin(), CE = G.fc_end(); CI != CE; ++CI, ++i) { const DSCallSite &CS = *CI; Instruction *TheCall = CS.getCallSite().getInstruction(); From jeffc at jolt-lang.org Tue Mar 15 00:31:57 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 15 Mar 2005 00:31:57 -0600 Subject: [llvm-commits] CVS: llvm/win32/Analysis/Analysis.vcproj Message-ID: <200503150631.AAA25169@zion.cs.uiuc.edu> Changes in directory llvm/win32/Analysis: Analysis.vcproj updated: 1.10 -> 1.11 --- Log message: Add EquivClassGraphs.cpp to VC++ project. --- Diffs of the changes: (+3 -0) Analysis.vcproj | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/win32/Analysis/Analysis.vcproj diff -u llvm/win32/Analysis/Analysis.vcproj:1.10 llvm/win32/Analysis/Analysis.vcproj:1.11 --- llvm/win32/Analysis/Analysis.vcproj:1.10 Sun Jan 30 11:54:11 2005 +++ llvm/win32/Analysis/Analysis.vcproj Tue Mar 15 00:31:46 2005 @@ -213,6 +213,9 @@ RelativePath="..\..\lib\Analysis\DataStructure\DSCallSiteIterator.h"> + + Changes in directory llvm/lib/Target/IA64: --- Log message: Directory /var/cvs/llvm/llvm/lib/Target/IA64 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From duraid at octopus.com.au Tue Mar 15 00:49:58 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 15 Mar 2005 00:49:58 -0600 Subject: [llvm-commits] CVS: llvm-www/OpenProjects.html Message-ID: <200503150649.AAA25405@zion.cs.uiuc.edu> Changes in directory llvm-www: OpenProjects.html updated: 1.2 -> 1.3 --- Log message: tee hee hee --- Diffs of the changes: (+2 -2) OpenProjects.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/OpenProjects.html diff -u llvm-www/OpenProjects.html:1.2 llvm-www/OpenProjects.html:1.3 --- llvm-www/OpenProjects.html:1.2 Fri Mar 11 15:17:56 2005 +++ llvm-www/OpenProjects.html Tue Mar 15 00:49:47 2005 @@ -311,7 +311,7 @@ used to implement a bottom-up analysis that will determine the *actual* registers clobbered by a function. Use the pass to fine tune register usage in callers based on *actual* registers used by the callee.

    • -
    • Write a new backend for a target (IA64? MIPS? MMIX?)
    • +
    • Write a new backend for a target (MIPS? MMIX?)
    • Improve the usefulness and utility of the Skeleton target backend:
      • Convert the non-functional Skeleton target to become an abstract machine @@ -370,7 +370,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
        - Last modified: $Date: 2005/03/11 21:17:56 $ + Last modified: $Date: 2005/03/15 06:49:47 $ From alkis at cs.uiuc.edu Tue Mar 15 01:02:37 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 15 Mar 2005 01:02:37 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/Miscompilation.cpp Message-ID: <200503150702.BAA25522@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: Miscompilation.cpp updated: 1.60 -> 1.61 --- Log message: Use arg_iterator and arg_begin and arg_end functions. --- Diffs of the changes: (+5 -4) Miscompilation.cpp | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.60 llvm/tools/bugpoint/Miscompilation.cpp:1.61 --- llvm/tools/bugpoint/Miscompilation.cpp:1.60 Sun Feb 27 00:18:25 2005 +++ llvm/tools/bugpoint/Miscompilation.cpp Tue Mar 15 01:02:26 2005 @@ -624,8 +624,9 @@ oldMain->getName(), Test); // Set up and remember the argument list for the main function. std::vector args; - for (Function::aiterator I = newMain->abegin(), E = newMain->aend(), - OI = oldMain->abegin(); I != E; ++I, ++OI) { + for (Function::arg_iterator + I = newMain->arg_begin(), E = newMain->arg_end(), + OI = oldMain->arg_begin(); I != E; ++I, ++OI) { I->setName(OI->getName()); // Copy argument names from oldMain args.push_back(I); } @@ -700,8 +701,8 @@ // Save the argument list std::vector Args; - for (Function::aiterator i = FuncWrapper->abegin(), - e = FuncWrapper->aend(); i != e; ++i) + for (Function::arg_iterator i = FuncWrapper->arg_begin(), + e = FuncWrapper->arg_end(); i != e; ++i) Args.push_back(i); // Pass on the arguments to the real function, return its result From alkis at cs.uiuc.edu Tue Mar 15 01:12:43 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 15 Mar 2005 01:12:43 -0600 Subject: [llvm-commits] CVS: llvm/examples/Fibonacci/fibonacci.cpp Message-ID: <200503150712.BAA25569@zion.cs.uiuc.edu> Changes in directory llvm/examples/Fibonacci: fibonacci.cpp updated: 1.5 -> 1.6 --- Log message: Stop using abegin. --- Diffs of the changes: (+1 -1) fibonacci.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/examples/Fibonacci/fibonacci.cpp diff -u llvm/examples/Fibonacci/fibonacci.cpp:1.5 llvm/examples/Fibonacci/fibonacci.cpp:1.6 --- llvm/examples/Fibonacci/fibonacci.cpp:1.5 Thu Nov 4 22:11:40 2004 +++ llvm/examples/Fibonacci/fibonacci.cpp Tue Mar 15 01:12:30 2005 @@ -47,7 +47,7 @@ Value *Two = ConstantSInt::get(Type::IntTy, 2); // Get pointer to the integer argument of the add1 function... - Argument *ArgX = FibF->abegin(); // Get the arg. + Argument *ArgX = FibF->arg_begin(); // Get the arg. ArgX->setName("AnArg"); // Give it a nice symbolic name for fun. // Create the true_block. From alkis at cs.uiuc.edu Tue Mar 15 01:21:06 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 15 Mar 2005 01:21:06 -0600 Subject: [llvm-commits] CVS: llvm/examples/HowToUseJIT/HowToUseJIT.cpp Message-ID: <200503150721.BAA25617@zion.cs.uiuc.edu> Changes in directory llvm/examples/HowToUseJIT: HowToUseJIT.cpp updated: 1.6 -> 1.7 --- Log message: Stop using abegin and aend. --- Diffs of the changes: (+2 -2) HowToUseJIT.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/examples/HowToUseJIT/HowToUseJIT.cpp diff -u llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.6 llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.7 --- llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.6 Sat Sep 11 15:30:11 2004 +++ llvm/examples/HowToUseJIT/HowToUseJIT.cpp Tue Mar 15 01:20:55 2005 @@ -61,8 +61,8 @@ Value *One = ConstantSInt::get(Type::IntTy, 1); // Get pointers to the integer argument of the add1 function... - assert(Add1F->abegin() != Add1F->aend()); // Make sure there's an arg - Argument *ArgX = Add1F->abegin(); // Get the arg + assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg + Argument *ArgX = Add1F->arg_begin(); // Get the arg ArgX->setName("AnArg"); // Give it a nice symbolic name for fun. // Create the add instruction, inserting it into the end of BB. From alkis at cs.uiuc.edu Tue Mar 15 01:24:50 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 15 Mar 2005 01:24:50 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Transforms/AddStubs.cpp Message-ID: <200503150724.BAA25645@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Transforms: AddStubs.cpp updated: 1.4 -> 1.5 --- Log message: Return an allones value in stubs instead of an undef. This makes this value more obvious when running programs with function tracing. --- Diffs of the changes: (+6 -1) AddStubs.cpp | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm-java/lib/Transforms/AddStubs.cpp diff -u llvm-java/lib/Transforms/AddStubs.cpp:1.4 llvm-java/lib/Transforms/AddStubs.cpp:1.5 --- llvm-java/lib/Transforms/AddStubs.cpp:1.4 Tue Feb 8 19:28:30 2005 +++ llvm-java/lib/Transforms/AddStubs.cpp Tue Mar 15 01:24:39 2005 @@ -26,6 +26,9 @@ using namespace llvm; namespace { + + static Constant* ALL_ONES = ConstantUInt::getAllOnesValue(Type::ULongTy); + struct AddStubs : public ModulePass { virtual bool runOnModule(Module &M) { for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) @@ -35,7 +38,9 @@ if (F->getReturnType() == Type::VoidTy) new ReturnInst(NULL, entry); else - new ReturnInst(UndefValue::get(F->getReturnType()), entry); + new ReturnInst( + new CastInst(ALL_ONES, F->getReturnType(), "dummy-value", entry), + entry); } return true; } From alkis at cs.uiuc.edu Tue Mar 15 01:25:23 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 15 Mar 2005 01:25:23 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503150725.BAA25674@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.226 -> 1.227 --- Log message: Allow more classes to compile. --- Diffs of the changes: (+4 -3) Compiler.cpp | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.226 llvm-java/lib/Compiler/Compiler.cpp:1.227 --- llvm-java/lib/Compiler/Compiler.cpp:1.226 Sun Mar 6 03:35:09 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Tue Mar 15 01:25:12 2005 @@ -1357,9 +1357,10 @@ 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/lib/Compiler: Compiler.cpp updated: 1.227 -> 1.228 --- Log message: Stop using aiterator, abegin, and aend. --- Diffs of the changes: (+4 -4) Compiler.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.227 llvm-java/lib/Compiler/Compiler.cpp:1.228 --- llvm-java/lib/Compiler/Compiler.cpp:1.227 Tue Mar 15 01:25:12 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Tue Mar 15 01:38:33 2005 @@ -1324,8 +1324,8 @@ params.push_back(JNIEnvPtr_); if (method->isStatic()) params.push_back(llvm::Constant::getNullValue(ObjectBaseRefTy)); - for (Function::aiterator A = function->abegin(), E = function->aend(); - A != E; ++A) { + for (Function::arg_iterator A = function->arg_begin(), + E = function->arg_end(); A != E; ++A) { params.push_back( new CastInst(A, jniFuncTy->getParamType(params.size()), TMP, bb)); } @@ -1377,8 +1377,8 @@ locals_ = Locals(codeAttr->getMaxLocals()); unsigned index = 0; - for (Function::aiterator - a = function->abegin(), ae = function->aend(); a != ae; ++a) { + for (Function::arg_iterator a = function->arg_begin(), + ae = function->arg_end(); a != ae; ++a) { locals_.store(index, a, &function->getEntryBlock()); index += isTwoSlotType(a->getType()) ? 2 : 1; } From criswell at cs.uiuc.edu Tue Mar 15 09:29:07 2005 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 15 Mar 2005 09:29:07 -0600 Subject: [llvm-commits] CVS: llvm-www/OpenProjects.html Message-ID: <200503151529.JAA29878@gally.cs.uiuc.edu> Changes in directory llvm-www: OpenProjects.html updated: 1.3 -> 1.4 --- Log message: Add another architecture for which we would probably like an LLVM code generator. --- Diffs of the changes: (+2 -2) OpenProjects.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/OpenProjects.html diff -u llvm-www/OpenProjects.html:1.3 llvm-www/OpenProjects.html:1.4 --- llvm-www/OpenProjects.html:1.3 Tue Mar 15 00:49:47 2005 +++ llvm-www/OpenProjects.html Tue Mar 15 09:28:41 2005 @@ -311,7 +311,7 @@ used to implement a bottom-up analysis that will determine the *actual* registers clobbered by a function. Use the pass to fine tune register usage in callers based on *actual* registers used by the callee.
      • -
      • Write a new backend for a target (MIPS? MMIX?)
      • +
      • Write a new backend for a target (ARM? MIPS? MMIX?)
      • Improve the usefulness and utility of the Skeleton target backend:
        • Convert the non-functional Skeleton target to become an abstract machine @@ -370,7 +370,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
          - Last modified: $Date: 2005/03/15 06:49:47 $ + Last modified: $Date: 2005/03/15 15:28:41 $ From lattner at cs.uiuc.edu Tue Mar 15 09:46:39 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 09:46:39 -0600 Subject: [llvm-commits] CVS: llvm/examples/ModuleMaker/ModuleMaker.cpp Message-ID: <200503151546.j2FFkd0K030256@apoc.cs.uiuc.edu> Changes in directory llvm/examples/ModuleMaker: ModuleMaker.cpp updated: 1.4 -> 1.5 --- Log message: add missing copyright header --- Diffs of the changes: (+7 -0) ModuleMaker.cpp | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/examples/ModuleMaker/ModuleMaker.cpp diff -u llvm/examples/ModuleMaker/ModuleMaker.cpp:1.4 llvm/examples/ModuleMaker/ModuleMaker.cpp:1.5 --- llvm/examples/ModuleMaker/ModuleMaker.cpp:1.4 Sat Sep 11 15:30:11 2004 +++ llvm/examples/ModuleMaker/ModuleMaker.cpp Tue Mar 15 09:46:23 2005 @@ -1,4 +1,11 @@ //===- examples/ModuleMaker/ModuleMaker.cpp - Example project ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// // // This programs is a simple example that creates an LLVM module "from scratch", // emitting it as a bytecode file to standard out. This is just to show how From lattner at cs.uiuc.edu Tue Mar 15 09:48:19 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 09:48:19 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp ExtractFunction.cpp Miscompilation.cpp Message-ID: <200503151548.j2FFmJO6030362@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.40 -> 1.41 ExtractFunction.cpp updated: 1.42 -> 1.43 Miscompilation.cpp updated: 1.61 -> 1.62 --- Log message: Replace more a*'s with arg_*'s, thanks to Gabor Greif! --- Diffs of the changes: (+5 -5) CrashDebugger.cpp | 4 ++-- ExtractFunction.cpp | 4 ++-- Miscompilation.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.40 llvm/tools/bugpoint/CrashDebugger.cpp:1.41 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.40 Sat Jan 22 10:30:58 2005 +++ llvm/tools/bugpoint/CrashDebugger.cpp Tue Mar 15 09:48:06 2005 @@ -265,10 +265,10 @@ // See if we can get away with nuking all of the global variable initializers // in the program... - if (BD.getProgram()->gbegin() != BD.getProgram()->gend()) { + if (BD.getProgram()->global_begin() != BD.getProgram()->global_end()) { Module *M = CloneModule(BD.getProgram()); bool DeletedInit = false; - for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) if (I->hasInitializer()) { I->setInitializer(0); I->setLinkage(GlobalValue::ExternalLinkage); Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.42 llvm/tools/bugpoint/ExtractFunction.cpp:1.43 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.42 Wed Feb 23 00:12:11 2005 +++ llvm/tools/bugpoint/ExtractFunction.cpp Tue Mar 15 09:48:06 2005 @@ -183,13 +183,13 @@ // between the two modules will work. for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) I->setLinkage(GlobalValue::ExternalLinkage); - for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) I->setLinkage(GlobalValue::ExternalLinkage); Module *New = CloneModule(M); // Make sure global initializers exist only in the safe module (CBE->.so) - for (Module::giterator I = New->gbegin(), E = New->gend(); I != E; ++I) + for (Module::global_iterator I = New->global_begin(), E = New->global_end(); I != E; ++I) I->setInitializer(0); // Delete the initializer to make it external // Remove the Test functions from the Safe module Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.61 llvm/tools/bugpoint/Miscompilation.cpp:1.62 --- llvm/tools/bugpoint/Miscompilation.cpp:1.61 Tue Mar 15 01:02:26 2005 +++ llvm/tools/bugpoint/Miscompilation.cpp Tue Mar 15 09:48:06 2005 @@ -232,7 +232,7 @@ // mangler is used by the two code generators), but having symbols with the // same name causes warnings to be emitted by the code generator. Mangler Mang(*M); - for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) I->setName(Mang.getValueName(I)); for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) I->setName(Mang.getValueName(I)); From lattner at cs.uiuc.edu Tue Mar 15 09:48:35 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 09:48:35 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-nm/llvm-nm.cpp Message-ID: <200503151548.j2FFmZuE030376@apoc.cs.uiuc.edu> Changes in directory llvm/tools/llvm-nm: llvm-nm.cpp updated: 1.22 -> 1.23 --- Log message: method renamed --- Diffs of the changes: (+1 -1) llvm-nm.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llvm-nm/llvm-nm.cpp diff -u llvm/tools/llvm-nm/llvm-nm.cpp:1.22 llvm/tools/llvm-nm/llvm-nm.cpp:1.23 --- llvm/tools/llvm-nm/llvm-nm.cpp:1.22 Wed Dec 29 23:36:07 2004 +++ llvm/tools/llvm-nm/llvm-nm.cpp Tue Mar 15 09:48:22 2005 @@ -113,7 +113,7 @@ << " Size Line Section\n"; } std::for_each (M->begin (), M->end (), DumpSymbolNameForGlobalValue); - std::for_each (M->gbegin (), M->gend (), DumpSymbolNameForGlobalValue); + std::for_each (M->global_begin (), M->global_end (), DumpSymbolNameForGlobalValue); } void DumpSymbolNamesFromFile (std::string &Filename) { From lattner at cs.uiuc.edu Tue Mar 15 10:46:27 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 10:46:27 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200503151646.j2FGkR5G003885@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.90 -> 1.91 --- Log message: add iterators for return nodes list. --- Diffs of the changes: (+7 -0) DSGraph.h | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.90 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.91 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.90 Mon Mar 14 18:58:09 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Tue Mar 15 10:46:11 2005 @@ -264,6 +264,13 @@ return I->second; } + /// retnodes_* iterator methods: expose iteration over return nodes in the + /// graph, which are also the set of functions incorporated in this graph. + typedef ReturnNodesTy::const_iterator retnodes_iterator; + retnodes_iterator retnodes_begin() const { return ReturnNodes.begin(); } + retnodes_iterator retnodes_end() const { return ReturnNodes.end(); } + + /// getReturnNodes - Return the mapping of functions to their return nodes for /// this graph. /// From lattner at cs.uiuc.edu Tue Mar 15 10:55:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 10:55:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp CompleteBottomUp.cpp DataStructure.cpp EquivClassGraphs.cpp Printer.cpp TopDownClosure.cpp Message-ID: <200503151655.j2FGtHrd004681@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.95 -> 1.96 CompleteBottomUp.cpp updated: 1.19 -> 1.20 DataStructure.cpp updated: 1.203 -> 1.204 EquivClassGraphs.cpp updated: 1.28 -> 1.29 Printer.cpp updated: 1.76 -> 1.77 TopDownClosure.cpp updated: 1.74 -> 1.75 --- Log message: Start using retnodes_* for iteration. --- Diffs of the changes: (+34 -39) BottomUpClosure.cpp | 6 +++--- CompleteBottomUp.cpp | 8 ++++---- DataStructure.cpp | 14 +++++++------- EquivClassGraphs.cpp | 21 +++++++++------------ Printer.cpp | 17 ++++++++--------- TopDownClosure.cpp | 7 +++---- 6 files changed, 34 insertions(+), 39 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.95 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.96 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.95 Sun Mar 13 14:32:26 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Tue Mar 15 10:55:04 2005 @@ -228,8 +228,8 @@ SCCGraph->getReturnNodes(), NodeMap); } // Update the DSInfo map and delete the old graph... - for (DSGraph::ReturnNodesTy::iterator I = G.getReturnNodes().begin(), - E = G.getReturnNodes().end(); I != E; ++I) + for (DSGraph::retnodes_iterator I = G.retnodes_begin(), + E = G.retnodes_end(); I != E; ++I) DSInfo[I->first] = SCCGraph; delete &G; } @@ -496,7 +496,7 @@ assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!"); // Change the Function* is the returnnodes map to the ToF. - DSNodeHandle Ret = NG->getReturnNodes().begin()->second; + DSNodeHandle Ret = NG->retnodes_begin()->second; NG->getReturnNodes().clear(); NG->getReturnNodes()[ToF] = Ret; return; Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.19 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.20 --- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.19 Sun Mar 13 14:32:26 2005 +++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Tue Mar 15 10:55:04 2005 @@ -127,8 +127,8 @@ // Make sure to update the DSInfo map for all of the functions currently in // this graph! - for (DSGraph::ReturnNodesTy::iterator I = Graph->getReturnNodes().begin(); - I != Graph->getReturnNodes().end(); ++I) + for (DSGraph::retnodes_iterator I = Graph->retnodes_begin(); + I != Graph->retnodes_end(); ++I) DSInfo[I->first] = Graph; return *Graph; @@ -180,8 +180,8 @@ FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap); // Update the DSInfo map and delete the old graph... - for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin(); - I != NG->getReturnNodes().end(); ++I) + for (DSGraph::retnodes_iterator I = NG->retnodes_begin(); + I != NG->retnodes_end(); ++I) DSInfo[I->first] = &FG; // Remove NG from the ValMap since the pointer may get recycled. Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.203 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.204 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.203 Mon Mar 14 22:54:18 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Tue Mar 15 10:55:04 2005 @@ -547,8 +547,8 @@ } Module *M = 0; - if (getParentGraph()->getReturnNodes().size()) - M = getParentGraph()->getReturnNodes().begin()->first->getParent(); + if (getParentGraph()->retnodes_begin() != getParentGraph()->retnodes_end()) + M = getParentGraph()->retnodes_begin()->first->getParent(); DEBUG(std::cerr << "MergeTypeInfo Folding OrigTy: "; WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:"; WriteTypeSymbolic(std::cerr, NewTy, M) << " @ " << Offset << "!\n" @@ -1058,11 +1058,11 @@ std::string DSGraph::getFunctionNames() const { switch (getReturnNodes().size()) { case 0: return "Globals graph"; - case 1: return getReturnNodes().begin()->first->getName(); + case 1: return retnodes_begin()->first->getName(); default: std::string Return; - for (DSGraph::ReturnNodesTy::const_iterator I = getReturnNodes().begin(); - I != getReturnNodes().end(); ++I) + for (DSGraph::retnodes_iterator I = retnodes_begin(); + I != retnodes_end(); ++I) Return += I->first->getName() + " "; Return.erase(Return.end()-1, Return.end()); // Remove last space character return Return; @@ -1233,8 +1233,8 @@ } // Map the return node pointers over... - for (ReturnNodesTy::const_iterator I = G.getReturnNodes().begin(), - E = G.getReturnNodes().end(); I != E; ++I) { + for (retnodes_iterator I = G.retnodes_begin(), + E = G.retnodes_end(); I != E; ++I) { const DSNodeHandle &Ret = I->second; DSNodeHandle &MappedRet = OldNodeMap[Ret.getNode()]; DSNode *MappedRetN = MappedRet.getNode(); Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.28 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.29 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.28 Tue Mar 15 00:29:12 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Tue Mar 15 10:55:04 2005 @@ -45,7 +45,7 @@ for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (!I->isExternal()) { DSGraph &G = ECGraphs.getDSGraph(*I); - if (G.getReturnNodes().begin()->first != I) + if (G.retnodes_begin()->first != I) continue; // Only check a graph once. DSGraph::NodeMapTy GlobalsGraphNodeMapping; @@ -181,9 +181,8 @@ // Currently, that is just the functions in the same call-graph-SCC as F. // DSGraph& funcDSGraph = CBU->getDSGraph(*I->second); - const DSGraph::ReturnNodesTy &RetNodes = funcDSGraph.getReturnNodes(); - for (DSGraph::ReturnNodesTy::const_iterator RI=RetNodes.begin(), - RE=RetNodes.end(); RI != RE; ++RI) + for (DSGraph::retnodes_iterator RI = funcDSGraph.retnodes_begin(), + RE = funcDSGraph.retnodes_end(); RI != RE; ++RI) FuncECs.unionSetsWith(FirstFunc, RI->first); } @@ -235,10 +234,8 @@ continue; // Record the "folded" graph for the function. - for (DSGraph::ReturnNodesTy::iterator - I = CBUGraph.getReturnNodes().begin(), - E = CBUGraph.getReturnNodes().end(); - I != E; ++I) { + for (DSGraph::retnodes_iterator I = CBUGraph.retnodes_begin(), + E = CBUGraph.retnodes_end(); I != E; ++I) { assert(DSInfo[I->first] == 0 && "Graph already exists for Fn!"); DSInfo[I->first] = &MergedG; } @@ -284,8 +281,8 @@ Graph->setPrintAuxCalls(); // Make sure to update the DSInfo map for all functions in the graph! - for (DSGraph::ReturnNodesTy::iterator I = Graph->getReturnNodes().begin(); - I != Graph->getReturnNodes().end(); ++I) + for (DSGraph::retnodes_iterator I = Graph->retnodes_begin(); + I != Graph->retnodes_end(); ++I) if (I->first != &F) { DSGraph *&FG = DSInfo[I->first]; assert(FG == 0 && "Merging function in SCC twice?"); @@ -342,8 +339,8 @@ FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap); // Update the DSInfo map and delete the old graph... - for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin(); - I != NG->getReturnNodes().end(); ++I) + for (DSGraph::retnodes_iterator I = NG->retnodes_begin(); + I != NG->retnodes_end(); ++I) DSInfo[I->first] = &FG; // Remove NG from the ValMap since the pointer may get recycled. Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.76 llvm/lib/Analysis/DataStructure/Printer.cpp:1.77 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.76 Sun Mar 13 13:51:24 2005 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Tue Mar 15 10:55:04 2005 @@ -44,8 +44,8 @@ if (!G) G = N->getParentGraph(); // Get the module from ONE of the functions in the graph it is available. - if (G && !G->getReturnNodes().empty()) - M = G->getReturnNodes().begin()->first->getParent(); + if (G && G->retnodes_begin() != G->retnodes_end()) + M = G->retnodes_begin()->first->getParent(); if (M == 0 && G) { // If there is a global in the graph, we can use it to find the module. const DSScalarMap &SM = G->getScalarMap(); @@ -126,8 +126,8 @@ static void addCustomGraphFeatures(const DSGraph *G, GraphWriter &GW) { Module *CurMod = 0; - if (!G->getReturnNodes().empty()) - CurMod = G->getReturnNodes().begin()->first->getParent(); + if (G->retnodes_begin() != G->retnodes_end()) + CurMod = G->retnodes_begin()->first->getParent(); else { // If there is a global in the graph, we can use it to find the module. const DSScalarMap &SM = G->getScalarMap(); @@ -154,12 +154,11 @@ // Output the returned value pointer... - const DSGraph::ReturnNodesTy &RetNodes = G->getReturnNodes(); - for (DSGraph::ReturnNodesTy::const_iterator I = RetNodes.begin(), - E = RetNodes.end(); I != E; ++I) + for (DSGraph::retnodes_iterator I = G->retnodes_begin(), + E = G->retnodes_end(); I != E; ++I) if (I->second.getNode()) { std::string Label; - if (RetNodes.size() == 1) + if (G->getReturnNodes().size() == 1) Label = "returning"; else Label = I->first->getName() + " ret node"; @@ -276,7 +275,7 @@ TotalCallNodes += NumCalls; if (I->getName() == "main" || !OnlyPrintMain) { - Function *SCCFn = Gr.getReturnNodes().begin()->first; + Function *SCCFn = Gr.retnodes_begin()->first; if (&*I == SCCFn) Gr.writeGraphToFile(O, Prefix+I->getName()); else Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.74 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.75 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.74 Fri Feb 4 12:58:04 2005 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Tue Mar 15 10:55:04 2005 @@ -179,9 +179,8 @@ // If any of the functions has incomplete incoming arguments, don't mark any // of them as complete. bool HasIncompleteArgs = false; - const DSGraph::ReturnNodesTy &GraphReturnNodes = Graph.getReturnNodes(); - for (DSGraph::ReturnNodesTy::const_iterator I = GraphReturnNodes.begin(), - E = GraphReturnNodes.end(); I != E; ++I) + for (DSGraph::retnodes_iterator I = Graph.retnodes_begin(), + E = Graph.retnodes_end(); I != E; ++I) if (ArgsRemainIncomplete.count(I->first)) { HasIncompleteArgs = true; break; @@ -330,7 +329,7 @@ assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!"); // Change the Function* is the returnnodes map to the ToF. - DSNodeHandle Ret = NG->getReturnNodes().begin()->second; + DSNodeHandle Ret = NG->retnodes_begin()->second; NG->getReturnNodes().clear(); NG->getReturnNodes()[ToF] = Ret; return; From lattner at cs.uiuc.edu Tue Mar 15 11:14:22 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 11:14:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Message-ID: <200503151714.j2FHEMfN006745@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: EquivClassGraphs.cpp updated: 1.29 -> 1.30 --- Log message: Finally fix (the right way) the problem where functions like this: void foo() { G = 1; } would have an empty DSGraph even though G (a global) is directly used in the function. --- Diffs of the changes: (+24 -0) EquivClassGraphs.cpp | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.29 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.30 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.29 Tue Mar 15 10:55:04 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Tue Mar 15 11:14:09 2005 @@ -16,6 +16,7 @@ #define DEBUG_TYPE "ECGraphs" #include "llvm/Analysis/DataStructure/EquivClassGraphs.h" +#include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Analysis/DataStructure/DSGraph.h" @@ -123,6 +124,29 @@ DSGraph::IgnoreGlobals); } + // Final processing. Note that dead node elimination may actually remove + // globals from a function graph that are immediately used. If there are no + // scalars pointing to the node (e.g. because the only use is a direct store + // to a scalar global) we have to make sure to rematerialize the globals back + // into the graphs here, or clients will break! + for (Module::global_iterator GI = M.global_begin(), E = M.global_end(); + GI != E; ++GI) + // This only happens to first class typed globals. + if (GI->getType()->getElementType()->isFirstClassType()) + for (Value::use_iterator UI = GI->use_begin(), E = GI->use_end(); + UI != E; ++UI) + // This only happens to direct uses by instructions. + if (Instruction *User = dyn_cast(*UI)) { + DSGraph &DSG = getOrCreateGraph(*User->getParent()->getParent()); + if (!DSG.getScalarMap().count(GI)) { + // If this global does not exist in the graph, but it is immediately + // used by an instruction in the graph, clone it over from the + // globals graph. + ReachabilityCloner RC(DSG, *GlobalsGraph, 0); + RC.getClonedNH(GlobalsGraph->getNodeForValue(GI)); + } + } + return false; } From lattner at cs.uiuc.edu Tue Mar 15 11:52:23 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 11:52:23 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200503151752.j2FHqN0Y009204@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.91 -> 1.92 --- Log message: remove warning, make computeGGToGMapping return an invnodemap. --- Diffs of the changes: (+8 -7) DSGraph.h | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.91 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.92 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.91 Tue Mar 15 10:46:11 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Tue Mar 15 11:52:07 2005 @@ -124,6 +124,10 @@ /// keep track of the correspondence between the nodes in the old and new /// graphs. typedef hash_map NodeMapTy; + + // InvNodeMapTy - This data type is used to represent the inverse of a node + // map. + typedef hash_multimap InvNodeMapTy; private: DSGraph *GlobalsGraph; // Pointer to the common graph of global objects bool PrintAuxCalls; // Should this graph print the Aux calls vector? @@ -383,16 +387,13 @@ const DSNodeHandle &NH2, NodeMapTy &NodeMap, bool StrictChecking = true); - /// computeGGToGMapping - Compute the mapping of nodes in the global - /// graph to nodes in this graph. - void computeGGToGMapping(NodeMapTy &NodeMap); - /// computeGToGGMapping - Compute the mapping of nodes in the graph to nodes - /// in the globals graph. Note that any uses of this method are probably - /// bugs, unless it is known that the globals graph has been merged into this - /// graph! + /// in the globals graph. void computeGToGGMapping(NodeMapTy &NodeMap); + /// computeGGToGMapping - Compute the mapping of nodes in the global + /// graph to nodes in this graph. + void computeGGToGMapping(InvNodeMapTy &InvNodeMap); /// cloneInto - Clone the specified DSGraph into the current graph. The /// translated ScalarMap for the old function is filled into the OldValMap From lattner at cs.uiuc.edu Tue Mar 15 11:52:35 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 11:52:35 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSSupport.h Message-ID: <200503151752.j2FHqZ2O009338@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSSupport.h updated: 1.36 -> 1.37 --- Log message: add support for hashing nodehandles. --- Diffs of the changes: (+9 -0) DSSupport.h | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/include/llvm/Analysis/DataStructure/DSSupport.h diff -u llvm/include/llvm/Analysis/DataStructure/DSSupport.h:1.36 llvm/include/llvm/Analysis/DataStructure/DSSupport.h:1.37 --- llvm/include/llvm/Analysis/DataStructure/DSSupport.h:1.36 Sun Jan 30 17:50:48 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSSupport.h Tue Mar 15 11:51:51 2005 @@ -146,6 +146,15 @@ inline void swap(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); } } +namespace HASH_NAMESPACE { + // Provide a hash function for arbitrary pointers... + template <> struct hash { + inline size_t operator()(const llvm::DSNodeHandle &Val) const { + return hash()(Val.getNode()) ^ Val.getOffset(); + } + }; +} + namespace llvm { //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Tue Mar 15 11:52:32 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 11:52:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503151752.j2FHqWPn009332@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.204 -> 1.205 --- Log message: Make computeGGToGMapping compute an invnodemap --- Diffs of the changes: (+11 -9) DataStructure.cpp | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.204 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.205 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.204 Tue Mar 15 10:55:04 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Tue Mar 15 11:52:18 2005 @@ -2087,8 +2087,7 @@ /// computeGToGGMapping - Compute the mapping of nodes in the global graph to -/// nodes in this graph. Note that any uses of this method are probably bugs, -/// unless it is known that the globals graph has been merged into this graph! +/// nodes in this graph. void DSGraph::computeGToGGMapping(NodeMapTy &NodeMap) { DSGraph &GG = *getGlobalsGraph(); @@ -2099,13 +2098,16 @@ } /// computeGGToGMapping - Compute the mapping of nodes in the global graph to -/// nodes in this graph. -void DSGraph::computeGGToGMapping(NodeMapTy &NodeMap) { - DSGraph &GG = *getGlobalsGraph(); +/// nodes in this graph. Note that any uses of this method are probably bugs, +/// unless it is known that the globals graph has been merged into this graph! +void DSGraph::computeGGToGMapping(InvNodeMapTy &InvNodeMap) { + NodeMapTy NodeMap; + computeGToGGMapping(NodeMap); - DSScalarMap &SM = getScalarMap(); - for (DSScalarMap::global_iterator I = SM.global_begin(), - E = SM.global_end(); I != E; ++I) - DSGraph::computeNodeMapping(GG.getNodeForValue(*I), SM[*I], NodeMap); + while (!NodeMap.empty()) { + InvNodeMap.insert(std::make_pair(NodeMap.begin()->second, + NodeMap.begin()->first)); + NodeMap.erase(NodeMap.begin()); + } } From alenhar2 at cs.uiuc.edu Tue Mar 15 13:51:35 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 15 Mar 2005 13:51:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaInstrInfo.td Message-ID: <200503151951.j2FJpZL2011778@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelPattern.cpp updated: 1.63 -> 1.64 AlphaInstrInfo.td updated: 1.32 -> 1.33 --- Log message: sure, I can set a flag, but if I never check it, why bother setting it? Should fix 20 programs :) --- Diffs of the changes: (+5 -3) AlphaISelPattern.cpp | 4 ++-- AlphaInstrInfo.td | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.63 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.64 --- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.63 Mon Mar 14 22:54:19 2005 +++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Mar 15 13:51:19 2005 @@ -1291,8 +1291,8 @@ BuildMI(BB, Opc, 2, Tmp3).addReg(Tmp1).addReg(Tmp2); //now arrange for Result (int) to have a 1 or 0 - - BuildMI(BB, Alpha::CC2INT, 1, Result).addReg(Tmp3); + Opc = inv?Alpha::CC2INT_INV:Alpha::CC2INT; + BuildMI(BB, Opc, 1, Result).addReg(Tmp3); // // Spill the FP to memory and reload it from there. // unsigned Size = MVT::getSizeInBits(MVT::f64)/8; Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.32 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.33 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.32 Mon Mar 14 13:23:45 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Tue Mar 15 13:51:19 2005 @@ -88,8 +88,10 @@ } //This is an improvement on the old style setcc (FP) -def CC2INT : PseudoInstAlpha<(ops GPRC:$RES, FPRC:$COND), +def CC2INT_INV : PseudoInstAlpha<(ops GPRC:$RES, FPRC:$COND), "lda $RES,1($$31)\n\tfbeq $COND, 42f\n\tbis $$31,$$31,$RES\n42:\n">; +def CC2INT : PseudoInstAlpha<(ops GPRC:$RES, FPRC:$COND), + "lda $RES,1($$31)\n\tfbne $COND, 42f\n\tbis $$31,$$31,$RES\n42:\n">; //*********************** //Real instructions From lattner at cs.uiuc.edu Tue Mar 15 14:25:42 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 14:25:42 -0600 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2000/Makefile Message-ID: <200503152025.j2FKPgjW012808@apoc.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2000: Makefile updated: 1.9 -> 1.10 --- Log message: Enable the F77 SPECFP2K programs. --- Diffs of the changes: (+11 -0) Makefile | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm-test/External/SPEC/CFP2000/Makefile diff -u llvm-test/External/SPEC/CFP2000/Makefile:1.9 llvm-test/External/SPEC/CFP2000/Makefile:1.10 --- llvm-test/External/SPEC/CFP2000/Makefile:1.9 Mon Sep 6 22:37:10 2004 +++ llvm-test/External/SPEC/CFP2000/Makefile Tue Mar 15 14:25:25 2005 @@ -1,8 +1,19 @@ LEVEL = ../../.. +include $(LEVEL)/Makefile.config + PARALLEL_DIRS := \ 177.mesa \ 179.art \ 183.equake \ 188.ammp +ifdef USE_F2C +PARALLEL_DIRS += \ + 168.wupwise \ + 171.swim \ + 172.mgrid \ + 173.applu +endif + + include $(LEVEL)/Makefile.programs From brukman at cs.uiuc.edu Tue Mar 15 14:31:12 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 15 Mar 2005 14:31:12 -0600 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2000/Makefile Message-ID: <200503152031.OAA26762@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2000: Makefile updated: 1.10 -> 1.11 --- Log message: Add notes on f2c status of program translation --- Diffs of the changes: (+7 -2) Makefile | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm-test/External/SPEC/CFP2000/Makefile diff -u llvm-test/External/SPEC/CFP2000/Makefile:1.10 llvm-test/External/SPEC/CFP2000/Makefile:1.11 --- llvm-test/External/SPEC/CFP2000/Makefile:1.10 Tue Mar 15 14:25:25 2005 +++ llvm-test/External/SPEC/CFP2000/Makefile Tue Mar 15 14:31:02 2005 @@ -7,13 +7,18 @@ 183.equake \ 188.ammp +# These are f90 and hence cannot be converted with f2c: +# 178.galgel, 187.facerec, 189.lucas, 191.fma3d +# +# These are broken with f2c: output does not compile natively +# 200.sixtrack, 301.apsi + ifdef USE_F2C PARALLEL_DIRS += \ 168.wupwise \ 171.swim \ 172.mgrid \ - 173.applu + 173.applu endif - include $(LEVEL)/Makefile.programs From lattner at cs.uiuc.edu Tue Mar 15 15:37:07 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 15:37:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503152137.j2FLb756014576@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.205 -> 1.206 --- Log message: Fix a crash that happens when mapping something like this: { short, short } to short where the second short maps onto the second field of the first struct. In this case, the struct index is not aligned, so we should avoid calling getLink(2), which asserts out. --- Diffs of the changes: (+12 -6) DataStructure.cpp | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.205 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.206 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.205 Tue Mar 15 11:52:18 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Tue Mar 15 15:36:50 2005 @@ -2077,12 +2077,18 @@ unsigned N2Size = N2->getSize(); if (N2Size == 0) return; // No edges to map to. - for (unsigned i = 0, e = N1->getSize(); i < e; i += DS::PointerSize) - if (unsigned(N2Idx)+i < N2Size) - computeNodeMapping(N1->getLink(i), N2->getLink(N2Idx+i), NodeMap); - else - computeNodeMapping(N1->getLink(i), - N2->getLink(unsigned(N2Idx+i) % N2Size), NodeMap); + for (unsigned i = 0, e = N1->getSize(); i < e; i += DS::PointerSize) { + const DSNodeHandle &N1NH = N1->getLink(i); + // Don't call N2->getLink if not needed (avoiding crash if N2Idx is not + // aligned right). + if (!N1NH.isNull()) { + if (unsigned(N2Idx)+i < N2Size) + computeNodeMapping(N1NH, N2->getLink(N2Idx+i), NodeMap); + else + computeNodeMapping(N1NH, + N2->getLink(unsigned(N2Idx+i) % N2Size), NodeMap); + } + } } From lattner at cs.uiuc.edu Tue Mar 15 16:10:19 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 16:10:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp CompleteBottomUp.cpp EquivClassGraphs.cpp Message-ID: <200503152210.j2FMAJgJ016259@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.96 -> 1.97 CompleteBottomUp.cpp updated: 1.20 -> 1.21 EquivClassGraphs.cpp updated: 1.30 -> 1.31 --- Log message: fix crashes when we only have a prototype for main. --- Diffs of the changes: (+3 -3) BottomUpClosure.cpp | 2 +- CompleteBottomUp.cpp | 2 +- EquivClassGraphs.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.96 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.97 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.96 Tue Mar 15 10:55:04 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Tue Mar 15 16:10:04 2005 @@ -85,7 +85,7 @@ // Merge the globals variables (not the calls) from the globals graph back // into the main function's graph so that the main function contains all of // the information about global pools and GV usage in the program. - if (MainFunc) { + if (MainFunc && !MainFunc->isExternal()) { DSGraph &MainGraph = getOrCreateGraph(MainFunc); const DSGraph &GG = *MainGraph.getGlobalsGraph(); ReachabilityCloner RC(MainGraph, GG, Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.20 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.21 --- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.20 Tue Mar 15 10:55:04 2005 +++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Tue Mar 15 16:10:04 2005 @@ -94,7 +94,7 @@ // Merge the globals variables (not the calls) from the globals graph back // into the main function's graph so that the main function contains all of // the information about global pools and GV usage in the program. - if (MainFunc) { + if (MainFunc && !MainFunc->isExternal()) { DSGraph &MainGraph = getOrCreateGraph(*MainFunc); const DSGraph &GG = *MainGraph.getGlobalsGraph(); ReachabilityCloner RC(MainGraph, GG, Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.30 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.31 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.30 Tue Mar 15 11:14:09 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Tue Mar 15 16:10:04 2005 @@ -106,7 +106,7 @@ // Merge the globals variables (not the calls) from the globals graph back // into the main function's graph so that the main function contains all of // the information about global pools and GV usage in the program. - if (MainFunc) { + if (MainFunc && !MainFunc->isExternal()) { DSGraph &MainGraph = getOrCreateGraph(*MainFunc); const DSGraph &GG = *MainGraph.getGlobalsGraph(); ReachabilityCloner RC(MainGraph, GG, From lattner at cs.uiuc.edu Tue Mar 15 16:47:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 16:47:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Message-ID: <200503152247.j2FMlYOx017368@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: EquivClassGraphs.cpp updated: 1.31 -> 1.32 --- Log message: make sure to mark nodes in the globals graph incomplete after computing it so that external globals (and whatever they point to) are marked incomplete. --- Diffs of the changes: (+1 -0) EquivClassGraphs.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.31 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.32 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.31 Tue Mar 15 16:10:04 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Tue Mar 15 16:47:18 2005 @@ -102,6 +102,7 @@ DEBUG(CheckAllGraphs(&M, *this)); getGlobalsGraph().removeTriviallyDeadNodes(); + getGlobalsGraph().markIncompleteNodes(DSGraph::IgnoreGlobals); // Merge the globals variables (not the calls) from the globals graph back // into the main function's graph so that the main function contains all of From lattner at cs.uiuc.edu Tue Mar 15 16:51:57 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 16:51:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkItems.cpp LinkLibraries.cpp Message-ID: <200503152251.j2FMpvN2017440@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkItems.cpp updated: 1.3 -> 1.4 LinkLibraries.cpp (r1.3) removed --- Log message: consolidate LinkLibraries into LinkItems --- Diffs of the changes: (+57 -0) LinkItems.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+) Index: llvm/lib/Linker/LinkItems.cpp diff -u llvm/lib/Linker/LinkItems.cpp:1.3 llvm/lib/Linker/LinkItems.cpp:1.4 --- llvm/lib/Linker/LinkItems.cpp:1.3 Sun Dec 12 20:59:52 2004 +++ llvm/lib/Linker/LinkItems.cpp Tue Mar 15 16:51:40 2005 @@ -47,3 +47,60 @@ return false; } + + +/// LinkInLibrary - links one library into the HeadModule. +/// +bool Linker::LinkInLibrary(const std::string& Lib) { + // Determine where this library lives. + sys::Path Pathname = FindLib(Lib); + if (Pathname.isEmpty()) + return warning("Cannot find library '" + Lib + "'"); + + // If its an archive, try to link it in + if (Pathname.isArchive()) { + if (LinkInArchive(Pathname)) + return error("Cannot link archive '" + Pathname.toString() + "'"); + } else if (Pathname.isBytecodeFile()) { + // LLVM ".so" file. + if (LinkInFile(Pathname)) + return error("Cannot link file '" + Pathname.toString() + "'"); + + } else if (Pathname.isDynamicLibrary()) { + return warning("Library '" + Lib + "' is a native dynamic library."); + } else { + return warning("Supposed library '" + Lib + "' isn't a library."); + } + return false; +} + +/// LinkLibraries - takes the specified library files and links them into the +/// main bytecode object file. +/// +/// Inputs: +/// Libraries - The list of libraries to link into the module. +/// +/// Return value: +/// FALSE - No error. +/// TRUE - Error. +/// +bool Linker::LinkInLibraries(const std::vector &Libraries) { + + // Process the set of libraries we've been provided. + for (unsigned i = 0; i < Libraries.size(); ++i) + if (LinkInLibrary(Libraries[i])) + return true; + + // At this point we have processed all the libraries provided to us. Since + // we have an aggregated module at this point, the dependent libraries in + // that module should also be aggregated with duplicates eliminated. This is + // now the time to process the dependent libraries to resolve any remaining + // symbols. + const Module::LibraryListType& DepLibs = Composite->getLibraries(); + for (Module::LibraryListType::const_iterator I = DepLibs.begin(), + E = DepLibs.end(); I != E; ++I) + if (LinkInLibrary(*I)) + return true; + + return false; +} From lattner at cs.uiuc.edu Tue Mar 15 16:55:34 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 16:55:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkItems.cpp LinkFiles.cpp Message-ID: <200503152255.j2FMtY0Y017711@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkItems.cpp updated: 1.4 -> 1.5 LinkFiles.cpp (r1.2) removed --- Log message: consolidate LinkFiles into LinkItems, use lib_* iterators. --- Diffs of the changes: (+61 -4) LinkItems.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 61 insertions(+), 4 deletions(-) Index: llvm/lib/Linker/LinkItems.cpp diff -u llvm/lib/Linker/LinkItems.cpp:1.4 llvm/lib/Linker/LinkItems.cpp:1.5 --- llvm/lib/Linker/LinkItems.cpp:1.4 Tue Mar 15 16:51:40 2005 +++ llvm/lib/Linker/LinkItems.cpp Tue Mar 15 16:55:17 2005 @@ -38,12 +38,10 @@ // that module should also be aggregated with duplicates eliminated. This is // now the time to process the dependent libraries to resolve any remaining // symbols. - const Module::LibraryListType& DepLibs = Composite->getLibraries(); - for (Module::LibraryListType::const_iterator I = DepLibs.begin(), - E = DepLibs.end(); I != E; ++I) { + for (Module::lib_iterator I = Composite->lib_begin(), + E = Composite->lib_end(); I != E; ++I) if(LinkInLibrary(*I)) return true; - } return false; } @@ -104,3 +102,62 @@ return false; } + +/// LinkInFile - opens a bytecode file and links in all objects which +/// provide symbols that are currently undefined. +/// +/// Inputs: +/// File - The pathname of the bytecode file. +/// +/// Outputs: +/// ErrorMessage - A C++ string detailing what error occurred, if any. +/// +/// Return Value: +/// TRUE - An error occurred. +/// FALSE - No errors. +/// +bool Linker::LinkInFile(const sys::Path &File) { + // Make sure we can at least read the file + if (!File.readable()) + return error("Cannot find linker input '" + File.toString() + "'"); + + // A user may specify an ar archive without -l, perhaps because it + // is not installed as a library. Detect that and link the library. + if (File.isArchive()) { + if (LinkInArchive(File)) + return error("Cannot link archive '" + File.toString() + "'"); + } else if (File.isBytecodeFile()) { + verbose("Linking bytecode file '" + File.toString() + "'"); + + std::auto_ptr M(LoadObject(File)); + if (M.get() == 0) + return error("Cannot load file '" + File.toString() + "'" + Error); + if (LinkInModule(M.get())) + return error("Cannot link file '" + File.toString() + "'" + Error); + + verbose("Linked in file '" + File.toString() + "'"); + } else { + return warning("File of unknown type '" + File.toString() + "' ignored."); + } + return false; +} + +/// LinkFiles - takes a module and a list of files and links them all together. +/// It locates the file either in the current directory, as its absolute +/// or relative pathname, or as a file somewhere in LLVM_LIB_SEARCH_PATH. +/// +/// Inputs: +/// Files - A vector of sys::Path indicating the LLVM bytecode filenames +/// to be linked. The names can refer to a mixture of pure LLVM +/// bytecode files and archive (ar) formatted files. +/// +/// Return value: +/// FALSE - No errors. +/// TRUE - Some error occurred. +/// +bool Linker::LinkInFiles(const std::vector &Files) { + for (unsigned i = 0; i < Files.size(); ++i) + if (LinkInFile(Files[i])) + return true; + return false; +} From lattner at cs.uiuc.edu Tue Mar 15 16:59:13 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 16:59:13 -0600 Subject: [llvm-commits] CVS: llvm-www/ProjectsWithLLVM/index.html Message-ID: <200503152259.j2FMxD1h017792@apoc.cs.uiuc.edu> Changes in directory llvm-www/ProjectsWithLLVM: index.html updated: 1.21 -> 1.22 --- Log message: remove broken link --- Diffs of the changes: (+2 -2) index.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/ProjectsWithLLVM/index.html diff -u llvm-www/ProjectsWithLLVM/index.html:1.21 llvm-www/ProjectsWithLLVM/index.html:1.22 --- llvm-www/ProjectsWithLLVM/index.html:1.21 Sun Oct 31 20:28:28 2004 +++ llvm-www/ProjectsWithLLVM/index.html Tue Mar 15 16:59:00 2005 @@ -109,8 +109,8 @@

          Wiki -page with overview; design doc, user manual & download on the -LLVM-TV website

          +page with overview; design doc, and user manual. You can download +llvm-tv from LLVM CVS (the llvm-tv module).

          From lattner at cs.uiuc.edu Tue Mar 15 17:03:47 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 17:03:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp Message-ID: <200503152303.j2FN3lsl018166@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.47 -> 1.48 --- Log message: fix some 80 column violations Add support for programs that define main in a .a file, such as f2c'd programs. --- Diffs of the changes: (+11 -4) LinkArchives.cpp | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.47 llvm/lib/Linker/LinkArchives.cpp:1.48 --- llvm/lib/Linker/LinkArchives.cpp:1.47 Mon Mar 14 22:54:19 2005 +++ llvm/lib/Linker/LinkArchives.cpp Tue Mar 15 17:03:34 2005 @@ -21,8 +21,6 @@ #include "llvm/Config/config.h" #include #include -#include - using namespace llvm; /// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the @@ -33,7 +31,8 @@ for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage()) DefinedSymbols.insert(I->getName()); - for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); + I != E; ++I) if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage()) DefinedSymbols.insert(I->getName()); } @@ -54,6 +53,13 @@ GetAllUndefinedSymbols(Module *M, std::set &UndefinedSymbols) { std::set DefinedSymbols; UndefinedSymbols.clear(); + + // If the program doesn't define a main, try pulling one in from a .a file. + // This is needed for programs where the main function is defined in an + // archive, such f2c'd programs. + Function *Main = M->getMainFunction(); + if (Main == 0 || Main->isExternal()) + UndefinedSymbols.insert("main"); for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (I->hasName()) { @@ -62,7 +68,8 @@ else if (!I->hasInternalLinkage()) DefinedSymbols.insert(I->getName()); } - for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); + I != E; ++I) if (I->hasName()) { if (I->isExternal()) UndefinedSymbols.insert(I->getName()); From lattner at cs.uiuc.edu Tue Mar 15 17:12:52 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 15 Mar 2005 17:12:52 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200503152312.j2FNCqpp018382@apoc.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.149 -> 1.150 --- Log message: pass EXTRA_LINKTIME_OPT_FLAGS after the main program so that we can play with archives. --- Diffs of the changes: (+1 -1) Makefile.programs | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.149 llvm-test/Makefile.programs:1.150 --- llvm-test/Makefile.programs:1.149 Wed Mar 2 11:24:39 2005 +++ llvm-test/Makefile.programs Tue Mar 15 17:12:39 2005 @@ -214,7 +214,7 @@ $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc): \ Output/%.llvm.bc: Output/%.linked.bc $(LGCCLDPROG) - -$(LGCCLD) $(STATS) $(EXTRA_LINKTIME_OPT_FLAGS) $< -lc $(LIBS) -lcrtend -o Output/$*.llvm + -$(LGCCLD) $(STATS) $< $(EXTRA_LINKTIME_OPT_FLAGS) -lc $(LIBS) -lcrtend -o Output/$*.llvm ifneq ($(OPTPASSES),) -$(LOPT) -q $(OPTPASSES) < $@ > $@.tmp $(MV) -f $@.tmp $@ From alkis at cs.uiuc.edu Tue Mar 15 19:11:16 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Tue, 15 Mar 2005 19:11:16 -0600 Subject: [llvm-commits] CVS: llvm-java/runtime/runtime.c Message-ID: <200503160111.TAA29689@zion.cs.uiuc.edu> Changes in directory llvm-java/runtime: runtime.c updated: 1.20 -> 1.21 --- Log message: Implement native method so that programs are linked properly. --- Diffs of the changes: (+5 -0) runtime.c | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm-java/runtime/runtime.c diff -u llvm-java/runtime/runtime.c:1.20 llvm-java/runtime/runtime.c:1.21 --- llvm-java/runtime/runtime.c:1.20 Thu Feb 3 02:01:13 2005 +++ llvm-java/runtime/runtime.c Tue Mar 15 19:11:05 2005 @@ -380,3 +380,8 @@ memcpy(dst, src, length * srcObj->vtable->typeinfo.elementSize); } + +void Java_gnu_classpath_VMSystemProperties_preInit(JNIEnv *env, jobject clazz, + jobject properties) { + +} From brukman at cs.uiuc.edu Tue Mar 15 21:47:06 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 15 Mar 2005 21:47:06 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Instructions.h Value.h Message-ID: <200503160347.VAA07361@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Instructions.h updated: 1.14 -> 1.15 Value.h updated: 1.74 -> 1.75 --- Log message: Convert tabs to spaces --- Diffs of the changes: (+14 -14) Instructions.h | 26 +++++++++++++------------- Value.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.14 llvm/include/llvm/Instructions.h:1.15 --- llvm/include/llvm/Instructions.h:1.14 Wed Feb 23 23:31:57 2005 +++ llvm/include/llvm/Instructions.h Tue Mar 15 21:46:55 2005 @@ -35,9 +35,9 @@ class AllocationInst : public UnaryInstruction { protected: AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, - const std::string &Name = "", Instruction *InsertBefore = 0); + const std::string &Name = "", Instruction *InsertBefore = 0); AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, - const std::string &Name, BasicBlock *InsertAtEnd); + const std::string &Name, BasicBlock *InsertAtEnd); public: @@ -306,16 +306,16 @@ /// instruction, the second appends the new instruction to the specified /// BasicBlock. GetElementPtrInst(Value *Ptr, const std::vector &Idx, - const std::string &Name = "", Instruction *InsertBefore =0); + const std::string &Name = "", Instruction *InsertBefore =0); GetElementPtrInst(Value *Ptr, const std::vector &Idx, - const std::string &Name, BasicBlock *InsertAtEnd); + const std::string &Name, BasicBlock *InsertAtEnd); /// Constructors - These two constructors are convenience methods because two /// index getelementptr instructions are so common. GetElementPtrInst(Value *Ptr, Value *Idx0, Value *Idx1, - const std::string &Name = "", Instruction *InsertBefore =0); + const std::string &Name = "", Instruction *InsertBefore =0); GetElementPtrInst(Value *Ptr, Value *Idx0, Value *Idx1, - const std::string &Name, BasicBlock *InsertAtEnd); + const std::string &Name, BasicBlock *InsertAtEnd); ~GetElementPtrInst(); virtual GetElementPtrInst *clone() const; @@ -332,10 +332,10 @@ /// pointer type. /// static const Type *getIndexedType(const Type *Ptr, - const std::vector &Indices, - bool AllowStructLeaf = false); + const std::vector &Indices, + bool AllowStructLeaf = false); static const Type *getIndexedType(const Type *Ptr, Value *Idx0, Value *Idx1, - bool AllowStructLeaf = false); + bool AllowStructLeaf = false); inline op_iterator idx_begin() { return op_begin()+1; } inline const_op_iterator idx_begin() const { return op_begin()+1; } @@ -380,9 +380,9 @@ class SetCondInst : public BinaryOperator { public: SetCondInst(BinaryOps Opcode, Value *LHS, Value *RHS, - const std::string &Name = "", Instruction *InsertBefore = 0); + const std::string &Name = "", Instruction *InsertBefore = 0); SetCondInst(BinaryOps Opcode, Value *LHS, Value *RHS, - const std::string &Name, BasicBlock *InsertAtEnd); + const std::string &Name, BasicBlock *InsertAtEnd); /// getInverseCondition - Return the inverse of the current condition opcode. /// For example seteq -> setne, setgt -> setle, setlt -> setge, etc... @@ -1163,10 +1163,10 @@ const std::vector &Params); public: InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, - const std::vector &Params, const std::string &Name = "", + const std::vector &Params, const std::string &Name = "", Instruction *InsertBefore = 0); InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, - const std::vector &Params, const std::string &Name, + const std::vector &Params, const std::string &Name, BasicBlock *InsertAtEnd); ~InvokeInst(); Index: llvm/include/llvm/Value.h diff -u llvm/include/llvm/Value.h:1.74 llvm/include/llvm/Value.h:1.75 --- llvm/include/llvm/Value.h:1.74 Sat Mar 5 20:10:40 2005 +++ llvm/include/llvm/Value.h Tue Mar 15 21:46:55 2005 @@ -197,7 +197,7 @@ template <> inline bool isa_impl(const Value &Val) { return Val.getValueType() == Value::SimpleConstantVal || Val.getValueType() == Value::FunctionVal || - Val.getValueType() == Value::GlobalVariableVal || + Val.getValueType() == Value::GlobalVariableVal || Val.getValueType() == Value::ConstantExprVal || Val.getValueType() == Value::ConstantAggregateZeroVal || Val.getValueType() == Value::UndefValueVal; From brukman at cs.uiuc.edu Tue Mar 15 21:55:01 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 15 Mar 2005 21:55:01 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200503160355.VAA07441@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.49 -> 1.50 --- Log message: Fix grammar wrt apostrophe's --- Diffs of the changes: (+3 -3) Pass.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.49 llvm/include/llvm/Pass.h:1.50 --- llvm/include/llvm/Pass.h:1.49 Tue Dec 7 02:11:11 2004 +++ llvm/include/llvm/Pass.h Tue Mar 15 21:54:50 2005 @@ -10,7 +10,7 @@ // This file defines a base class that indicates that a specified class is a // transformation pass implementation. // -// Pass's are designed this way so that it is possible to run passes in a cache +// Passes are designed this way so that it is possible to run passes in a cache // and organizationally optimal order without having to specify it at the front // end. This allows arbitrary passes to be strung together and have them // executed as effeciently as possible. @@ -208,7 +208,7 @@ //===----------------------------------------------------------------------===// /// ModulePass class - This class is used to implement unstructured -/// interprocedural optimizations and analyses. ModulePass's may do anything +/// interprocedural optimizations and analyses. ModulePasses may do anything /// they want to the program. /// class ModulePass : public Pass { @@ -303,7 +303,7 @@ /// instruction at a time. /// 2. Optimizations do not modify the CFG of the contained function, or any /// other basic block in the function. -/// 3. Optimizations conform to all of the constraints of FunctionPass's. +/// 3. Optimizations conform to all of the constraints of FunctionPasses. /// struct BasicBlockPass : public FunctionPass { /// doInitialization - Virtual method overridden by subclasses to do From jeffc at jolt-lang.org Tue Mar 15 23:10:10 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 15 Mar 2005 23:10:10 -0600 Subject: [llvm-commits] CVS: llvm/win32/Linker/Linker.vcproj Message-ID: <200503160510.XAA16578@zion.cs.uiuc.edu> Changes in directory llvm/win32/Linker: Linker.vcproj updated: 1.3 -> 1.4 --- Log message: Remove deleted files from VC++ project. --- Diffs of the changes: (+0 -6) Linker.vcproj | 6 ------ 1 files changed, 6 deletions(-) Index: llvm/win32/Linker/Linker.vcproj diff -u llvm/win32/Linker/Linker.vcproj:1.3 llvm/win32/Linker/Linker.vcproj:1.4 --- llvm/win32/Linker/Linker.vcproj:1.3 Wed Feb 2 00:33:11 2005 +++ llvm/win32/Linker/Linker.vcproj Tue Mar 15 23:09:59 2005 @@ -113,15 +113,9 @@ RelativePath="..\..\lib\Linker\Linker.cpp"> - - - - From jeffc at jolt-lang.org Tue Mar 15 23:25:20 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 15 Mar 2005 23:25:20 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/hash_map.in Message-ID: <200503160525.XAA16679@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: hash_map.in updated: 1.5 -> 1.6 --- Log message: Add adapter class to let VC++ hash_map use GCC's hash struct. --- Diffs of the changes: (+26 -0) hash_map.in | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+) Index: llvm/include/llvm/ADT/hash_map.in diff -u llvm/include/llvm/ADT/hash_map.in:1.5 llvm/include/llvm/ADT/hash_map.in:1.6 --- llvm/include/llvm/ADT/hash_map.in:1.5 Sat Jan 15 20:58:39 2005 +++ llvm/include/llvm/ADT/hash_map.in Tue Mar 15 23:25:09 2005 @@ -108,4 +108,30 @@ #include "llvm/ADT/HashExtras.h" +#ifdef _MSC_VER + +// GCC and VC++ have differing ways of implementing hash_maps. As it's not +// standardized, that's to be expected. This adapter class allows VC++ +// hash_map to use GCC's hash classes. +namespace stdext { + template struct hash { + inline size_t operator()(const Key &) const { + return 0; + } + }; + + template class hash_compare > { + std::less comp; + public: + enum { bucket_size = 4 }; + enum { min_buckets = 8 }; + hash_compare() {} + hash_compare(std::less pred) : comp(pred) {} + size_t operator()(const Key& key) const { return hash()(key); } + bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); } + }; +} + +#endif + #endif From brukman at cs.uiuc.edu Tue Mar 15 23:42:11 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Tue, 15 Mar 2005 23:42:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp Message-ID: <200503160542.XAA16783@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Instructions.cpp updated: 1.12 -> 1.13 --- Log message: Convert tabs to spaces --- Diffs of the changes: (+5 -5) Instructions.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.12 llvm/lib/VMCore/Instructions.cpp:1.13 --- llvm/lib/VMCore/Instructions.cpp:1.12 Wed Feb 23 23:32:09 2005 +++ llvm/lib/VMCore/Instructions.cpp Tue Mar 15 23:42:00 2005 @@ -604,7 +604,7 @@ } GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vector &Idx, - const std::string &Name, Instruction *InBe) + const std::string &Name, Instruction *InBe) : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(), Idx, true))), GetElementPtr, 0, 0, Name, InBe) { @@ -612,7 +612,7 @@ } GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vector &Idx, - const std::string &Name, BasicBlock *IAE) + const std::string &Name, BasicBlock *IAE) : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(), Idx, true))), GetElementPtr, 0, 0, Name, IAE) { @@ -628,7 +628,7 @@ } GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx0, Value *Idx1, - const std::string &Name, BasicBlock *IAE) + const std::string &Name, BasicBlock *IAE) : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(), Idx0, Idx1, true))), GetElementPtr, 0, 0, Name, IAE) { @@ -738,7 +738,7 @@ } BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2, - const std::string &Name, + const std::string &Name, Instruction *InsertBefore) { assert(S1->getType() == S2->getType() && "Cannot create binary operator with two operands of differing type!"); @@ -754,7 +754,7 @@ } BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2, - const std::string &Name, + const std::string &Name, BasicBlock *InsertAtEnd) { BinaryOperator *Res = create(Op, S1, S2, Name); InsertAtEnd->getInstList().push_back(Res); From jeffc at jolt-lang.org Tue Mar 15 23:49:17 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 15 Mar 2005 23:49:17 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/hash_map.in Message-ID: <200503160549.XAA16860@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: hash_map.in updated: 1.6 -> 1.7 --- Log message: Don't provide default hash struct instantiation. --- Diffs of the changes: (+9 -6) hash_map.in | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) Index: llvm/include/llvm/ADT/hash_map.in diff -u llvm/include/llvm/ADT/hash_map.in:1.6 llvm/include/llvm/ADT/hash_map.in:1.7 --- llvm/include/llvm/ADT/hash_map.in:1.6 Tue Mar 15 23:25:09 2005 +++ llvm/include/llvm/ADT/hash_map.in Tue Mar 15 23:49:06 2005 @@ -106,20 +106,21 @@ // out specializations like stl_bvector.h, causing link conflicts. #include -#include "llvm/ADT/HashExtras.h" - #ifdef _MSC_VER // GCC and VC++ have differing ways of implementing hash_maps. As it's not // standardized, that's to be expected. This adapter class allows VC++ // hash_map to use GCC's hash classes. namespace stdext { - template struct hash { - inline size_t operator()(const Key &) const { - return 0; + template struct hash; + + // Provide a hash function for unsigned ints... + template<> struct hash { + inline size_t operator()(unsigned int Val) const { + return Val; } }; - + template class hash_compare > { std::less comp; public: @@ -134,4 +135,6 @@ #endif +#include "llvm/ADT/HashExtras.h" + #endif From jeffc at jolt-lang.org Tue Mar 15 23:50:09 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 15 Mar 2005 23:50:09 -0600 Subject: [llvm-commits] CVS: llvm/win32/Configure/Configure.vcproj Message-ID: <200503160550.XAA16883@zion.cs.uiuc.edu> Changes in directory llvm/win32/Configure: Configure.vcproj updated: 1.7 -> 1.8 --- Log message: Do #include HashExtras.h with VC++ --- Diffs of the changes: (+1 -1) Configure.vcproj | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/win32/Configure/Configure.vcproj diff -u llvm/win32/Configure/Configure.vcproj:1.7 llvm/win32/Configure/Configure.vcproj:1.8 --- llvm/win32/Configure/Configure.vcproj:1.7 Sat Jan 8 22:13:09 2005 +++ llvm/win32/Configure/Configure.vcproj Tue Mar 15 23:49:58 2005 @@ -98,7 +98,7 @@ From lattner at cs.uiuc.edu Wed Mar 16 09:15:03 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 09:15:03 -0600 Subject: [llvm-commits] CVS: llvm-www/CurrentWork.html Message-ID: <200503161515.j2GFF3EB022981@apoc.cs.uiuc.edu> Changes in directory llvm-www: CurrentWork.html updated: 1.5 -> 1.6 --- Log message: Fix typo, noticed by Gabor Greif! --- Diffs of the changes: (+1 -1) CurrentWork.html | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/CurrentWork.html diff -u llvm-www/CurrentWork.html:1.5 llvm-www/CurrentWork.html:1.6 --- llvm-www/CurrentWork.html:1.5 Thu Oct 21 10:28:18 2004 +++ llvm-www/CurrentWork.html Wed Mar 16 09:14:47 2005 @@ -11,7 +11,7 @@ you have a code snippet that is not being compiled to very nice code, or have a suggestion for a new optimization to implement, please let us know by sending mail to the llvmdev -mailing list or filing an enhancment request bug +mailing list or filing an enhancement request bug in bugzilla.

          From lattner at cs.uiuc.edu Wed Mar 16 11:10:09 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 11:10:09 -0600 Subject: [llvm-commits] CVS: llvm/utils/NightlyTest.pl Message-ID: <200503161710.j2GHA9Sv023959@apoc.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTest.pl updated: 1.93 -> 1.94 --- Log message: Print out who commits and what files were modified at the bottom of the test summary log sent to llvm-commits. --- Diffs of the changes: (+14 -8) NightlyTest.pl | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) Index: llvm/utils/NightlyTest.pl diff -u llvm/utils/NightlyTest.pl:1.93 llvm/utils/NightlyTest.pl:1.94 --- llvm/utils/NightlyTest.pl:1.93 Fri Mar 11 14:17:04 2005 +++ llvm/utils/NightlyTest.pl Wed Mar 16 11:09:53 2005 @@ -546,8 +546,8 @@ } } -my $UserCommitList = join "\n", keys %UsersCommitted; -my $UserUpdateList = join "\n", keys %UsersUpdated; +my $UserCommitList = join "\n", sort keys %UsersCommitted; +my $UserUpdateList = join "\n", sort keys %UsersUpdated; my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles; my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles; my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles; @@ -779,6 +779,18 @@ # system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE); +print "\nUSERS WHO COMMITTED:\n " . (join "\n ", sort keys %UsersCommitted) . "\n" + if (scalar %UsersCommitted); + +print "\nADDED FILES:\n " . (join "\n ", sort keys %AddedFiles) . "\n" + if (scalar %AddedFiles); + +print "\nCHANGED FILES:\n " . (join "\n ", sort keys %ModifiedFiles) . "\n" + if (scalar %ModifiedFiles); + +print "\nREMOVED FILES:\n " . (join "\n ", sort keys %RemovedFiles) . "\n" + if (scalar %RemovedFiles); + # # Print out information... # @@ -790,12 +802,6 @@ print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n"; print "WARNINGS:\n $WarningsList\n"; - - print "Users committed: $UserCommitList\n"; - print "Added Files: \n $AddedFilesList\n"; - print "Modified Files: \n $ModifiedFilesList\n"; - print "Removed Files: \n $RemovedFilesList\n"; - print "Previous Days =\n $PrevDaysList\n"; } From lattner at cs.uiuc.edu Wed Mar 16 16:42:19 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 16:42:19 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h DSGraphTraits.h Message-ID: <200503162242.j2GMgJWZ006694@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.92 -> 1.93 DSGraphTraits.h updated: 1.22 -> 1.23 --- Log message: remove use of compat_iterator --- Diffs of the changes: (+11 -9) DSGraph.h | 12 ++++++++---- DSGraphTraits.h | 8 +++----- 2 files changed, 11 insertions(+), 9 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.92 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.93 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.92 Tue Mar 15 11:52:07 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Wed Mar 16 16:42:01 2005 @@ -204,9 +204,13 @@ /// cause the node to be removed from this list. This means that if you are /// iterating over nodes and doing something that could cause _any_ node to /// merge, your node_iterators into this graph can be invalidated. - typedef NodeListTy::compat_iterator node_iterator; - node_iterator node_begin() const { return Nodes.compat_begin(); } - node_iterator node_end() const { return Nodes.compat_end(); } + typedef NodeListTy::iterator node_iterator; + node_iterator node_begin() { return Nodes.begin(); } + node_iterator node_end() { return Nodes.end(); } + + typedef NodeListTy::const_iterator node_const_iterator; + node_const_iterator node_begin() const { return Nodes.begin(); } + node_const_iterator node_end() const { return Nodes.end(); } /// getFunctionNames - Return a space separated list of the name of the /// functions in this graph (if any) @@ -337,7 +341,7 @@ /// void maskNodeTypes(unsigned Mask) { for (node_iterator I = node_begin(), E = node_end(); I != E; ++I) - (*I)->maskNodeTypes(Mask); + I->maskNodeTypes(Mask); } void maskIncompleteMarkers() { maskNodeTypes(~DSNode::Incomplete); } Index: llvm/include/llvm/Analysis/DataStructure/DSGraphTraits.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraphTraits.h:1.22 llvm/include/llvm/Analysis/DataStructure/DSGraphTraits.h:1.23 --- llvm/include/llvm/Analysis/DataStructure/DSGraphTraits.h:1.22 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/Analysis/DataStructure/DSGraphTraits.h Wed Mar 16 16:42:01 2005 @@ -135,15 +135,13 @@ typedef const DSNode NodeType; typedef DSNode::const_iterator ChildIteratorType; - typedef std::pointer_to_unary_function DerefFun; - // nodes_iterator/begin/end - Allow iteration over all nodes in the graph - typedef mapped_iterator nodes_iterator; + typedef DSGraph::node_const_iterator nodes_iterator; static nodes_iterator nodes_begin(const DSGraph *G) { - return map_iterator(G->node_begin(), DerefFun(dereferenceC)); + return G->node_begin(); } static nodes_iterator nodes_end(const DSGraph *G) { - return map_iterator(G->node_end(), DerefFun(dereferenceC)); + return G->node_end(); } static ChildIteratorType child_begin(const NodeType *N) { return N->begin(); } From lattner at cs.uiuc.edu Wed Mar 16 16:42:41 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 16:42:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp GraphChecker.cpp Printer.cpp Message-ID: <200503162242.j2GMge0t006943@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.206 -> 1.207 GraphChecker.cpp updated: 1.16 -> 1.17 Printer.cpp updated: 1.77 -> 1.78 --- Log message: remove use of compat_iterator. --- Diffs of the changes: (+15 -14) DataStructure.cpp | 20 ++++++++++---------- GraphChecker.cpp | 7 ++++--- Printer.cpp | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.206 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.207 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.206 Tue Mar 15 15:36:50 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Mar 16 16:42:19 2005 @@ -1091,7 +1091,7 @@ // Drop all intra-node references, so that assertions don't fail... for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) - (*NI)->dropAllReferences(); + NI->dropAllReferences(); // Free all of the nodes. Nodes.clear(); @@ -1180,12 +1180,12 @@ | ((CloneFlags & StripIncompleteBit)? DSNode::Incomplete : 0); BitsToClear |= DSNode::DEAD; // Clear dead flag... - for (node_iterator I = G.node_begin(), E = G.node_end(); I != E; ++I) { - assert(!(*I)->isForwarding() && + for (node_const_iterator I = G.node_begin(), E = G.node_end(); I != E; ++I) { + assert(!I->isForwarding() && "Forward nodes shouldn't be in node list!"); - DSNode *New = new DSNode(**I, this); + DSNode *New = new DSNode(*I, this); New->maskNodeTypes(~BitsToClear); - OldNodeMap[*I] = New; + OldNodeMap[I] = New; } #ifndef NDEBUG @@ -1668,9 +1668,9 @@ // forwarded nodes to be delete-able. { TIME_REGION(X, "removeTriviallyDeadNodes:node_iterate"); for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) { - DSNode *N = *NI; - for (unsigned l = 0, e = N->getNumLinks(); l != e; ++l) - N->getLink(l*N->getPointerSize()).getNode(); + DSNode &N = *NI; + for (unsigned l = 0, e = N.getNumLinks(); l != e; ++l) + N.getLink(l*N.getPointerSize()).getNode(); } } @@ -2016,8 +2016,8 @@ } void DSGraph::AssertGraphOK() const { - for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) - (*NI)->assertOK(); + for (node_const_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) + NI->assertOK(); for (ScalarMapTy::const_iterator I = ScalarMap.begin(), E = ScalarMap.end(); I != E; ++I) { Index: llvm/lib/Analysis/DataStructure/GraphChecker.cpp diff -u llvm/lib/Analysis/DataStructure/GraphChecker.cpp:1.16 llvm/lib/Analysis/DataStructure/GraphChecker.cpp:1.17 --- llvm/lib/Analysis/DataStructure/GraphChecker.cpp:1.16 Wed Sep 1 17:55:35 2004 +++ llvm/lib/Analysis/DataStructure/GraphChecker.cpp Wed Mar 16 16:42:19 2005 @@ -116,10 +116,11 @@ void DSGC::verify(const DSGraph &G) { // Loop over all of the nodes, checking to see if any are collapsed... if (AbortIfAnyCollapsed) { - for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); I!=E; ++I) - if ((*I)->isNodeCompletelyFolded()) { + for (DSGraph::node_const_iterator I = G.node_begin(), E = G.node_end(); + I != E; ++I) + if (I->isNodeCompletelyFolded()) { std::cerr << "Node is collapsed: "; - (*I)->print(std::cerr, &G); + I->print(std::cerr, &G); abort(); } } Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.77 llvm/lib/Analysis/DataStructure/Printer.cpp:1.78 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.77 Tue Mar 15 10:55:04 2005 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Wed Mar 16 16:42:19 2005 @@ -292,7 +292,7 @@ for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end(); NI != E; ++NI) - if ((*NI)->isNodeCompletelyFolded()) + if (NI->isNodeCompletelyFolded()) ++NumFoldedNodes; } From lattner at cs.uiuc.edu Wed Mar 16 16:42:59 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 16:42:59 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/ilist Message-ID: <200503162242.j2GMgx5F007487@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: ilist updated: 1.24 -> 1.25 --- Log message: remove compat_iterator, which is dead in the tree. --- Diffs of the changes: (+0 -92) ilist | 92 ------------------------------------------------------------------ 1 files changed, 92 deletions(-) Index: llvm/include/llvm/ADT/ilist diff -u llvm/include/llvm/ADT/ilist:1.24 llvm/include/llvm/ADT/ilist:1.25 --- llvm/include/llvm/ADT/ilist:1.24 Sat Jan 29 18:08:31 2005 +++ llvm/include/llvm/ADT/ilist Wed Mar 16 16:42:45 2005 @@ -169,93 +169,6 @@ template void operator+(ilist_iterator,int); -//===----------------------------------------------------------------------===// -// ilist_compat_iterator - Compatibility iterator for intrusive list. -// This makes an ilist act like an std::list, where you have to -// dereference stuff multiple times. This should only be used for temporary -// migration purposes. Because we don't support "changing the pointer", we only -// expose constant pointers. -// -template -class ilist_compat_iterator - : public bidirectional_iterator { - typedef ilist_traits Traits; - typedef bidirectional_iterator super; - -public: - typedef size_t size_type; - typedef typename super::pointer pointer; - typedef typename super::reference reference; -private: - NodeTy *NodePtr; -public: - - ilist_compat_iterator(NodeTy *NP) : NodePtr(NP) {} - ilist_compat_iterator() : NodePtr(0) {} - - // This is templated so that we can allow constructing a const iterator from - // a nonconst iterator... - template - ilist_compat_iterator(const ilist_compat_iterator &RHS) - : NodePtr(RHS.getNodePtrUnchecked()) {} - - // This is templated so that we can allow assigning to a const iterator from - // a nonconst iterator... - template - const ilist_compat_iterator &operator=(const - ilist_compat_iterator &RHS) { - NodePtr = RHS.getNodePtrUnchecked(); - return *this; - } - - // Accessors... - operator pointer() const { - assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"); - return &NodePtr; - } - - reference operator*() const { - assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"); - return NodePtr; - } - pointer operator->() { return &operator*(); } - const pointer operator->() const { return &operator*(); } - - // Comparison operators - bool operator==(const ilist_compat_iterator &RHS) const { - return NodePtr == RHS.NodePtr; - } - bool operator!=(const ilist_compat_iterator &RHS) const { - return NodePtr != RHS.NodePtr; - } - - // Increment and decrement operators... - ilist_compat_iterator &operator--() { // predecrement - Back up - NodePtr = Traits::getPrev(NodePtr); - assert(NodePtr && "--'d off the beginning of an ilist!"); - return *this; - } - ilist_compat_iterator &operator++() { // preincrement - Advance - NodePtr = Traits::getNext(NodePtr); - assert(NodePtr && "++'d off the end of an ilist!"); - return *this; - } - ilist_compat_iterator operator--(int) { // postdecrement operators... - ilist_compat_iterator tmp = *this; - --*this; - return tmp; - } - ilist_compat_iterator operator++(int) { // postincrement operators... - ilist_compat_iterator tmp = *this; - ++*this; - return tmp; - } - - // Internal interface, do not use... - pointer getNodePtrUnchecked() const { return NodePtr; } -}; - - // Allow ilist_iterators to convert into pointers to a node automatically when // used by the dyn_cast, cast, isa mechanisms... @@ -321,11 +234,6 @@ const_reverse_iterator rend() const {return const_reverse_iterator(begin());} - // "compatibility" iterator creation methods. - typedef ilist_compat_iterator compat_iterator; - compat_iterator compat_begin() const { return compat_iterator(Head); } - compat_iterator compat_end() const { return compat_iterator(Tail); } - // Miscellaneous inspection routines. size_type max_size() const { return size_type(-1); } bool empty() const { return Head == Tail; } From lattner at cs.uiuc.edu Wed Mar 16 16:47:01 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 16:47:01 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp PointerCompress.cpp PoolAllocate.cpp Message-ID: <200503162247.j2GMl11o011237@apoc.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: Heuristic.cpp updated: 1.8 -> 1.9 PointerCompress.cpp updated: 1.57 -> 1.58 PoolAllocate.cpp updated: 1.111 -> 1.112 --- Log message: convert code to use normal ilist iterators instead of compat iterators --- Diffs of the changes: (+6 -6) Heuristic.cpp | 2 +- PointerCompress.cpp | 8 ++++---- PoolAllocate.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp diff -u llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.8 llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.9 --- llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.8 Wed Mar 2 20:38:52 2005 +++ llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp Wed Mar 16 16:46:45 2005 @@ -146,7 +146,7 @@ std::set ReachableFromMemory; for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); I != E; ++I) { - DSNode *N = *I; + DSNode *N = I; // Ignore nodes that are just globals and not arrays. /* if (N->isArray() || N->isHeapNode() || N->isAllocaNode() || Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.57 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.58 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.57 Mon Mar 14 22:46:30 2005 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Wed Mar 16 16:46:45 2005 @@ -1119,12 +1119,12 @@ // globals graph, and if so, if it is compressed. for (DSGraph::node_iterator I = DSG.node_begin(), E = DSG.node_end(); I != E;++I) - if (GlobalsGraphNodeMapping.count(*I)) { + if (GlobalsGraphNodeMapping.count(I)) { // If it is a global pool, set up the pool descriptor appropriately. - DSNode *GGN = GlobalsGraphNodeMapping[*I].getNode(); + DSNode *GGN = GlobalsGraphNodeMapping[I].getNode(); if (CompressedGlobalPools.count(GGN)) { - Pools.insert(*I); - PreassignedPools[*I] = CompressedGlobalPools[GGN]; + Pools.insert(I); + PreassignedPools[I] = CompressedGlobalPools[GGN]; } } } Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.111 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.112 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.111 Mon Mar 14 22:46:30 2005 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Wed Mar 16 16:46:45 2005 @@ -555,7 +555,7 @@ // ones to the NodesToPA vector. for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); I != E;++I){ // We only need to make a pool if there is a heap object in it... - DSNode *N = *I; + DSNode *N = I; if (N->isHeapNode()) if (GlobalsGraphNodeMapping.count(N)) { // If it is a global pool, set up the pool descriptor appropriately. From lattner at cs.uiuc.edu Wed Mar 16 22:48:46 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 22:48:46 -0600 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2000/172.mgrid/Makefile Message-ID: <200503170448.j2H4mkX3012790@apoc.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2000/172.mgrid: Makefile updated: 1.1 -> 1.2 --- Log message: add tolerances as specified by spec --- Diffs of the changes: (+4 -0) Makefile | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm-test/External/SPEC/CFP2000/172.mgrid/Makefile diff -u llvm-test/External/SPEC/CFP2000/172.mgrid/Makefile:1.1 llvm-test/External/SPEC/CFP2000/172.mgrid/Makefile:1.2 --- llvm-test/External/SPEC/CFP2000/172.mgrid/Makefile:1.1 Wed Oct 6 16:39:39 2004 +++ llvm-test/External/SPEC/CFP2000/172.mgrid/Makefile Wed Mar 16 22:48:30 2005 @@ -3,6 +3,10 @@ Source = mgrid.f include $(LEVEL)/Makefile.f2c +FP_ABSTOLERANCE=1.0e-12 +FP_TOLERANCE=0.001 + + STDIN_FILENAME = mgrid.in STDOUT_FILENAME = mgrid.out From lattner at cs.uiuc.edu Wed Mar 16 22:49:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 22:49:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/FileUtilities.cpp Message-ID: <200503170449.j2H4nH5H012948@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: FileUtilities.cpp updated: 1.43 -> 1.44 --- Log message: Fix a bug where we would consider " .99" and "1.0" different because of the leading whitespace. --- Diffs of the changes: (+9 -0) FileUtilities.cpp | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/lib/Support/FileUtilities.cpp diff -u llvm/lib/Support/FileUtilities.cpp:1.43 llvm/lib/Support/FileUtilities.cpp:1.44 --- llvm/lib/Support/FileUtilities.cpp:1.43 Tue Feb 15 16:12:10 2005 +++ llvm/lib/Support/FileUtilities.cpp Wed Mar 16 22:49:04 2005 @@ -18,6 +18,7 @@ #include "llvm/ADT/StringExtras.h" #include #include +#include using namespace llvm; static bool isNumberChar(char C) { @@ -47,6 +48,14 @@ std::string *ErrorMsg) { char *F1NumEnd, *F2NumEnd; double V1 = 0.0, V2 = 0.0; + + // If one of the positions is at a space and the other isn't, chomp up 'til + // the end of the space. + while (isspace(*F1P) && F1P != F1End) + ++F1P; + while (isspace(*F2P) && F2P != F2End) + ++F2P; + // If we stop on numbers, compare their difference. if (isNumberChar(*F1P) && isNumberChar(*F2P)) { V1 = strtod(F1P, &F1NumEnd); From lattner at cs.uiuc.edu Wed Mar 16 23:25:51 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 16 Mar 2005 23:25:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503170525.j2H5PpVw014692@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.207 -> 1.208 --- Log message: Do not create ridiculously huge DSNodes, as described in the comments. This speeds up the BU pass on 172.mgrid from 62.3 -> 0.1242s. --- Diffs of the changes: (+21 -1) DataStructure.cpp | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.207 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.208 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.207 Wed Mar 16 16:42:19 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Mar 16 23:25:34 2005 @@ -382,13 +382,23 @@ // question.... assert(Offset == 0 && !isArray() && "Cannot have an offset into a void node!"); + + // If this node would have to have an unreasonable number of fields, just + // collapse it. This can occur for fortran common blocks, which have stupid + // things like { [100000000 x double], [1000000 x double] }. + unsigned NumFields = (NewTySize+DS::PointerSize-1) >> DS::PointerShift; + if (NumFields > 64) { + foldNodeCompletely(); + return true; + } + Ty = NewTy; NodeType &= ~Array; if (WillBeArray) NodeType |= Array; Size = NewTySize; // Calculate the number of outgoing links from this node. - Links.resize((Size+DS::PointerSize-1) >> DS::PointerShift); + Links.resize(NumFields); return false; } @@ -418,6 +428,16 @@ Ty = NewTy; NodeType &= ~Array; if (WillBeArray) NodeType |= Array; + + // If this node would have to have an unreasonable number of fields, just + // collapse it. This can occur for fortran common blocks, which have stupid + // things like { [100000000 x double], [1000000 x double] }. + unsigned NumFields = (NewTySize+DS::PointerSize-1) >> DS::PointerShift; + if (NumFields > 64) { + foldNodeCompletely(); + return true; + } + Size = NewTySize; // Must grow links to be the appropriate size... From lattner at cs.uiuc.edu Thu Mar 17 09:36:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:36:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/AliasAnalysis.cpp AliasSetTracker.cpp Message-ID: <200503171536.j2HFaZCI019593@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: AliasAnalysis.cpp updated: 1.22 -> 1.23 AliasSetTracker.cpp updated: 1.33 -> 1.34 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+2 -0) AliasAnalysis.cpp | 1 + AliasSetTracker.cpp | 1 + 2 files changed, 2 insertions(+) Index: llvm/lib/Analysis/AliasAnalysis.cpp diff -u llvm/lib/Analysis/AliasAnalysis.cpp:1.22 llvm/lib/Analysis/AliasAnalysis.cpp:1.23 --- llvm/lib/Analysis/AliasAnalysis.cpp:1.22 Wed Dec 15 01:22:10 2004 +++ llvm/lib/Analysis/AliasAnalysis.cpp Thu Mar 17 09:36:18 2005 @@ -27,6 +27,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/BasicBlock.h" #include "llvm/Instructions.h" +#include "llvm/Type.h" #include "llvm/Target/TargetData.h" #include using namespace llvm; Index: llvm/lib/Analysis/AliasSetTracker.cpp diff -u llvm/lib/Analysis/AliasSetTracker.cpp:1.33 llvm/lib/Analysis/AliasSetTracker.cpp:1.34 --- llvm/lib/Analysis/AliasSetTracker.cpp:1.33 Wed Dec 15 01:22:10 2004 +++ llvm/lib/Analysis/AliasSetTracker.cpp Thu Mar 17 09:36:18 2005 @@ -15,6 +15,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Instructions.h" #include "llvm/Pass.h" +#include "llvm/Type.h" #include "llvm/Target/TargetData.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/InstIterator.h" From lattner at cs.uiuc.edu Thu Mar 17 09:36:50 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:36:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/UnreachableBlockElim.cpp Message-ID: <200503171536.j2HFaoQb019646@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: UnreachableBlockElim.cpp updated: 1.4 -> 1.5 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+1 -0) UnreachableBlockElim.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/UnreachableBlockElim.cpp diff -u llvm/lib/CodeGen/UnreachableBlockElim.cpp:1.4 llvm/lib/CodeGen/UnreachableBlockElim.cpp:1.5 --- llvm/lib/CodeGen/UnreachableBlockElim.cpp:1.4 Wed Sep 1 17:55:35 2004 +++ llvm/lib/CodeGen/UnreachableBlockElim.cpp Thu Mar 17 09:36:37 2005 @@ -25,6 +25,7 @@ #include "llvm/Instructions.h" #include "llvm/Function.h" #include "llvm/Pass.h" +#include "llvm/Type.h" #include "llvm/Support/CFG.h" #include "llvm/ADT/DepthFirstIterator.h" using namespace llvm; From lattner at cs.uiuc.edu Thu Mar 17 09:36:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:36:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp Message-ID: <200503171536.j2HFaarq019599@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructureOpt.cpp updated: 1.10 -> 1.11 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+1 -0) DataStructureOpt.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.10 llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.11 --- llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp:1.10 Mon Mar 14 22:54:18 2005 +++ llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp Thu Mar 17 09:36:21 2005 @@ -17,6 +17,7 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Module.h" #include "llvm/Constant.h" +#include "llvm/Type.h" #include "llvm/ADT/Statistic.h" using namespace llvm; From lattner at cs.uiuc.edu Thu Mar 17 09:37:07 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:37:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200503171537.j2HFb7k7019888@apoc.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.63 -> 1.64 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+1 -0) JITEmitter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.63 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.64 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.63 Sun Feb 20 12:43:35 2005 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Mar 17 09:36:52 2005 @@ -16,6 +16,7 @@ #include "JIT.h" #include "llvm/Constant.h" #include "llvm/Module.h" +#include "llvm/Type.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineConstantPool.h" From lattner at cs.uiuc.edu Thu Mar 17 09:37:31 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:37:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Message-ID: <200503171537.j2HFbVSR020083@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.9 -> 1.10 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+1 -0) AlphaAsmPrinter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.9 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.10 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.9 Mon Mar 14 22:54:19 2005 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Thu Mar 17 09:37:15 2005 @@ -15,6 +15,7 @@ #include "Alpha.h" #include "AlphaInstrInfo.h" #include "llvm/Module.h" +#include "llvm/Type.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/ValueTypes.h" From lattner at cs.uiuc.edu Thu Mar 17 09:37:38 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:37:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200503171537.j2HFbcb3020183@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.134 -> 1.135 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+1 -0) X86AsmPrinter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.134 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.135 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.134 Mon Mar 14 22:54:20 2005 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Thu Mar 17 09:37:23 2005 @@ -17,6 +17,7 @@ #include "X86.h" #include "X86TargetMachine.h" #include "llvm/Module.h" +#include "llvm/Type.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineConstantPool.h" From lattner at cs.uiuc.edu Thu Mar 17 09:37:38 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:37:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp Message-ID: <200503171537.j2HFbcHH020179@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9/RegAlloc: LiveRangeInfo.cpp updated: 1.57 -> 1.58 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+1 -0) LiveRangeInfo.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp diff -u llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp:1.57 llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp:1.58 --- llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp:1.57 Mon Mar 14 22:54:20 2005 +++ llvm/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp Thu Mar 17 09:37:20 2005 @@ -16,6 +16,7 @@ #include "RegAllocCommon.h" #include "RegClass.h" #include "llvm/Function.h" +#include "llvm/Type.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Target/TargetMachine.h" From lattner at cs.uiuc.edu Thu Mar 17 09:38:29 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:38:29 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/TestPasses.cpp Message-ID: <200503171538.j2HFcTFC020483@apoc.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: TestPasses.cpp updated: 1.8 -> 1.9 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+1 -0) TestPasses.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/bugpoint/TestPasses.cpp diff -u llvm/tools/bugpoint/TestPasses.cpp:1.8 llvm/tools/bugpoint/TestPasses.cpp:1.9 --- llvm/tools/bugpoint/TestPasses.cpp:1.8 Thu Jul 29 12:16:41 2004 +++ llvm/tools/bugpoint/TestPasses.cpp Thu Mar 17 09:38:16 2005 @@ -16,6 +16,7 @@ #include "llvm/Constant.h" #include "llvm/Instructions.h" #include "llvm/Pass.h" +#include "llvm/Type.h" #include "llvm/Support/InstVisitor.h" using namespace llvm; From lattner at cs.uiuc.edu Thu Mar 17 09:38:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:38:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp DemoteRegToStack.cpp Message-ID: <200503171538.j2HFcC3g020308@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.24 -> 1.25 DemoteRegToStack.cpp updated: 1.11 -> 1.12 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+2 -0) BreakCriticalEdges.cpp | 1 + DemoteRegToStack.cpp | 1 + 2 files changed, 2 insertions(+) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.24 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.25 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.24 Wed Sep 15 12:06:42 2004 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Thu Mar 17 09:37:58 2005 @@ -21,6 +21,7 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/Function.h" #include "llvm/Instructions.h" +#include "llvm/Type.h" #include "llvm/Support/CFG.h" #include "llvm/ADT/Statistic.h" using namespace llvm; Index: llvm/lib/Transforms/Utils/DemoteRegToStack.cpp diff -u llvm/lib/Transforms/Utils/DemoteRegToStack.cpp:1.11 llvm/lib/Transforms/Utils/DemoteRegToStack.cpp:1.12 --- llvm/lib/Transforms/Utils/DemoteRegToStack.cpp:1.11 Thu Apr 1 14:28:45 2004 +++ llvm/lib/Transforms/Utils/DemoteRegToStack.cpp Thu Mar 17 09:37:58 2005 @@ -19,6 +19,7 @@ #include "llvm/Transforms/Utils/Local.h" #include "llvm/Function.h" #include "llvm/Instructions.h" +#include "llvm/Type.h" #include using namespace llvm; From lattner at cs.uiuc.edu Thu Mar 17 09:37:33 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 09:37:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9TmpInstr.cpp Message-ID: <200503171537.j2HFbX76020116@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV9: SparcV9TmpInstr.cpp updated: 1.3 -> 1.4 --- Log message: Fix the missing symbols problem Bill was hitting. Patch contributed by Bill Wendling!! --- Diffs of the changes: (+1 -0) SparcV9TmpInstr.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/SparcV9/SparcV9TmpInstr.cpp diff -u llvm/lib/Target/SparcV9/SparcV9TmpInstr.cpp:1.3 llvm/lib/Target/SparcV9/SparcV9TmpInstr.cpp:1.4 --- llvm/lib/Target/SparcV9/SparcV9TmpInstr.cpp:1.3 Fri Jan 28 18:36:59 2005 +++ llvm/lib/Target/SparcV9/SparcV9TmpInstr.cpp Thu Mar 17 09:37:18 2005 @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "SparcV9TmpInstr.h" +#include "llvm/Type.h" #include "llvm/Support/LeakDetector.h" using namespace llvm; From lattner at cs.uiuc.edu Thu Mar 17 10:08:01 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 10:08:01 -0600 Subject: [llvm-commits] CVS: llvm/utils/NightlyTest.pl Message-ID: <200503171608.j2HG81Z4007823@apoc.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTest.pl updated: 1.94 -> 1.95 --- Log message: spiff up the nightly tester output one more notch --- Diffs of the changes: (+3 -3) NightlyTest.pl | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/utils/NightlyTest.pl diff -u llvm/utils/NightlyTest.pl:1.94 llvm/utils/NightlyTest.pl:1.95 --- llvm/utils/NightlyTest.pl:1.94 Wed Mar 16 11:09:53 2005 +++ llvm/utils/NightlyTest.pl Thu Mar 17 10:07:45 2005 @@ -199,7 +199,7 @@ my $firstline; $/ = "\n"; #Make sure we're going line at a time. - print "Dejagnu test results:\n"; + print "DEJAGNU TEST RESULTS:\n"; if (open SRCHFILE, $filename) { # Process test results @@ -230,13 +230,13 @@ push(@lines, "

        • \n"); } push(@lines, "

          STATISTICS

          \n");
          -          print "\nSTATISTICS:\n";
          +          print "\nDEJAGNU STATISTICS:\n";
                     $should_break = 0;
                     $nocopy = 0;
                     $readingsum = 1;
                   } elsif ( $readingsum ) {
                     push(@lines,"$_\n");
          -          print "$_\n";
          +          print "  $_\n";
                   }
                 }
               }
          
          
          
          
          
          From lattner at cs.uiuc.edu  Thu Mar 17 10:29:42 2005
          From: lattner at cs.uiuc.edu (Chris Lattner)
          Date: Thu, 17 Mar 2005 10:29:42 -0600
          Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp 
          Message-ID: <200503171629.j2HGTg1W020824@apoc.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Target/X86:
          
          X86ISelPattern.cpp updated: 1.91 -> 1.92
          ---
          Log message:
          
          Don't emit two comparisons when comparing a FP value against zero!
          
          
          ---
          Diffs of the changes:  (+1 -0)
          
           X86ISelPattern.cpp |    1 +
           1 files changed, 1 insertion(+)
          
          
          Index: llvm/lib/Target/X86/X86ISelPattern.cpp
          diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.91 llvm/lib/Target/X86/X86ISelPattern.cpp:1.92
          --- llvm/lib/Target/X86/X86ISelPattern.cpp:1.91	Mon Mar 14 22:54:20 2005
          +++ llvm/lib/Target/X86/X86ISelPattern.cpp	Thu Mar 17 10:29:26 2005
          @@ -1078,6 +1078,7 @@
                 BuildMI(BB, X86::FTST, 1).addReg(Reg);
                 BuildMI(BB, X86::FNSTSW8r, 0);
                 BuildMI(BB, X86::SAHF, 1);
          +      return;
               }
             }
           
          
          
          
          
          
          From duraid at octopus.com.au  Thu Mar 17 12:17:14 2005
          From: duraid at octopus.com.au (Duraid Madina)
          Date: Thu, 17 Mar 2005 12:17:14 -0600
          Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64.h IA64.td
          	IA64AsmPrinter.cpp IA64ISelPattern.cpp IA64InstrBuilder.h
          	IA64InstrFormats.td IA64InstrInfo.cpp IA64InstrInfo.h
          	IA64InstrInfo.td IA64MachineFunctionInfo.h
          	IA64RegisterInfo.cpp IA64RegisterInfo.h IA64RegisterInfo.td
          	IA64TargetMachine.cpp IA64TargetMachine.h Makefile README 
          Message-ID: <200503171817.MAA19356@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Target/IA64:
          
          IA64.h added (r1.1)
          IA64.td added (r1.1)
          IA64AsmPrinter.cpp added (r1.1)
          IA64ISelPattern.cpp added (r1.1)
          IA64InstrBuilder.h added (r1.1)
          IA64InstrFormats.td added (r1.1)
          IA64InstrInfo.cpp added (r1.1)
          IA64InstrInfo.h added (r1.1)
          IA64InstrInfo.td added (r1.1)
          IA64MachineFunctionInfo.h added (r1.1)
          IA64RegisterInfo.cpp added (r1.1)
          IA64RegisterInfo.h added (r1.1)
          IA64RegisterInfo.td added (r1.1)
          IA64TargetMachine.cpp added (r1.1)
          IA64TargetMachine.h added (r1.1)
          Makefile added (r1.1)
          README added (r1.1)
          ---
          Log message:
          
          and so it begins... 
          
          PHASE 1: write instruction selector
          PHASE 2: ???
          PHASE 3: profit!
          
          
          
          ---
          Diffs of the changes:  (+3756 -0)
          
           IA64.h                    |   50 +
           IA64.td                   |   93 ++
           IA64AsmPrinter.cpp        |  399 +++++++++++
           IA64ISelPattern.cpp       | 1640 ++++++++++++++++++++++++++++++++++++++++++++++
           IA64InstrBuilder.h        |   52 +
           IA64InstrFormats.td       |   67 +
           IA64InstrInfo.cpp         |   47 +
           IA64InstrInfo.h           |   50 +
           IA64InstrInfo.td          |  319 ++++++++
           IA64MachineFunctionInfo.h |   34 
           IA64RegisterInfo.cpp      |  362 ++++++++++
           IA64RegisterInfo.h        |   55 +
           IA64RegisterInfo.td       |  291 ++++++++
           IA64TargetMachine.cpp     |  134 +++
           IA64TargetMachine.h       |   48 +
           Makefile                  |   17 
           README                    |   98 ++
           17 files changed, 3756 insertions(+)
          
          
          Index: llvm/lib/Target/IA64/IA64.h
          diff -c /dev/null llvm/lib/Target/IA64/IA64.h:1.1
          *** /dev/null	Thu Mar 17 12:17:13 2005
          --- llvm/lib/Target/IA64/IA64.h	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,50 ----
          + //===-- IA64.h - Top-level interface for IA64 representation ------*- C++ -*-===//
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file contains the entry points for global functions defined in the IA64
          + // target library, as used by the LLVM JIT.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #ifndef TARGET_IA64_H
          + #define TARGET_IA64_H
          + 
          + #include 
          + 
          + namespace llvm {
          + 
          + class TargetMachine;
          + class FunctionPass;
          + class IntrinsicLowering;
          + 
          + /// createIA64PatternInstructionSelector - This pass converts an LLVM function
          + /// into a machine code representation in a more aggressive way.
          + ///
          + FunctionPass *createIA64PatternInstructionSelector(TargetMachine &TM);
          + 
          + /// createIA64CodePrinterPass - Returns a pass that prints the IA64
          + /// assembly code for a MachineFunction to the given output stream,
          + /// using the given target machine description.  This should work
          + /// regardless of whether the function is in SSA form.
          + ///
          + FunctionPass *createIA64CodePrinterPass(std::ostream &o,TargetMachine &tm);
          + 
          + } // End llvm namespace
          + 
          + // Defines symbolic names for IA64 registers.  This defines a mapping from
          + // register name to register number.
          + //
          + #include "IA64GenRegisterNames.inc"
          + 
          + // Defines symbolic names for the IA64 instructions.
          + //
          + #include "IA64GenInstrNames.inc"
          + 
          + #endif
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64.td
          diff -c /dev/null llvm/lib/Target/IA64/IA64.td:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64.td	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,93 ----
          + //===-- IA64.td - Target definition file for Intel IA64 -------------------===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This is a target description file for the Intel IA64 architecture,
          + // also known variously as ia64, IA-64, IPF, "the Itanium architecture" etc.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + // Get the target-independent interfaces which we are implementing...
          + //
          + include "../Target.td"
          + 
          + //===----------------------------------------------------------------------===//
          + // Register File Description
          + //===----------------------------------------------------------------------===//
          + 
          + include "IA64RegisterInfo.td"
          + 
          + //===----------------------------------------------------------------------===//
          + // Instruction Descriptions
          + //===----------------------------------------------------------------------===//
          + 
          + include "IA64InstrInfo.td"
          + 
          + def IA64InstrInfo : InstrInfo {
          +     let PHIInst = PHI;
          + }
          + 
          + def IA64 : Target {
          +   // The following registers are always saved across calls:
          +   let CalleeSavedRegisters = 
          +   
          +   //'preserved' GRs:
          +   
          +   [r4, r5, r6, r7,
          +   
          +   //'special' GRs:
          + 
          +   r1, // global data pointer (GP)
          +   r12, // memory stack pointer (SP)
          +   // **** r13 (thread pointer) we do not touch, ever. it's not here. ****//
          +   //r15, // our frame pointer (FP)
          +   
          +   //'stacked' GRs the RSE takes care of, we don't worry about
          + /* We don't want PEI::calculateCallerSavedRegisters to worry about them,
          +   since the RSE takes care of them (and we determinethe appropriate
          +   'alloc' instructions and save/restore ar.pfs ourselves, in instruction
          +   selection)
          + 
          + **************************************************************************  
          + *  r32, r33, r34, r35,
          + *  r36, r37, r38, r39, r40, r41, r42, r43, r44, r45, r46, r47,
          + *  r48, r49, r50, r51, r52, r53, r54, r55, r56, r57, r58, r59,
          + *  r60, r61, r62, r63, r64, r65, r66, r67, r68, r69, r70, r71,
          + *  r72, r73, r74, r75, r76, r77, r78, r79, r80, r81, r82, r83,
          + *  r84, r85, r86, r87, r88, r89, r90, r91, r92, r93, r94, r95,
          + *  r96, r97, r98, r99, r100, r101, r102, r103, r104, r105, r106, r107,
          + *  r108, r109, r110, r111, r112, r113, r114, r115, r116, r117, r118, r119,
          + *  r120, r121, r122, r123, r124, r125, r126, r127,	
          + **************************************************************************
          + */
          +   //'preserved' FP regs:
          + 
          +   F2,F3,F4,F5,
          +   F16,F17,F18,F19,F20,F21,F22,F23,
          +   F24,F25,F26,F27,F28,F29,F30,F31,
          +   
          +   //'preserved' predicate regs:
          + 
          +   p1, p2, p3, p4, p5,
          +   p16, p17, p18, p19, p20, p21, p22, p23,
          +   p24, p25, p26, p27, p28, p29, p30, p31,
          +   p32, p33, p34, p35, p36, p37, p38, p39,
          +   p40, p41, p42, p43, p44, p45, p46, p47,
          +   p48, p49, p50, p51, p52, p53, p54, p55,
          +   p56, p57, p58, p59, p60, p61, p62, p63];
          + 
          +   // We don't go anywhere near the LP32 variant of IA64 as 
          +   // sometimes seen in (for example) HP-UX
          +   let PointerType = i64;
          + 
          +   // Our instruction set
          +   let InstructionSet = IA64InstrInfo;
          + 
          + }
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64AsmPrinter.cpp
          diff -c /dev/null llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64AsmPrinter.cpp	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,399 ----
          + //===-- IA64AsmPrinter.cpp - Print out IA64 LLVM as assembly --------------===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file contains a printer that converts from our internal representation
          + // of machine-dependent LLVM code to assembly accepted by the GNU binutils 'gas'
          + // assembler. The Intel 'ias' and HP-UX 'as' assemblers *may* choke on this
          + // output, but if so that's a bug I'd like to hear about: please file a bug
          + // report in bugzilla. FYI, the excellent 'ias' assembler is bundled with
          + // the Intel C/C++ compiler for Itanium Linux.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #include "IA64.h"
          + #include "IA64TargetMachine.h"
          + #include "llvm/Module.h"
          + #include "llvm/Assembly/Writer.h"
          + #include "llvm/CodeGen/AsmPrinter.h"
          + #include "llvm/CodeGen/MachineConstantPool.h"
          + #include "llvm/CodeGen/MachineFunctionPass.h"
          + #include "llvm/CodeGen/ValueTypes.h"
          + #include "llvm/Target/TargetMachine.h"
          + #include "llvm/Support/Mangler.h"
          + #include "llvm/ADT/Statistic.h"
          + #include "llvm/Support/CommandLine.h"
          + using namespace llvm;
          + 
          + namespace {
          +   Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
          + 
          +   struct IA64SharedAsmPrinter : public AsmPrinter {
          + 
          +     std::set ExternalFunctionNames;
          +     
          +     IA64SharedAsmPrinter(std::ostream &O, TargetMachine &TM)
          +       : AsmPrinter(O, TM) { }
          + 
          +     void printConstantPool(MachineConstantPool *MCP);
          +     bool doFinalization(Module &M);
          +   };
          + }
          + 
          + static bool isScale(const MachineOperand &MO) {
          +   return MO.isImmediate() &&
          +     (MO.getImmedValue() == 1 || MO.getImmedValue() == 2 ||
          +      MO.getImmedValue() == 4 || MO.getImmedValue() == 8);
          + }
          + 
          + static bool isMem(const MachineInstr *MI, unsigned Op) {
          +   if (MI->getOperand(Op).isFrameIndex()) return true;
          +   if (MI->getOperand(Op).isConstantPoolIndex()) return true;
          +   return Op+4 <= MI->getNumOperands() &&
          +     MI->getOperand(Op  ).isRegister() && isScale(MI->getOperand(Op+1)) &&
          +     MI->getOperand(Op+2).isRegister() && (MI->getOperand(Op+3).isImmediate() ||
          +         MI->getOperand(Op+3).isGlobalAddress());
          + }
          + 
          + // SwitchSection - Switch to the specified section of the executable if we are
          + // not already in it!
          + //
          + static void SwitchSection(std::ostream &OS, std::string &CurSection,
          +                           const char *NewSection) {
          +   if (CurSection != NewSection) {
          +     CurSection = NewSection;
          +     if (!CurSection.empty())
          +       OS << "\t" << NewSection << "\n";
          +   }
          + }
          + 
          + /// printConstantPool - Print to the current output stream assembly
          + /// representations of the constants in the constant pool MCP. This is
          + /// used to print out constants which have been "spilled to memory" by
          + /// the code generator.
          + ///
          + void IA64SharedAsmPrinter::printConstantPool(MachineConstantPool *MCP) {
          +   const std::vector &CP = MCP->getConstants();
          +   const TargetData &TD = TM.getTargetData();
          +  
          +   if (CP.empty()) return;
          + 
          +   O << "\n\t.section .data\n"; // would be nice to have this rodata? hmmm
          +   for (unsigned i = 0, e = CP.size(); i != e; ++i) {
          +     emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
          +     O << ".CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString
          +       << *CP[i] << "\n";
          +     emitGlobalConstant(CP[i]);
          +   }
          + }
          + 
          + bool IA64SharedAsmPrinter::doFinalization(Module &M) {
          +   const TargetData &TD = TM.getTargetData();
          +   std::string CurSection;
          + 
          +   // Print out module-level global variables here.
          +   for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
          +     if (I->hasInitializer()) {   // External global require no code
          +       O << "\n\n";
          +       std::string name = Mang->getValueName(I);
          +       Constant *C = I->getInitializer();
          +       unsigned Size = TD.getTypeSize(C->getType());
          +       unsigned Align = TD.getTypeAlignmentShift(C->getType());
          + 
          +       if (C->isNullValue() && 
          +           (I->hasLinkOnceLinkage() || I->hasInternalLinkage() ||
          +            I->hasWeakLinkage() /* FIXME: Verify correct */)) {
          +         SwitchSection(O, CurSection, ".data");
          +         if (I->hasInternalLinkage())
          +           O << "\t.local " << name << "\n";
          +         
          +         O << "\t.common " << name << "," << TD.getTypeSize(C->getType())
          +           << "," << (1 << Align);
          +         O << "\t\t// ";
          +         WriteAsOperand(O, I, true, true, &M);
          +         O << "\n";
          +       } else {
          +         switch (I->getLinkage()) {
          +         case GlobalValue::LinkOnceLinkage:
          +         case GlobalValue::WeakLinkage:   // FIXME: Verify correct for weak.
          +           // Nonnull linkonce -> weak
          +           O << "\t.weak " << name << "\n";
          +           SwitchSection(O, CurSection, "");
          +           O << "\t.section\t.llvm.linkonce.d." << name
          + 	    << ", \"aw\", \"progbits\"\n";
          +           break;
          +         case GlobalValue::AppendingLinkage:
          +           // FIXME: appending linkage variables should go into a section of
          +           // their name or something.  For now, just emit them as external.
          +         case GlobalValue::ExternalLinkage:
          +           // If external or appending, declare as a global symbol
          +           O << "\t.global " << name << "\n";
          +           // FALL THROUGH
          +         case GlobalValue::InternalLinkage:
          +           if (C->isNullValue())
          +             SwitchSection(O, CurSection, ".data"); // FIXME: this was
          + 	  // '.bss', but in ia64-land .bss means "nobits" (i.e. uninitialized)
          + 	  // hmm.
          +           else
          +             SwitchSection(O, CurSection, ".data");
          +           break;
          +         case GlobalValue::GhostLinkage:
          +           std::cerr << "GhostLinkage cannot appear in IA64AsmPrinter!\n";
          +           abort();
          +         }
          + 
          +         emitAlignment(Align);
          +         O << "\t.type " << name << ", at object\n";
          +         O << "\t.size " << name << "," << Size << "\n";
          +         O << name << ":\t\t\t\t// ";
          +         WriteAsOperand(O, I, true, true, &M);
          +         O << " = ";
          +         WriteAsOperand(O, C, false, false, &M);
          +         O << "\n";
          +         emitGlobalConstant(C);
          +       }
          +     }
          + 
          +   // we print out ".global X \n .type X, @function" for each external function
          +   O << "\n\n// br.call targets referenced (and not defined) above: \n";
          +   for (std::set::iterator i = ExternalFunctionNames.begin(),
          +        e = ExternalFunctionNames.end(); i!=e; ++i) {
          +     O << "\t.global " << *i << "\n\t.type " << *i << ", @function\n";
          +   }
          +   O << "\n\n";
          +  
          +   AsmPrinter::doFinalization(M);
          +   return false; // success
          + }
          + 
          + namespace {
          +   struct IA64AsmPrinter : public IA64SharedAsmPrinter {
          +     IA64AsmPrinter(std::ostream &O, TargetMachine &TM)
          +       : IA64SharedAsmPrinter(O, TM) {
          + 
          +       CommentString = "//";
          +       Data8bitsDirective = "\tdata1\t";
          +       Data16bitsDirective = "\tdata2\t";
          +       Data32bitsDirective = "\tdata4\t";
          +       Data64bitsDirective = "\tdata8\t";
          +       ZeroDirective = "\t.skip\t";
          +       AsciiDirective = "\tstring\t";
          + 
          +     }
          + 
          +     virtual const char *getPassName() const {
          +       return "IA64 Assembly Printer";
          +     }
          + 
          +     /// printInstruction - This method is automatically generated by tablegen
          +     /// from the instruction set description.  This method returns true if the
          +     /// machine instruction was sufficiently described to print it, otherwise it
          +     /// returns false.
          +     bool printInstruction(const MachineInstr *MI);
          + 
          +     // This method is used by the tablegen'erated instruction printer.
          +     void printOperand(const MachineInstr *MI, unsigned OpNo, MVT::ValueType VT){
          +       const MachineOperand &MO = MI->getOperand(OpNo);
          +       if (MO.getType() == MachineOperand::MO_MachineRegister) {
          +         assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physref??");
          +         //XXX Bug Workaround: See note in Printer::doInitialization about %.
          +         O << TM.getRegisterInfo()->get(MO.getReg()).Name;
          +       } else {
          +         printOp(MO);
          +       }
          +     }
          +     
          +     void printS16ImmOperand(const MachineInstr *MI, unsigned OpNo,
          +                             MVT::ValueType VT) {
          +       O << (short)MI->getOperand(OpNo).getImmedValue();
          +     }
          +     void printU16ImmOperand(const MachineInstr *MI, unsigned OpNo,
          +                             MVT::ValueType VT) {
          +       O << (unsigned short)MI->getOperand(OpNo).getImmedValue();
          +     }
          +     void printS21ImmOperand(const MachineInstr *MI, unsigned OpNo,
          +                             MVT::ValueType VT) {
          +       O << (int)MI->getOperand(OpNo).getImmedValue(); // FIXME (21, not 32!)
          +     }
          +     void printS32ImmOperand(const MachineInstr *MI, unsigned OpNo,
          +                             MVT::ValueType VT) {
          +       O << (int)MI->getOperand(OpNo).getImmedValue();
          +     }
          +     void printU32ImmOperand(const MachineInstr *MI, unsigned OpNo,
          +                             MVT::ValueType VT) {
          +       O << (unsigned int)MI->getOperand(OpNo).getImmedValue();
          +     }
          +     void printU64ImmOperand(const MachineInstr *MI, unsigned OpNo,
          +                             MVT::ValueType VT) {
          +       O << (uint64_t)MI->getOperand(OpNo).getImmedValue();
          +     }
          +    
          +     void printCallOperand(const MachineInstr *MI, unsigned OpNo,
          +                           MVT::ValueType VT) {
          +       printOp(MI->getOperand(OpNo), true); // this is a br.call instruction 
          +     }
          + 
          +     void printMachineInstruction(const MachineInstr *MI);
          +     void printOp(const MachineOperand &MO, bool isBRCALLinsn= false);
          +     bool runOnMachineFunction(MachineFunction &F);    
          +     bool doInitialization(Module &M);
          +   };
          + } // end of anonymous namespace
          + 
          + 
          + // Include the auto-generated portion of the assembly writer.
          + #include "IA64GenAsmWriter.inc"
          + 
          + 
          + /// runOnMachineFunction - This uses the printMachineInstruction()
          + /// method to print assembly for each instruction.
          + ///
          + bool IA64AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
          +   setupMachineFunction(MF);
          +   O << "\n\n";
          + 
          +   // Print out constants referenced by the function
          +   printConstantPool(MF.getConstantPool());
          + 
          +   // Print out labels for the function.
          +   O << "\n\t.section .text, \"ax\", \"progbits\"\n";
          +               // ^^  means "Allocated instruXions in mem, initialized"
          +   emitAlignment(4);
          +   O << "\t.global\t" << CurrentFnName << "\n";
          +   O << "\t.type\t" << CurrentFnName << ", @function\n";
          +   O << CurrentFnName << ":\n";
          + 
          +   // Print out code for the function.
          +   for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
          +        I != E; ++I) {
          +     // Print a label for the basic block if there are any predecessors.
          +     if (I->pred_begin() != I->pred_end())
          +       O << ".LBB" << CurrentFnName << "_" << I->getNumber() << ":\t"
          +         << CommentString << " " << I->getBasicBlock()->getName() << "\n";
          +     for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
          +          II != E; ++II) {
          +       // Print the assembly for the instruction.
          +       O << "\t";
          +       printMachineInstruction(II);
          +     }
          +   }
          + 
          +   // We didn't modify anything.
          +   return false;
          + }
          + 
          + void IA64AsmPrinter::printOp(const MachineOperand &MO,
          +                                  bool isBRCALLinsn /* = false */) {
          +   const MRegisterInfo &RI = *TM.getRegisterInfo();
          +   switch (MO.getType()) {
          +   case MachineOperand::MO_VirtualRegister:
          +     if (Value *V = MO.getVRegValueOrNull()) {
          +       O << "<" << V->getName() << ">";
          +       return;
          +     }
          +     // FALLTHROUGH
          +   case MachineOperand::MO_MachineRegister:
          +   case MachineOperand::MO_CCRegister: {
          +     O << RI.get(MO.getReg()).Name;
          +     return;
          +   }
          + 
          +   case MachineOperand::MO_SignExtendedImmed:
          +   case MachineOperand::MO_UnextendedImmed:
          +     O << /*(unsigned int)*/MO.getImmedValue();
          +     return;
          +   case MachineOperand::MO_MachineBasicBlock: {
          +     MachineBasicBlock *MBBOp = MO.getMachineBasicBlock();
          +     O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction())
          +       << "_" << MBBOp->getNumber () << "\t// "
          +       << MBBOp->getBasicBlock ()->getName ();
          +     return;
          +   }
          +   case MachineOperand::MO_PCRelativeDisp:
          +     std::cerr << "Shouldn't use addPCDisp() when building IA64 MachineInstrs";
          +     abort ();
          +     return;
          + 
          +   case MachineOperand::MO_ConstantPoolIndex: {
          +     O << "@gprel(.CPI" << CurrentFnName << "_"
          +       << MO.getConstantPoolIndex() << ")";
          +     return;
          +   }
          + 
          +   case MachineOperand::MO_GlobalAddress: {
          + 
          +     // functions need @ltoff(@fptr(fn_name)) form
          +     GlobalValue *GV = MO.getGlobal();
          +     Function *F = dyn_cast(GV);
          + 
          +     bool Needfptr=false; // if we're computing an address @ltoff(X), do
          +                          // we need to decorate it so it becomes
          + 			 // @ltoff(@fptr(X)) ?
          +     if(F && !isBRCALLinsn && F->isExternal())
          +       Needfptr=true;
          +    
          +     // if this is the target of a call instruction, we should define
          +     // the function somewhere (GNU gas has no problem without this, but
          +     // Intel ias rightly complains of an 'undefined symbol')
          +   
          +     if(F && isBRCALLinsn && F->isExternal())
          +       ExternalFunctionNames.insert(Mang->getValueName(MO.getGlobal()));
          +     
          +     if (!isBRCALLinsn)
          +       O << "@ltoff(";
          +     if (Needfptr)
          +       O << "@fptr(";
          +     O << Mang->getValueName(MO.getGlobal());
          +     if (Needfptr)
          +       O << ")"; // close fptr(
          +     if (!isBRCALLinsn)
          +       O << ")"; // close ltoff(
          +     int Offset = MO.getOffset();
          +     if (Offset > 0)
          +       O << " + " << Offset;
          +     else if (Offset < 0)
          +       O << " - " << -Offset;
          +     return;
          +   }
          +   case MachineOperand::MO_ExternalSymbol:
          +     O << MO.getSymbolName();
          +     return;
          +   default:
          +     O << ""; return;    
          +   }
          + }
          + 
          + /// printMachineInstruction -- Print out a single IA64 LLVM instruction
          + /// MI to the current output stream.
          + ///
          + void IA64AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
          +   
          +   ++EmittedInsts;
          +   
          +   // Call the autogenerated instruction printer routines.
          +   printInstruction(MI);
          + }
          + 
          + bool IA64AsmPrinter::doInitialization(Module &M) {
          +   AsmPrinter::doInitialization(M);
          +   
          +   O << "\t.psr	  lsb\n"  // should be "msb" on HP-UX, for starters
          +     << "\t.radix  C\n"
          +     << "\t.psr	  abi64\n"; // we only support 64 bits for now
          +   return false;
          + }
          + 
          + /// createIA64CodePrinterPass - Returns a pass that prints the IA64
          + /// assembly code for a MachineFunction to the given output stream, using
          + /// the given target machine description.
          + ///
          + FunctionPass *llvm::createIA64CodePrinterPass(std::ostream &o,TargetMachine &tm){
          +   return new IA64AsmPrinter(o, tm);
          + }
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64ISelPattern.cpp
          diff -c /dev/null llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64ISelPattern.cpp	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,1640 ----
          + //===-- IA64ISelPattern.cpp - A pattern matching inst selector for IA64 ---===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file defines a pattern matching instruction selector for IA64.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #include "IA64.h"
          + #include "IA64InstrBuilder.h"
          + #include "IA64RegisterInfo.h"
          + #include "IA64MachineFunctionInfo.h"
          + #include "llvm/Constants.h"                   // FIXME: REMOVE
          + #include "llvm/Function.h"
          + #include "llvm/CodeGen/MachineConstantPool.h" // FIXME: REMOVE
          + #include "llvm/CodeGen/MachineFunction.h"
          + #include "llvm/CodeGen/MachineFrameInfo.h"
          + #include "llvm/CodeGen/SelectionDAG.h"
          + #include "llvm/CodeGen/SelectionDAGISel.h"
          + #include "llvm/CodeGen/SSARegMap.h"
          + #include "llvm/Target/TargetData.h"
          + #include "llvm/Target/TargetLowering.h"
          + #include "llvm/Support/MathExtras.h"
          + #include "llvm/ADT/Statistic.h"
          + #include 
          + #include 
          + using namespace llvm;
          + 
          + //===----------------------------------------------------------------------===//
          + //  IA64TargetLowering - IA64 Implementation of the TargetLowering interface
          + namespace {
          +   class IA64TargetLowering : public TargetLowering {
          +     int VarArgsFrameIndex;            // FrameIndex for start of varargs area.
          +     
          +     //int ReturnAddrIndex;              // FrameIndex for return slot.
          +     unsigned GP, SP, RP; // FIXME - clean this mess up
          +   public:
          + 
          +    unsigned VirtGPR; // this is public so it can be accessed in the selector
          +    // for ISD::RET down below. add an accessor instead? FIXME
          + 
          +    IA64TargetLowering(TargetMachine &TM) : TargetLowering(TM) {
          +       
          +       // register class for general registers
          +       addRegisterClass(MVT::i64, IA64::GRRegisterClass);
          + 
          +       // register class for FP registers
          +       addRegisterClass(MVT::f64, IA64::FPRegisterClass);
          +       
          +       // register class for predicate registers 
          +       addRegisterClass(MVT::i1, IA64::PRRegisterClass);
          +       
          +       setOperationAction(ISD::FP_ROUND_INREG   , MVT::f32  , Expand);
          + 
          +       setSetCCResultType(MVT::i1); 
          +       setShiftAmountType(MVT::i64);
          + 
          +       setOperationAction(ISD::EXTLOAD          , MVT::i1   , Promote);
          +       setOperationAction(ISD::EXTLOAD          , MVT::f32  , Promote);
          + 
          +       setOperationAction(ISD::ZEXTLOAD         , MVT::i1   , Expand);
          +       setOperationAction(ISD::ZEXTLOAD         , MVT::i32  , Expand);
          + 
          +       setOperationAction(ISD::SEXTLOAD         , MVT::i1   , Expand);
          +       setOperationAction(ISD::SEXTLOAD         , MVT::i8   , Expand);
          +       setOperationAction(ISD::SEXTLOAD         , MVT::i16  , Expand);
          + 
          +       setOperationAction(ISD::SREM             , MVT::f32  , Expand);
          +       setOperationAction(ISD::SREM             , MVT::f64  , Expand);
          + 
          +       setOperationAction(ISD::UREM             , MVT::f32  , Expand);
          +       setOperationAction(ISD::UREM             , 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);
          +       addLegalFPImmediate(+1.0);
          +       addLegalFPImmediate(-0.0);
          +       addLegalFPImmediate(-1.0);
          +     }
          + 
          +     /// LowerArguments - This hook must be implemented to indicate how we should
          +     /// lower the arguments for the specified function, into the specified DAG.
          +     virtual std::vector
          +     LowerArguments(Function &F, SelectionDAG &DAG);
          + 
          +     /// LowerCallTo - This hook lowers an abstract call to a function into an
          +     /// actual call.
          +     virtual std::pair
          +     LowerCallTo(SDOperand Chain, const Type *RetTy, SDOperand Callee,
          +                 ArgListTy &Args, SelectionDAG &DAG);
          + 
          +     virtual std::pair
          +     LowerVAStart(SDOperand Chain, SelectionDAG &DAG);
          + 
          +     virtual std::pair
          +     LowerVAArgNext(bool isVANext, SDOperand Chain, SDOperand VAList,
          +                    const Type *ArgTy, SelectionDAG &DAG);
          + 
          +     virtual std::pair
          +     LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth,
          +                             SelectionDAG &DAG);
          + 
          +     void restoreGP_SP_RP(MachineBasicBlock* BB)
          +     {
          +       BuildMI(BB, IA64::MOV, 1, IA64::r1).addReg(GP);
          +       BuildMI(BB, IA64::MOV, 1, IA64::r12).addReg(SP);
          +       BuildMI(BB, IA64::MOV, 1, IA64::rp).addReg(RP);
          +     }
          + 
          +     void restoreRP(MachineBasicBlock* BB)
          +     {
          +       BuildMI(BB, IA64::MOV, 1, IA64::rp).addReg(RP);
          +     }
          + 
          +     void restoreGP(MachineBasicBlock* BB)
          +     {
          +       BuildMI(BB, IA64::MOV, 1, IA64::r1).addReg(GP);
          +     }
          + 
          +   };
          + }
          + 
          + 
          + std::vector
          + IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
          +   std::vector ArgValues;
          + 
          +   //
          +   // add beautiful description of IA64 stack frame format
          +   // here (from intel 24535803.pdf most likely)
          +   //
          +   MachineFunction &MF = DAG.getMachineFunction();
          +   MachineFrameInfo *MFI = MF.getFrameInfo();
          + 
          +   GP = MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::i64));
          +   SP = MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::i64));
          +   RP = MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::i64));
          + 
          +   MachineBasicBlock& BB = MF.front();
          + 
          +   unsigned args_int[] = {IA64::r32, IA64::r33, IA64::r34, IA64::r35, 
          +                          IA64::r36, IA64::r37, IA64::r38, IA64::r39};
          +  
          +   unsigned args_FP[] = {IA64::F8, IA64::F9, IA64::F10, IA64::F11, 
          +                         IA64::F12,IA64::F13,IA64::F14, IA64::F15};
          +  
          +   unsigned argVreg[8];
          +   unsigned argPreg[8];
          +   unsigned argOpc[8];
          + 
          +   unsigned used_FPArgs=0; // how many FP args have been used so far?
          +   
          +   int count = 0;
          +   for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I)
          +     {
          +       SDOperand newroot, argt;
          +       if(count < 8) { // need to fix this logic? maybe.
          + 	  
          + 	switch (getValueType(I->getType())) {
          + 	  default:
          + 	    std::cerr << "ERROR in LowerArgs: unknown type "
          + 	      << getValueType(I->getType()) << "\n";
          + 	    abort();
          + 	  case MVT::f32:
          + 	    // fixme? (well, will need to for weird FP structy stuff, 
          + 	    // see intel ABI docs)
          + 	  case MVT::f64:
          + 	    BuildMI(&BB, IA64::IDEF, 0, args_FP[used_FPArgs]);
          + 	    // floating point args go into f8..f15 as-needed, the increment
          + 	    argVreg[count] =                              // is below..:
          + 	    MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::f64));
          + 	    // FP args go into f8..f15 as needed: (hence the ++)
          + 	    argPreg[count] = args_FP[used_FPArgs++];
          + 	    argOpc[count] = IA64::FMOV;
          + 	    argt = newroot = DAG.getCopyFromReg(argVreg[count],
          + 		getValueType(I->getType()), DAG.getRoot());
          + 	    break;
          + 	  case MVT::i1: // NOTE: as far as C abi stuff goes,
          + 	                // bools are just boring old ints
          + 	  case MVT::i8:
          + 	  case MVT::i16:
          + 	  case MVT::i32:
          + 	  case MVT::i64:
          + 	    BuildMI(&BB, IA64::IDEF, 0, args_int[count]);
          + 	    argVreg[count] = 
          + 	    MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::i64));
          + 	    argPreg[count] = args_int[count];
          + 	    argOpc[count] = IA64::MOV; 
          + 	    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;
          + 	}
          +       } else { // more than 8 args go into the frame
          + 	// Create the frame index object for this incoming parameter...
          + 	int FI = MFI->CreateFixedObject(8, 16 + 8 * (count - 8));
          +         
          + 	// Create the SelectionDAG nodes corresponding to a load 
          + 	//from this parameter
          + 	SDOperand FIN = DAG.getFrameIndex(FI, MVT::i64);
          + 	argt = newroot = DAG.getLoad(getValueType(I->getType()), 
          + 	    DAG.getEntryNode(), FIN);
          +       }
          +       ++count;
          +       DAG.setRoot(newroot.getValue(1));
          +       ArgValues.push_back(argt);
          +     }    
          + 	
          + // Create a vreg to hold the output of (what will become)
          + // the "alloc" instruction
          +   VirtGPR = MF.getSSARegMap()->createVirtualRegister(getRegClassFor(MVT::i64));
          +   BuildMI(&BB, IA64::PSEUDO_ALLOC, 0, VirtGPR);
          +   // we create a PSEUDO_ALLOC (pseudo)instruction for now
          + 
          +   BuildMI(&BB, IA64::IDEF, 0, IA64::r1);
          + 
          +   // hmm:
          +   BuildMI(&BB, IA64::IDEF, 0, IA64::r12);
          +   BuildMI(&BB, IA64::IDEF, 0, IA64::rp);
          +   // ..hmm.
          + 
          +   BuildMI(&BB, IA64::MOV, 1, GP).addReg(IA64::r1);
          + 
          +   // hmm:
          +   BuildMI(&BB, IA64::MOV, 1, SP).addReg(IA64::r12);
          +   BuildMI(&BB, IA64::MOV, 1, RP).addReg(IA64::rp);
          +   // ..hmm.
          + 
          +   for (int i = 0; i < count && i < 8; ++i) {
          +     BuildMI(&BB, argOpc[i], 1, argVreg[i]).addReg(argPreg[i]);
          +   }
          +  
          +   return ArgValues;
          + }
          +   
          + std::pair
          + IA64TargetLowering::LowerCallTo(SDOperand Chain,
          +                                const Type *RetTy, SDOperand Callee,
          +                                ArgListTy &Args, SelectionDAG &DAG) {
          + 
          +   MachineFunction &MF = DAG.getMachineFunction();
          + 
          + // fow now, we are overly-conservative and pretend that all 8
          + // outgoing registers (out0-out7) are always used. FIXME
          + 
          + // update comment line 137 of MachineFunction.h
          +   MF.getInfo()->outRegsUsed=8;
          +   
          +   unsigned NumBytes = 16;
          +   if (Args.size() > 8)
          +     NumBytes += (Args.size() - 8) * 8;
          +   
          +   Chain = DAG.getNode(ISD::ADJCALLSTACKDOWN, MVT::Other, Chain,
          +                         DAG.getConstant(NumBytes, getPointerTy()));
          +   
          +   std::vector args_to_use;
          +   for (unsigned i = 0, e = Args.size(); i != e; ++i)
          +     {
          +       switch (getValueType(Args[i].second)) {
          +       default: assert(0 && "unexpected argument type!");
          +       case MVT::i1:
          +       case MVT::i8:
          +       case MVT::i16:
          +       case MVT::i32:
          + 	//promote to 64-bits, sign/zero extending based on type
          + 	//of the argument
          + 	if(Args[i].second->isSigned())
          + 	  Args[i].first = DAG.getNode(ISD::SIGN_EXTEND, MVT::i64,
          + 	      Args[i].first);
          + 	else
          + 	  Args[i].first = DAG.getNode(ISD::ZERO_EXTEND, MVT::i64,
          + 	      Args[i].first);
          + 	break;
          +       case MVT::f32:
          + 	//promote to 64-bits
          + 	Args[i].first = DAG.getNode(ISD::FP_EXTEND, MVT::f64, Args[i].first);
          +       case MVT::f64:
          +       case MVT::i64:
          +         break;
          +       }
          +       args_to_use.push_back(Args[i].first);
          +     }
          + 
          +   std::vector RetVals;
          +   MVT::ValueType RetTyVT = getValueType(RetTy);
          +   if (RetTyVT != MVT::isVoid)
          +     RetVals.push_back(RetTyVT);
          +   RetVals.push_back(MVT::Other);
          + 
          +   SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain,
          + 	Callee, args_to_use), 0);
          +   Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
          +   Chain = DAG.getNode(ISD::ADJCALLSTACKUP, MVT::Other, Chain,
          +                       DAG.getConstant(NumBytes, getPointerTy()));
          +   return std::make_pair(TheCall, Chain);
          + }
          + 
          + std::pair
          + IA64TargetLowering::LowerVAStart(SDOperand Chain, SelectionDAG &DAG) {
          +   // vastart just returns the address of the VarArgsFrameIndex slot.
          +   return std::make_pair(DAG.getFrameIndex(VarArgsFrameIndex, MVT::i64), Chain);
          + }
          + 
          + std::pair IA64TargetLowering::
          + LowerVAArgNext(bool isVANext, SDOperand Chain, SDOperand VAList,
          +                const Type *ArgTy, SelectionDAG &DAG) {
          +  
          +   assert(0 && "LowerVAArgNext not done yet!\n");
          + }
          +                
          + 
          + std::pair IA64TargetLowering::
          + LowerFrameReturnAddress(bool isFrameAddress, SDOperand Chain, unsigned Depth,
          +                         SelectionDAG &DAG) {
          + 
          +   assert(0 && "LowerFrameReturnAddress not done yet\n");
          + }
          + 
          + 
          + namespace {
          + 
          +   //===--------------------------------------------------------------------===//
          +   /// ISel - IA64 specific code to select IA64 machine instructions for
          +   /// SelectionDAG operations.
          +   ///
          +   class ISel : public SelectionDAGISel {
          +     /// IA64Lowering - This object fully describes how to lower LLVM code to an
          +     /// IA64-specific SelectionDAG.
          +     IA64TargetLowering IA64Lowering;
          + 
          +     /// ExprMap - As shared expressions are codegen'd, we keep track of which
          +     /// vreg the value is produced in, so we only emit one copy of each compiled
          +     /// tree.
          +     std::map ExprMap;
          +     std::set LoweredTokens;
          + 
          +   public:
          +     ISel(TargetMachine &TM) : SelectionDAGISel(IA64Lowering), IA64Lowering(TM) {
          +     }
          + 
          +     /// InstructionSelectBasicBlock - This callback is invoked by
          +     /// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
          +     virtual void InstructionSelectBasicBlock(SelectionDAG &DAG);
          + 
          + //    bool isFoldableLoad(SDOperand Op);
          + //    void EmitFoldedLoad(SDOperand Op, IA64AddressMode &AM);
          + 
          +     unsigned SelectExpr(SDOperand N);
          +     void Select(SDOperand N);
          +   };
          + }
          + 
          + /// InstructionSelectBasicBlock - This callback is invoked by SelectionDAGISel
          + /// when it has created a SelectionDAG for us to codegen.
          + void ISel::InstructionSelectBasicBlock(SelectionDAG &DAG) {
          + 
          +   // Codegen the basic block.
          +   Select(DAG.getRoot());
          + 
          +   // Clear state used for selection.
          +   ExprMap.clear();
          +   LoweredTokens.clear();
          + }
          + 
          + unsigned ISel::SelectExpr(SDOperand N) {
          +   unsigned Result;
          +   unsigned Tmp1, Tmp2, Tmp3;
          +   unsigned Opc = 0;
          +   MVT::ValueType DestType = N.getValueType();
          + 
          +   unsigned opcode = N.getOpcode();
          + 
          +   SDNode *Node = N.Val;
          +   SDOperand Op0, Op1;
          + 
          +   if (Node->getOpcode() == ISD::CopyFromReg)
          +     // Just use the specified register as our input.
          +     return dyn_cast(Node)->getReg();
          +   
          +   unsigned &Reg = ExprMap[N];
          +   if (Reg) return Reg;
          +   
          +   if (N.getOpcode() != ISD::CALL)
          +     Reg = Result = (N.getValueType() != MVT::Other) ?
          +       MakeReg(N.getValueType()) : 1;
          +   else {
          +     // If this is a call instruction, make sure to prepare ALL of the result
          +     // values as well as the chain.
          +     if (Node->getNumValues() == 1)
          +       Reg = Result = 1;  // Void call, just a chain.
          +     else {
          +       Result = MakeReg(Node->getValueType(0));
          +       ExprMap[N.getValue(0)] = Result;
          +       for (unsigned i = 1, e = N.Val->getNumValues()-1; i != e; ++i)
          +         ExprMap[N.getValue(i)] = MakeReg(Node->getValueType(i));
          +       ExprMap[SDOperand(Node, Node->getNumValues()-1)] = 1;
          +     }
          +   }
          +   
          +   switch (N.getOpcode()) {
          +   default:
          +     Node->dump();
          +     assert(0 && "Node not handled!\n");
          + 
          +   case ISD::FrameIndex: {
          +     Tmp1 = cast(N)->getIndex();
          +     BuildMI(BB, IA64::MOV, 1, Result).addFrameIndex(Tmp1);
          +     return Result;
          +   }
          + 
          +   case ISD::ConstantPool: {
          +     Tmp1 = cast(N)->getIndex();
          +     IA64Lowering.restoreGP(BB); // FIXME: do i really need this?
          +     BuildMI(BB, IA64::ADD, 2, Result).addConstantPoolIndex(Tmp1)
          +       .addReg(IA64::r1);
          +     return Result;
          +   }
          + 
          +   case ISD::ConstantFP: {
          +     Tmp1 = Result;   // Intermediate Register
          +     if (cast(N)->getValue() < 0.0 ||
          +         cast(N)->isExactlyValue(-0.0))
          +       Tmp1 = MakeReg(MVT::f64);
          + 
          +     if (cast(N)->isExactlyValue(+0.0) ||
          +         cast(N)->isExactlyValue(-0.0))
          +       BuildMI(BB, IA64::FMOV, 1, Tmp1).addReg(IA64::F0); // load 0.0
          +     else if (cast(N)->isExactlyValue(+1.0) ||
          +              cast(N)->isExactlyValue(-1.0))
          +       BuildMI(BB, IA64::FMOV, 1, Tmp1).addReg(IA64::F1); // load 1.0
          +     else
          +       assert(0 && "Unexpected FP constant!");
          +     if (Tmp1 != Result)
          +       // we multiply by +1.0, negate (this is FNMA), and then add 0.0
          +       BuildMI(BB, IA64::FNMA, 3, Result).addReg(Tmp1).addReg(IA64::F1)
          + 	.addReg(IA64::F0);
          +     return Result;
          +   }
          + 
          +   case ISD::DYNAMIC_STACKALLOC: {
          +     // Generate both result values.
          +     if (Result != 1)
          +       ExprMap[N.getValue(1)] = 1;   // Generate the token
          +     else
          +       Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType());
          + 
          +     // FIXME: We are currently ignoring the requested alignment for handling
          +     // greater than the stack alignment.  This will need to be revisited at some
          +     // point.  Align = N.getOperand(2);
          + 
          +     if (!isa(N.getOperand(2)) ||
          +         cast(N.getOperand(2))->getValue() != 0) {
          +       std::cerr << "Cannot allocate stack object with greater alignment than"
          +                 << " the stack alignment yet!";
          +       abort();
          +     }
          +   
          +     Select(N.getOperand(0));
          +     if (ConstantSDNode* CN = dyn_cast(N.getOperand(1)))
          +     {
          +       if (CN->getValue() < 32000)
          +       {
          +         BuildMI(BB, IA64::ADDIMM22, 2, IA64::r12).addReg(IA64::r12)
          + 	  .addImm(-CN->getValue());
          +       } else {
          +         Tmp1 = SelectExpr(N.getOperand(1));
          +         // Subtract size from stack pointer, thereby allocating some space.
          +         BuildMI(BB, IA64::SUB, 2, IA64::r12).addReg(IA64::r12).addReg(Tmp1);
          +       }
          +     } else {
          +       Tmp1 = SelectExpr(N.getOperand(1));
          +       // Subtract size from stack pointer, thereby allocating some space.
          +       BuildMI(BB, IA64::SUB, 2, IA64::r12).addReg(IA64::r12).addReg(Tmp1);
          +     }
          + 
          +     // Put a pointer to the space into the result register, by copying the
          +     // stack pointer.
          +     BuildMI(BB, IA64::MOV, 1, Result).addReg(IA64::r12);
          +     return Result;
          +   }
          +     
          +   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
          + 
          +       // a temporary predicate register to hold the complement of the
          +       // condition:
          +       unsigned CondComplement=MakeReg(MVT::i1);
          +       unsigned bogusTemp=MakeReg(MVT::i1);
          + 
          +       unsigned bogoResult;
          +       
          +       switch (N.getOperand(1).getValueType()) {
          + 	default: assert(0 &&
          + 	"ISD::SELECT: 'select'ing something other than i64 or f64!\n");
          + 	case MVT::i64:
          + 	  bogoResult=MakeReg(MVT::i64);
          + 	  break;
          + 	case MVT::f64:
          + 	  bogoResult=MakeReg(MVT::f64);
          + 	  break;
          +       }
          +       // set up the complement predicate reg (CondComplement = NOT Tmp1)
          +       BuildMI(BB, IA64::CMPEQ, 2, bogusTemp).addReg(IA64::r0).addReg(IA64::r0);
          +       BuildMI(BB, IA64::TPCMPNE, 3, CondComplement).addReg(bogusTemp)
          + 	.addReg(IA64::r0).addReg(IA64::r0).addReg(Tmp1);
          + 	
          +       // and do a 'conditional move'
          +       BuildMI(BB, IA64::PMOV, 2, bogoResult).addReg(Tmp2).addReg(Tmp1);
          +       BuildMI(BB, IA64::CMOV, 2, Result).addReg(bogoResult).addReg(Tmp3)
          + 	.addReg(CondComplement);
          +  
          +       return Result;
          +   }
          +   
          +   case ISD::Constant: {
          +     unsigned depositPos=0;
          +     unsigned depositLen=0;
          +     switch (N.getValueType()) {
          +       default: assert(0 && "Cannot use constants of this type!");
          +       case MVT::i1: { // if a bool, we don't 'load' so much as generate
          + 		      // the constant:
          + 		      if(cast(N)->getValue())  // true:
          + 			BuildMI(BB, IA64::CMPEQ, 2, Result)
          + 			  .addReg(IA64::r0).addReg(IA64::r0);
          + 		      else // false:
          + 			BuildMI(BB, IA64::CMPNE, 2, Result)
          + 			  .addReg(IA64::r0).addReg(IA64::r0);
          + 		      return Result;
          + 		    }
          +       case MVT::i64: Opc = IA64::MOVLI32; break;
          +     }
          +    
          +     int64_t immediate = cast(N)->getValue();
          +     if(immediate>>32) { // if our immediate really is big:
          +       int highPart = immediate>>32;
          +       int lowPart = immediate&0xFFFFFFFF;
          +       unsigned dummy = MakeReg(MVT::i64);
          +       unsigned dummy2 = MakeReg(MVT::i64);
          +       unsigned dummy3 = MakeReg(MVT::i64);
          +      
          +       BuildMI(BB, IA64::MOVLI32, 1, dummy).addImm(highPart);
          +       BuildMI(BB, IA64::SHLI, 2, dummy2).addReg(dummy).addImm(32);
          +       BuildMI(BB, IA64::MOVLI32, 1, dummy3).addImm(lowPart);
          +       BuildMI(BB, IA64::ADD, 2, Result).addReg(dummy2).addReg(dummy3);
          +     } else {
          +       BuildMI(BB, IA64::MOVLI32, 1, Result).addImm(immediate);
          +     }
          + 
          +   return Result;
          +   }
          +     
          +   case ISD::GlobalAddress: {
          +     GlobalValue *GV = cast(N)->getGlobal();
          +     unsigned Tmp1 = MakeReg(MVT::i64);
          +     BuildMI(BB, IA64::ADD, 2, Tmp1).addGlobalAddress(GV).addReg(IA64::r1);
          +                                                         //r1==GP
          +     BuildMI(BB, IA64::LD8, 1, Result).addReg(Tmp1);
          +     return Result;
          +   }
          +   
          +   case ISD::ExternalSymbol: {
          +     const char *Sym = cast(N)->getSymbol();
          +     assert(0 && "ISD::ExternalSymbol not done yet\n");
          +     //XXX BuildMI(BB, IA64::MOV, 1, Result).addExternalSymbol(Sym);
          +     return Result;
          +   }
          + 
          +   case ISD::FP_EXTEND: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     BuildMI(BB, IA64::FMOV, 1, Result).addReg(Tmp1);
          +     return Result;
          +   }
          + 
          +   case ISD::ZERO_EXTEND: {
          +     Tmp1 = SelectExpr(N.getOperand(0)); // value
          +     
          +     switch (N.getOperand(0).getValueType()) {
          +     default: assert(0 && "Cannot zero-extend this type!");
          +     case MVT::i8:  Opc = IA64::ZXT1; break;
          +     case MVT::i16: Opc = IA64::ZXT2; break;
          +     case MVT::i32: Opc = IA64::ZXT4; break;
          + 
          +     // we handle bools differently! : 
          +     case MVT::i1: { // if the predicate reg has 1, we want a '1' in our GR.
          + 		    unsigned dummy = MakeReg(MVT::i64);
          + 		    // first load zero:
          + 		    BuildMI(BB, IA64::MOV, 1, dummy).addReg(IA64::r0);
          + 		    // ...then conditionally (PR:Tmp1) add 1:
          + 		    BuildMI(BB, IA64::CADDIMM22, 3, Result).addReg(dummy)
          + 		      .addImm(1).addReg(Tmp1);
          + 		    return Result; // XXX early exit!
          + 		  }
          +     }
          + 
          +     BuildMI(BB, Opc, 1, Result).addReg(Tmp1);
          +     return Result;
          +    }
          + 
          +   case ISD::SIGN_EXTEND: {   // we should only have to handle i1 -> i64 here!!!
          + 
          + assert(0 && "hmm, ISD::SIGN_EXTEND: shouldn't ever be reached. bad luck!\n");
          + 
          +     Tmp1 = SelectExpr(N.getOperand(0)); // value
          +     
          +     switch (N.getOperand(0).getValueType()) {
          +     default: assert(0 && "Cannot sign-extend this type!");
          +     case MVT::i1:  assert(0 && "trying to sign extend a bool? ow.\n");
          + 		   Opc = IA64::SXT1; break;
          + 		   // FIXME: for now, we treat bools the same as i8s
          +     case MVT::i8:  Opc = IA64::SXT1; break;
          +     case MVT::i16: Opc = IA64::SXT2; break;
          +     case MVT::i32: Opc = IA64::SXT4; break;
          +     }
          + 
          +     BuildMI(BB, Opc, 1, Result).addReg(Tmp1);
          +     return Result;
          +    }
          + 
          +   case ISD::TRUNCATE: {
          +     // we use the funky dep.z (deposit (zero)) instruction to deposit bits
          +     // of R0 appropriately.
          +     switch (N.getOperand(0).getValueType()) {
          +     default: assert(0 && "Unknown truncate!");
          +     case MVT::i64: break;
          +     }
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     unsigned depositPos, depositLen;
          + 
          +     switch (N.getValueType()) {
          +     default: assert(0 && "Unknown truncate!");
          +     case MVT::i1: {
          +       // if input (normal reg) is 0, 0!=0 -> false (0), if 1, 1!=0 ->true (1):
          + 		    BuildMI(BB, IA64::CMPNE, 2, Result).addReg(Tmp1)
          + 		      .addReg(IA64::r0);
          + 		    return Result; // XXX early exit!
          + 		  }
          +     case MVT::i8:  depositPos=0; depositLen=8;  break;
          +     case MVT::i16: depositPos=0; depositLen=16; break;
          +     case MVT::i32: depositPos=0; depositLen=32; break;
          +     }
          +     BuildMI(BB, IA64::DEPZ, 1, Result).addReg(Tmp1)
          +       .addImm(depositPos).addImm(depositLen);
          +     return Result;
          +   }
          + 
          + /*			
          +   case ISD::FP_ROUND: {
          +     assert (DestType == MVT::f32 && N.getOperand(0).getValueType() == MVT::f64 &&
          + 	"error: trying to FP_ROUND something other than f64 -> f32!\n");
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     BuildMI(BB, IA64::FADDS, 2, Result).addReg(Tmp1).addReg(IA64::F0);
          +     // we add 0.0 using a single precision add to do rounding
          +     return Result;
          +   }
          + */
          + 
          + // FIXME: the following 4 cases need cleaning
          +   case ISD::SINT_TO_FP: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = MakeReg(MVT::f64);
          +     unsigned dummy = MakeReg(MVT::f64);
          +     BuildMI(BB, IA64::SETFSIG, 1, Tmp2).addReg(Tmp1);
          +     BuildMI(BB, IA64::FCVTXF, 1, dummy).addReg(Tmp2);
          +     BuildMI(BB, IA64::FNORMD, 1, Result).addReg(dummy);
          +     return Result;
          +   }
          + 
          +   case ISD::UINT_TO_FP: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = MakeReg(MVT::f64);
          +     unsigned dummy = MakeReg(MVT::f64);
          +     BuildMI(BB, IA64::SETFSIG, 1, Tmp2).addReg(Tmp1);
          +     BuildMI(BB, IA64::FCVTXUF, 1, dummy).addReg(Tmp2);
          +     BuildMI(BB, IA64::FNORMD, 1, Result).addReg(dummy);
          +     return Result;
          +   }
          + 
          +   case ISD::FP_TO_SINT: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = MakeReg(MVT::f64);
          +     BuildMI(BB, IA64::FCVTFXTRUNC, 1, Tmp2).addReg(Tmp1);
          +     BuildMI(BB, IA64::GETFSIG, 1, Result).addReg(Tmp2);
          +     return Result;
          +   }
          + 
          +   case ISD::FP_TO_UINT: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = MakeReg(MVT::f64);
          +     BuildMI(BB, IA64::FCVTFXUTRUNC, 1, Tmp2).addReg(Tmp1);
          +     BuildMI(BB, IA64::GETFSIG, 1, Result).addReg(Tmp2);
          +     return Result;
          +   }
          + 
          +   case ISD::ADD: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = SelectExpr(N.getOperand(1));
          +     if(DestType != MVT::f64)
          +       BuildMI(BB, IA64::ADD, 2, Result).addReg(Tmp1).addReg(Tmp2); // int
          +     else
          +       BuildMI(BB, IA64::FADD, 2, Result).addReg(Tmp1).addReg(Tmp2); // FP
          +     return Result;
          +   }
          + 
          +   case ISD::MUL: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = SelectExpr(N.getOperand(1));
          +     if(DestType != MVT::f64) { // integer multiply, emit some code (FIXME)
          +       unsigned TempFR1=MakeReg(MVT::f64);
          +       unsigned TempFR2=MakeReg(MVT::f64);
          +       unsigned TempFR3=MakeReg(MVT::f64);
          +       BuildMI(BB, IA64::SETFSIG, 1, TempFR1).addReg(Tmp1);
          +       BuildMI(BB, IA64::SETFSIG, 1, TempFR2).addReg(Tmp2);
          +       BuildMI(BB, IA64::XMAL, 1, TempFR3).addReg(TempFR1).addReg(TempFR2)
          + 	.addReg(IA64::F0);
          +       BuildMI(BB, IA64::GETFSIG, 1, Result).addReg(TempFR3);
          +     }
          +     else  // floating point multiply
          +       BuildMI(BB, IA64::FMPY, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +     return Result;
          +   }
          +   
          +   case ISD::SUB: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = SelectExpr(N.getOperand(1));
          +     if(DestType != MVT::f64)
          +       BuildMI(BB, IA64::SUB, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +     else
          +       BuildMI(BB, IA64::FSUB, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +     return Result;
          +   }
          + 		 
          +   case ISD::AND: {
          +      switch (N.getValueType()) {
          +     default: assert(0 && "Cannot AND this type!");
          +     case MVT::i1: { // if a bool, we emit a pseudocode AND
          +       unsigned pA = SelectExpr(N.getOperand(0));
          +       unsigned pB = SelectExpr(N.getOperand(1));
          +        
          + /* our pseudocode for AND is:
          +  *
          + (pA) cmp.eq.unc pC,p0 = r0,r0   // pC = pA
          +      cmp.eq pTemp,p0 = r0,r0    // pTemp = NOT pB
          +      ;;
          + (pB) cmp.ne pTemp,p0 = r0,r0
          +      ;;
          + (pTemp)cmp.ne pC,p0 = r0,r0    // if (NOT pB) pC = 0
          + 
          + */
          +       unsigned pTemp = MakeReg(MVT::i1);
          +      
          +       unsigned bogusTemp1 = MakeReg(MVT::i1);
          +       unsigned bogusTemp2 = MakeReg(MVT::i1);
          +       unsigned bogusTemp3 = MakeReg(MVT::i1);
          +       unsigned bogusTemp4 = MakeReg(MVT::i1);
          +     
          +       BuildMI(BB, IA64::PCMPEQUNC, 3, bogusTemp1)
          + 	.addReg(IA64::r0).addReg(IA64::r0).addReg(pA);
          +       BuildMI(BB, IA64::CMPEQ, 2, bogusTemp2)
          + 	.addReg(IA64::r0).addReg(IA64::r0);
          +       BuildMI(BB, IA64::TPCMPNE, 3, pTemp)
          + 	.addReg(bogusTemp2).addReg(IA64::r0).addReg(IA64::r0).addReg(pB);
          +       BuildMI(BB, IA64::TPCMPNE, 3, Result)
          + 	.addReg(bogusTemp1).addReg(IA64::r0).addReg(IA64::r0).addReg(pTemp);
          +       break;
          +     }
          +     // if not a bool, we just AND away:
          +     case MVT::i8:
          +     case MVT::i16:
          +     case MVT::i32:
          +     case MVT::i64: {
          +       Tmp1 = SelectExpr(N.getOperand(0));
          +       Tmp2 = SelectExpr(N.getOperand(1));
          +       BuildMI(BB, IA64::AND, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +       break;
          +     }
          +     }
          +     return Result;
          +   }
          +  
          +   case ISD::OR: {
          +   switch (N.getValueType()) {
          +     default: assert(0 && "Cannot OR this type!");
          +     case MVT::i1: { // if a bool, we emit a pseudocode OR
          +       unsigned pA = SelectExpr(N.getOperand(0));
          +       unsigned pB = SelectExpr(N.getOperand(1));
          + 
          +       unsigned pTemp1 = MakeReg(MVT::i1);
          +        
          + /* our pseudocode for OR is:
          +  *
          + 
          + pC = pA OR pB
          + -------------
          + 
          + (pA)	cmp.eq.unc pC,p0 = r0,r0  // pC = pA
          + 	;;
          + (pB)	cmp.eq pC,p0 = r0,r0	// if (pB) pC = 1
          + 
          + */
          +       BuildMI(BB, IA64::PCMPEQUNC, 3, pTemp1)
          + 	.addReg(IA64::r0).addReg(IA64::r0).addReg(pA);
          +       BuildMI(BB, IA64::TPCMPEQ, 3, Result)
          + 	.addReg(pTemp1).addReg(IA64::r0).addReg(IA64::r0).addReg(pB);
          +       break;
          +     }
          +     // if not a bool, we just OR away:
          +     case MVT::i8:
          +     case MVT::i16:
          +     case MVT::i32:
          +     case MVT::i64: {
          +       Tmp1 = SelectExpr(N.getOperand(0));
          +       Tmp2 = SelectExpr(N.getOperand(1));
          +       BuildMI(BB, IA64::OR, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +       break;
          +     }
          +     }
          +     return Result;
          +   }
          + 	 
          +   case ISD::XOR: {
          +      switch (N.getValueType()) {
          +     default: assert(0 && "Cannot XOR this type!");
          +     case MVT::i1: { // if a bool, we emit a pseudocode XOR
          +       unsigned pY = SelectExpr(N.getOperand(0));
          +       unsigned pZ = SelectExpr(N.getOperand(1));
          + 
          + /* one possible routine for XOR is:
          + 
          +       // Compute px = py ^ pz
          +         // using sum of products: px = (py & !pz) | (pz & !py)
          +         // Uses 5 instructions in 3 cycles.
          +         // cycle 1
          + (pz)    cmp.eq.unc      px = r0, r0     // px = pz
          + (py)    cmp.eq.unc      pt = r0, r0     // pt = py
          +         ;;
          +         // cycle 2
          + (pt)    cmp.ne.and      px = r0, r0     // px = px & !pt (px = pz & !pt)
          + (pz)    cmp.ne.and      pt = r0, r0     // pt = pt & !pz
          +         ;;
          +         } { .mmi
          +         // cycle 3
          + (pt)    cmp.eq.or       px = r0, r0     // px = px | pt
          + 
          + *** Another, which we use here, requires one scratch GR. it is:
          + 
          +         mov             rt = 0          // initialize rt off critical path
          +         ;;
          + 
          +         // cycle 1
          + (pz)    cmp.eq.unc      px = r0, r0     // px = pz
          + (pz)    mov             rt = 1          // rt = pz
          +         ;;
          +         // cycle 2
          + (py)    cmp.ne          px = 1, rt      // if (py) px = !pz
          + 
          + .. these routines kindly provided by Jim Hull
          + */
          +       unsigned rt = MakeReg(MVT::i64);
          + 
          +       // these two temporaries will never actually appear,
          +       // due to the two-address form of some of the instructions below
          +       unsigned bogoPR = MakeReg(MVT::i1);  // becomes Result
          +       unsigned bogoGR = MakeReg(MVT::i64); // becomes rt
          + 
          +       BuildMI(BB, IA64::MOV, 1, bogoGR).addReg(IA64::r0);
          +       BuildMI(BB, IA64::PCMPEQUNC, 3, bogoPR)
          + 	.addReg(IA64::r0).addReg(IA64::r0).addReg(pZ);
          +       BuildMI(BB, IA64::TPCADDIMM22, 2, rt)
          + 	.addReg(bogoGR).addImm(1).addReg(pZ);
          +       BuildMI(BB, IA64::TPCMPIMM8NE, 3, Result)
          + 	.addReg(bogoPR).addImm(1).addReg(rt).addReg(pY);
          +       break;
          +     }
          +     // if not a bool, we just XOR away:
          +     case MVT::i8:
          +     case MVT::i16:
          +     case MVT::i32:
          +     case MVT::i64: {
          +       Tmp1 = SelectExpr(N.getOperand(0));
          +       Tmp2 = SelectExpr(N.getOperand(1));
          +       BuildMI(BB, IA64::XOR, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +       break;
          +     }
          +     }
          +     return Result;
          +   }
          + 
          +   case ISD::SHL: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = SelectExpr(N.getOperand(1));
          +     BuildMI(BB, IA64::SHL, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +     return Result;
          +   }
          +   case ISD::SRL: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = SelectExpr(N.getOperand(1));
          +     BuildMI(BB, IA64::SHRU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +     return Result;
          +   }
          +   case ISD::SRA: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = SelectExpr(N.getOperand(1));
          +     BuildMI(BB, IA64::SHRS, 2, Result).addReg(Tmp1).addReg(Tmp2);
          +     return Result;
          +   }
          + 
          +   case ISD::SDIV:
          +   case ISD::UDIV:
          +   case ISD::SREM:
          +   case ISD::UREM: {
          + 
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = SelectExpr(N.getOperand(1));
          + 
          +     bool isFP=false;
          + 
          +     if(DestType == MVT::f64) // XXX: we're not gonna be fed MVT::f32, are we?
          +       isFP=true;
          + 
          +     bool isModulus=false; // is it a division or a modulus?
          +     bool isSigned=false;
          + 
          +     switch(N.getOpcode()) {
          +       case ISD::SDIV:  isModulus=false; isSigned=true;  break;
          +       case ISD::UDIV:  isModulus=false; isSigned=false; break;
          +       case ISD::SREM:  isModulus=true;  isSigned=true;  break;
          +       case ISD::UREM:  isModulus=true;  isSigned=false; break;
          +     }
          + 
          +     unsigned TmpPR=MakeReg(MVT::i1);  // we need a scratch predicate register,
          +     unsigned TmpF1=MakeReg(MVT::f64); // and one metric truckload of FP regs.
          +     unsigned TmpF2=MakeReg(MVT::f64); // lucky we have IA64?
          +     unsigned TmpF3=MakeReg(MVT::f64); // well, the real FIXME is to have
          +     unsigned TmpF4=MakeReg(MVT::f64); // isTwoAddress forms of these
          +     unsigned TmpF5=MakeReg(MVT::f64); // FP instructions so we can end up with
          +     unsigned TmpF6=MakeReg(MVT::f64); // stuff like setf.sig f10=f10 etc.
          +     unsigned TmpF7=MakeReg(MVT::f64);
          +     unsigned TmpF8=MakeReg(MVT::f64);
          +     unsigned TmpF9=MakeReg(MVT::f64);
          +     unsigned TmpF10=MakeReg(MVT::f64);
          +     unsigned TmpF11=MakeReg(MVT::f64);
          +     unsigned TmpF12=MakeReg(MVT::f64);
          +     unsigned TmpF13=MakeReg(MVT::f64);
          +     unsigned TmpF14=MakeReg(MVT::f64);
          +     unsigned TmpF15=MakeReg(MVT::f64);
          +   
          +     // OK, emit some code:
          + 
          +     if(!isFP) {
          +       // first, load the inputs into FP regs.
          +       BuildMI(BB, IA64::SETFSIG, 1, TmpF1).addReg(Tmp1);
          +       BuildMI(BB, IA64::SETFSIG, 1, TmpF2).addReg(Tmp2);
          +       
          +       // next, convert the inputs to FP
          +       if(isSigned) {
          + 	BuildMI(BB, IA64::FCVTXF, 1, TmpF3).addReg(TmpF1);
          + 	BuildMI(BB, IA64::FCVTXF, 1, TmpF4).addReg(TmpF2);
          +       } else {
          + 	BuildMI(BB, IA64::FCVTXUFS1, 1, TmpF3).addReg(TmpF1);
          + 	BuildMI(BB, IA64::FCVTXUFS1, 1, TmpF4).addReg(TmpF2);
          +       }
          +       
          +     } else { // this is an FP divide/remainder, so we 'leak' some temp
          +              // regs and assign TmpF3=Tmp1, TmpF4=Tmp2
          +       TmpF3=Tmp1;
          +       TmpF4=Tmp2;
          +     }
          + 
          +     // we start by computing an approximate reciprocal (good to 9 bits?)
          +     // note, this instruction writes _both_ TmpF5 (answer) and tmpPR (predicate)
          +     // FIXME: or at least, it should!!
          +     BuildMI(BB, IA64::FRCPAS1FLOAT, 2, TmpF5).addReg(TmpF3).addReg(TmpF4);
          +     BuildMI(BB, IA64::FRCPAS1PREDICATE, 2, TmpPR).addReg(TmpF3).addReg(TmpF4);
          + 
          +     // now we apply newton's method, thrice! (FIXME: this is ~72 bits of
          +     // precision, don't need this much for f32/i32)
          +     BuildMI(BB, IA64::CFNMAS1, 4, TmpF6)
          +       .addReg(TmpF4).addReg(TmpF5).addReg(IA64::F1).addReg(TmpPR);
          +     BuildMI(BB, IA64::CFMAS1,  4, TmpF7)
          +       .addReg(TmpF3).addReg(TmpF5).addReg(IA64::F0).addReg(TmpPR);
          +     BuildMI(BB, IA64::CFMAS1,  4, TmpF8)
          +       .addReg(TmpF6).addReg(TmpF6).addReg(IA64::F0).addReg(TmpPR);
          +     BuildMI(BB, IA64::CFMAS1,  4, TmpF9)
          +       .addReg(TmpF6).addReg(TmpF7).addReg(TmpF7).addReg(TmpPR);
          +     BuildMI(BB, IA64::CFMAS1,  4,TmpF10)
          +       .addReg(TmpF6).addReg(TmpF5).addReg(TmpF5).addReg(TmpPR);
          +     BuildMI(BB, IA64::CFMAS1,  4,TmpF11)
          +       .addReg(TmpF8).addReg(TmpF9).addReg(TmpF9).addReg(TmpPR);
          +     BuildMI(BB, IA64::CFMAS1,  4,TmpF12)
          +       .addReg(TmpF8).addReg(TmpF10).addReg(TmpF10).addReg(TmpPR);
          +     BuildMI(BB, IA64::CFNMAS1, 4,TmpF13)
          +       .addReg(TmpF4).addReg(TmpF11).addReg(TmpF3).addReg(TmpPR);
          +     BuildMI(BB, IA64::CFMAS1,  4,TmpF14)
          +       .addReg(TmpF13).addReg(TmpF12).addReg(TmpF11).addReg(TmpPR);
          + 
          +     if(!isFP) {
          +       // round to an integer
          +       if(isSigned)
          + 	BuildMI(BB, IA64::FCVTFXTRUNCS1, 1, TmpF15).addReg(TmpF14);
          +       else
          + 	BuildMI(BB, IA64::FCVTFXUTRUNCS1, 1, TmpF15).addReg(TmpF14);
          +     } else {
          +       BuildMI(BB, IA64::FMOV, 1, TmpF15).addReg(TmpF14);
          +      // EXERCISE: can you see why TmpF15=TmpF14 does not work here, and
          +      // we really do need the above FMOV? ;)
          +     }
          + 
          +     if(!isModulus) {
          +       if(isFP)
          + 	BuildMI(BB, IA64::FMOV, 1, Result).addReg(TmpF15);
          +       else
          + 	BuildMI(BB, IA64::GETFSIG, 1, Result).addReg(TmpF15);
          +     } else { // this is a modulus
          +       if(!isFP) {
          + 	// answer = q * (-b) + a
          + 	unsigned ModulusResult = MakeReg(MVT::f64);
          + 	unsigned TmpF = MakeReg(MVT::f64);
          + 	unsigned TmpI = MakeReg(MVT::i64);
          + 	BuildMI(BB, IA64::SUB, 2, TmpI).addReg(IA64::r0).addReg(Tmp2);
          + 	BuildMI(BB, IA64::SETFSIG, 1, TmpF).addReg(TmpI);
          + 	BuildMI(BB, IA64::XMAL, 3, ModulusResult)
          + 	  .addReg(TmpF15).addReg(TmpF).addReg(TmpF1);
          + 	BuildMI(BB, IA64::GETFSIG, 1, Result).addReg(ModulusResult);
          +       } else { // FP modulus! The horror... the horror....
          + 	assert(0 && "sorry, no FP modulus just yet!\n!\n");
          +       }
          +     }
          + 
          +     return Result;
          +   }
          + 
          +   case ISD::ZERO_EXTEND_INREG: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     MVTSDNode* MVN = dyn_cast(Node);
          +     switch(MVN->getExtraValueType())
          +     {
          +     default:
          +       Node->dump();
          +       assert(0 && "don't know how to zero extend this type");
          +       break;
          +     case MVT::i8: Opc = IA64::ZXT1; break;
          +     case MVT::i16: Opc = IA64::ZXT2; break;
          +     case MVT::i32: Opc = IA64::ZXT4; break;
          +     }
          +     BuildMI(BB, Opc, 1, Result).addReg(Tmp1);
          +     return Result;
          +   }
          +  
          +   case ISD::SIGN_EXTEND_INREG: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     MVTSDNode* MVN = dyn_cast(Node);
          +     switch(MVN->getExtraValueType())
          +     {
          +     default:
          +       Node->dump();
          +       assert(0 && "don't know how to sign extend this type");
          +       break;
          +     case MVT::i8: Opc = IA64::SXT1; break;
          +     case MVT::i16: Opc = IA64::SXT2; break;
          +     case MVT::i32: Opc = IA64::SXT4; break;
          +     }
          +     BuildMI(BB, Opc, 1, Result).addReg(Tmp1);
          +     return Result;
          +   }
          + 
          +   case ISD::SETCC: {
          +     Tmp1 = SelectExpr(N.getOperand(0));
          +     Tmp2 = SelectExpr(N.getOperand(1));
          +     if (SetCCSDNode *SetCC = dyn_cast(Node)) {
          +       if (MVT::isInteger(SetCC->getOperand(0).getValueType())) {
          + 	switch (SetCC->getCondition()) {
          + 	default: assert(0 && "Unknown integer comparison!");
          + 	case ISD::SETEQ:
          + 	  BuildMI(BB, IA64::CMPEQ, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETGT:
          + 	  BuildMI(BB, IA64::CMPGT, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETGE:
          + 	  BuildMI(BB, IA64::CMPGE, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETLT:
          + 	  BuildMI(BB, IA64::CMPLT, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETLE:
          + 	  BuildMI(BB, IA64::CMPLE, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETNE:
          + 	  BuildMI(BB, IA64::CMPNE, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETULT:
          + 	  BuildMI(BB, IA64::CMPLTU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETUGT:
          + 	  BuildMI(BB, IA64::CMPGTU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETULE:
          + 	  BuildMI(BB, IA64::CMPLEU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETUGE:
          + 	  BuildMI(BB, IA64::CMPGEU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	}
          +       }
          +       else { // if not integer, should be FP. FIXME: what about bools? ;)
          + 	assert(SetCC->getOperand(0).getValueType() != MVT::f32 &&
          + 	    "error: SETCC should have had incoming f32 promoted to f64!\n");
          + 	switch (SetCC->getCondition()) {
          + 	default: assert(0 && "Unknown FP comparison!");
          + 	case ISD::SETEQ:
          + 	  BuildMI(BB, IA64::FCMPEQ, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETGT:
          + 	  BuildMI(BB, IA64::FCMPGT, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETGE:
          + 	  BuildMI(BB, IA64::FCMPGE, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETLT:
          + 	  BuildMI(BB, IA64::FCMPLT, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETLE:
          + 	  BuildMI(BB, IA64::FCMPLE, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETNE:
          + 	  BuildMI(BB, IA64::FCMPNE, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETULT:
          + 	  BuildMI(BB, IA64::FCMPLTU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETUGT:
          + 	  BuildMI(BB, IA64::FCMPGTU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETULE:
          + 	  BuildMI(BB, IA64::FCMPLEU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	case ISD::SETUGE:
          + 	  BuildMI(BB, IA64::FCMPGEU, 2, Result).addReg(Tmp1).addReg(Tmp2);
          + 	  break;
          + 	}
          +       }
          +     }
          +     else
          +       assert(0 && "this setcc not implemented yet");
          + 
          +     return Result;
          +   }
          + 
          +   case ISD::EXTLOAD:
          +   case ISD::ZEXTLOAD:
          +   case ISD::LOAD: {
          +     // Make sure we generate both values.
          +     if (Result != 1)
          +       ExprMap[N.getValue(1)] = 1;   // Generate the token
          +     else
          +       Result = ExprMap[N.getValue(0)] = MakeReg(N.getValue(0).getValueType());
          + 
          +     bool isBool=false;
          +     
          +     if(opcode == ISD::LOAD) { // this is a LOAD
          +       switch (Node->getValueType(0)) {
          + 	default: assert(0 && "Cannot load this type!");
          + 	case MVT::i1:  Opc = IA64::LD1; isBool=true; break;
          + 	      // FIXME: for now, we treat bool loads the same as i8 loads */
          + 	case MVT::i8:  Opc = IA64::LD1; break;
          + 	case MVT::i16: Opc = IA64::LD2; break;
          + 	case MVT::i32: Opc = IA64::LD4; break;
          + 	case MVT::i64: Opc = IA64::LD8; break;
          + 		       
          + 	case MVT::f32: Opc = IA64::LDF4; break;
          + 	case MVT::f64: Opc = IA64::LDF8; break;
          +       }
          +     } else { // this is an EXTLOAD or ZEXTLOAD
          +       MVT::ValueType TypeBeingLoaded = cast(Node)->getExtraValueType();
          +       switch (TypeBeingLoaded) {
          + 	default: assert(0 && "Cannot extload/zextload this type!");
          + 	// FIXME: bools?
          + 	case MVT::i8: Opc = IA64::LD1; break;
          + 	case MVT::i16: Opc = IA64::LD2; break;
          + 	case MVT::i32: Opc = IA64::LD4; break;
          + 	case MVT::f32: Opc = IA64::LDF4; break;
          +       }
          +     }
          +     
          +     SDOperand Chain = N.getOperand(0);
          +     SDOperand Address = N.getOperand(1);
          + 
          +     if(Address.getOpcode() == ISD::GlobalAddress) {
          +       Select(Chain);
          +       unsigned dummy = MakeReg(MVT::i64);
          +       unsigned dummy2 = MakeReg(MVT::i64);
          +       BuildMI(BB, IA64::ADD, 2, dummy)
          + 	.addGlobalAddress(cast(Address)->getGlobal())
          + 	.addReg(IA64::r1);
          +       BuildMI(BB, IA64::LD8, 1, dummy2).addReg(dummy);
          +       if(!isBool)
          + 	BuildMI(BB, Opc, 1, Result).addReg(dummy2);
          +       else { // emit a little pseudocode to load a bool (stored in one byte)
          + 	     // into a predicate register
          + 	assert(Opc==IA64::LD1 && "problem loading a bool");
          + 	unsigned dummy3 = MakeReg(MVT::i64);
          + 	BuildMI(BB, Opc, 1, dummy3).addReg(dummy2);
          + 	// we compare to 0. true? 0. false? 1.
          + 	BuildMI(BB, IA64::CMPNE, 2, Result).addReg(dummy3).addReg(IA64::r0);
          +       }
          +     } else if(ConstantPoolSDNode *CP = dyn_cast(Address)) {
          +       Select(Chain);
          +       IA64Lowering.restoreGP(BB);
          +       unsigned dummy = MakeReg(MVT::i64);
          +       BuildMI(BB, IA64::ADD, 2, dummy).addConstantPoolIndex(CP->getIndex())
          + 	.addReg(IA64::r1); // CPI+GP
          +       if(!isBool)
          + 	BuildMI(BB, Opc, 1, Result).addReg(dummy);
          +       else { // emit a little pseudocode to load a bool (stored in one byte)
          + 	     // into a predicate register
          + 	assert(Opc==IA64::LD1 && "problem loading a bool");
          + 	unsigned dummy3 = MakeReg(MVT::i64);
          + 	BuildMI(BB, Opc, 1, dummy3).addReg(dummy);
          + 	// we compare to 0. true? 0. false? 1.
          + 	BuildMI(BB, IA64::CMPNE, 2, Result).addReg(dummy3).addReg(IA64::r0);
          +       }
          +     } else if(Address.getOpcode() == ISD::FrameIndex) {
          +       Select(Chain);  // FIXME ? what about bools?
          +       unsigned dummy = MakeReg(MVT::i64);
          +       BuildMI(BB, IA64::MOV, 1, dummy)
          + 	.addFrameIndex(cast(Address)->getIndex());
          +       if(!isBool)
          + 	BuildMI(BB, Opc, 1, Result).addReg(dummy);
          +       else { // emit a little pseudocode to load a bool (stored in one byte)
          + 	     // into a predicate register
          + 	assert(Opc==IA64::LD1 && "problem loading a bool");
          + 	unsigned dummy3 = MakeReg(MVT::i64);
          + 	BuildMI(BB, Opc, 1, dummy3).addReg(dummy);
          + 	// we compare to 0. true? 0. false? 1.
          + 	BuildMI(BB, IA64::CMPNE, 2, Result).addReg(dummy3).addReg(IA64::r0);
          +       }
          +     } else { // none of the above... 
          +       Select(Chain);
          +       Tmp2 = SelectExpr(Address);
          +       if(!isBool)
          + 	BuildMI(BB, Opc, 1, Result).addReg(Tmp2);
          +       else { // emit a little pseudocode to load a bool (stored in one byte)
          + 	     // into a predicate register
          + 	assert(Opc==IA64::LD1 && "problem loading a bool");
          + 	unsigned dummy = MakeReg(MVT::i64);
          + 	BuildMI(BB, Opc, 1, dummy).addReg(Tmp2);
          + 	// we compare to 0. true? 0. false? 1.
          + 	BuildMI(BB, IA64::CMPNE, 2, Result).addReg(dummy).addReg(IA64::r0);
          +       }	
          +     }
          + 
          +     return Result;
          +   }
          +   
          +   case ISD::CopyFromReg: {
          +     if (Result == 1)
          +         Result = ExprMap[N.getValue(0)] = 
          + 	  MakeReg(N.getValue(0).getValueType());
          +                                                                                 
          +       SDOperand Chain   = N.getOperand(0);
          + 
          +       Select(Chain);
          +       unsigned r = dyn_cast(Node)->getReg();
          + 
          +       if(N.getValueType() == MVT::i1) // if a bool, we use pseudocode
          + 	BuildMI(BB, IA64::PCMPEQUNC, 3, Result)
          + 	  .addReg(IA64::r0).addReg(IA64::r0).addReg(r);
          +                             // (r) Result =cmp.eq.unc(r0,r0)
          +       else
          + 	BuildMI(BB, IA64::MOV, 1, Result).addReg(r); // otherwise MOV
          +       return Result;
          +   }
          + 
          +   case ISD::CALL: {
          +       Select(N.getOperand(0));
          + 
          +       // The chain for this call is now lowered.
          +       ExprMap.insert(std::make_pair(N.getValue(Node->getNumValues()-1), 1));
          +       
          +       //grab the arguments
          +       std::vector argvregs;
          + 
          +       for(int i = 2, e = Node->getNumOperands(); i < e; ++i)
          + 	argvregs.push_back(SelectExpr(N.getOperand(i)));
          +       
          +       // see section 8.5.8 of "Itanium Software Conventions and 
          +       // Runtime Architecture Guide to see some examples of what's going
          +       // on here. (in short: int args get mapped 1:1 'slot-wise' to out0->out7,
          +       // while FP args get mapped to F8->F15 as needed)
          + 
          +       unsigned used_FPArgs=0; // how many FP Args have been used so far?
          +       
          +       // in reg args
          +       for(int i = 0, e = std::min(8, (int)argvregs.size()); i < e; ++i)
          +       {
          + 	unsigned intArgs[] = {IA64::out0, IA64::out1, IA64::out2, IA64::out3, 
          + 			      IA64::out4, IA64::out5, IA64::out6, IA64::out7 };
          + 	unsigned FPArgs[] = {IA64::F8, IA64::F9, IA64::F10, IA64::F11,
          + 	                     IA64::F12, IA64::F13, IA64::F14, IA64::F15 };
          + 
          + 	switch(N.getOperand(i+2).getValueType())
          + 	{
          + 	  default:  // XXX do we need to support MVT::i1 here?
          + 	    Node->dump();
          + 	    N.getOperand(i).Val->dump();
          + 	    std::cerr << "Type for " << i << " is: " << 
          + 	      N.getOperand(i+2).getValueType() << std::endl;
          + 	    assert(0 && "Unknown value type for call");
          + 	  case MVT::i64:
          + 	    BuildMI(BB, IA64::MOV, 1, intArgs[i]).addReg(argvregs[i]);
          + 	    break;
          + 	  case MVT::f64:
          + 	    BuildMI(BB, IA64::FMOV, 1, FPArgs[used_FPArgs++])
          + 	      .addReg(argvregs[i]);
          + 	    BuildMI(BB, IA64::GETFD, 1, intArgs[i]).addReg(argvregs[i]);
          + 	    break;
          + 	  }
          +       }
          + 
          +       //in mem args
          +       for (int i = 8, e = argvregs.size(); i < e; ++i)
          +       {
          + 	unsigned tempAddr = MakeReg(MVT::i64);
          + 	
          +         switch(N.getOperand(i+2).getValueType()) {
          +         default: 
          +           Node->dump(); 
          +           N.getOperand(i).Val->dump();
          +           std::cerr << "Type for " << i << " is: " << 
          +             N.getOperand(i+2).getValueType() << "\n";
          +           assert(0 && "Unknown value type for call");
          +         case MVT::i1: // FIXME?
          +         case MVT::i8:
          +         case MVT::i16:
          +         case MVT::i32:
          +         case MVT::i64:
          + 	  BuildMI(BB, IA64::ADDIMM22, 2, tempAddr)
          + 	    .addReg(IA64::r12).addImm(16 + (i - 8) * 8); // r12 is SP
          + 	  BuildMI(BB, IA64::ST8, 2).addReg(tempAddr).addReg(argvregs[i]);
          +           break;
          +         case MVT::f32:
          +         case MVT::f64:
          +           BuildMI(BB, IA64::ADDIMM22, 2, tempAddr)
          + 	    .addReg(IA64::r12).addImm(16 + (i - 8) * 8); // r12 is SP
          + 	  BuildMI(BB, IA64::STF8, 2).addReg(tempAddr).addReg(argvregs[i]);
          +           break;
          +         }
          +       }
          +     //build the right kind of call
          +     if (GlobalAddressSDNode *GASD =
          +                dyn_cast(N.getOperand(1))) 
          +       {
          + 	BuildMI(BB, IA64::BRCALL, 1).addGlobalAddress(GASD->getGlobal(),true);
          + 	IA64Lowering.restoreGP_SP_RP(BB);
          +       }
          + 
          +     else if (ExternalSymbolSDNode *ESSDN =
          + 	     dyn_cast(N.getOperand(1))) 
          +       {
          + 	BuildMI(BB, IA64::BRCALL, 0)
          + 	  .addExternalSymbol(ESSDN->getSymbol(), true);
          + 	IA64Lowering.restoreGP_SP_RP(BB);
          +       }
          +     else {
          +       // no need to restore GP as we are doing an indirect call
          +       Tmp1 = SelectExpr(N.getOperand(1));
          +       // b6 is a scratch branch register, we load the target:
          +       BuildMI(BB, IA64::MOV, 1, IA64::B6).addReg(Tmp1);
          +       // and then jump: (well, call)
          +       BuildMI(BB, IA64::BRCALL, 1).addReg(IA64::B6);
          +       IA64Lowering.restoreGP_SP_RP(BB);
          +   }
          + 
          +     switch (Node->getValueType(0)) {
          +     default: assert(0 && "Unknown value type for call result!");
          +     case MVT::Other: return 1;
          +     case MVT::i1:
          +       BuildMI(BB, IA64::CMPNE, 2, Result)
          + 	.addReg(IA64::r8).addReg(IA64::r0);
          +       break;
          +     case MVT::i8:
          +     case MVT::i16:
          +     case MVT::i32:
          +     case MVT::i64:
          +       BuildMI(BB, IA64::MOV, 1, Result).addReg(IA64::r8);
          +       break;
          +     case MVT::f64:
          +       BuildMI(BB, IA64::FMOV, 1, Result).addReg(IA64::F8);
          +       break;
          +     }
          +     return Result+N.ResNo;
          +   }
          + 
          +   } // <- uhhh XXX 
          +   return 0;
          + }
          + 
          + void ISel::Select(SDOperand N) {
          +   unsigned Tmp1, Tmp2, Opc;
          +   unsigned opcode = N.getOpcode();
          + 
          +   // FIXME: Disable for our current expansion model!
          +   if (/*!N->hasOneUse() &&*/ !LoweredTokens.insert(N).second)
          +     return;  // Already selected.
          + 
          +   SDNode *Node = N.Val;
          + 
          +   switch (Node->getOpcode()) {
          +   default:
          +     Node->dump(); std::cerr << "\n";
          +     assert(0 && "Node not handled yet!");
          + 
          +   case ISD::EntryToken: return;  // Noop
          +   
          +   case ISD::TokenFactor: {
          +     for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i)
          +       Select(Node->getOperand(i));
          +     return;
          +   }
          + 
          +   case ISD::CopyToReg: {
          +     Select(N.getOperand(0));
          +     Tmp1 = SelectExpr(N.getOperand(1));   
          +     Tmp2 = cast(N)->getReg();
          +     
          +     if (Tmp1 != Tmp2) {
          +       if(N.getValueType() == MVT::i1) // if a bool, we use pseudocode
          + 	BuildMI(BB, IA64::PCMPEQUNC, 3, Tmp2)
          + 	  .addReg(IA64::r0).addReg(IA64::r0).addReg(Tmp1);
          +                                    // (Tmp1) Tmp2 = cmp.eq.unc(r0,r0)
          +       else
          + 	BuildMI(BB, IA64::MOV, 1, Tmp2).addReg(Tmp1);
          +                       // XXX is this the right way 'round? ;)
          +     }
          +     return;
          +   }
          +   
          +   case ISD::RET: {
          + 
          +   /* what the heck is going on here:
          + 
          + <_sabre_> ret with two operands is obvious: chain and value
          +  yep
          + <_sabre_> ret with 3 values happens when 'expansion' occurs
          + <_sabre_> e.g. i64 gets split into 2x i32
          +  oh right
          + <_sabre_> you don't have this case on ia64
          +  yep
          + <_sabre_> so the two returned values go into EAX/EDX on ia32
          +  ahhh *memories*
          + <_sabre_> :)
          +  ok, thanks :)
          + <_sabre_> so yeah, everything that has a side effect takes a 'token chain'
          + <_sabre_> this is the first operand always
          + <_sabre_> these operand often define chains, they are the last operand
          + <_sabre_> they are printed as 'ch' if you do DAG.dump()
          +   */
          +   
          +     switch (N.getNumOperands()) {
          +     default:
          +       assert(0 && "Unknown return instruction!");
          +     case 2:
          +         Select(N.getOperand(0));
          +         Tmp1 = SelectExpr(N.getOperand(1));
          +       switch (N.getOperand(1).getValueType()) {
          +       default: assert(0 && "All other types should have been promoted!!");
          + 	       // FIXME: do I need to add support for bools here?
          + 	       // (return '0' or '1' r8, basically...)
          +       case MVT::i64:
          + 	BuildMI(BB, IA64::MOV, 1, IA64::r8).addReg(Tmp1);
          + 	break;
          +       case MVT::f64:
          + 	BuildMI(BB, IA64::FMOV, 1, IA64::F8).addReg(Tmp1);
          +       }
          +       break;
          +     case 1:
          +       Select(N.getOperand(0));
          +       break;
          +     }
          +     // before returning, restore the ar.pfs register (set by the 'alloc' up top)
          +     BuildMI(BB, IA64::MOV, 1).addReg(IA64::AR_PFS).addReg(IA64Lowering.VirtGPR);
          +     BuildMI(BB, IA64::RET, 0); // and then just emit a 'ret' instruction
          +     return;
          +   }
          +   
          +   case ISD::BR: {
          +     Select(N.getOperand(0));
          +     MachineBasicBlock *Dest =
          +       cast(N.getOperand(1))->getBasicBlock();
          +     BuildMI(BB, IA64::BRLCOND_NOTCALL, 1).addReg(IA64::p0).addMBB(Dest);
          +     // XXX HACK! we do _not_ need long branches all the time
          +     return;
          +   }
          + 
          +   case ISD::ImplicitDef: {
          +     Select(N.getOperand(0));
          +     BuildMI(BB, IA64::IDEF, 0, cast(N)->getReg());
          +     return;
          +   }
          + 
          +   case ISD::BRCOND: {
          +     MachineBasicBlock *Dest =
          +       cast(N.getOperand(2))->getBasicBlock();
          + 
          +     Select(N.getOperand(0));
          +     Tmp1 = SelectExpr(N.getOperand(1));
          +     BuildMI(BB, IA64::BRLCOND_NOTCALL, 1).addReg(Tmp1).addMBB(Dest);
          +     // XXX HACK! we do _not_ need long branches all the time
          +     return;
          +   }
          +   
          +   case ISD::EXTLOAD:
          +   case ISD::ZEXTLOAD:
          +   case ISD::SEXTLOAD:
          +   case ISD::LOAD:
          +   case ISD::CALL:
          +   case ISD::CopyFromReg:
          +   case ISD::DYNAMIC_STACKALLOC:
          +     SelectExpr(N);
          +     return;
          + 
          +   case ISD::TRUNCSTORE:
          +   case ISD::STORE: {
          +       Select(N.getOperand(0));
          +       Tmp1 = SelectExpr(N.getOperand(1)); // value
          + 
          +       bool isBool=false;
          +      
          +       if(opcode == ISD::STORE) {
          + 	switch (N.getOperand(1).getValueType()) {
          + 	  default: assert(0 && "Cannot store this type!");
          + 	  case MVT::i1:  Opc = IA64::ST1; isBool=true; break;
          + 	      // FIXME?: for now, we treat bool loads the same as i8 stores */
          + 	  case MVT::i8:  Opc = IA64::ST1; break;
          + 	  case MVT::i16: Opc = IA64::ST2; break;
          + 	  case MVT::i32: Opc = IA64::ST4; break;
          + 	  case MVT::i64: Opc = IA64::ST8; break;
          + 			 
          + 	  case MVT::f32: Opc = IA64::STF4; break;
          + 	  case MVT::f64: Opc = IA64::STF8; break;
          + 	}
          +       } else { // truncstore
          + 	switch(cast(Node)->getExtraValueType()) {
          + 	  default: assert(0 && "unknown type in truncstore");
          + 	  case MVT::i1: Opc = IA64::ST1; isBool=true; break;
          + 			//FIXME: DAG does not promote this load?
          + 	  case MVT::i8: Opc = IA64::ST1; break;
          + 	  case MVT::i16: Opc = IA64::ST2; break;
          + 	  case MVT::i32: Opc = IA64::ST4; break;
          + 	  case MVT::f32: Opc = IA64::STF4; break; 
          + 	}
          +       }
          + 
          +       if(N.getOperand(2).getOpcode() == ISD::GlobalAddress) {
          + 	unsigned dummy = MakeReg(MVT::i64);
          + 	unsigned dummy2 = MakeReg(MVT::i64);
          + 	BuildMI(BB, IA64::ADD, 2, dummy)
          + 	  .addGlobalAddress(cast
          + 	      (N.getOperand(2))->getGlobal()).addReg(IA64::r1);
          + 	BuildMI(BB, IA64::LD8, 1, dummy2).addReg(dummy);
          +       
          + 	if(!isBool)
          + 	  BuildMI(BB, Opc, 2).addReg(dummy2).addReg(Tmp1);
          + 	else { // we are storing a bool, so emit a little pseudocode
          + 	       // to store a predicate register as one byte
          + 	  assert(Opc==IA64::ST1);
          + 	  unsigned dummy3 = MakeReg(MVT::i64);
          + 	  unsigned dummy4 = MakeReg(MVT::i64);
          + 	  BuildMI(BB, IA64::MOV, 1, dummy3).addReg(IA64::r0);
          + 	  BuildMI(BB, IA64::CADDIMM22, 3, dummy4)
          + 	    .addReg(dummy3).addImm(1).addReg(Tmp1); // if(Tmp1) dummy=0+1;
          + 	  BuildMI(BB, Opc, 2).addReg(dummy2).addReg(dummy4);
          + 	}
          +       } else if(N.getOperand(2).getOpcode() == ISD::FrameIndex) {
          + 
          + 	// FIXME? (what about bools?)
          + 	
          + 	unsigned dummy = MakeReg(MVT::i64);
          + 	BuildMI(BB, IA64::MOV, 1, dummy)
          + 	  .addFrameIndex(cast(N.getOperand(2))->getIndex());
          + 	BuildMI(BB, Opc, 2).addReg(dummy).addReg(Tmp1);
          +       } else { // otherwise
          + 	Tmp2 = SelectExpr(N.getOperand(2)); //address
          + 	if(!isBool) 
          + 	  BuildMI(BB, Opc, 2).addReg(Tmp2).addReg(Tmp1);
          + 	else { // we are storing a bool, so emit a little pseudocode
          + 	       // to store a predicate register as one byte
          + 	  assert(Opc==IA64::ST1);
          + 	  unsigned dummy3 = MakeReg(MVT::i64);
          + 	  unsigned dummy4 = MakeReg(MVT::i64);
          + 	  BuildMI(BB, IA64::MOV, 1, dummy3).addReg(IA64::r0);
          + 	  BuildMI(BB, IA64::CADDIMM22, 3, dummy4)
          + 	    .addReg(dummy3).addImm(1).addReg(Tmp1); // if(Tmp1) dummy=0+1;
          + 	  BuildMI(BB, Opc, 2).addReg(Tmp2).addReg(dummy4);
          + 	}
          +       }
          +     return;
          +   }
          +   
          +   case ISD::ADJCALLSTACKDOWN:
          +   case ISD::ADJCALLSTACKUP: {
          +     Select(N.getOperand(0));
          +     Tmp1 = cast(N.getOperand(1))->getValue();
          +    
          +     Opc = N.getOpcode() == ISD::ADJCALLSTACKDOWN ? IA64::ADJUSTCALLSTACKDOWN :
          +                                                    IA64::ADJUSTCALLSTACKUP;
          +     BuildMI(BB, Opc, 1).addImm(Tmp1);
          +     return;
          +   }
          + 
          +     return;
          +   }
          +   assert(0 && "GAME OVER. INSERT COIN?");
          + }
          + 
          + 
          + /// createIA64PatternInstructionSelector - This pass converts an LLVM function
          + /// into a machine code representation using pattern matching and a machine
          + /// description file.
          + ///
          + FunctionPass *llvm::createIA64PatternInstructionSelector(TargetMachine &TM) {
          +   return new ISel(TM);  
          + }
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64InstrBuilder.h
          diff -c /dev/null llvm/lib/Target/IA64/IA64InstrBuilder.h:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64InstrBuilder.h	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,52 ----
          + //===-- IA64PCInstrBuilder.h - Aids for building IA64 insts -----*- C++ -*-===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file exposes functions that may be used with BuildMI from the
          + // MachineInstrBuilder.h file to simplify generating frame and constant pool
          + // references.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #ifndef IA64_INSTRBUILDER_H
          + #define IA64_INSTRBUILDER_H
          + 
          + #include "llvm/CodeGen/MachineInstrBuilder.h"
          + 
          + namespace llvm {
          + 
          + /// addFrameReference - This function is used to add a reference to the base of
          + /// an abstract object on the stack frame of the current function.  This
          + /// reference has base register as the FrameIndex offset until it is resolved.
          + /// This allows a constant offset to be specified as well...
          + ///
          + inline const MachineInstrBuilder&
          + addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0, 
          +                   bool mem = true) {
          +   if (mem)
          +     return MIB.addSImm(Offset).addFrameIndex(FI);
          +   else
          +     return MIB.addFrameIndex(FI).addSImm(Offset);
          + }
          + 
          + /// addConstantPoolReference - This function is used to add a reference to the
          + /// base of a constant value spilled to the per-function constant pool.  The
          + /// reference has base register ConstantPoolIndex offset which is retained until
          + /// either machine code emission or assembly output.  This allows an optional
          + /// offset to be added as well.
          + ///
          + inline const MachineInstrBuilder&
          + addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
          +                          int Offset = 0) {
          +   return MIB.addSImm(Offset).addConstantPoolIndex(CPI);
          + }
          + 
          + } // End llvm namespace
          + 
          + #endif
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64InstrFormats.td
          diff -c /dev/null llvm/lib/Target/IA64/IA64InstrFormats.td:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64InstrFormats.td	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,67 ----
          + //===- IA64InstrFormats.td - IA64 Instruction Formats --*- tablegen -*-=//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + //  - Warning: the stuff in here isn't really being used, so is mostly
          + //             junk. It'll get fixed as the JIT gets built.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + //===----------------------------------------------------------------------===//
          + // Instruction format superclass
          + //===----------------------------------------------------------------------===//
          + 
          + class InstIA64 op, dag OL, string asmstr> : Instruction { 
          +   // IA64 instruction baseline
          +   field bits<41> Inst;
          +   let Namespace = "IA64";
          +   let OperandList = OL;
          +   let AsmString = asmstr;
          + 
          +   let Inst{40-37} = op;
          + }
          + 
          + //"Each Itanium instruction is categorized into one of six types."
          + //We should have:
          + // A, I, M, F, B, L+X
          + 
          + class AForm opcode, bits<6> qpReg, dag OL, string asmstr> : 
          +   InstIA64 {
          + 
          +   let Inst{5-0} = qpReg;
          + }
          + 
          + let isBranch = 1, isTerminator = 1 in
          + class BForm opcode, bits<6> x6, bits<3> btype, dag OL, string asmstr> :
          +   InstIA64 {
          + 
          +   let Inst{32-27} = x6;
          +   let Inst{8-6} = btype;
          + }
          + 
          + class MForm opcode, bits<6> x6, dag OL, string asmstr> :
          +   InstIA64 {
          +     bits<7> Ra;
          +     bits<7> Rb;
          +     bits<16> disp;
          + 
          +     let Inst{35-30} = x6;
          + //  let Inst{20-16} = Rb;
          +     let Inst{15-0} = disp;
          + }
          + 
          + class RawForm opcode, bits<26> rest, dag OL, string asmstr> :
          +   InstIA64 {
          +     let Inst{25-0} = rest;
          + }
          + 
          + // Pseudo instructions.
          + class PseudoInstIA64 : InstIA64<0, OL, nm>  {
          + }
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64InstrInfo.cpp
          diff -c /dev/null llvm/lib/Target/IA64/IA64InstrInfo.cpp:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64InstrInfo.cpp	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,47 ----
          + //===- IA64InstrInfo.cpp - IA64 Instruction Information -----------*- C++ -*-===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by the LLVM research group and is distributed under
          + // the University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file contains the IA64 implementation of the TargetInstrInfo class.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #include "IA64InstrInfo.h"
          + #include "IA64.h"
          + #include "IA64InstrBuilder.h"
          + #include "llvm/CodeGen/MachineInstrBuilder.h"
          + #include "IA64GenInstrInfo.inc"
          + using namespace llvm;
          + 
          + IA64InstrInfo::IA64InstrInfo()
          +   : TargetInstrInfo(IA64Insts, sizeof(IA64Insts)/sizeof(IA64Insts[0])) {
          + }
          + 
          + 
          + bool IA64InstrInfo::isMoveInstr(const MachineInstr& MI,
          +                                unsigned& sourceReg,
          +                                unsigned& destReg) const {
          +   MachineOpCode oc = MI.getOpcode();
          +   if (oc == IA64::MOV || oc == IA64::FMOV) {
          +      assert(MI.getNumOperands() == 2 &&
          +              /* MI.getOperand(0).isRegister() &&
          +              MI.getOperand(1).isRegister() && */
          +              "invalid register-register move instruction");
          +      if( MI.getOperand(0).isRegister() &&
          + 	 MI.getOperand(1).isRegister() ) {
          +        // if both operands of the MOV/FMOV are registers, then
          +        // yes, this is a move instruction
          +        sourceReg = MI.getOperand(1).getReg();
          +        destReg = MI.getOperand(0).getReg();
          +        return true;
          +      }
          +   }
          +   return false; // we don't consider e.g. %regN = MOV  a
          +                 // move instruction
          + }
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64InstrInfo.h
          diff -c /dev/null llvm/lib/Target/IA64/IA64InstrInfo.h:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64InstrInfo.h	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,50 ----
          + //===- IA64InstrInfo.h - IA64 Instruction Information ----------*- C++ -*- ===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file contains the IA64 implementation of the TargetInstrInfo class.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #ifndef IA64INSTRUCTIONINFO_H
          + #define IA64INSTRUCTIONINFO_H
          + 
          + #include "llvm/Target/TargetInstrInfo.h"
          + #include "IA64RegisterInfo.h"
          + 
          + namespace llvm {
          + 
          + /// IA64II - This namespace holds all of the target specific flags that
          + /// instruction info tracks.
          + /// FIXME: now gone!
          + 
          +   class IA64InstrInfo : public TargetInstrInfo {
          +   const IA64RegisterInfo RI;
          + public:
          +   IA64InstrInfo();
          + 
          +   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
          +   /// such, whenever a client has an instance of instruction info, it should
          +   /// always be able to get register info as well (through this method).
          +   ///
          +   virtual const MRegisterInfo &getRegisterInfo() const { return RI; }
          + 
          +   //
          +   // Return true if the instruction is a register to register move and
          +   // leave the source and dest operands in the passed parameters.
          +   //
          +   virtual bool isMoveInstr(const MachineInstr& MI,
          +                            unsigned& sourceReg,
          +                            unsigned& destReg) const;
          + 
          + };
          + 
          + } // End llvm namespace
          + 
          + #endif
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64InstrInfo.td
          diff -c /dev/null llvm/lib/Target/IA64/IA64InstrInfo.td:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64InstrInfo.td	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,319 ----
          + //===- IA64InstrInfo.td - Describe the IA64 Instruction Set -----*- C++ -*-===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file describes the IA64 instruction set, defining the instructions, and
          + // properties of the instructions which are needed for code generation, machine
          + // code emission, and analysis.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + include "IA64InstrFormats.td"
          + 
          + def u6imm : Operand;
          + def s16imm  : Operand;
          + def s21imm  : Operand {
          +   let PrintMethod = "printS21ImmOperand";
          + }
          + def u32imm  : Operand {
          +   let PrintMethod = "printU32ImmOperand";
          + }
          + def s32imm  : Operand {
          +   let PrintMethod = "printS32ImmOperand";
          + }
          + def u64imm  : Operand {
          +   let PrintMethod = "printU64ImmOperand";
          + }
          + 
          + // the asmprinter needs to know about calls
          + let PrintMethod = "printCallOperand" in
          +   def calltarget : Operand;
          +   
          + def PHI : PseudoInstIA64<(ops), "PHI">;
          + def IDEF : PseudoInstIA64<(ops), "// IDEF">;
          + def WTF : PseudoInstIA64<(ops), "que??">;
          + def ADJUSTCALLSTACKUP : PseudoInstIA64<(ops), "// ADJUSTCALLSTACKUP">;
          + def ADJUSTCALLSTACKDOWN : PseudoInstIA64<(ops), "// ADJUSTCALLSTACKDOWN">;
          + def PSEUDO_ALLOC : PseudoInstIA64<(ops), "// PSEUDO_ALLOC">;
          + 
          + def ALLOC : AForm<0x03, 0x0b,
          +   (ops GR:$dst, i8imm:$inputs, i8imm:$locals, i8imm:$outputs, i8imm:$rotating),
          +     "alloc $dst = ar.pfs,$inputs,$locals,$outputs,$rotating;;">;
          + 
          + def MOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "mov $dst = $src;;">;
          + def PMOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src, PR:$qp),
          +   "($qp) mov $dst = $src;;">;
          + 
          + def SPILL_ALL_PREDICATES_TO_GR : AForm<0x03, 0x0b, (ops GR:$dst),
          +   "mov $dst = pr;;">;
          + def FILL_ALL_PREDICATES_FROM_GR : AForm<0x03, 0x0b, (ops GR:$src),
          +   "mov pr = $src;;">;
          + 
          + let isTwoAddress = 1 in {
          +   def CMOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src2, GR:$src, PR:$qp),
          +     "($qp) mov $dst = $src;;">;
          + }
          + 
          + let isTwoAddress = 1 in {
          +   def TCMPNE : AForm<0x03, 0x0b,
          +   (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4),
          +     "cmp.ne $dst, p0 = $src3, $src4;;">;
          +   
          +   def TPCMPEQOR : AForm<0x03, 0x0b,
          +   (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
          +     "($qp) cmp.eq.or $dst, p0 = $src3, $src4;;">;
          +   
          +   def TPCMPNE : AForm<0x03, 0x0b,
          +   (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
          +     "($qp) cmp.ne $dst, p0 = $src3, $src4;;">;
          +   
          +   def TPCMPEQ : AForm<0x03, 0x0b,
          +   (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
          +     "($qp) cmp.eq $dst, p0 = $src3, $src4;;">;
          + }
          + 
          + def MOVI32 : AForm<0x03, 0x0b, (ops GR:$dst, u32imm:$imm),
          +   "mov $dst = $imm;;">;
          + def MOVLI32 : AForm<0x03, 0x0b, (ops GR:$dst, u32imm:$imm),
          +   "movl $dst = $imm;;">;
          + def MOVLSI32 : AForm<0x03, 0x0b, (ops GR:$dst, s32imm:$imm),
          +   "movl $dst = $imm;;">;
          + def MOVLI64 : AForm<0x03, 0x0b, (ops GR:$dst, u64imm:$imm),
          +   "movl $dst = $imm;;">;
          + 
          + def AND : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
          +   "and $dst = $src1, $src2;;">;
          + def OR : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
          +   "or $dst = $src1, $src2;;">;
          + def XOR : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
          +   "xor $dst = $src1, $src2;;">;
          + def SHL : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
          +   "shl $dst = $src1, $src2;;">;
          + def SHLI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s21imm:$imm), 
          +   "shl $dst = $src1, $imm;;">; // FIXME: 6 immediate bits, not 21
          + def SHRU : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
          +   "shr.u $dst = $src1, $src2;;">;
          + def SHRS : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
          +   "shr $dst = $src1, $src2;;">;
          + 
          + def DEPZ : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm1, u6imm:$imm2),	  "dep.z $dst = $src1, $imm1, $imm2;;">;
          + 
          + def SXT1 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt1 $dst = $src;;">;
          + def ZXT1 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt1 $dst = $src;;">;
          + def SXT2 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt2 $dst = $src;;">;
          + def ZXT2 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt2 $dst = $src;;">;
          + def SXT4 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt4 $dst = $src;;">;
          + def ZXT4 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt4 $dst = $src;;">;
          + 
          + // the following are all a bit unfortunate: we throw away the complement
          + // of the compare!
          + def CMPEQ : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.eq $dst, p0 = $src1, $src2;;">;
          + def CMPGT : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.gt $dst, p0 = $src1, $src2;;">;
          + def CMPGE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.ge $dst, p0 = $src1, $src2;;">;
          + def CMPLT : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.lt $dst, p0 = $src1, $src2;;">;
          + def CMPLE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.le $dst, p0 = $src1, $src2;;">;
          + def CMPNE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.ne $dst, p0 = $src1, $src2;;">;
          + def CMPLTU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.ltu $dst, p0 = $src1, $src2;;">;
          + def CMPGTU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.gtu $dst, p0 = $src1, $src2;;">;
          + def CMPLEU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.leu $dst, p0 = $src1, $src2;;">;
          + def CMPGEU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
          +   "cmp.geu $dst, p0 = $src1, $src2;;">;
          + 
          + // and we do the whole thing again for FP compares!
          + def FCMPEQ : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.eq $dst, p0 = $src1, $src2;;">;
          + def FCMPGT : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.gt $dst, p0 = $src1, $src2;;">;
          + def FCMPGE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.ge $dst, p0 = $src1, $src2;;">;
          + def FCMPLT : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.lt $dst, p0 = $src1, $src2;;">;
          + def FCMPLE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.le $dst, p0 = $src1, $src2;;">;
          + def FCMPNE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.neq $dst, p0 = $src1, $src2;;">;
          + def FCMPLTU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.ltu $dst, p0 = $src1, $src2;;">;
          + def FCMPGTU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.gtu $dst, p0 = $src1, $src2;;">;
          + def FCMPLEU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.leu $dst, p0 = $src1, $src2;;">;
          + def FCMPGEU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "fcmp.geu $dst, p0 = $src1, $src2;;">;
          + 
          + def PCMPEQOR : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
          +   "($qp) cmp.eq.or $dst, p0 = $src1, $src2;;">;
          + def PCMPEQUNC : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
          +   "($qp) cmp.eq.unc $dst, p0 = $src1, $src2;;">;
          + def PCMPNE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
          +   "($qp) cmp.ne $dst, p0 = $src1, $src2;;">;
          + 
          + // two destinations! 
          + def BCMPEQ : AForm<0x03, 0x0b, (ops PR:$dst1, PR:$dst2, GR:$src1, GR:$src2),
          +   "cmp.eq $dst1, dst2 = $src1, $src2;;">;
          + 
          + def ADD : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
          +   "add $dst = $src1, $src2;;">;
          + 
          + def ADDIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s21imm:$imm),
          +   "add $dst = $imm, $src1;;">;
          + def CADDIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s21imm:$imm, PR:$qp),
          +   "($qp) add $dst = $imm, $src1;;">;
          + 
          + let isTwoAddress = 1 in {
          + def TPCADDIMM22 : AForm<0x03, 0x0b,
          +   (ops GR:$dst, GR:$src1, s21imm:$imm, PR:$qp),
          +     "($qp) add $dst = $imm, $dst;;">;
          + def TPCMPIMM8NE : AForm<0x03, 0x0b,
          +   (ops PR:$dst, PR:$src1, s21imm:$imm, GR:$src2, PR:$qp),
          +     "($qp) cmp.ne $dst , p0 = $imm, $src2;;">;
          + }
          + 
          + def SUB : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
          +   "sub $dst = $src1, $src2;;">;
          + 
          + def ST1 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
          +   "st1 [$dstPtr] = $value;;">;
          + def ST2 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
          +   "st2 [$dstPtr] = $value;;">;
          + def ST4 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
          +   "st4 [$dstPtr] = $value;;">;
          + def ST8 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
          +   "st8 [$dstPtr] = $value;;">;
          + 
          + def LD1 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
          +   "ld1 $dst = [$srcPtr];;">;
          + def LD2 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
          +   "ld2 $dst = [$srcPtr];;">;
          + def LD4 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
          +   "ld4 $dst = [$srcPtr];;">;
          + def LD8 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
          +   "ld8 $dst = [$srcPtr];;">;
          + 
          + // some FP stuff:
          + def FADD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
          +   "fadd $dst = $src1, $src2;;">;
          + def FADDS: AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
          +   "fadd.s $dst = $src1, $src2;;">;
          + def FSUB : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
          +   "fsub $dst = $src1, $src2;;">;
          + def FMPY : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
          +   "fmpy $dst = $src1, $src2;;">;
          + def FMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "mov $dst = $src;;">; // XXX: there _is_ no fmov
          + def FMA : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
          +   "fma $dst = $src1, $src2, $src3;;">;
          + def FNMA : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
          +   "fnma $dst = $src1, $src2, $src3;;">;
          + 
          + def CFMAS1 : AForm<0x03, 0x0b,
          +   (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3, PR:$qp),
          +     "($qp) fma.s1 $dst = $src1, $src2, $src3;;">;
          + def CFNMAS1 : AForm<0x03, 0x0b,
          +   (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3, PR:$qp),
          +     "($qp) fnma.s1 $dst = $src1, $src2, $src3;;">;
          + 
          + // FIXME: we 'explode' FRCPA (which should write two registers) into two
          + // operations that write one each. this is a waste, and is also destroying
          + // f127. not cool.
          + def FRCPAS1FLOAT : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
          +   "frcpa.s1 $dst , p0 = $src1, $src2;;">;
          + // XXX: this _will_ break things: (f127)
          + def FRCPAS1PREDICATE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
          +   "frcpa.s1 f127 , $dst = $src1, $src2;; // XXX FIXME!!!!">;
          + 
          + def XMAL : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
          +   "xma.l $dst = $src1, $src2, $src3;;">;
          + 
          + def FCVTXF : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.xf $dst = $src;;">;
          + def FCVTXUF : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.xuf $dst = $src;;">;
          + def FCVTXUFS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.xuf.s1 $dst = $src;;">;
          + def FCVTFX : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.fx $dst = $src;;">;
          + def FCVTFXU : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.fxu $dst = $src;;">;
          + 
          + def FCVTFXTRUNC : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.fx.trunc $dst = $src;;">;
          + def FCVTFXUTRUNC : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.fxu.trunc $dst = $src;;">;
          + 
          + def FCVTFXTRUNCS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.fx.trunc.s1 $dst = $src;;">;
          + def FCVTFXUTRUNCS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fcvt.fxu.trunc.s1 $dst = $src;;">;
          + 
          + def FNORMD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
          +   "fnorm.d $dst = $src;;">;
          + 
          + def GETFD : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
          +   "getf.d $dst = $src;;">;
          + def SETFD : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
          +   "setf.d $dst = $src;;">;
          + 
          + def GETFSIG : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
          +   "getf.sig $dst = $src;;">;
          + def SETFSIG : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
          +   "setf.sig $dst = $src;;">;
          + 
          + def LDF4 : AForm<0x03, 0x0b, (ops FP:$dst, GR:$srcPtr),
          +   "ldfs $dst = [$srcPtr];;">;
          + def LDF8 : AForm<0x03, 0x0b, (ops FP:$dst, GR:$srcPtr),
          +   "ldfd $dst = [$srcPtr];;">;
          + 
          + def STF4 : AForm<0x03, 0x0b, (ops GR:$dstPtr, FP:$value),
          +   "stfs [$dstPtr] = $value;;">;
          + def STF8 : AForm<0x03, 0x0b, (ops GR:$dstPtr, FP:$value),
          +   "stfd [$dstPtr] = $value;;">;
          + 
          + let isTerminator = 1, isBranch = 1 in {
          +   def BRLCOND_NOTCALL : RawForm<0x03, 0xb0, (ops PR:$qp, i64imm:$dst),
          +     "($qp) brl.cond.sptk $dst;;">;
          +   def BRCOND_NOTCALL : RawForm<0x03, 0xb0, (ops PR:$qp, GR:$dst),
          +     "($qp) br.cond.sptk $dst;;">;
          + }
          + 
          + let isCall = 1, isTerminator = 1, isBranch = 1, 
          + // all calls clobber non-callee-saved registers, and for now, they are these:
          +   Defs = [r2,r3,r8,r9,r10,r11,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,
          +   r25,r26,r27,r28,r29,r30,r31,
          +   p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,
          +   F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,
          +   F32,F33,F34,F35,F36,F37,F38,F39,F40,F41,F42,F43,F44,F45,F46,F47,F48,F49,
          +   F50,F51,F52,F53,F54,F55,F56,
          +   F57,F58,F59,F60,F61,F62,F63,F64,F65,F66,F67,F68,F69,F70,F71,F72,F73,F74,
          +   F75,F76,F77,F78,F79,F80,F81,
          +   F82,F83,F84,F85,F86,F87,F88,F89,F90,F91,F92,F93,F94,F95,F96,F97,F98,F99,
          +   F100,F101,F102,F103,F104,F105,
          +   F106,F107,F108,F109,F110,F111,F112,F113,F114,F115,F116,F117,F118,F119,
          +   F120,F121,F122,F123,F124,F125,F126,F127,
          +   out0,out1,out2,out3,out4,out5,out6,out7] in {
          +   def BRCALL : RawForm<0x03, 0xb0, (ops calltarget:$dst),
          +   "br.call.sptk rp = $dst;;">;       // FIXME: teach llvm about branch regs?
          +   def BRLCOND_CALL : RawForm<0x03, 0xb0, (ops PR:$qp, i64imm:$dst),
          +     "($qp) brl.cond.call.sptk $dst;;">;
          +   def BRCOND_CALL : RawForm<0x03, 0xb0, (ops PR:$qp, GR:$dst),
          +     "($qp) br.cond.call.sptk $dst;;">;
          + }
          + 
          + let isTerminator = 1, isReturn = 1 in
          +   def RET : RawForm<0x03, 0xb0, (ops), "br.ret.sptk.many rp;;">; // return
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64MachineFunctionInfo.h
          diff -c /dev/null llvm/lib/Target/IA64/IA64MachineFunctionInfo.h:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64MachineFunctionInfo.h	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,34 ----
          + //===-- IA64MachineFunctionInfo.h - IA64-specific information ---*- C++ -*-===//
          + //===--                   for MachineFunction                 ---*- C++ -*-===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + // 
          + //===----------------------------------------------------------------------===//
          + // 
          + // This file declares IA64-specific per-machine-function information.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #ifndef IA64MACHINEFUNCTIONINFO_H
          + #define IA64MACHINEFUNCTIONINFO_H
          + 
          + #include "llvm/CodeGen/MachineFunction.h"
          + //#include "IA64JITInfo.h"
          + 
          + namespace llvm {
          + 
          + class IA64FunctionInfo : public MachineFunctionInfo {
          +   
          + public:
          +   unsigned outRegsUsed; // how many 'out' registers are used
          +   // by this machinefunction? (used to compute the appropriate
          +   // entry in the 'alloc' instruction at the top of the
          +   // machinefunction)
          +   IA64FunctionInfo(MachineFunction& MF) { outRegsUsed=0; };
          + 
          + };
          + 
          + } // End llvm namespace
          + 
          + #endif
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64RegisterInfo.cpp
          diff -c /dev/null llvm/lib/Target/IA64/IA64RegisterInfo.cpp:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64RegisterInfo.cpp	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,362 ----
          + //===- IA64RegisterInfo.cpp - IA64 Register Information ---------*- C++ -*-===//
          + //
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + //
          + //===----------------------------------------------------------------------===//
          + //
          + // This file contains the IA64 implementation of the MRegisterInfo class.  This
          + // file is responsible for the frame pointer elimination optimization on IA64.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #include "IA64.h"
          + #include "IA64RegisterInfo.h"
          + #include "IA64InstrBuilder.h"
          + #include "IA64MachineFunctionInfo.h"
          + #include "llvm/Constants.h"
          + #include "llvm/Type.h"
          + #include "llvm/CodeGen/ValueTypes.h"
          + #include "llvm/CodeGen/MachineInstrBuilder.h"
          + #include "llvm/CodeGen/MachineFunction.h"
          + #include "llvm/CodeGen/MachineFrameInfo.h"
          + #include "llvm/Target/TargetFrameInfo.h"
          + #include "llvm/Target/TargetMachine.h"
          + #include "llvm/Target/TargetOptions.h"
          + #include "llvm/Support/CommandLine.h"
          + #include "llvm/ADT/STLExtras.h"
          + #include 
          + 
          + using namespace llvm;
          + 
          + namespace {
          + }
          + 
          + IA64RegisterInfo::IA64RegisterInfo()
          +   : IA64GenRegisterInfo(IA64::ADJUSTCALLSTACKDOWN, IA64::ADJUSTCALLSTACKUP) {}
          + 
          + static const TargetRegisterClass *getClass(unsigned SrcReg) {
          +   if (IA64::FPRegisterClass->contains(SrcReg))
          +     return IA64::FPRegisterClass;
          +   if (IA64::PRRegisterClass->contains(SrcReg))
          +     return IA64::PRRegisterClass;
          +   
          +   assert(IA64::GRRegisterClass->contains(SrcReg) &&
          +          "PROBLEM: Reg is not FP, predicate or GR!");
          +   return IA64::GRRegisterClass;
          + }
          + 
          + void IA64RegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
          +                                           MachineBasicBlock::iterator MI,
          +                                           unsigned SrcReg, int FrameIdx) const {
          + 
          +   if (getClass(SrcReg) == IA64::FPRegisterClass) {
          +     BuildMI(MBB, MI, IA64::STF8, 2).addFrameIndex(FrameIdx).addReg(SrcReg);
          +   }
          +   else if (getClass(SrcReg) == IA64::GRRegisterClass) {
          +     BuildMI(MBB, MI, IA64::ST8, 2).addFrameIndex(FrameIdx).addReg(SrcReg);
          +  }
          +   else if (getClass(SrcReg) == IA64::PRRegisterClass) {
          +     /* we use IA64::r2 as a temporary register for doing this hackery. */
          +     // first we load 0:
          +     BuildMI(MBB, MI, IA64::MOV, 1, IA64::r2).addReg(IA64::r0);
          +     // then conditionally add 1:
          +     BuildMI(MBB, MI, IA64::CADDIMM22, 3, IA64::r2).addReg(IA64::r2)
          +       .addImm(1).addReg(SrcReg);
          +     // and then store it to the stack
          +     BuildMI(MBB, MI, IA64::ST8, 2).addFrameIndex(FrameIdx).addReg(IA64::r2);
          +   } else assert(0 &&
          +       "sorry, I don't know how to store this sort of reg in the stack\n");
          + }
          + 
          + void IA64RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
          +                                            MachineBasicBlock::iterator MI,
          +                                            unsigned DestReg, int FrameIdx)const{
          + 
          +   if (getClass(DestReg) == IA64::FPRegisterClass) {
          +     BuildMI(MBB, MI, IA64::LDF8, 1, DestReg).addFrameIndex(FrameIdx);
          +   } else if (getClass(DestReg) == IA64::GRRegisterClass) {
          +     BuildMI(MBB, MI, IA64::LD8, 1, DestReg).addFrameIndex(FrameIdx);
          +  } else if (getClass(DestReg) == IA64::PRRegisterClass) {
          +    // first we load a byte from the stack into r2, our 'predicate hackery'
          +    // scratch reg
          +    BuildMI(MBB, MI, IA64::LD8, 1, IA64::r2).addFrameIndex(FrameIdx);
          +    // then we compare it to zero. If it _is_ zero, compare-not-equal to
          +    // r0 gives us 0, which is what we want, so that's nice.
          +    BuildMI(MBB, MI, IA64::CMPNE, 2, DestReg).addReg(IA64::r2).addReg(IA64::r0);
          +  } else assert(0 &&
          +      "sorry, I don't know how to load this sort of reg from the stack\n");
          + }
          + 
          + void IA64RegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
          +                                    MachineBasicBlock::iterator MI,
          +                                    unsigned DestReg, unsigned SrcReg,
          +                                    const TargetRegisterClass *RC) const {
          + 
          +   if(RC == IA64::PRRegisterClass ) // if a bool, we use pseudocode
          +     // (SrcReg) DestReg = cmp.eq.unc(r0, r0)
          +     BuildMI(MBB, MI, IA64::PCMPEQUNC, 1, DestReg).addReg(IA64::r0).addReg(IA64::r0).addReg(SrcReg);
          +   else // otherwise, MOV works (for both gen. regs and FP regs)
          +     BuildMI(MBB, MI, IA64::MOV, 1, DestReg).addReg(SrcReg);
          + }
          + 
          + //===----------------------------------------------------------------------===//
          + // Stack Frame Processing methods
          + //===----------------------------------------------------------------------===//
          + 
          + // hasFP - Return true if the specified function should have a dedicated frame
          + // pointer register.  This is true if the function has variable sized allocas or
          + // if frame pointer elimination is disabled.
          + //
          + static bool hasFP(MachineFunction &MF) {
          +   return NoFramePointerElim || MF.getFrameInfo()->hasVarSizedObjects();
          + }
          + 
          + void IA64RegisterInfo::
          + eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
          +                               MachineBasicBlock::iterator I) const {
          + 
          +   if (hasFP(MF)) {
          +     // If we have a frame pointer, turn the adjcallstackup instruction into a
          +     // 'sub SP, ' and the adjcallstackdown instruction into 'add SP,
          +     // '
          +     MachineInstr *Old = I;
          +     unsigned Amount = Old->getOperand(0).getImmedValue();
          +     if (Amount != 0) {
          +       // We need to keep the stack aligned properly.  To do this, we round the
          +       // amount of space needed for the outgoing arguments up to the next
          +       // alignment boundary.
          +       unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
          +       Amount = (Amount+Align-1)/Align*Align;
          +       
          +       MachineInstr *New;
          +       if (Old->getOpcode() == IA64::ADJUSTCALLSTACKDOWN) {
          + 	New=BuildMI(IA64::ADDIMM22, 2, IA64::r12).addReg(IA64::r12)
          + 	  .addImm(-Amount);
          +       } else {
          + 	assert(Old->getOpcode() == IA64::ADJUSTCALLSTACKUP);
          + 	New=BuildMI(IA64::ADDIMM22, 2, IA64::r12).addReg(IA64::r12)
          + 	  .addImm(Amount);
          +       }
          + 
          +       // Replace the pseudo instruction with a new instruction...
          +       MBB.insert(I, New);
          +     }
          +   }
          + 
          +   MBB.erase(I);
          + }
          + 
          + void IA64RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II) const{
          +   unsigned i = 0;
          +   MachineInstr &MI = *II;
          +   MachineBasicBlock &MBB = *MI.getParent();
          +   MachineFunction &MF = *MBB.getParent();
          + 
          +   bool FP = hasFP(MF);
          +   
          +   while (!MI.getOperand(i).isFrameIndex()) {
          +     ++i;
          +     assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!");
          +   }
          + 
          +   int FrameIndex = MI.getOperand(i).getFrameIndex();
          + 
          +   // choose a base register: ( hasFP? framepointer : stack pointer )
          +   unsigned BaseRegister = FP ? IA64::r15 : IA64::r12;
          +   // Add the base register
          +   MI.SetMachineOperandReg(i, BaseRegister);
          + 
          +   // Now add the frame object offset to the offset from r1.
          +   int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex);
          + 
          +   // If we're not using a Frame Pointer that has been set to the value of the
          +   // SP before having the stack size subtracted from it, then add the stack size
          +   // to Offset to get the correct offset.
          +   Offset += MF.getFrameInfo()->getStackSize();
          + 
          +   // XXX: we use 'r22' as another hack+slash temporary register here :(
          +   if ( Offset <= 8191 && Offset >= -8192) { // smallish offset
          +     //fix up the old:
          +     MI.SetMachineOperandReg(i, IA64::r22);
          +     //insert the new
          +     MachineInstr* nMI=BuildMI(IA64::ADDIMM22, 2, IA64::r22)
          +       .addReg(BaseRegister).addSImm(Offset);
          +     MBB.insert(II, nMI);
          +   } else { // it's big
          +     //fix up the old:
          +     MI.SetMachineOperandReg(i, IA64::r22);
          +     MachineInstr* nMI;
          +     nMI=BuildMI(IA64::MOVLSI32, 1, IA64::r22).addSImm(Offset);
          +     MBB.insert(II, nMI);
          +     nMI=BuildMI(IA64::ADD, 2, IA64::r22).addReg(BaseRegister)
          +       .addReg(IA64::r22);
          +     MBB.insert(II, nMI);
          +   }
          + 
          + }
          + 
          + void IA64RegisterInfo::emitPrologue(MachineFunction &MF) const {
          +   MachineBasicBlock &MBB = MF.front();   // Prolog goes in entry BB
          +   MachineBasicBlock::iterator MBBI = MBB.begin();
          +   MachineFrameInfo *MFI = MF.getFrameInfo();
          +   MachineInstr *MI;
          +   bool FP = hasFP(MF);
          +  
          +   // first, we handle the 'alloc' instruction, that should be right up the
          +   // top of any function
          +   static const unsigned RegsInOrder[96] = { // there are 96 GPRs the
          +                                             // RSE worries about
          +         IA64::r32, IA64::r33, IA64::r34, IA64::r35, 
          +         IA64::r36, IA64::r37, IA64::r38, IA64::r39, IA64::r40, IA64::r41, 
          +         IA64::r42, IA64::r43, IA64::r44, IA64::r45, IA64::r46, IA64::r47, 
          +         IA64::r48, IA64::r49, IA64::r50, IA64::r51, IA64::r52, IA64::r53, 
          +         IA64::r54, IA64::r55, IA64::r56, IA64::r57, IA64::r58, IA64::r59, 
          +         IA64::r60, IA64::r61, IA64::r62, IA64::r63, IA64::r64, IA64::r65, 
          +         IA64::r66, IA64::r67, IA64::r68, IA64::r69, IA64::r70, IA64::r71, 
          +         IA64::r72, IA64::r73, IA64::r74, IA64::r75, IA64::r76, IA64::r77, 
          +         IA64::r78, IA64::r79, IA64::r80, IA64::r81, IA64::r82, IA64::r83, 
          +         IA64::r84, IA64::r85, IA64::r86, IA64::r87, IA64::r88, IA64::r89, 
          +         IA64::r90, IA64::r91, IA64::r92, IA64::r93, IA64::r94, IA64::r95, 
          +         IA64::r96, IA64::r97, IA64::r98, IA64::r99, IA64::r100, IA64::r101, 
          +         IA64::r102, IA64::r103, IA64::r104, IA64::r105, IA64::r106, IA64::r107, 
          +         IA64::r108, IA64::r109, IA64::r110, IA64::r111, IA64::r112, IA64::r113, 
          +         IA64::r114, IA64::r115, IA64::r116, IA64::r117, IA64::r118, IA64::r119, 
          +         IA64::r120, IA64::r121, IA64::r122, IA64::r123, IA64::r124, IA64::r125,
          + 	IA64::r126, IA64::r127 };
          + 
          +   unsigned numStackedGPRsUsed=0;
          +   for(int i=0; i<96; i++) {
          +     if(MF.isPhysRegUsed(RegsInOrder[i]))
          +       numStackedGPRsUsed=i+1; // (i+1 and not ++ - consider fn(fp, fp, int)
          +   }
          + 
          +   unsigned numOutRegsUsed=MF.getInfo()->outRegsUsed;
          + 
          +   // XXX FIXME : this code should be a bit more reliable (in case there _isn't_ a pseudo_alloc in the MBB)
          +   unsigned dstRegOfPseudoAlloc;
          +   for(MBBI = MBB.begin(); /*MBBI->getOpcode() != IA64::PSEUDO_ALLOC*/; ++MBBI) {
          +     assert(MBBI != MBB.end());
          +     if(MBBI->getOpcode() == IA64::PSEUDO_ALLOC) {
          +       dstRegOfPseudoAlloc=MBBI->getOperand(0).getReg();
          +       break;
          +     }
          +   }
          +  
          +   MI=BuildMI(IA64::ALLOC,5).addReg(dstRegOfPseudoAlloc).addImm(0).\
          +      addImm(numStackedGPRsUsed).addImm(numOutRegsUsed).addImm(0);
          +   MBB.insert(MBBI, MI);
          +  
          +   // Get the number of bytes to allocate from the FrameInfo
          +   unsigned NumBytes = MFI->getStackSize();
          + 
          +   if (MFI->hasCalls() && !FP) {
          +     // We reserve argument space for call sites in the function immediately on 
          +     // entry to the current function.  This eliminates the need for add/sub 
          +     // brackets around call sites.
          +     NumBytes += MFI->getMaxCallFrameSize();
          +   }
          + 
          +   if(FP)
          +     NumBytes += 8; // reserve space for the old FP
          + 
          +   // Do we need to allocate space on the stack?
          +   if (NumBytes == 0)
          +     return;
          + 
          +   // Add 16 bytes at the bottom of the stack (scratch area)
          +   // and round the size to a multiple of the alignment.
          +   unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
          +   unsigned Size = 16 + (FP ? 8 : 0);
          +   NumBytes = (NumBytes+Size+Align-1)/Align*Align;
          + 
          +   // Update frame info to pretend that this is part of the stack...
          +   MFI->setStackSize(NumBytes);
          + 
          +   // adjust stack pointer: r12 -= numbytes
          +   if (NumBytes <= 8191) {
          +     MI=BuildMI(IA64::ADDIMM22, 2, IA64::r12).addReg(IA64::r12).addImm(-NumBytes);
          +     MBB.insert(MBBI, MI);
          +   } else { // we use r22 as a scratch register here
          +     MI=BuildMI(IA64::MOVLSI32, 1, IA64::r22).addSImm(-NumBytes);
          +     // FIXME: MOVLSI32 expects a _u_32imm
          +     MBB.insert(MBBI, MI);  // first load the decrement into r22
          +     MI=BuildMI(IA64::ADD, 2, IA64::r12).addReg(IA64::r12).addReg(IA64::r22);
          +     MBB.insert(MBBI, MI);  // then add (subtract) it to r12 (stack ptr)
          +   }
          +   
          +   // now if we need to, save the old FP and set the new
          +   if (FP) {
          +     MI = BuildMI(IA64::ST8, 2).addReg(IA64::r12).addReg(IA64::r15);
          +     MBB.insert(MBBI, MI);
          +     // this must be the last instr in the prolog ?  (XXX: why??)
          +     MI = BuildMI(IA64::MOV, 1, IA64::r15).addReg(IA64::r12);
          +     MBB.insert(MBBI, MI);
          +   } 
          + 
          + }
          + 
          + void IA64RegisterInfo::emitEpilogue(MachineFunction &MF,
          +                                    MachineBasicBlock &MBB) const {
          +   const MachineFrameInfo *MFI = MF.getFrameInfo();
          +   MachineBasicBlock::iterator MBBI = prior(MBB.end());
          +   MachineInstr *MI;
          +   assert(MBBI->getOpcode() == IA64::RET &&
          +          "Can only insert epilog into returning blocks");
          + 
          +   bool FP = hasFP(MF);
          + 
          +   // Get the number of bytes allocated from the FrameInfo...
          +   unsigned NumBytes = MFI->getStackSize();
          + 
          +   //now if we need to, restore the old FP
          +   if (FP)
          +   {
          +     //copy the FP into the SP (discards allocas)
          +     MI=BuildMI(IA64::MOV, 1, IA64::r12).addReg(IA64::r15);
          +     MBB.insert(MBBI, MI);
          +     //restore the FP
          +     MI=BuildMI(IA64::LD8, 1, IA64::r15).addReg(IA64::r15);
          +     MBB.insert(MBBI, MI);
          +   }
          + 
          +   if (NumBytes != 0) 
          +   {
          +     if (NumBytes <= 8191) {
          +       MI=BuildMI(IA64::ADDIMM22, 2, IA64::r12).addReg(IA64::r12).addImm(NumBytes);
          +       MBB.insert(MBBI, MI);
          +     } else {
          +       MI=BuildMI(IA64::MOVLI32, 1, IA64::r22).addImm(NumBytes);
          +       MBB.insert(MBBI, MI);
          +       MI=BuildMI(IA64::ADD, 2, IA64::r12).addReg(IA64::r12).addReg(IA64::r22);
          +       MBB.insert(MBBI, MI);
          +     }
          +   }
          + 
          + }
          + 
          + #include "IA64GenRegisterInfo.inc"
          + 
          + const TargetRegisterClass*
          + IA64RegisterInfo::getRegClassForType(const Type* Ty) const {
          +   switch (Ty->getTypeID()) {
          +   default:              assert(0 && "Invalid type to getClass!");
          +   case Type::LongTyID:
          +   case Type::ULongTyID:
          +   case Type::BoolTyID:
          +   case Type::SByteTyID:
          +   case Type::UByteTyID:
          +   case Type::ShortTyID:
          +   case Type::UShortTyID:
          +   case Type::IntTyID:
          +   case Type::UIntTyID:
          +   case Type::PointerTyID: return &GRInstance;
          + 
          +   case Type::FloatTyID:
          +   case Type::DoubleTyID: return &FPInstance;
          +   }
          + }
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64RegisterInfo.h
          diff -c /dev/null llvm/lib/Target/IA64/IA64RegisterInfo.h:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64RegisterInfo.h	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,55 ----
          + //===- IA64RegisterInfo.h - IA64 Register Information Impl ------*- C++ -*-===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file contains the IA64 implementation of the MRegisterInfo class.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #ifndef IA64REGISTERINFO_H
          + #define IA64REGISTERINFO_H
          + 
          + #include "llvm/Target/MRegisterInfo.h"
          + #include "IA64GenRegisterInfo.h.inc"
          + 
          + namespace llvm { class llvm::Type; }
          + 
          + namespace llvm {
          + 
          + struct IA64RegisterInfo : public IA64GenRegisterInfo {
          +   IA64RegisterInfo();
          +   const TargetRegisterClass* getRegClassForType(const Type* Ty) const;
          + 
          +   /// Code Generation virtual methods...
          +   void storeRegToStackSlot(MachineBasicBlock &MBB,
          +                            MachineBasicBlock::iterator MI,
          +                            unsigned SrcReg, int FrameIndex) const;
          + 
          +   void loadRegFromStackSlot(MachineBasicBlock &MBB,
          +                             MachineBasicBlock::iterator MI,
          +                             unsigned DestReg, int FrameIndex) const;
          +   
          +   void copyRegToReg(MachineBasicBlock &MBB,
          +                     MachineBasicBlock::iterator MI,
          +                     unsigned DestReg, unsigned SrcReg,
          +                     const TargetRegisterClass *RC) const;
          + 
          +   void eliminateCallFramePseudoInstr(MachineFunction &MF,
          +                                      MachineBasicBlock &MBB,
          +                                      MachineBasicBlock::iterator MI) const;
          + 
          +   void eliminateFrameIndex(MachineBasicBlock::iterator MI) const;
          + 
          +   void emitPrologue(MachineFunction &MF) const;
          +   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
          + };
          + 
          + } // End llvm namespace
          + 
          + #endif
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64RegisterInfo.td
          diff -c /dev/null llvm/lib/Target/IA64/IA64RegisterInfo.td:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64RegisterInfo.td	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,291 ----
          + //===- IA64RegisterInfo.td - Describe the IA64 Register File ----*- C++ -*-===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + //
          + // This file describes the IA64 register file, defining the registers
          + // themselves, aliases between the registers, and the register classes built
          + // out of the registers.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + //===----------------------------------------------------------------------===//
          + //  Register definitions...
          + //
          + 
          + class IA64Register : Register {
          +     let Namespace = "IA64";
          + }
          + 
          + // GR - One of 128 32-bit general registers
          + class GR num, string n> : IA64Register {
          +     field bits<7> Num = num;
          + }
          + 
          + // FP - One of 128 82-bit floating-point registers
          + class FP num, string n> : IA64Register {
          +     field bits<7> Num = num;
          + }
          + 
          + // PR - One of 64 1-bit predicate registers
          + class PR num, string n> : IA64Register {
          +     field bits<6> Num = num;
          + }
          + 
          + /* general registers */
          + def r0 : GR< 0, "r0">;	def r1 : GR< 1, "r1">;
          + def r2 : GR< 2, "r2">;	def r3 : GR< 3, "r3">;
          + def r4 : GR< 4, "r4">;	def r5 : GR< 5, "r5">;
          + def r6 : GR< 6, "r6">;	def r7 : GR< 7, "r7">;
          + def r8 : GR< 8, "r8">;	def r9 : GR< 9, "r9">;
          + def r10 : GR< 10, "r10">;	def r11 : GR< 11, "r11">;
          + def r12 : GR< 12, "r12">;	def r13 : GR< 13, "r13">;
          + def r14 : GR< 14, "r14">;	def r15 : GR< 15, "r15">;
          + def r16 : GR< 16, "r16">;	def r17 : GR< 17, "r17">;
          + def r18 : GR< 18, "r18">;	def r19 : GR< 19, "r19">;
          + def r20 : GR< 20, "r20">;	def r21 : GR< 21, "r21">;
          + def r22 : GR< 22, "r22">;	def r23 : GR< 23, "r23">;
          + def r24 : GR< 24, "r24">;	def r25 : GR< 25, "r25">;
          + def r26 : GR< 26, "r26">;	def r27 : GR< 27, "r27">;
          + def r28 : GR< 28, "r28">;	def r29 : GR< 29, "r29">;
          + def r30 : GR< 30, "r30">;	def r31 : GR< 31, "r31">;
          + def r32 : GR< 32, "r32">;	def r33 : GR< 33, "r33">;
          + def r34 : GR< 34, "r34">;	def r35 : GR< 35, "r35">;
          + def r36 : GR< 36, "r36">;	def r37 : GR< 37, "r37">;
          + def r38 : GR< 38, "r38">;	def r39 : GR< 39, "r39">;
          + def r40 : GR< 40, "r40">;	def r41 : GR< 41, "r41">;
          + def r42 : GR< 42, "r42">;	def r43 : GR< 43, "r43">;
          + def r44 : GR< 44, "r44">;	def r45 : GR< 45, "r45">;
          + def r46 : GR< 46, "r46">;	def r47 : GR< 47, "r47">;
          + def r48 : GR< 48, "r48">;	def r49 : GR< 49, "r49">;
          + def r50 : GR< 50, "r50">;	def r51 : GR< 51, "r51">;
          + def r52 : GR< 52, "r52">;	def r53 : GR< 53, "r53">;
          + def r54 : GR< 54, "r54">;	def r55 : GR< 55, "r55">;
          + def r56 : GR< 56, "r56">;	def r57 : GR< 57, "r57">;
          + def r58 : GR< 58, "r58">;	def r59 : GR< 59, "r59">;
          + def r60 : GR< 60, "r60">;	def r61 : GR< 61, "r61">;
          + def r62 : GR< 62, "r62">;	def r63 : GR< 63, "r63">;
          + def r64 : GR< 64, "r64">;	def r65 : GR< 65, "r65">;
          + def r66 : GR< 66, "r66">;	def r67 : GR< 67, "r67">;
          + def r68 : GR< 68, "r68">;	def r69 : GR< 69, "r69">;
          + def r70 : GR< 70, "r70">;	def r71 : GR< 71, "r71">;
          + def r72 : GR< 72, "r72">;	def r73 : GR< 73, "r73">;
          + def r74 : GR< 74, "r74">;	def r75 : GR< 75, "r75">;
          + def r76 : GR< 76, "r76">;	def r77 : GR< 77, "r77">;
          + def r78 : GR< 78, "r78">;	def r79 : GR< 79, "r79">;
          + def r80 : GR< 80, "r80">;	def r81 : GR< 81, "r81">;
          + def r82 : GR< 82, "r82">;	def r83 : GR< 83, "r83">;
          + def r84 : GR< 84, "r84">;	def r85 : GR< 85, "r85">;
          + def r86 : GR< 86, "r86">;	def r87 : GR< 87, "r87">;
          + def r88 : GR< 88, "r88">;	def r89 : GR< 89, "r89">;
          + def r90 : GR< 90, "r90">;	def r91 : GR< 91, "r91">;
          + def r92 : GR< 92, "r92">;	def r93 : GR< 93, "r93">;
          + def r94 : GR< 94, "r94">;	def r95 : GR< 95, "r95">;
          + def r96 : GR< 96, "r96">;	def r97 : GR< 97, "r97">;
          + def r98 : GR< 98, "r98">;	def r99 : GR< 99, "r99">;
          + def r100 : GR< 100, "r100">;	def r101 : GR< 101, "r101">;
          + def r102 : GR< 102, "r102">;	def r103 : GR< 103, "r103">;
          + def r104 : GR< 104, "r104">;	def r105 : GR< 105, "r105">;
          + def r106 : GR< 106, "r106">;	def r107 : GR< 107, "r107">;
          + def r108 : GR< 108, "r108">;	def r109 : GR< 109, "r109">;
          + def r110 : GR< 110, "r110">;	def r111 : GR< 111, "r111">;
          + def r112 : GR< 112, "r112">;	def r113 : GR< 113, "r113">;
          + def r114 : GR< 114, "r114">;	def r115 : GR< 115, "r115">;
          + def r116 : GR< 116, "r116">;	def r117 : GR< 117, "r117">;
          + def r118 : GR< 118, "r118">;	def r119 : GR< 119, "r119">;
          + def r120 : GR< 120, "r120">;	def r121 : GR< 121, "r121">;
          + def r122 : GR< 122, "r122">;	def r123 : GR< 123, "r123">;
          + def r124 : GR< 124, "r124">;	def r125 : GR< 125, "r125">;
          + def r126 : GR< 126, "r126">;	def r127 : GR< 127, "r127">;
          + 
          + /* floating-point registers */
          + def F0 : FP< 0, "f0">;	def F1 : FP< 1, "f1">;
          + def F2 : FP< 2, "f2">;	def F3 : FP< 3, "f3">;
          + def F4 : FP< 4, "f4">;	def F5 : FP< 5, "f5">;
          + def F6 : FP< 6, "f6">;	def F7 : FP< 7, "f7">;
          + def F8 : FP< 8, "f8">;	def F9 : FP< 9, "f9">;
          + def F10 : FP< 10, "f10">;	def F11 : FP< 11, "f11">;
          + def F12 : FP< 12, "f12">;	def F13 : FP< 13, "f13">;
          + def F14 : FP< 14, "f14">;	def F15 : FP< 15, "f15">;
          + def F16 : FP< 16, "f16">;	def F17 : FP< 17, "f17">;
          + def F18 : FP< 18, "f18">;	def F19 : FP< 19, "f19">;
          + def F20 : FP< 20, "f20">;	def F21 : FP< 21, "f21">;
          + def F22 : FP< 22, "f22">;	def F23 : FP< 23, "f23">;
          + def F24 : FP< 24, "f24">;	def F25 : FP< 25, "f25">;
          + def F26 : FP< 26, "f26">;	def F27 : FP< 27, "f27">;
          + def F28 : FP< 28, "f28">;	def F29 : FP< 29, "f29">;
          + def F30 : FP< 30, "f30">;	def F31 : FP< 31, "f31">;
          + def F32 : FP< 32, "f32">;	def F33 : FP< 33, "f33">;
          + def F34 : FP< 34, "f34">;	def F35 : FP< 35, "f35">;
          + def F36 : FP< 36, "f36">;	def F37 : FP< 37, "f37">;
          + def F38 : FP< 38, "f38">;	def F39 : FP< 39, "f39">;
          + def F40 : FP< 40, "f40">;	def F41 : FP< 41, "f41">;
          + def F42 : FP< 42, "f42">;	def F43 : FP< 43, "f43">;
          + def F44 : FP< 44, "f44">;	def F45 : FP< 45, "f45">;
          + def F46 : FP< 46, "f46">;	def F47 : FP< 47, "f47">;
          + def F48 : FP< 48, "f48">;	def F49 : FP< 49, "f49">;
          + def F50 : FP< 50, "f50">;	def F51 : FP< 51, "f51">;
          + def F52 : FP< 52, "f52">;	def F53 : FP< 53, "f53">;
          + def F54 : FP< 54, "f54">;	def F55 : FP< 55, "f55">;
          + def F56 : FP< 56, "f56">;	def F57 : FP< 57, "f57">;
          + def F58 : FP< 58, "f58">;	def F59 : FP< 59, "f59">;
          + def F60 : FP< 60, "f60">;	def F61 : FP< 61, "f61">;
          + def F62 : FP< 62, "f62">;	def F63 : FP< 63, "f63">;
          + def F64 : FP< 64, "f64">;	def F65 : FP< 65, "f65">;
          + def F66 : FP< 66, "f66">;	def F67 : FP< 67, "f67">;
          + def F68 : FP< 68, "f68">;	def F69 : FP< 69, "f69">;
          + def F70 : FP< 70, "f70">;	def F71 : FP< 71, "f71">;
          + def F72 : FP< 72, "f72">;	def F73 : FP< 73, "f73">;
          + def F74 : FP< 74, "f74">;	def F75 : FP< 75, "f75">;
          + def F76 : FP< 76, "f76">;	def F77 : FP< 77, "f77">;
          + def F78 : FP< 78, "f78">;	def F79 : FP< 79, "f79">;
          + def F80 : FP< 80, "f80">;	def F81 : FP< 81, "f81">;
          + def F82 : FP< 82, "f82">;	def F83 : FP< 83, "f83">;
          + def F84 : FP< 84, "f84">;	def F85 : FP< 85, "f85">;
          + def F86 : FP< 86, "f86">;	def F87 : FP< 87, "f87">;
          + def F88 : FP< 88, "f88">;	def F89 : FP< 89, "f89">;
          + def F90 : FP< 90, "f90">;	def F91 : FP< 91, "f91">;
          + def F92 : FP< 92, "f92">;	def F93 : FP< 93, "f93">;
          + def F94 : FP< 94, "f94">;	def F95 : FP< 95, "f95">;
          + def F96 : FP< 96, "f96">;	def F97 : FP< 97, "f97">;
          + def F98 : FP< 98, "f98">;	def F99 : FP< 99, "f99">;
          + def F100 : FP< 100, "f100">;	def F101 : FP< 101, "f101">;
          + def F102 : FP< 102, "f102">;	def F103 : FP< 103, "f103">;
          + def F104 : FP< 104, "f104">;	def F105 : FP< 105, "f105">;
          + def F106 : FP< 106, "f106">;	def F107 : FP< 107, "f107">;
          + def F108 : FP< 108, "f108">;	def F109 : FP< 109, "f109">;
          + def F110 : FP< 110, "f110">;	def F111 : FP< 111, "f111">;
          + def F112 : FP< 112, "f112">;	def F113 : FP< 113, "f113">;
          + def F114 : FP< 114, "f114">;	def F115 : FP< 115, "f115">;
          + def F116 : FP< 116, "f116">;	def F117 : FP< 117, "f117">;
          + def F118 : FP< 118, "f118">;	def F119 : FP< 119, "f119">;
          + def F120 : FP< 120, "f120">;	def F121 : FP< 121, "f121">;
          + def F122 : FP< 122, "f122">;	def F123 : FP< 123, "f123">;
          + def F124 : FP< 124, "f124">;	def F125 : FP< 125, "f125">;
          + def F126 : FP< 126, "f126">;	def F127 : FP< 127, "f127">;
          + 
          + /* predicate registers */
          + def p0 : PR< 0, "p0">;  def p1 : PR< 1, "p1">;
          + def p2 : PR< 2, "p2">;  def p3 : PR< 3, "p3">;
          + def p4 : PR< 4, "p4">;  def p5 : PR< 5, "p5">;
          + def p6 : PR< 6, "p6">;  def p7 : PR< 7, "p7">;
          + def p8 : PR< 8, "p8">;  def p9 : PR< 9, "p9">;
          + def p10 : PR< 10, "p10">;       def p11 : PR< 11, "p11">;
          + def p12 : PR< 12, "p12">;       def p13 : PR< 13, "p13">;
          + def p14 : PR< 14, "p14">;       def p15 : PR< 15, "p15">;
          + def p16 : PR< 16, "p16">;       def p17 : PR< 17, "p17">;
          + def p18 : PR< 18, "p18">;       def p19 : PR< 19, "p19">;
          + def p20 : PR< 20, "p20">;       def p21 : PR< 21, "p21">;
          + def p22 : PR< 22, "p22">;       def p23 : PR< 23, "p23">;
          + def p24 : PR< 24, "p24">;       def p25 : PR< 25, "p25">;
          + def p26 : PR< 26, "p26">;       def p27 : PR< 27, "p27">;
          + def p28 : PR< 28, "p28">;       def p29 : PR< 29, "p29">;
          + def p30 : PR< 30, "p30">;       def p31 : PR< 31, "p31">;
          + def p32 : PR< 32, "p32">;       def p33 : PR< 33, "p33">;
          + def p34 : PR< 34, "p34">;       def p35 : PR< 35, "p35">;
          + def p36 : PR< 36, "p36">;       def p37 : PR< 37, "p37">;
          + def p38 : PR< 38, "p38">;       def p39 : PR< 39, "p39">;
          + def p40 : PR< 40, "p40">;       def p41 : PR< 41, "p41">;
          + def p42 : PR< 42, "p42">;       def p43 : PR< 43, "p43">;
          + def p44 : PR< 44, "p44">;       def p45 : PR< 45, "p45">;
          + def p46 : PR< 46, "p46">;       def p47 : PR< 47, "p47">;
          + def p48 : PR< 48, "p48">;       def p49 : PR< 49, "p49">;
          + def p50 : PR< 50, "p50">;       def p51 : PR< 51, "p51">;
          + def p52 : PR< 52, "p52">;       def p53 : PR< 53, "p53">;
          + def p54 : PR< 54, "p54">;       def p55 : PR< 55, "p55">;
          + def p56 : PR< 56, "p56">;       def p57 : PR< 57, "p57">;
          + def p58 : PR< 58, "p58">;       def p59 : PR< 59, "p59">;
          + def p60 : PR< 60, "p60">;       def p61 : PR< 61, "p61">;
          + def p62 : PR< 62, "p62">;       def p63 : PR< 63, "p63">;
          + 
          + // XXX : this is temporary, we'll eventually have the output registers
          + // in the general purpose register class too?
          + def out0 : GR<0, "out0">;  def out1 : GR<1, "out1">;
          + def out2 : GR<2, "out2">;  def out3 : GR<3, "out3">;
          + def out4 : GR<4, "out4">;  def out5 : GR<5, "out5">;
          + def out6 : GR<6, "out6">;  def out7 : GR<7, "out7">;
          + 
          + // application (special) registers:
          + 
          + // " previous function state" application register
          + def AR_PFS : GR<0, "ar.pfs">;
          + 
          + // "return pointer" (this is really branch register b0)
          + def rp : GR<0, "rp">;
          + // branch reg 6
          + def B6 : GR<0, "b6">;
          + 
          + //===----------------------------------------------------------------------===//
          + // Register Class Definitions... now that we have all of the pieces, define the
          + // top-level register classes.  The order specified in the register list is
          + // implicitly defined to be the register allocation order.
          + //
          + 
          + // these are the scratch (+stacked) general registers
          + // ZERO (r0), GP (r1), SP (r12), ThreadP (r13) are not here... 
          + // FIXME/XXX  we also reserve a frame pointer (r15)
          + // FIXME/XXX  we also reserve r2 for spilling/filling predicates
          + // in IA64RegisterInfo.cpp
          + // FIXME/XXX  we also reserve r22 for calculating addresses
          + // in IA64RegisterInfo.cpp
          + 
          + def GR : RegisterClass;
          + 
          + // these are the scratch (+stacked) FP registers
          + // ZERO (F0) and ONE (F1) are not here
          + def FP : RegisterClass;
          + 
          + // these are the predicate registers, p0 (1/TRUE) is not here
          + def PR : RegisterClass {
          +    let Size = 64;
          +  }
          + 
          + /*
          +  [p1, p2, p3, p4, p5, p6, p7,
          +   p8, p9, p10, p11, p12, p13, p14, p15,
          +   p16, p17, p18, p19, p20, p21, p22, p23,
          +   p24, p25, p26, p27, p28, p29, p30, p31,
          +   p32, p33, p34, p35, p36, p37, p38, p39,
          +   p40, p41, p42, p43, p44, p45, p46, p47,
          +   p48, p49, p50, p51, p52, p53, p54, p55,
          +   p56, p57, p58, p59, p60, p61, p62, p63]>;
          +   */
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64TargetMachine.cpp
          diff -c /dev/null llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64TargetMachine.cpp	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,134 ----
          + //===-- IA64TargetMachine.cpp - Define TargetMachine for IA64 -------------===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + // 
          + // This file defines the IA64 specific subclass of TargetMachine.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #include "IA64TargetMachine.h"
          + #include "IA64.h"
          + #include "llvm/Module.h"
          + #include "llvm/PassManager.h"
          + #include "llvm/CodeGen/IntrinsicLowering.h"
          + #include "llvm/CodeGen/MachineFunction.h"
          + #include "llvm/CodeGen/Passes.h"
          + #include "llvm/Target/TargetOptions.h"
          + #include "llvm/Target/TargetMachineRegistry.h"
          + #include "llvm/Transforms/Scalar.h"
          + #include "llvm/Support/CommandLine.h"
          + #include "llvm/ADT/Statistic.h"
          + using namespace llvm;
          + 
          + /// IA64TargetMachineModule - Note that this is used on hosts that cannot link
          + /// in a library unless there are references into the library.  In particular,
          + /// it seems that it is not possible to get things to work on Win32 without
          + /// this.  Though it is unused, do not remove it.
          + extern "C" int IA64TargetMachineModule;
          + int IA64TargetMachineModule = 0;
          + 
          + namespace {
          +   cl::opt DisableOutput("disable-ia64-llc-output", cl::Hidden,
          +                               cl::desc("Disable the IA64 asm printer, for use "
          +                                        "when profiling the code generator."));
          + 
          +   // Register the target.
          +   RegisterTarget X("ia64", "  IA-64 (Itanium)");
          + }
          + 
          + unsigned IA64TargetMachine::compileTimeMatchQuality() {
          + #if defined(__ia64__) || defined(__IA64__)
          +   return 50;
          + #else
          +   return 0;
          + #endif
          + }
          + 
          + unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) {
          +   // we match [iI][aA]*64
          +   bool seenIA64=false;
          +   std::string TT = M.getTargetTriple();
          + 
          +   if (TT.size() >= 4) {
          +     if( (TT[0]=='i' || TT[0]=='I') &&
          + 	(TT[1]=='a' || TT[1]=='A') ) {
          +       for(unsigned int i=2; i<(TT.size()-1); i++)
          + 	if(TT[i]=='6' && TT[i+1]=='4')
          + 	  seenIA64=true;
          +     }
          + 
          +     if(seenIA64)
          +       return 50; // strong match
          +   }
          + 
          +   return compileTimeMatchQuality()/2;
          + 
          + }
          + 
          + /// IA64TargetMachine ctor - Create an LP64 architecture model
          + ///
          + IA64TargetMachine::IA64TargetMachine(const Module &M, IntrinsicLowering *IL)
          +   : TargetMachine("IA64", IL, true),
          +     FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0) { // FIXME? check this stuff
          + }
          + 
          + // addPassesToEmitAssembly - We currently use all of the same passes as the JIT
          + // does to emit statically compiled machine code.
          + bool IA64TargetMachine::addPassesToEmitAssembly(PassManager &PM,
          + 					       std::ostream &Out) {
          +   // FIXME: Implement efficient support for garbage collection intrinsics.
          +   PM.add(createLowerGCPass());
          + 
          +   // FIXME: Implement the invoke/unwind instructions!
          +   PM.add(createLowerInvokePass());
          + 
          +   // FIXME: Implement the switch instruction in the instruction selector!
          +   PM.add(createLowerSwitchPass());
          + 
          +   // Make sure that no unreachable blocks are instruction selected.
          +   PM.add(createUnreachableBlockEliminationPass());
          + 
          +   PM.add(createIA64PatternInstructionSelector(*this));
          + 
          + /* XXX not yet. ;)
          +   // Run optional SSA-based machine code optimizations next...
          +   if (!NoSSAPeephole)
          +     PM.add(createIA64SSAPeepholeOptimizerPass());
          + */
          + 
          +   // Print the instruction selected machine code...
          +   if (PrintMachineCode)
          +     PM.add(createMachineFunctionPrinterPass(&std::cerr));
          + 
          +   // Perform register allocation to convert to a concrete IA64 representation
          +   PM.add(createRegisterAllocator());
          + 
          +   if (PrintMachineCode)
          +     PM.add(createMachineFunctionPrinterPass(&std::cerr));
          + 
          +   if (PrintMachineCode)
          +     PM.add(createMachineFunctionPrinterPass(&std::cerr));
          + 
          +   // Insert prolog/epilog code.  Eliminate abstract frame index references...
          +   PM.add(createPrologEpilogCodeInserter());
          + 
          + /* XXX no, not just yet */
          + //  PM.add(createIA64PeepholeOptimizerPass());
          + 
          +   if (PrintMachineCode)  // Print the register-allocated code
          +     PM.add(createIA64CodePrinterPass(std::cerr, *this));
          + 
          +   if (!DisableOutput)
          +     PM.add(createIA64CodePrinterPass(Out, *this));
          + 
          +   // Delete machine code for this function
          +   PM.add(createMachineCodeDeleter());
          + 
          +   return false; // success!
          + }
          + 
          
          
          Index: llvm/lib/Target/IA64/IA64TargetMachine.h
          diff -c /dev/null llvm/lib/Target/IA64/IA64TargetMachine.h:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/IA64TargetMachine.h	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,48 ----
          + //===-- IA64TargetMachine.h - Define TargetMachine for IA64 ---*- C++ -*---===//
          + // 
          + //                     The LLVM Compiler Infrastructure
          + //
          + // This file was developed by Duraid Madina and is distributed under the
          + // University of Illinois Open Source License. See LICENSE.TXT for details.
          + // 
          + //===----------------------------------------------------------------------===//
          + // 
          + // This file declares the IA64 specific subclass of TargetMachine.
          + //
          + //===----------------------------------------------------------------------===//
          + 
          + #ifndef IA64TARGETMACHINE_H
          + #define IA64TARGETMACHINE_H
          + 
          + #include "llvm/Target/TargetMachine.h"
          + #include "llvm/Target/TargetFrameInfo.h"
          + #include "llvm/PassManager.h"
          + #include "IA64InstrInfo.h"
          + 
          + namespace llvm {
          + class IntrinsicLowering;
          + 
          + class IA64TargetMachine : public TargetMachine {
          +   IA64InstrInfo    InstrInfo;
          +   TargetFrameInfo FrameInfo;
          +   //IA64JITInfo      JITInfo;
          + public:
          +   IA64TargetMachine(const Module &M, IntrinsicLowering *IL);
          + 
          +   virtual const IA64InstrInfo     *getInstrInfo() const { return &InstrInfo; }
          +   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
          +   virtual const MRegisterInfo    *getRegisterInfo() const {
          +     return &InstrInfo.getRegisterInfo();
          +   }
          + 
          +   virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
          + 
          +   static unsigned getModuleMatchQuality(const Module &M);
          +   static unsigned compileTimeMatchQuality(void);
          + 
          + };
          + } // End llvm namespace
          + 
          + #endif
          + 
          + 
          
          
          Index: llvm/lib/Target/IA64/Makefile
          diff -c /dev/null llvm/lib/Target/IA64/Makefile:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/Makefile	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,17 ----
          + ##===- lib/Target/IA64/Makefile -----------------------------*- Makefile -*-===##
          + #                     The LLVM Compiler Infrastructure
          + #
          + # This file was developed by Duraid Madina and is distributed under the
          + # University of Illinois Open Source License. See LICENSE.TXT for details.
          + # 
          + ##===----------------------------------------------------------------------===##
          + LEVEL = ../../..
          + LIBRARYNAME = LLVMIA64
          + TARGET = IA64
          + # Make sure that tblgen is run, first thing.
          + BUILT_SOURCES = IA64GenRegisterInfo.h.inc IA64GenRegisterNames.inc \
          +                 IA64GenRegisterInfo.inc IA64GenInstrNames.inc \
          +                 IA64GenInstrInfo.inc IA64GenAsmWriter.inc
          + 
          + include $(LEVEL)/Makefile.common
          + 
          
          
          Index: llvm/lib/Target/IA64/README
          diff -c /dev/null llvm/lib/Target/IA64/README:1.1
          *** /dev/null	Thu Mar 17 12:17:14 2005
          --- llvm/lib/Target/IA64/README	Thu Mar 17 12:17:03 2005
          ***************
          *** 0 ****
          --- 1,98 ----
          + *** README for the LLVM IA64 Backend "Version 0.01" - March 18, 2004           
          + *** Quote for this version:
          + 
          +       "Kaori and Hitomi are naughty!!"
          + 
          + 
          + Congratulations, you have found:
          + 
          + **************************************************************** 
          + * @@@       @@@       @@@  @@@  @@@@@@@@@@                     *
          + * @@@       @@@       @@@  @@@  @@@@@@@@@@@                    *
          + * @@!       @@!       @@!  @@@  @@! @@! @@!                    *
          + * !@!       !@!       !@!  @!@  !@! !@! !@!                    *
          + * @!!       @!!       @!@  !@!  @!! !!@ @!@                    *
          + * !!!       !!!       !@!  !!!  !@!   ! !@!                    *
          + * !!:       !!:       :!:  !!:  !!:     !!:                    *
          + *  :!:       :!:       ::!!:!   :!:     :!:                    *
          + *  :: ::::   :: ::::    ::::    :::     ::                     *
          + * : :: : :  : :: : :     :       :      :                      *
          + *                                                              *
          + *                                                              *
          + *  @@@@@@   @@@  @@@       @@@   @@@@@@     @@@@@@       @@@   *
          + * @@@@@@@@  @@@@ @@@       @@@  @@@@@@@@   @@@@@@@      @@@@   *
          + * @@!  @@@  @@!@!@@@       @@!  @@!  @@@  !@@          @@!@!   *
          + * !@!  @!@  !@!!@!@!       !@!  !@!  @!@  !@!         !@!!@!   *
          + * @!@  !@!  @!@ !!@!       !!@  @!@!@!@!  !!@@!@!    @!! @!!   *
          + * !@!  !!!  !@!  !!!       !!!  !!!@!!!!  @!!@!!!!  !!!  !@!   *
          + * !!:  !!!  !!:  !!!       !!:  !!:  !!!  !:!  !:!  :!!:!:!!:  *
          + * :!:  !:!  :!:  !:!       :!:  :!:  !:!  :!:  !:!  !:::!!:::  *
          + * ::::: ::   ::   ::        ::  ::   :::  :::: :::       :::   *
          + *  : :  :   ::    :        :     :   : :   :: : :        :::   *
          + *                                                              *
          + ****************************************************************
          + * Bow down, bow down, before the power of IA64! Or be crushed, *
          + * be crushed, by its jolly registers of doom!!                 *
          + ****************************************************************
          + 
          + DEVELOPMENT PLAN:
          + 
          +    _  you are       2005           maybe 2005       2006            2006 and
          +   /   here            |               |              |               beyond 
          +  v                    v               v              v                |
          +                                                                       v
          + CLEAN UP        ADD INSTRUCTION      ADD          PLAY WITH
          + INSTRUCTION --> SCHEDULING AND  -->  JIT    -->    DYNAMIC     --> FUTURE WORK
          + SELECTION       BUNDLING            SUPPORT     REOPTIMIZATION
          + 
          + DISCLAIMER AND PROMISE:
          + 
          + As of the time of this release, you are probably better off using Intel C/C++
          + or GCC. The performance of the code emitted right now is, in a word,
          + terrible. Check back in a few months - the story will be different then,
          + I guarantee it.
          + 
          + TODO:
          + 
          +   - clean up and thoroughly test the isel patterns.
          +   - fix up floating point
          +     (nb http://gcc.gnu.org/wiki?pagename=ia64%20floating%20point )
          +   - bundling!
          +     (we will avoid the mess that is:
          +      http://gcc.gnu.org/ml/gcc/2003-12/msg00832.html )
          +   - instruction scheduling (yep)
          +   - write truly inspirational documentation
          +   - if-conversion (predicate database/knowledge? etc etc)
          +   - counted loop support
          +   - make integer + FP mul/div more clever (we have fixed pseudocode atm)
          +   - track and use comparison complements
          + 
          + INFO:
          + 
          +   - we are strictly LP64 here, no support for ILP32 on HP-UX. Linux users
          +     don't need to worry about this.
          +   - i have instruction scheduling/bundling pseudocode, that really works
          +     (has been tested, albeit at the perl-script level).
          +     so, before you go write your own, send me an email!
          + 
          + KNOWN DEFECTS AT THE CURRENT TIME:
          + 
          +   - no varargs
          +   - alloca doesn't work (indeed, stack frame layout is bogus)
          +   - no support for big-endian environments
          +   - (not really the backend, but...) the CFE has some issues on IA64.
          +     these will probably be fixed soon.
          +   
          + ACKNOWLEDGEMENTS:
          + 
          +   - Chris Lattner (x100)
          +   - Other LLVM developers ("hey, that looks familiar")
          + 
          + CONTACT:
          + 
          +   - You can email me at duraid at octopus.com.au. If you find a small bug,
          +     just email me. If you find a big bug, please file a bug report
          +     in bugzilla! http://llvm.cs.uiuc.edu is your one stop shop for all
          +     things LLVM.
          + 
          + 
          
          
          
          
          
          From duraid at octopus.com.au  Thu Mar 17 12:23:33 2005
          From: duraid at octopus.com.au (Duraid Madina)
          Date: Thu, 17 Mar 2005 12:23:33 -0600
          Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFunction.h 
          Message-ID: <200503171823.MAA19416@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/include/llvm/CodeGen:
          
          MachineFunction.h updated: 1.49 -> 1.50
          ---
          Log message:
          
          dainty
          
          ---
          Diffs of the changes:  (+2 -1)
          
           MachineFunction.h |    3 ++-
           1 files changed, 2 insertions(+), 1 deletion(-)
          
          
          Index: llvm/include/llvm/CodeGen/MachineFunction.h
          diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.49 llvm/include/llvm/CodeGen/MachineFunction.h:1.50
          --- llvm/include/llvm/CodeGen/MachineFunction.h:1.49	Sat Jan 29 18:13:34 2005
          +++ llvm/include/llvm/CodeGen/MachineFunction.h	Thu Mar 17 12:23:22 2005
          @@ -135,7 +135,8 @@
             MachineConstantPool *getConstantPool() const { return ConstantPool; }
           
             /// MachineFunctionInfo - Keep track of various per-function pieces of
          -  /// information for the sparc backend.
          +  /// information for backends that would like to do so. (Currently,
          +  /// SPARC and IA64.)
             ///
             template
             Ty *getInfo() {
          
          
          
          
          
          From duraid at octopus.com.au  Thu Mar 17 12:29:15 2005
          From: duraid at octopus.com.au (Duraid Madina)
          Date: Thu, 17 Mar 2005 12:29:15 -0600
          Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/Makefile 
          Message-ID: <200503171829.MAA19596@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Target/IA64:
          
          Makefile updated: 1.1 -> 1.2
          ---
          Log message:
          
          build the IA64 target as a .so for now
          
          ---
          Diffs of the changes:  (+2 -0)
          
           Makefile |    2 ++
           1 files changed, 2 insertions(+)
          
          
          Index: llvm/lib/Target/IA64/Makefile
          diff -u llvm/lib/Target/IA64/Makefile:1.1 llvm/lib/Target/IA64/Makefile:1.2
          --- llvm/lib/Target/IA64/Makefile:1.1	Thu Mar 17 12:17:03 2005
          +++ llvm/lib/Target/IA64/Makefile	Thu Mar 17 12:29:04 2005
          @@ -7,6 +7,8 @@
           ##===----------------------------------------------------------------------===##
           LEVEL = ../../..
           LIBRARYNAME = LLVMIA64
          +SHARED_LIBRARY = 1
          +LOADABLE_MODULE = 1
           TARGET = IA64
           # Make sure that tblgen is run, first thing.
           BUILT_SOURCES = IA64GenRegisterInfo.h.inc IA64GenRegisterNames.inc \
          
          
          
          
          
          From duraid at octopus.com.au  Thu Mar 17 12:29:15 2005
          From: duraid at octopus.com.au (Duraid Madina)
          Date: Thu, 17 Mar 2005 12:29:15 -0600
          Subject: [llvm-commits] CVS: llvm/lib/Target/Makefile 
          Message-ID: <200503171829.MAA19592@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Target:
          
          Makefile updated: 1.22 -> 1.23
          ---
          Log message:
          
          build the IA64 target as a .so for now
          
          ---
          Diffs of the changes:  (+1 -1)
          
           Makefile |    2 +-
           1 files changed, 1 insertion(+), 1 deletion(-)
          
          
          Index: llvm/lib/Target/Makefile
          diff -u llvm/lib/Target/Makefile:1.22 llvm/lib/Target/Makefile:1.23
          --- llvm/lib/Target/Makefile:1.22	Sat Jan 22 22:34:46 2005
          +++ llvm/lib/Target/Makefile	Thu Mar 17 12:29:04 2005
          @@ -7,7 +7,7 @@
           # 
           ##===----------------------------------------------------------------------===##
           LEVEL = ../..
          -PARALLEL_DIRS = CBackend X86 SparcV8 SparcV9 PowerPC Alpha Skeleton
          +PARALLEL_DIRS = CBackend X86 SparcV8 SparcV9 PowerPC Alpha IA64 Skeleton
           LIBRARYNAME = LLVMTarget
           BUILD_ARCHIVE = 1
           
          
          
          
          
          
          From duraid at octopus.com.au  Thu Mar 17 12:37:16 2005
          From: duraid at octopus.com.au (Duraid Madina)
          Date: Thu, 17 Mar 2005 12:37:16 -0600
          Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/Makefile 
          Message-ID: <200503171837.MAA19718@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Target/IA64:
          
          Makefile updated: 1.2 -> 1.3
          ---
          Log message:
          
          OK, IA64 is statically linked into llc
          
          
          
          ---
          Diffs of the changes:  (+0 -2)
          
           Makefile |    2 --
           1 files changed, 2 deletions(-)
          
          
          Index: llvm/lib/Target/IA64/Makefile
          diff -u llvm/lib/Target/IA64/Makefile:1.2 llvm/lib/Target/IA64/Makefile:1.3
          --- llvm/lib/Target/IA64/Makefile:1.2	Thu Mar 17 12:29:04 2005
          +++ llvm/lib/Target/IA64/Makefile	Thu Mar 17 12:37:05 2005
          @@ -7,8 +7,6 @@
           ##===----------------------------------------------------------------------===##
           LEVEL = ../../..
           LIBRARYNAME = LLVMIA64
          -SHARED_LIBRARY = 1
          -LOADABLE_MODULE = 1
           TARGET = IA64
           # Make sure that tblgen is run, first thing.
           BUILT_SOURCES = IA64GenRegisterInfo.h.inc IA64GenRegisterNames.inc \
          
          
          
          
          
          From lattner at cs.uiuc.edu  Thu Mar 17 12:39:22 2005
          From: lattner at cs.uiuc.edu (Chris Lattner)
          Date: Thu, 17 Mar 2005 12:39:22 -0600
          Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile 
          Message-ID: <200503171839.j2HIdMRh025277@apoc.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/tools/llc:
          
          Makefile updated: 1.67 -> 1.68
          ---
          Log message:
          
          statically link ia64 into llc
          
          
          ---
          Diffs of the changes:  (+1 -0)
          
           Makefile |    1 +
           1 files changed, 1 insertion(+)
          
          
          Index: llvm/tools/llc/Makefile
          diff -u llvm/tools/llc/Makefile:1.67 llvm/tools/llc/Makefile:1.68
          --- llvm/tools/llc/Makefile:1.67	Tue Feb 15 15:14:09 2005
          +++ llvm/tools/llc/Makefile	Thu Mar 17 12:39:06 2005
          @@ -17,6 +17,7 @@
           	LLVMSparcV9 \
           	LLVMX86 \
           	LLVMAlpha \
          +	LLVMIA64 \
           	LLVMSkeleton \
           	LLVMSparcV9RegAlloc \
           	LLVMSparcV9InstrSched \
          
          
          
          
          
          From duraid at octopus.com.au  Thu Mar 17 12:57:13 2005
          From: duraid at octopus.com.au (Duraid Madina)
          Date: Thu, 17 Mar 2005 12:57:13 -0600
          Subject: [llvm-commits] CVS: llvm/CREDITS.TXT 
          Message-ID: <200503171857.MAA21363@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm:
          
          CREDITS.TXT updated: 1.37 -> 1.38
          ---
          Log message:
          
          now the angry bug reports have somewhere to go!
          
          ---
          Diffs of the changes:  (+5 -0)
          
           CREDITS.TXT |    5 +++++
           1 files changed, 5 insertions(+)
          
          
          Index: llvm/CREDITS.TXT
          diff -u llvm/CREDITS.TXT:1.37 llvm/CREDITS.TXT:1.38
          --- llvm/CREDITS.TXT:1.37	Sat Feb 19 11:14:24 2005
          +++ llvm/CREDITS.TXT	Thu Mar 17 12:57:02 2005
          @@ -81,6 +81,11 @@
           W: http://www.lenharth.org/~andrewl/
           D: Alpha backend
           
          +N: Duraid Madina
          +E: duraid at octopus.com.au
          +W: http://kinoko.c.u-tokyo.ac.jp/~duraid/
          +D: IA64 backend
          +
           N: Michael McCracken
           E: michael.mccracken at gmail.com
           D: Line number support for llvmgcc
          
          
          
          
          
          From duraid at octopus.com.au  Thu Mar 17 13:00:51 2005
          From: duraid at octopus.com.au (Duraid Madina)
          Date: Thu, 17 Mar 2005 13:00:51 -0600
          Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64ISelPattern.cpp 
          Message-ID: <200503171900.NAA25583@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Target/IA64:
          
          IA64ISelPattern.cpp updated: 1.1 -> 1.2
          ---
          Log message:
          
          clean up warnings when building in release mode
          
          ---
          Diffs of the changes:  (+2 -0)
          
           IA64ISelPattern.cpp |    2 ++
           1 files changed, 2 insertions(+)
          
          
          Index: llvm/lib/Target/IA64/IA64ISelPattern.cpp
          diff -u llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.1 llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.2
          --- llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.1	Thu Mar 17 12:17:03 2005
          +++ llvm/lib/Target/IA64/IA64ISelPattern.cpp	Thu Mar 17 13:00:40 2005
          @@ -319,6 +319,7 @@
                          const Type *ArgTy, SelectionDAG &DAG) {
            
             assert(0 && "LowerVAArgNext not done yet!\n");
          +  abort();
           }
                          
           
          @@ -327,6 +328,7 @@
                                   SelectionDAG &DAG) {
           
             assert(0 && "LowerFrameReturnAddress not done yet\n");
          +  abort();
           }
           
           
          
          
          
          
          
          From lattner at cs.uiuc.edu  Thu Mar 17 13:56:35 2005
          From: lattner at cs.uiuc.edu (Chris Lattner)
          Date: Thu, 17 Mar 2005 13:56:35 -0600
          Subject: [llvm-commits] 
          	CVS: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp
          Message-ID: <200503171956.j2HJuZqN007341@apoc.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Analysis/DataStructure:
          
          DataStructureAA.cpp updated: 1.23 -> 1.24
          ---
          Log message:
          
          Two changes:
            1. Chain to the parent implementation of M/R analysis if we can't find
               any information.  It has some heuristics that often do well.
            2. Do not clear all flags, this can make invalid nodes by turning nodes
               that used to be collapsed into non-collapsed nodes (fixing crashes)
          
          
          ---
          Diffs of the changes:  (+3 -3)
          
           DataStructureAA.cpp |    6 +++---
           1 files changed, 3 insertions(+), 3 deletions(-)
          
          
          Index: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp
          diff -u llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.23 llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.24
          --- llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.23	Mon Jan 24 14:00:14 2005
          +++ llvm/lib/Analysis/DataStructure/DataStructureAA.cpp	Thu Mar 17 13:56:18 2005
          @@ -174,13 +174,13 @@
           AliasAnalysis::ModRefResult
           DSAA::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
             Function *F = CS.getCalledFunction();
          -  if (!F) return pointsToConstantMemory(P) ? Ref : ModRef;
          -  if (F->isExternal()) return ModRef;
          +  if (!F || F->isExternal())
          +    return AliasAnalysis::getModRefInfo(CS, P, Size);
           
             // Clone the function TD graph, clearing off Mod/Ref flags
             const Function *csParent = CS.getInstruction()->getParent()->getParent();
             DSGraph TDGraph(TD->getDSGraph(*csParent));
          -  TDGraph.maskNodeTypes(0);
          +  TDGraph.maskNodeTypes(~(DSNode::Modified|DSNode::Read));
             
             // Insert the callee's BU graph into the TD graph
             const DSGraph &BUGraph = BU->getDSGraph(*F);
          
          
          
          
          
          From lattner at cs.uiuc.edu  Thu Mar 17 13:57:09 2005
          From: lattner at cs.uiuc.edu (Chris Lattner)
          Date: Thu, 17 Mar 2005 13:57:09 -0600
          Subject: [llvm-commits] 
          	CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp
          Message-ID: <200503171957.j2HJv9Al007415@apoc.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Analysis/DataStructure:
          
          DataStructure.cpp updated: 1.208 -> 1.209
          ---
          Log message:
          
          Clean up some code, handle null pointer specially to avoid an assertion
          
          
          ---
          Diffs of the changes:  (+10 -6)
          
           DataStructure.cpp |   16 ++++++++++------
           1 files changed, 10 insertions(+), 6 deletions(-)
          
          
          Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
          diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.208 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.209
          --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.208	Wed Mar 16 23:25:34 2005
          +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Thu Mar 17 13:56:56 2005
          @@ -12,6 +12,7 @@
           //===----------------------------------------------------------------------===//
           
           #include "llvm/Analysis/DataStructure/DSGraphTraits.h"
          +#include "llvm/Constants.h"
           #include "llvm/Function.h"
           #include "llvm/GlobalVariable.h"
           #include "llvm/Instructions.h"
          @@ -424,10 +425,6 @@
               // hit the other code path here.  If the other code path decides it's not
               // ok, it will collapse the node as appropriate.
               //
          -    const Type *OldTy = Ty;
          -    Ty = NewTy;
          -    NodeType &= ~Array;
          -    if (WillBeArray) NodeType |= Array;
           
               // If this node would have to have an unreasonable number of fields, just
               // collapse it.  This can occur for fortran common blocks, which have stupid
          @@ -438,10 +435,14 @@
                 return true;
               }
           
          +    const Type *OldTy = Ty;
          +    Ty = NewTy;
          +    NodeType &= ~Array;
          +    if (WillBeArray) NodeType |= Array;
               Size = NewTySize;
           
               // Must grow links to be the appropriate size...
          -    Links.resize((Size+DS::PointerSize-1) >> DS::PointerShift);
          +    Links.resize(NumFields);
           
               // Merge in the old type now... which is guaranteed to be smaller than the
               // "current" type.
          @@ -1446,7 +1447,10 @@
             // Calculate the arguments vector...
             for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I)
               if (isPointerType((*I)->getType()))
          -      Args.push_back(getNodeForValue(*I));
          +      if (isa(*I))
          +        Args.push_back(DSNodeHandle());
          +      else
          +        Args.push_back(getNodeForValue(*I));
           
             // Add a new function call entry...
             if (Function *F = CS.getCalledFunction())
          
          
          
          
          
          From lattner at cs.uiuc.edu  Thu Mar 17 13:59:18 2005
          From: lattner at cs.uiuc.edu (Chris Lattner)
          Date: Thu, 17 Mar 2005 13:59:18 -0600
          Subject: [llvm-commits] CVS: llvm-test/TEST.dsprecision.Makefile
          	TEST.dsprecision.report 
          Message-ID: <200503171959.j2HJxIhW007458@apoc.cs.uiuc.edu>
          
          
          
          Changes in directory llvm-test:
          
          TEST.dsprecision.Makefile added (r1.1)
          TEST.dsprecision.report added (r1.1)
          ---
          Log message:
          
          add a report for comparing the AA and mod/ref precision of basic-aa,
          steensgaards, steensgaards with field sensitivity, and DSA.
          
          
          ---
          Diffs of the changes:  (+96 -0)
          
           TEST.dsprecision.Makefile |   51 ++++++++++++++++++++++++++++++++++++++++++++++
           TEST.dsprecision.report   |   45 ++++++++++++++++++++++++++++++++++++++++
           2 files changed, 96 insertions(+)
          
          
          Index: llvm-test/TEST.dsprecision.Makefile
          diff -c /dev/null llvm-test/TEST.dsprecision.Makefile:1.1
          *** /dev/null	Thu Mar 17 13:59:15 2005
          --- llvm-test/TEST.dsprecision.Makefile	Thu Mar 17 13:59:05 2005
          ***************
          *** 0 ****
          --- 1,51 ----
          + ##===- TEST.dsprecision.Makefile ---------------------------*- Makefile -*-===##
          + #
          + # This recursively traverses the programs, running -aa-eval on them with various
          + # different aa implementations.
          + #
          + ##===----------------------------------------------------------------------===##
          + 
          + RELDIR  := $(subst $(PROJ_OBJ_ROOT),,$(PROJ_OBJ_DIR))
          + 
          + # We require the programs to be linked with libdummy
          + include $(LEVEL)/Makefile.dummylib
          + 
          + $(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \
          + Output/%.$(TEST).report.txt: Output/%.lib.bc $(LOPT)
          + 	@echo > $@
          + 	-($(LOPT) -basicaa -aa-eval -disable-output $<) > Output/$*.basicaa.out 2>&1
          + 	@echo -n "BASIC MA: " >> $@
          + 	- at grep 'may alias responses' Output/$*.basicaa.out >> $@
          + 	@echo -n "BASIC MR: " >> $@
          + 	- at grep 'mod & ref responses' Output/$*.basicaa.out >> $@
          + 	@
          + 	-($(LOPT) -steens-aa -disable-ds-field-sensitivity -aa-eval \
          +                            -disable-output $<) > Output/$*.steensfiaa.out 2>&1
          + 	@echo -n "STEENS-FI MA: " >> $@
          + 	- at grep 'may alias responses' Output/$*.steensfiaa.out >> $@
          + 	@echo -n "STEENS-FI MR: " >> $@
          + 	- at grep 'mod & ref responses' Output/$*.steensfiaa.out >> $@
          + 	@
          + 	-($(LOPT) -steens-aa -aa-eval -disable-output $<) > Output/$*.steensfsaa.out 2>&1
          + 	@echo -n "STEENS-FS MA: " >> $@
          + 	- at grep 'may alias responses' Output/$*.steensfsaa.out >> $@
          + 	@echo -n "STEENS-FS MR: " >> $@
          + 	- at grep 'mod & ref responses' Output/$*.steensfsaa.out >> $@
          + 	-($(LOPT) -ds-aa -aa-eval -disable-output $<) > Output/$*.dsaa.out 2>&1
          + 	@echo -n "DS MA: " >> $@
          + 	- at grep 'may alias responses' Output/$*.dsaa.out >> $@
          + 	@echo -n "DS MR: " >> $@
          + 	- at grep 'mod & ref responses' Output/$*.dsaa.out >> $@
          + 
          + $(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
          + test.$(TEST).%: Output/%.$(TEST).report.txt
          + 	@echo "---------------------------------------------------------------"
          + 	@echo ">>> ========= '$(RELDIR)/$*' Program"
          + 	@echo "---------------------------------------------------------------"
          + 	@cat $<
          + 
          + # Define REPORT_DEPENDENCIES so that the report is regenerated if analyze or
          + # dummylib is updated.
          + #
          + REPORT_DEPENDENCIES := $(DUMMYLIB) $(LOPT)
          + 
          
          
          Index: llvm-test/TEST.dsprecision.report
          diff -c /dev/null llvm-test/TEST.dsprecision.report:1.1
          *** /dev/null	Thu Mar 17 13:59:18 2005
          --- llvm-test/TEST.dsprecision.report	Thu Mar 17 13:59:05 2005
          ***************
          *** 0 ****
          --- 1,45 ----
          + ##=== TEST.dsprecision.report - Report for precision tests -----*- perl -*-===##
          + #
          + # This file defines a report to be generated for the precision comparison
          + # test.
          + #
          + ##===----------------------------------------------------------------------===##
          + 
          + # Helper function
          + sub Ratio {
          +   my ($Cols, $Col) = @_;
          +   if ($Cols->[$Col-2] ne "*" and
          +       $Cols->[$Col-2] != "0") {
          +     return $Cols->[$Col-1]/$Cols->[$Col-2];
          +   } else {
          +     return "n/a";
          +   }
          + }
          + 
          + $SortCol = 0;
          + #$SortNumeric = 1;
          + $TrimRepeatedPrefix = 1;
          + 
          + # Sort in ascending order
          + $SortReverse = 0;
          + 
          + # These are the columns for the report.  The first entry is the header for the
          + # column, the second is the regex to use to match the value.  Empty list create
          + # seperators, and closures may be put in for custom processing.
          + (
          + # Name
          +             ["Name:",     '\'([^\']+)\' Program'],
          +             [],
          + # AA Precision
          +             ["basic",     'BASIC MA:.* \((.*)\)'],
          +             ["steens-fi", 'STEENS-FI MA:.* \((.*)\)'],
          +             ["steens-fs", 'STEENS-FS MA:.* \((.*)\)'],
          +             ["ds",        'DS MA:.* \((.*)\)'],
          +             [],
          + # MR Precision
          +             ["basic",     'BASIC MR:.* \((.*)\)'],
          +             ["steens-fi", 'STEENS-FI MR:.* \((.*)\)'],
          +             ["steens-fs", 'STEENS-FS MR:.* \((.*)\)'],
          +             ["ds",        'DS MR:.* \((.*)\)'],
          +             [],
          + );
          
          
          
          
          
          From lattner at cs.uiuc.edu  Thu Mar 17 14:17:11 2005
          From: lattner at cs.uiuc.edu (Chris Lattner)
          Date: Thu, 17 Mar 2005 14:17:11 -0600
          Subject: [llvm-commits] 
          	CVS: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp
          Message-ID: <200503172017.j2HKHBoT008243@apoc.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Analysis/DataStructure:
          
          DataStructureAA.cpp updated: 1.24 -> 1.25
          ---
          Log message:
          
          simplify this function a bit, allow DS-AA to build on/improve the mod/ref
          results returned by AA, not just use one or the other.
          
          
          ---
          Diffs of the changes:  (+11 -8)
          
           DataStructureAA.cpp |   19 +++++++++++--------
           1 files changed, 11 insertions(+), 8 deletions(-)
          
          
          Index: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp
          diff -u llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.24 llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.25
          --- llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.24	Thu Mar 17 13:56:18 2005
          +++ llvm/lib/Analysis/DataStructure/DataStructureAA.cpp	Thu Mar 17 14:16:58 2005
          @@ -173,9 +173,11 @@
           ///
           AliasAnalysis::ModRefResult
           DSAA::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
          +  AliasAnalysis::ModRefResult Result =AliasAnalysis::getModRefInfo(CS, P, Size);
             Function *F = CS.getCalledFunction();
          -  if (!F || F->isExternal())
          -    return AliasAnalysis::getModRefInfo(CS, P, Size);
          +
          +  if (!F || F->isExternal() || Result == NoModRef)
          +    return Result;
           
             // Clone the function TD graph, clearing off Mod/Ref flags
             const Function *csParent = CS.getInstruction()->getParent()->getParent();
          @@ -189,12 +191,13 @@
           
             // Report the flags that have been added
             const DSNodeHandle &DSH = TDGraph.getNodeForValue(P);
          -  if (const DSNode *N = DSH.getNode())
          -    if (N->isModified())
          -      return N->isRead() ? ModRef : Mod;
          -    else
          -      return N->isRead() ? Ref : NoModRef;
          -  return NoModRef;
          +  if (const DSNode *N = DSH.getNode()) {
          +    if (!N->isModified())   // We proved it was not modified.
          +      Result = ModRefResult(Result & ~Mod);
          +    if (!N->isRead())       // We proved it was not read.
          +      Result = ModRefResult(Result & ~Ref);
          +  }
          +  return Result;
           }
           
           
          
          
          
          
          
          From duraid at octopus.com.au  Thu Mar 17 14:23:38 2005
          From: duraid at octopus.com.au (Duraid Madina)
          Date: Thu, 17 Mar 2005 14:23:38 -0600
          Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/README 
          Message-ID: <200503172023.OAA29889@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Target/IA64:
          
          README updated: 1.1 -> 1.2
          ---
          Log message:
          
          typo/denial
          
          ---
          Diffs of the changes:  (+1 -1)
          
           README |    2 +-
           1 files changed, 1 insertion(+), 1 deletion(-)
          
          
          Index: llvm/lib/Target/IA64/README
          diff -u llvm/lib/Target/IA64/README:1.1 llvm/lib/Target/IA64/README:1.2
          --- llvm/lib/Target/IA64/README:1.1	Thu Mar 17 12:17:03 2005
          +++ llvm/lib/Target/IA64/README	Thu Mar 17 14:23:27 2005
          @@ -1,4 +1,4 @@
          -*** README for the LLVM IA64 Backend "Version 0.01" - March 18, 2004           
          +*** README for the LLVM IA64 Backend "Version 0.01" - March 18, 2005
           *** Quote for this version:
           
                 "Kaori and Hitomi are naughty!!"
          
          
          
          
          
          From lattner at cs.uiuc.edu  Thu Mar 17 14:25:20 2005
          From: lattner at cs.uiuc.edu (Chris Lattner)
          Date: Thu, 17 Mar 2005 14:25:20 -0600
          Subject: [llvm-commits] CVS: llvm/lib/Analysis/AliasAnalysisEvaluator.cpp 
          Message-ID: <200503172025.j2HKPKuw009012@apoc.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Analysis:
          
          AliasAnalysisEvaluator.cpp updated: 1.22 -> 1.23
          ---
          Log message:
          
          Do not include the Function* for direct call/invoke instructions in the
          alias evaluation.  Clients really don't care.
          
          
          ---
          Diffs of the changes:  (+6 -1)
          
           AliasAnalysisEvaluator.cpp |    7 ++++++-
           1 files changed, 6 insertions(+), 1 deletion(-)
          
          
          Index: llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
          diff -u llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.22 llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.23
          --- llvm/lib/Analysis/AliasAnalysisEvaluator.cpp:1.22	Mon Mar 14 22:54:15 2005
          +++ llvm/lib/Analysis/AliasAnalysisEvaluator.cpp	Thu Mar 17 14:25:04 2005
          @@ -109,7 +109,12 @@
             for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
               if (isa(I->getType())) // Add all pointer instructions
                 Pointers.insert(&*I);
          -    for (User::op_iterator OI = (*I).op_begin(); OI != (*I).op_end(); ++OI)
          +    Instruction &Inst = *I;
          +    User::op_iterator OI = Inst.op_begin();
          +    if ((isa(Inst) || isa(Inst)) &&
          +        isa(Inst.getOperand(0)))
          +      ++OI;  // Skip actual functions for direct function calls.
          +    for (; OI != Inst.op_end(); ++OI)
                 if (isa((*OI)->getType()))
                   Pointers.insert(*OI);
           
          
          
          
          
          
          From lattner at cs.uiuc.edu  Thu Mar 17 14:33:40 2005
          From: lattner at cs.uiuc.edu (Chris Lattner)
          Date: Thu, 17 Mar 2005 14:33:40 -0600
          Subject: [llvm-commits] 
          	CVS: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp
          Message-ID: <200503172033.j2HKXeIv013620@apoc.cs.uiuc.edu>
          
          
          
          Changes in directory llvm/lib/Analysis/DataStructure:
          
          DataStructureAA.cpp updated: 1.25 -> 1.26
          ---
          Log message:
          
          add some possibly bogus assertions.
          
          
          ---
          Diffs of the changes:  (+10 -0)
          
           DataStructureAA.cpp |   10 ++++++++++
           1 files changed, 10 insertions(+)
          
          
          Index: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp
          diff -u llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.25 llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.26
          --- llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.25	Thu Mar 17 14:16:58 2005
          +++ llvm/lib/Analysis/DataStructure/DataStructureAA.cpp	Thu Mar 17 14:33:27 2005
          @@ -12,6 +12,8 @@
           //
           //===----------------------------------------------------------------------===//
           
          +#include "llvm/Constants.h"
          +#include "llvm/DerivedTypes.h"
           #include "llvm/Module.h"
           #include "llvm/Analysis/AliasAnalysis.h"
           #include "llvm/Analysis/Passes.h"
          @@ -196,6 +198,14 @@
                 Result = ModRefResult(Result & ~Mod);
               if (!N->isRead())       // We proved it was not read.
                 Result = ModRefResult(Result & ~Ref);
          +  } else {
          +    if (isa(P))
          +      Result = NoModRef;
          +    else
          +      assert(isa(P) &&
          +    cast(P)->getType()->getElementType()->isFirstClassType() &&
          +             "This isn't a global that DSA inconsiderately dropped "
          +             "from the graph?");
             }
             return Result;
           }
          
          
          
          
          
          From brukman at cs.uiuc.edu  Thu Mar 17 14:56:32 2005
          From: brukman at cs.uiuc.edu (Misha Brukman)
          Date: Thu, 17 Mar 2005 14:56:32 -0600
          Subject: [llvm-commits] CVS: llvm/configure 
          Message-ID: <200503172056.OAA30365@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm:
          
          configure updated: 1.176 -> 1.177
          ---
          Log message:
          
          Recognize an IA64 when we see one
          
          
          ---
          Diffs of the changes:  (+30 -29)
          
           configure |   59 ++++++++++++++++++++++++++++++-----------------------------
           1 files changed, 30 insertions(+), 29 deletions(-)
          
          
          Index: llvm/configure
          diff -u llvm/configure:1.176 llvm/configure:1.177
          --- llvm/configure:1.176	Thu Feb 24 13:05:19 2005
          +++ llvm/configure	Thu Mar 17 14:56:21 2005
          @@ -1791,6 +1791,7 @@
             sparc*-*)               llvm_cv_target_arch="Sparc" ;;
             powerpc*-*)             llvm_cv_target_arch="PowerPC" ;;
             alpha*-*)               llvm_cv_target_arch="Alpha" ;;
          +  ia64-*)                 llvm_cv_target_arch="IA64" ;;
             *)                      llvm_cv_target_arch="Unknown" ;;
           esac
           fi
          @@ -8186,7 +8187,7 @@
             lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
             lt_status=$lt_dlunknown
             cat > conftest.$ac_ext < conftest.$ac_ext
          +  echo '#line 10181 "configure"' > conftest.$ac_ext
             if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
             (eval $ac_compile) 2>&5
             ac_status=$?
          @@ -10662,7 +10663,7 @@
           
           
           # Provide some information about the compiler.
          -echo "$as_me:10665:" \
          +echo "$as_me:10666:" \
                "checking for Fortran 77 compiler version" >&5
           ac_compiler=`set X $ac_compile; echo $2`
           { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5
          @@ -11719,11 +11720,11 @@
              -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
              -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
              -e 's:$: $lt_compiler_flag:'`
          -   (eval echo "\"\$as_me:11722: $lt_compile\"" >&5)
          +   (eval echo "\"\$as_me:11723: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>conftest.err)
              ac_status=$?
              cat conftest.err >&5
          -   echo "$as_me:11726: \$? = $ac_status" >&5
          +   echo "$as_me:11727: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s "$ac_outfile"; then
                # The compiler can only warn and ignore the option if not recognized
                # So say no if there are warnings
          @@ -11962,11 +11963,11 @@
              -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
              -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
              -e 's:$: $lt_compiler_flag:'`
          -   (eval echo "\"\$as_me:11965: $lt_compile\"" >&5)
          +   (eval echo "\"\$as_me:11966: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>conftest.err)
              ac_status=$?
              cat conftest.err >&5
          -   echo "$as_me:11969: \$? = $ac_status" >&5
          +   echo "$as_me:11970: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s "$ac_outfile"; then
                # The compiler can only warn and ignore the option if not recognized
                # So say no if there are warnings
          @@ -12022,11 +12023,11 @@
              -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
              -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
              -e 's:$: $lt_compiler_flag:'`
          -   (eval echo "\"\$as_me:12025: $lt_compile\"" >&5)
          +   (eval echo "\"\$as_me:12026: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>out/conftest.err)
              ac_status=$?
              cat out/conftest.err >&5
          -   echo "$as_me:12029: \$? = $ac_status" >&5
          +   echo "$as_me:12030: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s out/conftest2.$ac_objext
              then
                # The compiler can only warn and ignore the option if not recognized
          @@ -14207,7 +14208,7 @@
             lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
             lt_status=$lt_dlunknown
             cat > conftest.$ac_ext < conftest.$ac_ext <&5)
          +   (eval echo "\"\$as_me:16502: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>conftest.err)
              ac_status=$?
              cat conftest.err >&5
          -   echo "$as_me:16505: \$? = $ac_status" >&5
          +   echo "$as_me:16506: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s "$ac_outfile"; then
                # The compiler can only warn and ignore the option if not recognized
                # So say no if there are warnings
          @@ -16558,11 +16559,11 @@
              -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
              -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
              -e 's:$: $lt_compiler_flag:'`
          -   (eval echo "\"\$as_me:16561: $lt_compile\"" >&5)
          +   (eval echo "\"\$as_me:16562: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>out/conftest.err)
              ac_status=$?
              cat out/conftest.err >&5
          -   echo "$as_me:16565: \$? = $ac_status" >&5
          +   echo "$as_me:16566: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s out/conftest2.$ac_objext
              then
                # The compiler can only warn and ignore the option if not recognized
          @@ -17919,7 +17920,7 @@
             lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
             lt_status=$lt_dlunknown
             cat > conftest.$ac_ext < conftest.$ac_ext <&5)
          +   (eval echo "\"\$as_me:18858: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>conftest.err)
              ac_status=$?
              cat conftest.err >&5
          -   echo "$as_me:18861: \$? = $ac_status" >&5
          +   echo "$as_me:18862: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s "$ac_outfile"; then
                # The compiler can only warn and ignore the option if not recognized
                # So say no if there are warnings
          @@ -18914,11 +18915,11 @@
              -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
              -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
              -e 's:$: $lt_compiler_flag:'`
          -   (eval echo "\"\$as_me:18917: $lt_compile\"" >&5)
          +   (eval echo "\"\$as_me:18918: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>out/conftest.err)
              ac_status=$?
              cat out/conftest.err >&5
          -   echo "$as_me:18921: \$? = $ac_status" >&5
          +   echo "$as_me:18922: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s out/conftest2.$ac_objext
              then
                # The compiler can only warn and ignore the option if not recognized
          @@ -20953,11 +20954,11 @@
              -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
              -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
              -e 's:$: $lt_compiler_flag:'`
          -   (eval echo "\"\$as_me:20956: $lt_compile\"" >&5)
          +   (eval echo "\"\$as_me:20957: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>conftest.err)
              ac_status=$?
              cat conftest.err >&5
          -   echo "$as_me:20960: \$? = $ac_status" >&5
          +   echo "$as_me:20961: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s "$ac_outfile"; then
                # The compiler can only warn and ignore the option if not recognized
                # So say no if there are warnings
          @@ -21196,11 +21197,11 @@
              -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
              -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
              -e 's:$: $lt_compiler_flag:'`
          -   (eval echo "\"\$as_me:21199: $lt_compile\"" >&5)
          +   (eval echo "\"\$as_me:21200: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>conftest.err)
              ac_status=$?
              cat conftest.err >&5
          -   echo "$as_me:21203: \$? = $ac_status" >&5
          +   echo "$as_me:21204: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s "$ac_outfile"; then
                # The compiler can only warn and ignore the option if not recognized
                # So say no if there are warnings
          @@ -21256,11 +21257,11 @@
              -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
              -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
              -e 's:$: $lt_compiler_flag:'`
          -   (eval echo "\"\$as_me:21259: $lt_compile\"" >&5)
          +   (eval echo "\"\$as_me:21260: $lt_compile\"" >&5)
              (eval "$lt_compile" 2>out/conftest.err)
              ac_status=$?
              cat out/conftest.err >&5
          -   echo "$as_me:21263: \$? = $ac_status" >&5
          +   echo "$as_me:21264: \$? = $ac_status" >&5
              if (exit $ac_status) && test -s out/conftest2.$ac_objext
              then
                # The compiler can only warn and ignore the option if not recognized
          @@ -23441,7 +23442,7 @@
             lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
             lt_status=$lt_dlunknown
             cat > conftest.$ac_ext < conftest.$ac_ext <
          
          
          
          Changes in directory llvm/autoconf:
          
          configure.ac updated: 1.170 -> 1.171
          ---
          Log message:
          
          Recognize an IA64 when we see one
          
          
          ---
          Diffs of the changes:  (+1 -0)
          
           configure.ac |    1 +
           1 files changed, 1 insertion(+)
          
          
          Index: llvm/autoconf/configure.ac
          diff -u llvm/autoconf/configure.ac:1.170 llvm/autoconf/configure.ac:1.171
          --- llvm/autoconf/configure.ac:1.170	Thu Feb 24 12:31:27 2005
          +++ llvm/autoconf/configure.ac	Thu Mar 17 14:56:22 2005
          @@ -175,6 +175,7 @@
             sparc*-*)               llvm_cv_target_arch="Sparc" ;;
             powerpc*-*)             llvm_cv_target_arch="PowerPC" ;;
             alpha*-*)               llvm_cv_target_arch="Alpha" ;;
          +  ia64-*)                 llvm_cv_target_arch="IA64" ;;
             *)                      llvm_cv_target_arch="Unknown" ;;
           esac])
           
          
          
          
          
          
          From brukman at cs.uiuc.edu  Thu Mar 17 16:20:38 2005
          From: brukman at cs.uiuc.edu (Misha Brukman)
          Date: Thu, 17 Mar 2005 16:20:38 -0600
          Subject: [llvm-commits] CVS: llvm-www/OpenProjects.html 
          Message-ID: <200503172220.QAA31556@zion.cs.uiuc.edu>
          
          
          
          Changes in directory llvm-www:
          
          OpenProjects.html updated: 1.4 -> 1.5
          ---
          Log message:
          
          Add some architecture reference links
          
          
          ---
          Diffs of the changes:  (+5 -2)
          
           OpenProjects.html |    7 +++++--
           1 files changed, 5 insertions(+), 2 deletions(-)
          
          
          Index: llvm-www/OpenProjects.html
          diff -u llvm-www/OpenProjects.html:1.4 llvm-www/OpenProjects.html:1.5
          --- llvm-www/OpenProjects.html:1.4	Tue Mar 15 09:28:41 2005
          +++ llvm-www/OpenProjects.html	Thu Mar 17 16:20:27 2005
          @@ -311,7 +311,10 @@
               used to implement a bottom-up analysis that will determine the *actual* 
               registers clobbered by a function. Use the pass to fine tune register usage 
               in callers based on *actual* registers used by the callee.
          -
        • Write a new backend for a target (ARM? MIPS? MMIX?)
        • +
        • Write a new backend for a target +(ARM? + MIPS? + MMIX?)
        • Improve the usefulness and utility of the Skeleton target backend:
          • Convert the non-functional Skeleton target to become an abstract machine @@ -370,7 +373,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
            - Last modified: $Date: 2005/03/15 15:28:41 $ + Last modified: $Date: 2005/03/17 22:20:27 $ From lattner at cs.uiuc.edu Thu Mar 17 17:45:51 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 17:45:51 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200503172345.j2HNjptH018553@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.93 -> 1.94 --- Log message: add 3 methods --- Diffs of the changes: (+8 -0) DSGraph.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.93 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.94 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.93 Wed Mar 16 16:42:01 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Thu Mar 17 17:45:35 2005 @@ -106,6 +106,8 @@ typedef GlobalSetTy::const_iterator global_iterator; global_iterator global_begin() const { return GlobalSet.begin(); } global_iterator global_end() const { return GlobalSet.end(); } + unsigned global_size() const { return GlobalSet.size(); } + unsigned global_count(GlobalValue *GV) const { return GlobalSet.count(GV); } }; @@ -399,6 +401,12 @@ /// graph to nodes in this graph. void computeGGToGMapping(InvNodeMapTy &InvNodeMap); + /// computeCalleeCallerMapping - Given a call from a function in the current + /// graph to the 'Callee' function (which lives in 'CalleeGraph'), compute the + /// mapping of nodes from the callee to nodes in the caller. + void computeCalleeCallerMapping(DSCallSite CS, const Function &Callee, + DSGraph &CalleeGraph, NodeMapTy &NodeMap); + /// cloneInto - Clone the specified DSGraph into the current graph. The /// translated ScalarMap for the old function is filled into the OldValMap /// member, and the translated ReturnNodes map is returned into ReturnNodes. From lattner at cs.uiuc.edu Thu Mar 17 17:46:07 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 17:46:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503172346.j2HNk7PQ018567@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.209 -> 1.210 --- Log message: implement a new method. --- Diffs of the changes: (+36 -0) DataStructure.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.209 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.210 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.209 Thu Mar 17 13:56:56 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Mar 17 17:45:54 2005 @@ -2141,3 +2141,39 @@ } } + +/// computeCalleeCallerMapping - Given a call from a function in the current +/// graph to the 'Callee' function (which lives in 'CalleeGraph'), compute the +/// mapping of nodes from the callee to nodes in the caller. +void DSGraph::computeCalleeCallerMapping(DSCallSite CS, const Function &Callee, + DSGraph &CalleeGraph, + NodeMapTy &NodeMap) { + + DSCallSite CalleeArgs = + CalleeGraph.getCallSiteForArguments(const_cast(Callee)); + + computeNodeMapping(CalleeArgs.getRetVal(), CS.getRetVal(), NodeMap); + + unsigned NumArgs = CS.getNumPtrArgs(); + if (NumArgs > CalleeArgs.getNumPtrArgs()) + NumArgs = CalleeArgs.getNumPtrArgs(); + + for (unsigned i = 0; i != NumArgs; ++i) + computeNodeMapping(CalleeArgs.getPtrArg(i), CS.getPtrArg(i), NodeMap); + + // Map the nodes that are pointed to by globals. + DSScalarMap &CalleeSM = CalleeGraph.getScalarMap(); + DSScalarMap &CallerSM = getScalarMap(); + + if (CalleeSM.global_size() >= CallerSM.global_size()) { + for (DSScalarMap::global_iterator GI = CallerSM.global_begin(), + E = CallerSM.global_end(); GI != E; ++GI) + if (CalleeSM.global_count(*GI)) + computeNodeMapping(CalleeSM[*GI], CallerSM[*GI], NodeMap); + } else { + for (DSScalarMap::global_iterator GI = CalleeSM.global_begin(), + E = CalleeSM.global_end(); GI != E; ++GI) + if (CallerSM.global_count(*GI)) + computeNodeMapping(CalleeSM[*GI], CallerSM[*GI], NodeMap); + } +} From lattner at cs.uiuc.edu Thu Mar 17 18:21:19 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 18:21:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp Message-ID: <200503180021.j2I0LJtr024220@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructureAA.cpp updated: 1.26 -> 1.27 --- Log message: Rewrite DSAA::getModRefInfo to compute the mapping between caller and callee to determine mod/ref behavior, instead of creating a *copy* of the caller graph and inlining the callee graph into the copy. This speeds up aa-eval on Ptrdist/yacr2 from 109.13s to 3.98s, and gives identical results. The speedup is similar on other programs. --- Diffs of the changes: (+47 -24) DataStructureAA.cpp | 71 ++++++++++++++++++++++++++++++++++------------------ 1 files changed, 47 insertions(+), 24 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.26 llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.27 --- llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.26 Thu Mar 17 14:33:27 2005 +++ llvm/lib/Analysis/DataStructure/DataStructureAA.cpp Thu Mar 17 18:21:03 2005 @@ -125,15 +125,14 @@ const DSGraph::ScalarMapTy &GSM = G.getScalarMap(); DSGraph::ScalarMapTy::const_iterator I = GSM.find((Value*)V1); if (I == GSM.end()) return NoAlias; - - assert(I->second.getNode() && "Scalar map points to null node?"); + DSGraph::ScalarMapTy::const_iterator J = GSM.find((Value*)V2); if (J == GSM.end()) return NoAlias; - assert(J->second.getNode() && "Scalar map points to null node?"); - DSNode *N1 = I->second.getNode(), *N2 = J->second.getNode(); unsigned O1 = I->second.getOffset(), O2 = J->second.getOffset(); + if (N1 == 0 || N2 == 0) + return MayAlias; // Can't tell whether anything aliases null. // We can only make a judgment of one of the nodes is complete... if (N1->isComplete() || N2->isComplete()) { @@ -181,32 +180,56 @@ if (!F || F->isExternal() || Result == NoModRef) return Result; - // Clone the function TD graph, clearing off Mod/Ref flags - const Function *csParent = CS.getInstruction()->getParent()->getParent(); - DSGraph TDGraph(TD->getDSGraph(*csParent)); - TDGraph.maskNodeTypes(~(DSNode::Modified|DSNode::Read)); - - // Insert the callee's BU graph into the TD graph - const DSGraph &BUGraph = BU->getDSGraph(*F); - TDGraph.mergeInGraph(TDGraph.getDSCallSiteForCallSite(CS), - *F, BUGraph, 0); - - // Report the flags that have been added - const DSNodeHandle &DSH = TDGraph.getNodeForValue(P); - if (const DSNode *N = DSH.getNode()) { - if (!N->isModified()) // We proved it was not modified. - Result = ModRefResult(Result & ~Mod); - if (!N->isRead()) // We proved it was not read. - Result = ModRefResult(Result & ~Ref); - } else { + // Get the graphs for the callee and caller. Note that we want the BU graph + // for the callee because we don't want all caller's effects incorporated! + const Function *Caller = CS.getInstruction()->getParent()->getParent(); + DSGraph &CallerTDGraph = TD->getDSGraph(*Caller); + DSGraph &CalleeBUGraph = BU->getDSGraph(*F); + + // Figure out which node in the TD graph this pointer corresponds to. + DSScalarMap &CallerSM = CallerTDGraph.getScalarMap(); + DSScalarMap::iterator NI = CallerSM.find(P); + if (NI == CallerSM.end()) { if (isa(P)) - Result = NoModRef; - else + Result = NoModRef; // null is never modified :) + else { assert(isa(P) && cast(P)->getType()->getElementType()->isFirstClassType() && "This isn't a global that DSA inconsiderately dropped " "from the graph?"); + } + return Result; } + + const DSNode *N = NI->second.getNode(); + assert(N && "Null pointer in scalar map??"); + + // Compute the mapping from nodes in the callee graph to the nodes in the + // caller graph for this call site. + DSGraph::NodeMapTy CalleeCallerMap; + DSCallSite DSCS = CallerTDGraph.getDSCallSiteForCallSite(CS); + CallerTDGraph.computeCalleeCallerMapping(DSCS, *F, CalleeBUGraph, + CalleeCallerMap); + + // Loop over all of the nodes in the callee that correspond to "N", keeping + // track of aggregate mod/ref info. + bool NeverReads = true, NeverWrites = true; + for (DSGraph::NodeMapTy::iterator I = CalleeCallerMap.begin(), + E = CalleeCallerMap.end(); I != E; ++I) + if (I->second.getNode() == N) { + if (I->first->isModified()) + NeverWrites = false; + if (I->first->isRead()) + NeverReads = false; + if (NeverReads == false && NeverWrites == false) + return Result; + } + + if (NeverWrites) // We proved it was not modified. + Result = ModRefResult(Result & ~Mod); + if (NeverReads) // We proved it was not read. + Result = ModRefResult(Result & ~Ref); + return Result; } From lattner at cs.uiuc.edu Thu Mar 17 18:24:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 18:24:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503180024.j2I0OCwI024346@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.210 -> 1.211 --- Log message: remove a bogus optimization. This only works if there are no globals in the graph, and the combination of a function that does not reference globals, takes not arguments and returns no value is pretty rare. --- Diffs of the changes: (+0 -4) DataStructure.cpp | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.210 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.211 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.210 Thu Mar 17 17:45:54 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Mar 17 18:23:59 2005 @@ -1409,10 +1409,6 @@ /// 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); From brukman at cs.uiuc.edu Thu Mar 17 18:49:07 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Thu, 17 Mar 2005 18:49:07 -0600 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200503180049.SAA00746@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.305 -> 1.306 --- Log message: We shall have IA64 as a new experimental backend released with LLVM 1.5 --- Diffs of the changes: (+4 -4) ReleaseNotes.html | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.305 llvm/docs/ReleaseNotes.html:1.306 --- llvm/docs/ReleaseNotes.html:1.305 Fri Mar 11 00:16:26 2005 +++ llvm/docs/ReleaseNotes.html Thu Mar 17 18:48:56 2005 @@ -80,8 +80,8 @@ -ipsccp, which is run by default at link-time.
          • LLVM 1.5 is now about 15% faster than LLVM 1.4 and its core data structures use about 30% less memory.
          • -
          • LLVM includes new experimental native code generators for SparcV8 and - Alpha.
          • +
          • LLVM includes new experimental native code generators for SparcV8, + Alpha, and IA64.
          • Support for Microsoft Visual Studio is improved, and now documented.
          • @@ -242,7 +242,7 @@ be used to step through programs and inspect the stack.
          • The "iterative scan" register allocator (enabled with -regalloc=iterativescan) is not stable.
          • -
          • The SparcV8 and Alpha ports are experimental.
          • +
          • The SparcV8, Alpha, and IA64 ports are experimental.
          @@ -597,7 +597,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
          - Last modified: $Date: 2005/03/11 06:16:26 $ + Last modified: $Date: 2005/03/18 00:48:56 $ From lattner at cs.uiuc.edu Thu Mar 17 23:28:13 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 17 Mar 2005 23:28:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ProfileInfoLoaderPass.cpp Message-ID: <200503180528.j2I5SDtu028607@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ProfileInfoLoaderPass.cpp updated: 1.10 -> 1.11 --- Log message: expose this pass to both opt and analyze --- Diffs of the changes: (+3 -2) ProfileInfoLoaderPass.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/ProfileInfoLoaderPass.cpp diff -u llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.10 llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.11 --- llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.10 Sun Jan 9 21:56:27 2005 +++ llvm/lib/Analysis/ProfileInfoLoaderPass.cpp Thu Mar 17 23:27:57 2005 @@ -49,8 +49,9 @@ virtual bool runOnModule(Module &M); }; - RegisterOpt - X("profile-loader", "Load profile information from llvmprof.out"); + RegisterPass + X("profile-loader", "Load profile information from llvmprof.out", + PassInfo::Analysis|PassInfo::Optimization); RegisterAnalysisGroup Y; } // End of anonymous namespace From lattner at cs.uiuc.edu Fri Mar 18 10:12:54 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 18 Mar 2005 10:12:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200503181612.j2IGCsdJ006082@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.233 -> 1.234 --- Log message: remove use of getPrev() and getNext() on ilist nodes. --- Diffs of the changes: (+8 -5) Writer.cpp | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.233 llvm/lib/Target/CBackend/Writer.cpp:1.234 --- llvm/lib/Target/CBackend/Writer.cpp:1.233 Mon Mar 14 22:59:54 2005 +++ llvm/lib/Target/CBackend/Writer.cpp Fri Mar 18 10:12:37 2005 @@ -33,6 +33,7 @@ #include "llvm/Support/InstVisitor.h" #include "llvm/Support/Mangler.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" #include "llvm/Config/config.h" #include @@ -1246,7 +1247,7 @@ BasicBlock *Succ = cast(SI.getOperand(i+1)); printPHICopiesForSuccessor (SI.getParent(), Succ, 2); printBranchToBlock(SI.getParent(), Succ, 2); - if (Succ == SI.getParent()->getNext()) + if (Succ == next(Function::iterator(SI.getParent()))) Out << " break;\n"; } Out << " }\n"; @@ -1260,12 +1261,11 @@ /// FIXME: This should be reenabled, but loop reordering safe!! return true; - if (From->getNext() != To) // Not the direct successor, we need a goto - return true; + if (next(Function::iterator(From)) != Function::iterator(To)) + return true; // Not the direct successor, we need a goto. //isa(From->getTerminator()) - if (LI->getLoopFor(From) != LI->getLoopFor(To)) return true; return false; @@ -1443,7 +1443,10 @@ break; default: // All other intrinsic calls we must lower. - Instruction *Before = CI->getPrev(); + Instruction *Before = 0; + if (CI != &BB->front()) + Before = prior(BasicBlock::iterator(CI)); + IL.LowerIntrinsicCall(CI); if (Before) { // Move iterator to instruction after call I = Before; ++I; From lattner at cs.uiuc.edu Fri Mar 18 17:18:36 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 18 Mar 2005 17:18:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200503182318.j2INIa41010704@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.126 -> 1.127 --- Log message: another fastpath --- Diffs of the changes: (+2 -1) Local.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.126 llvm/lib/Analysis/DataStructure/Local.cpp:1.127 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.126 Mon Mar 14 22:54:18 2005 +++ llvm/lib/Analysis/DataStructure/Local.cpp Fri Mar 18 17:18:20 2005 @@ -349,7 +349,8 @@ // If all of the indices are zero, the result points to the operand without // applying the type. - if (AllZeros) { + if (AllZeros || (!Value.isNull() && + Value.getNode()->isNodeCompletelyFolded())) { setDestTo(GEP, Value); return; } From lattner at cs.uiuc.edu Fri Mar 18 17:20:02 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 18 Mar 2005 17:20:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp CompleteBottomUp.cpp EquivClassGraphs.cpp Message-ID: <200503182320.j2INK2Wt010726@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.97 -> 1.98 CompleteBottomUp.cpp updated: 1.21 -> 1.22 EquivClassGraphs.cpp updated: 1.32 -> 1.33 --- Log message: do not bother inlining nullary functions without return values. The only effect these calls can have is due to global variables, and these passes all use the globals graph to capture their effect anyway. This speeds up the BU pass very slightly on perlbmk, reducing the number of dsnodes allocated from 98913 to 96423. --- Diffs of the changes: (+15 -1) BottomUpClosure.cpp | 7 +++++++ CompleteBottomUp.cpp | 6 +++++- EquivClassGraphs.cpp | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.97 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.98 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.97 Tue Mar 15 16:10:04 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Fri Mar 18 17:19:47 2005 @@ -305,6 +305,13 @@ CalledFuncs.clear(); + // Fast path for noop calls. Note that we don't care about merging globals + // in the callee with nodes in the caller here. + if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0) { + TempFCs.erase(TempFCs.begin()); + continue; + } + if (CS.isDirectCall()) { Function *F = CS.getCalleeFunc(); if (isResolvableFunc(F)) Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.21 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.22 --- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.21 Tue Mar 15 16:10:04 2005 +++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Fri Mar 18 17:19:47 2005 @@ -217,7 +217,11 @@ assert(calls.insert(TheCall).second && "Call instruction occurs multiple times in graph??"); - + + // Fast path for noop calls. Note that we don't care about merging globals + // in the callee with nodes in the caller here. + if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0) + continue; // Loop over all of the potentially called functions... // Inline direct calls as well as indirect calls because the direct Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.32 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.33 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.32 Tue Mar 15 16:47:18 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Fri Mar 18 17:19:47 2005 @@ -406,6 +406,9 @@ assert(calls.insert(TheCall).second && "Call instruction occurs multiple times in graph??"); + if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0) + continue; + // Inline the common callee graph into the current graph, if the callee // graph has not changed. Note that all callees should have the same // graph so we only need to do this once. From lattner at cs.uiuc.edu Fri Mar 18 17:20:13 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 18 Mar 2005 17:20:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp Message-ID: <200503182320.j2INKDYV010736@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructureAA.cpp updated: 1.27 -> 1.28 --- Log message: fix a bogus assertion --- Diffs of the changes: (+1 -1) DataStructureAA.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.27 llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.28 --- llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.27 Thu Mar 17 18:21:03 2005 +++ llvm/lib/Analysis/DataStructure/DataStructureAA.cpp Fri Mar 18 17:18:30 2005 @@ -190,7 +190,7 @@ DSScalarMap &CallerSM = CallerTDGraph.getScalarMap(); DSScalarMap::iterator NI = CallerSM.find(P); if (NI == CallerSM.end()) { - if (isa(P)) + if (isa(P) || isa(P)) Result = NoModRef; // null is never modified :) else { assert(isa(P) && From lattner at cs.uiuc.edu Fri Mar 18 23:14:46 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 18 Mar 2005 23:14:46 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/EquivalenceClasses.h Message-ID: <200503190514.j2J5EkRQ025959@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: EquivalenceClasses.h updated: 1.8 -> 1.9 --- Log message: Rewrite this class, making the following improvements: 1. It now actually uses tarjan's algorithm, so it is a efficient inverse ackerman's function for union operations, not linear time. 2. It now stores one copy of the data in the set instead of two. 3. It now works for elements other than pointers. 4. It now has a more STL-like interface that exposes iterators instead of internal implementation details. --- Diffs of the changes: (+189 -79) EquivalenceClasses.h | 268 +++++++++++++++++++++++++++++++++++---------------- 1 files changed, 189 insertions(+), 79 deletions(-) Index: llvm/include/llvm/ADT/EquivalenceClasses.h diff -u llvm/include/llvm/ADT/EquivalenceClasses.h:1.8 llvm/include/llvm/ADT/EquivalenceClasses.h:1.9 --- llvm/include/llvm/ADT/EquivalenceClasses.h:1.8 Wed Sep 1 17:55:34 2004 +++ llvm/include/llvm/ADT/EquivalenceClasses.h Fri Mar 18 23:14:29 2005 @@ -7,108 +7,218 @@ // //===----------------------------------------------------------------------===// // -// Generic implementation of equivalence classes and implementation of -// union-find algorithms A not-so-fancy implementation: 2 level tree i.e root -// and one more level Overhead of a union = size of the equivalence class being -// attached Overhead of a find = 1. +// Generic implementation of equivalence classes through the use Tarjan's +// efficient union-find algorithm. // //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_EQUIVALENCECLASSES_H #define LLVM_ADT_EQUIVALENCECLASSES_H -#include +#include "llvm/ADT/iterator" #include -#include namespace llvm { +/// EquivalenceClasses - This represents a collection of equivalence classes and +/// supports three efficient operations: insert an element into a class of its +/// own, union two classes, and find the class for a given element. In +/// addition to these modification methods, it is possible to iterate over all +/// of the equivalence classes and all of the elements in a class. +/// +/// This implementation is an efficient implementation that only stores one copy +/// of the element being indexed per entry in the set, and allows any arbitrary +/// type to be indexed (as long as it can be ordered with operator<). +/// +/// Here is a simple example using integers: +/// +/// EquivalenceClasses EC; +/// EC.unionSets(1, 2); // insert 1, 2 into the same set +/// EC.insert(4); EC.insert(5); // insert 4, 5 into own sets +/// EC.unionSets(5, 1); // merge the set for 1 with 5's set. +/// +/// for (EquivalenceClasses::iterator I = EC.begin(), E = EC.end(); +/// I != E; ++I) { // Iterate over all of the equivalence sets. +/// if (!I->isLeader()) continue; // Ignore non-leader sets. +/// for (EquivalenceClasses::member_iterator MI = EC.member_begin(I); +/// MI != EC.member_end(); ++MI) // Loop over members in this set. +/// std::cerr << *MI << " "; // Print member. +/// std::cerr << "\n"; // Finish set. +/// } +/// +/// This example prints: +/// 4 +/// 5 1 2 +/// template class EquivalenceClasses { - // Maps each element to the element that is the leader of its - // equivalence class. - std::map Elem2LeaderMap; - - // Maintains the set of leaders - std::set LeaderSet; + /// ECValue - The EquivalenceClasses data structure is just a set of these. + /// Each of these represents a relation for a value. First it stores the + /// value itself, which provides the ordering that the set queries. Next, it + /// provides a "next pointer", which is used to enumerate all of the elements + /// in the unioned set. Finally, it defines either a "end of list pointer" or + /// "leader pointer" depending on whether the value itself is a leader. A + /// "leader pointer" points to the node that is the leader for this element, + /// if the node is not a leader. A "end of list pointer" points to the last + /// node in the list of members of this list. Whether or not a node is a + /// leader is determined by a bit stolen from one of the pointers. + class ECValue { + friend class EquivalenceClasses; + mutable const ECValue *Leader, *Next; + ElemTy Data; + // ECValue ctor - Start out with EndOfList pointing to this node, Next is + // Null, isLeader = true. + ECValue(const ElemTy &Elt) + : Leader(this), Next((ECValue*)(intptr_t)1), Data(Elt) {} + + const ECValue *getLeader() const { + if (isLeader()) return this; + if (Leader->isLeader() == 0) return Leader; + // Path compression. + return Leader = Leader->getLeader(); + } + const ECValue *getEndOfList() const { + assert(isLeader() && "Cannot get the end of a list for a non-leader!"); + return Leader; + } - // Caches the equivalence class for each leader - std::map > LeaderToEqClassMap; + void setNext(const ECValue *NewNext) const { + assert(getNext() == 0 && "Already has a next pointer!"); + bool isL = isLeader(); + Next = (const ECValue*)((intptr_t)NewNext | isLeader()); + } + public: + ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1), + Data(RHS.Data) { + // Only support copying of singleton nodes. + assert(RHS.isLeader() && RHS.getNext() == 0 && "Not a singleton!"); + } - // Make Element2 the leader of the union of classes Element1 and Element2 - // Element1 and Element2 are presumed to be leaders of their respective - // equivalence classes. - void attach(ElemTy Element1, ElemTy Element2) { - for (typename std::map::iterator ElemI = - Elem2LeaderMap.begin(), ElemE = Elem2LeaderMap.end(); - ElemI != ElemE; ++ElemI) { - if (ElemI->second == Element1) - Elem2LeaderMap[ElemI->first] = Element2; + bool operator<(const ECValue &UFN) const { return Data < UFN.Data; } + + bool isLeader() const { return (intptr_t)Next & 1; } + const ElemTy &getData() const { return Data; } + + const ECValue *getNext() const { + return (ECValue*)((intptr_t)Next & ~(intptr_t)1); } - } + + template + bool operator<(const T &Val) const { return Data < Val; } + }; + + /// TheMapping - This implicitly provides a mapping from ElemTy values to the + /// ECValues, it just keeps the key as part of the value. + std::set TheMapping; public: - // If an element has not yet in any class, make it a separate new class. - // Return the leader of the class containing the element. - ElemTy addElement (ElemTy NewElement) { - typename std::map::iterator ElemI = - Elem2LeaderMap.find(NewElement); - if (ElemI == Elem2LeaderMap.end()) { - Elem2LeaderMap[NewElement] = NewElement; - LeaderSet.insert(NewElement); - return NewElement; - } - else - return ElemI->second; - } - ElemTy findClass(ElemTy Element) const { - typename std::map::const_iterator I = - Elem2LeaderMap.find(Element); - return (I == Elem2LeaderMap.end())? (ElemTy) 0 : I->second; - } - - /// Attach the set with Element1 to the set with Element2 adding Element1 and - /// Element2 to the set of equivalence classes if they are not there already. - /// Implication: Make Element1 the element in the smaller set. - /// Take Leader[Element1] out of the set of leaders. - void unionSetsWith(ElemTy Element1, ElemTy Element2) { - // If either Element1 or Element2 does not already exist, include it - const ElemTy& leader1 = addElement(Element1); - const ElemTy& leader2 = addElement(Element2); - assert(leader1 != (ElemTy) 0 && leader2 != (ElemTy) 0); - if (leader1 != leader2) { - attach(leader1, leader2); - LeaderSet.erase(leader1); - } + //===--------------------------------------------------------------------===// + // Inspection methods + // + + /// iterator* - Provides a way to iterate over all values in the set. + typedef typename std::set::const_iterator iterator; + iterator begin() const { return TheMapping.begin(); } + iterator end() const { return TheMapping.end(); } + + /// member_* Iterate over the members of an equivalence class. + /// + class member_iterator; + member_iterator member_begin(iterator I) const { + // Only leaders provide anything to iterate over. + return member_iterator(I->isLeader() ? &*I : 0); } - - // Returns a vector containing all the elements in the equivalence class - // including Element1 - const std::set & getEqClass(ElemTy Element1) { - assert(Elem2LeaderMap.find(Element1) != Elem2LeaderMap.end()); - const ElemTy classLeader = Elem2LeaderMap[Element1]; - - std::set & EqClass = LeaderToEqClassMap[classLeader]; - - // If the EqClass vector is empty, it has not been computed yet: do it now - if (EqClass.empty()) { - for (typename std::map::iterator - ElemI = Elem2LeaderMap.begin(), ElemE = Elem2LeaderMap.end(); - ElemI != ElemE; ++ElemI) - if (ElemI->second == classLeader) - EqClass.insert(ElemI->first); - assert(! EqClass.empty()); // must at least include the leader - } + member_iterator member_end() const { + return member_iterator(0); + } + + //===--------------------------------------------------------------------===// + // Mutation methods + + /// insert - Insert a new value into the union/find set, ignoring the request + /// if the value already exists. + iterator insert(const ElemTy &Data) { + return TheMapping.insert(Data).first; + } + + /// findLeader - Given a value in the set, return a member iterator for the + /// equivalence class it is in. This does the path-compression part that + /// makes union-find "union findy". This returns an end iterator if the value + /// is not in the equivalence class. + /// + member_iterator findLeader(iterator I) const { + if (I == TheMapping.end()) return member_end(); + return member_iterator(I->getLeader()); + } + member_iterator findLeader(const ElemTy &V) const { + return findLeader(TheMapping.find(V)); + } + + + /// union - Merge the two equivalence sets for the specified values, inserting + /// them if they do not already exist in the equivalence set. + member_iterator unionSets(const ElemTy &V1, const ElemTy &V2) { + return unionSets(findLeader(insert(V1)), findLeader(insert(V2))); + } + member_iterator unionSets(member_iterator L1, member_iterator L2) { + assert(L1 != member_end() && L2 != member_end() && "Illegal inputs!"); + if (L1 == L2) return L1; // Unifying the same two sets, noop. + + // Otherwise, this is a real union operation. Set the end of the L1 list to + // point to the L2 leader node. + const ECValue &L1LV = *L1.Node, &L2LV = *L2.Node; + L1LV.getEndOfList()->setNext(&L2LV); - return EqClass; + // Update L1LV's end of list pointer. + L1LV.Leader = L2LV.getEndOfList(); + + // Clear L2's leader flag: + L2LV.Next = L2LV.getNext(); + + // L2's leader is now L1. + L2LV.Leader = &L1LV; + return L1; } - std::set& getLeaderSet() { return LeaderSet; } - const std::set& getLeaderSet() const { return LeaderSet; } + class member_iterator : public forward_iterator { + typedef forward_iterator super; + const ECValue *Node; + friend class EquivalenceClasses; + public: + typedef size_t size_type; + typedef typename super::pointer pointer; + typedef typename super::reference reference; + + explicit member_iterator() {} + explicit member_iterator(const ECValue *N) : Node(N) {} + member_iterator(const member_iterator &I) : Node(I.Node) {} + + reference operator*() const { + assert(Node != 0 && "Dereferencing end()!"); + return Node->getData(); + } + reference operator->() const { return operator*(); } + + member_iterator &operator++() { + assert(Node != 0 && "++'d off the end of the list!"); + Node = Node->getNext(); + return *this; + } + + member_iterator operator++(int) { // postincrement operators. + member_iterator tmp = *this; + ++*this; + return tmp; + } - std::map& getLeaderMap() { return Elem2LeaderMap;} - const std::map& getLeaderMap() const { return Elem2LeaderMap;} + bool operator==(const member_iterator &RHS) const { + return Node == RHS.Node; + } + bool operator!=(const member_iterator &RHS) const { + return Node != RHS.Node; + } + }; }; } // End llvm namespace From lattner at cs.uiuc.edu Fri Mar 18 23:15:40 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 18 Mar 2005 23:15:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Message-ID: <200503190515.j2J5FeT7025976@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: EquivClassGraphs.cpp updated: 1.33 -> 1.34 --- Log message: Switch to use the new interface for the EquivalenceClasses class, and fix a bug involving SCC's who have multiple members that are part of an EC. --- Diffs of the changes: (+65 -61) EquivClassGraphs.cpp | 126 ++++++++++++++++++++++++++------------------------- 1 files changed, 65 insertions(+), 61 deletions(-) Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.33 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.34 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.33 Fri Mar 18 17:19:47 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Fri Mar 18 23:15:27 2005 @@ -171,7 +171,7 @@ CallSite CS = CallSite::get(I->first); if (CS.getCalledFunction()) { // Direct call: - FuncECs.addElement(I->second); // -- Make sure function has equiv class + FuncECs.insert(I->second); // -- Make sure function has equiv class FirstFunc = I->second; // -- First callee at this site } else { // Else indirect call // DEBUG(std::cerr << "CALLEE: " << I->second->getName() @@ -186,11 +186,11 @@ DSGraph &TFG = CBU->getDSGraph(*thisFunc); DSNode *calleeNode = TFG.getNodeForValue(CS.getCalledValue()).getNode(); OneCalledFunction[calleeNode] = FirstFunc; - FuncECs.addElement(I->second); + FuncECs.insert(I->second); } else { // This is not the first possible callee from a particular call site. // Union the callee in with the other functions. - FuncECs.unionSetsWith(FirstFunc, I->second); + FuncECs.unionSets(FirstFunc, I->second); #ifndef NDEBUG Function *thisFunc = LastInst->getParent()->getParent(); DSGraph &TFG = CBU->getDSGraph(*thisFunc); @@ -208,56 +208,59 @@ DSGraph& funcDSGraph = CBU->getDSGraph(*I->second); for (DSGraph::retnodes_iterator RI = funcDSGraph.retnodes_begin(), RE = funcDSGraph.retnodes_end(); RI != RE; ++RI) - FuncECs.unionSetsWith(FirstFunc, RI->first); + FuncECs.unionSets(FirstFunc, RI->first); } // Now that all of the equivalences have been built, merge the graphs for // each equivalence class. // - std::set &leaderSet = FuncECs.getLeaderSet(); DEBUG(std::cerr << "\nIndirect Function Equivalence Sets:\n"); - for (std::set::iterator LI = leaderSet.begin(), - LE = leaderSet.end(); LI != LE; ++LI) { + for (EquivalenceClasses::iterator EQSI = FuncECs.begin(), E = + FuncECs.end(); EQSI != E; ++EQSI) { + if (!EQSI->isLeader()) continue; + + EquivalenceClasses::member_iterator SI = + FuncECs.member_begin(EQSI); + assert(SI != FuncECs.member_end() && "Empty equiv set??"); + EquivalenceClasses::member_iterator SN = SI; + ++SN; + if (SN == FuncECs.member_end()) + continue; // Single function equivalence set, no merging to do. - Function* LF = *LI; - const std::set& EqClass = FuncECs.getEqClass(LF); + Function* LF = *SI; - if (EqClass.size() > 1) { #ifndef NDEBUG - DEBUG(std::cerr <<" Equivalence set for leader " <getName()<<" = "); - for (std::set::const_iterator EqI = EqClass.begin(), - EqEnd = EqClass.end(); EqI != EqEnd; ++EqI) - DEBUG(std::cerr << " " << (*EqI)->getName() << ","); - DEBUG(std::cerr << "\n"); + DEBUG(std::cerr <<" Equivalence set for leader " << LF->getName() <<" = "); + for (SN = SI; SN != FuncECs.member_end(); ++SN) + DEBUG(std::cerr << " " << (*SN)->getName() << "," ); + DEBUG(std::cerr << "\n"); #endif - // This equiv class has multiple functions: merge their graphs. First, - // clone the CBU graph for the leader and make it the common graph for the - // equivalence graph. - DSGraph &MergedG = getOrCreateGraph(*LF); - - // Record the argument nodes for use in merging later below. - std::vector ArgNodes; - - for (Function::arg_iterator AI1 = LF->arg_begin(); AI1 != LF->arg_end(); ++AI1) - if (DS::isPointerType(AI1->getType())) - ArgNodes.push_back(MergedG.getNodeForValue(AI1)); + // This equiv class has multiple functions: merge their graphs. First, + // clone the CBU graph for the leader and make it the common graph for the + // equivalence graph. + DSGraph &MergedG = getOrCreateGraph(*LF); + + // Record the argument nodes for use in merging later below. + std::vector ArgNodes; + + for (Function::arg_iterator AI = LF->arg_begin(), E = LF->arg_end(); + AI != E; ++AI) + if (DS::isPointerType(AI->getType())) + ArgNodes.push_back(MergedG.getNodeForValue(AI)); - // Merge in the graphs of all other functions in this equiv. class. Note - // that two or more functions may have the same graph, and it only needs - // to be merged in once. - std::set GraphsMerged; - GraphsMerged.insert(&CBU->getDSGraph(*LF)); - - for (std::set::const_iterator EqI = EqClass.begin(), - E = EqClass.end(); EqI != E; ++EqI) { - Function *F = *EqI; - DSGraph *&FG = DSInfo[F]; - - DSGraph &CBUGraph = CBU->getDSGraph(*F); - if (!GraphsMerged.insert(&CBUGraph).second) - continue; - + // Merge in the graphs of all other functions in this equiv. class. Note + // that two or more functions may have the same graph, and it only needs + // to be merged in once. + std::set GraphsMerged; + GraphsMerged.insert(&CBU->getDSGraph(*LF)); + + for (++SI; SI != FuncECs.member_end(); ++SI) { + Function *F = *SI; + DSGraph *&FG = DSInfo[F]; + + DSGraph &CBUGraph = CBU->getDSGraph(*F); + if (GraphsMerged.insert(&CBUGraph).second) { // Record the "folded" graph for the function. for (DSGraph::retnodes_iterator I = CBUGraph.retnodes_begin(), E = CBUGraph.retnodes_end(); I != E; ++I) { @@ -266,27 +269,28 @@ } // Clone this member of the equivalence class into MergedG. - DSGraph::NodeMapTy NodeMap; - - MergedG.cloneInto(CBUGraph, MergedG.getScalarMap(), - MergedG.getReturnNodes(), NodeMap, 0); - - // Merge the return nodes of all functions together. - MergedG.getReturnNodes()[LF].mergeWith(MergedG.getReturnNodes()[F]); - - // Merge the function arguments with all argument nodes found so far. - // If there are extra function args, add them to the vector of argNodes - Function::arg_iterator AI2 = F->arg_begin(), AI2end = F->arg_end(); - for (unsigned arg=0, numArgs = ArgNodes.size(); - arg != numArgs && AI2 != AI2end; ++AI2, ++arg) - if (DS::isPointerType(AI2->getType())) - ArgNodes[arg].mergeWith(MergedG.getNodeForValue(AI2)); - - for ( ; AI2 != AI2end; ++AI2) - if (DS::isPointerType(AI2->getType())) - ArgNodes.push_back(MergedG.getNodeForValue(AI2)); - DEBUG(MergedG.AssertGraphOK()); + { + DSGraph::NodeMapTy NodeMap; + MergedG.cloneInto(CBUGraph, MergedG.getScalarMap(), + MergedG.getReturnNodes(), NodeMap, 0); + } } + + // Merge the return nodes of all functions together. + MergedG.getReturnNodes()[LF].mergeWith(MergedG.getReturnNodes()[F]); + + // Merge the function arguments with all argument nodes found so far. + // If there are extra function args, add them to the vector of argNodes + Function::arg_iterator AI2 = F->arg_begin(), AI2end = F->arg_end(); + for (unsigned arg = 0, numArgs = ArgNodes.size(); + arg != numArgs && AI2 != AI2end; ++AI2, ++arg) + if (DS::isPointerType(AI2->getType())) + ArgNodes[arg].mergeWith(MergedG.getNodeForValue(AI2)); + + for ( ; AI2 != AI2end; ++AI2) + if (DS::isPointerType(AI2->getType())) + ArgNodes.push_back(MergedG.getNodeForValue(AI2)); + DEBUG(MergedG.AssertGraphOK()); } } DEBUG(std::cerr << "\n"); From alkis at cs.uiuc.edu Sat Mar 19 03:22:28 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 03:22:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64ISelPattern.cpp IA64AsmPrinter.cpp Message-ID: <200503190922.DAA22317@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64ISelPattern.cpp updated: 1.2 -> 1.3 IA64AsmPrinter.cpp updated: 1.1 -> 1.2 --- Log message: Stop using deprecated interface. --- Diffs of the changes: (+3 -2) IA64AsmPrinter.cpp | 3 ++- IA64ISelPattern.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Target/IA64/IA64ISelPattern.cpp diff -u llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.2 llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.3 --- llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.2 Thu Mar 17 13:00:40 2005 +++ llvm/lib/Target/IA64/IA64ISelPattern.cpp Sat Mar 19 03:22:17 2005 @@ -162,7 +162,7 @@ unsigned used_FPArgs=0; // how many FP args have been used so far? int count = 0; - for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) { SDOperand newroot, argt; if(count < 8) { // need to fix this logic? maybe. Index: llvm/lib/Target/IA64/IA64AsmPrinter.cpp diff -u llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.1 llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.2 --- llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.1 Thu Mar 17 12:17:03 2005 +++ llvm/lib/Target/IA64/IA64AsmPrinter.cpp Sat Mar 19 03:22:17 2005 @@ -97,7 +97,8 @@ std::string CurSection; // Print out module-level global variables here. - for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) if (I->hasInitializer()) { // External global require no code O << "\n\n"; std::string name = Mang->getValueName(I); From alkis at cs.uiuc.edu Sat Mar 19 03:44:05 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 03:44:05 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503190944.DAA25254@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.228 -> 1.229 --- Log message: We cannot compile java.io.* yet. --- Diffs of the changes: (+1 -2) Compiler.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.228 llvm-java/lib/Compiler/Compiler.cpp:1.229 --- llvm-java/lib/Compiler/Compiler.cpp:1.228 Tue Mar 15 01:38:33 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sat Mar 19 03:43:54 2005 @@ -1359,8 +1359,7 @@ classMethodDesc.find("java/lang/StringBuffer") != 0 && classMethodDesc.find("java/lang/System") != 0 && classMethodDesc.find("java/lang/VMSystem") != 0 && - classMethodDesc.find("java/util/") != 0 && - classMethodDesc.find("java/io/") != 0) { + classMethodDesc.find("java/util/") != 0) { DEBUG(std::cerr << "Skipping compilation of method: " << classMethodDesc << '\n'); return function; From alkis at cs.uiuc.edu Sat Mar 19 04:36:11 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 04:36:11 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503191036.EAA07988@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.229 -> 1.230 --- Log message: Pull java object and array allocation code in its own method. --- Diffs of the changes: (+42 -27) Compiler.cpp | 69 +++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 42 insertions(+), 27 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.229 llvm-java/lib/Compiler/Compiler.cpp:1.230 --- llvm-java/lib/Compiler/Compiler.cpp:1.229 Sat Mar 19 03:43:54 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sat Mar 19 04:36:00 2005 @@ -2221,22 +2221,27 @@ makeCall(vfun, params); } + Value* allocateObject(const ClassInfo& ci, BasicBlock* bb) { + static std::vector params(4); + + Value* objRef = new MallocInst(ci.getType(), NULL, TMP, bb); + params[0] = + new CastInst(objRef, PointerType::get(Type::SByteTy), TMP, bb); // dest + params[1] = ConstantUInt::get(Type::UByteTy, 0); // value + params[2] = ConstantExpr::getSizeOf(ci.getType()); // size + params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment + new CallInst(memset_, params, "", bb); + + return objRef; + } + void do_new(unsigned index) { ConstantClass* classRef = cf_->getConstantClass(index); const ClassFile* cf = ClassFile::get(classRef->getName()->str()); const ClassInfo& ci = getClassInfo(cf); 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* objRef = allocateObject(ci, currentBB_); Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, currentBB_); Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, @@ -2284,38 +2289,48 @@ do_newarray_common(ci, PointerType::get(ei.getType()), vi, count); } - void do_newarray_common(const ClassInfo& ci, - Type* elementTy, - const VTableInfo& vi, - Value* count) { + Value* allocateArray(const ClassInfo& ci, + Type* elementTy, + Value* count, + BasicBlock* bb) { + static std::vector params(4); + // The size of the element. llvm::Constant* elementSize = ConstantExpr::getCast(ConstantExpr::getSizeOf(elementTy), Type::UIntTy); // The size of the array part of the struct. Value* size = BinaryOperator::create( - Instruction::Mul, count, elementSize, TMP, currentBB_); + Instruction::Mul, count, elementSize, TMP, bb); // The size of the rest of the array object. llvm::Constant* arrayObjectSize = - ConstantExpr::getCast(ConstantExpr::getSizeOf(ci.getType()), Type::UIntTy); + ConstantExpr::getCast(ConstantExpr::getSizeOf(ci.getType()), + Type::UIntTy); // Add the array part plus the object part together. size = BinaryOperator::create( - Instruction::Add, size, arrayObjectSize, TMP, currentBB_); + Instruction::Add, size, arrayObjectSize, TMP, bb); // 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_); + Value* objRef = new MallocInst(Type::SByteTy, size, TMP, bb); + params[0] = objRef; // dest + params[1] = ConstantUInt::get(Type::UByteTy, 0); // value + params[2] = new CastInst(size, Type::ULongTy, TMP, bb); // size + params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment + new CallInst(memset_, params, "", bb); // Store the size. Value* lengthPtr = getArrayLengthPtr(objRef); - new StoreInst(count, lengthPtr, currentBB_); + new StoreInst(count, lengthPtr, bb); + + return new CastInst(objRef, PointerType::get(ci.getType()), TMP, bb); + } + + void do_newarray_common(const ClassInfo& ci, + Type* elementTy, + const VTableInfo& vi, + Value* count) { + Value* objRef = allocateArray(ci, elementTy, count, currentBB_); + // Install the vtable pointer. Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, currentBB_); From alkis at cs.uiuc.edu Sat Mar 19 04:51:36 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 04:51:36 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503191051.EAA16250@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.230 -> 1.231 --- Log message: Install vtable pointers when allocating new java objects/arrays. --- Diffs of the changes: (+38 -44) Compiler.cpp | 82 +++++++++++++++++++++++++++-------------------------------- 1 files changed, 38 insertions(+), 44 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.230 llvm-java/lib/Compiler/Compiler.cpp:1.231 --- llvm-java/lib/Compiler/Compiler.cpp:1.230 Sat Mar 19 04:36:00 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sat Mar 19 04:51:24 2005 @@ -2221,7 +2221,9 @@ makeCall(vfun, params); } - Value* allocateObject(const ClassInfo& ci, BasicBlock* bb) { + Value* allocateObject(const ClassInfo& ci, + const VTableInfo& vi, + BasicBlock* bb) { static std::vector params(4); Value* objRef = new MallocInst(ci.getType(), NULL, TMP, bb); @@ -2232,6 +2234,13 @@ params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment new CallInst(memset_, params, "", bb); + // Install the vtable pointer. + Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, currentBB_); + Value* vtable = new CastInst(vi.vtable, + VTableBaseRefTy, + TMP, currentBB_); + new CallInst(setVtable_, objBase, vtable, "", currentBB_); + return objRef; } @@ -2241,13 +2250,7 @@ const ClassInfo& ci = getClassInfo(cf); const VTableInfo& vi = getVTableInfo(cf); - Value* objRef = allocateObject(ci, currentBB_); - Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, currentBB_); - Value* vtable = new CastInst(vi.vtable, - VTableBaseRefTy, - TMP, currentBB_); - new CallInst(setVtable_, objBase, vtable, "", currentBB_); - push(objRef); + push(allocateObject(ci, vi, currentBB_)); } Value* getArrayLengthPtr(Value* arrayRef) const { @@ -2268,29 +2271,9 @@ return new GetElementPtrInst(arrayRef, indices, TMP, currentBB_); } - void do_newarray(JType type) { - Value* count = pop(Type::UIntTy); - - const ClassInfo& ci = getPrimitiveArrayInfo(type); - const VTableInfo& vi = getPrimitiveArrayVTableInfo(type); - - do_newarray_common(ci, getType(type), vi, count); - } - - void do_anewarray(unsigned index) { - Value* count = pop(Type::UIntTy); - - ConstantClass* classRef = cf_->getConstantClass(index); - const ClassFile* cf = ClassFile::get(classRef->getName()->str()); - const ClassInfo& ci = getObjectArrayInfo(); - const ClassInfo& ei = getClassInfo(cf); - const VTableInfo& vi = getObjectArrayVTableInfo(cf); - - do_newarray_common(ci, PointerType::get(ei.getType()), vi, count); - } - Value* allocateArray(const ClassInfo& ci, - Type* elementTy, + const Type* elementTy, + const VTableInfo& vi, Value* count, BasicBlock* bb) { static std::vector params(4); @@ -2322,23 +2305,34 @@ Value* lengthPtr = getArrayLengthPtr(objRef); new StoreInst(count, lengthPtr, bb); - return new CastInst(objRef, PointerType::get(ci.getType()), TMP, bb); + new CastInst(objRef, PointerType::get(ci.getType()), TMP, bb); + + // Install the vtable pointer. + Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, bb); + Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, bb); + return new CallInst(setVtable_, objBase, vtable, "", bb); } - void do_newarray_common(const ClassInfo& ci, - Type* elementTy, - const VTableInfo& vi, - Value* count) { - Value* objRef = allocateArray(ci, elementTy, count, currentBB_); + void do_newarray(JType type) { + Value* count = pop(Type::UIntTy); - // Install the vtable pointer. - Value* objBase = new CastInst(objRef, ObjectBaseRefTy, - TMP, currentBB_); - Value* vtable = new CastInst(vi.vtable, - VTableBaseRefTy, - TMP, currentBB_); - new CallInst(setVtable_, objBase, vtable, "", currentBB_); - push(objRef); + const ClassInfo& ci = getPrimitiveArrayInfo(type); + const VTableInfo& vi = getPrimitiveArrayVTableInfo(type); + + push(allocateArray(ci, getType(type), vi, count, currentBB_)); + } + + void do_anewarray(unsigned index) { + Value* count = pop(Type::UIntTy); + + ConstantClass* classRef = cf_->getConstantClass(index); + const ClassFile* cf = ClassFile::get(classRef->getName()->str()); + const ClassInfo& ci = getObjectArrayInfo(); + const ClassInfo& ei = getClassInfo(cf); + const VTableInfo& vi = getObjectArrayVTableInfo(cf); + + const Type* elementTy = PointerType::get(ei.getType()); + push(allocateArray(ci, elementTy, vi, count, currentBB_)); } void do_arraylength() { From alkis at cs.uiuc.edu Sat Mar 19 04:56:42 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 04:56:42 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503191056.EAA16712@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.231 -> 1.232 --- Log message: Templetize java object/array allocation methods to accept both a basic block to append to or an instruction to insert before at. --- Diffs of the changes: (+22 -22) Compiler.cpp | 44 ++++++++++++++++++++++---------------------- 1 files changed, 22 insertions(+), 22 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.231 llvm-java/lib/Compiler/Compiler.cpp:1.232 --- llvm-java/lib/Compiler/Compiler.cpp:1.231 Sat Mar 19 04:51:24 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sat Mar 19 04:56:30 2005 @@ -1969,7 +1969,7 @@ void do_switch_common(unsigned defTarget, const SwitchCases& sw) { Value* v = pop(Type::IntTy); SwitchInst* in = - new SwitchInst(v, bbBuilder_->getBasicBlock(defTarget), sw.size(), + new SwitchInst(v, bbBuilder_->getBasicBlock(defTarget), sw.size(), currentBB_); for (unsigned i = 0, e = sw.size(); i != e; ++i) in->addCase(ConstantSInt::get(Type::IntTy, sw[i].first), @@ -2221,25 +2221,24 @@ makeCall(vfun, params); } + template Value* allocateObject(const ClassInfo& ci, const VTableInfo& vi, - BasicBlock* bb) { + InsertionPointTy* ip) { static std::vector params(4); - Value* objRef = new MallocInst(ci.getType(), NULL, TMP, bb); + Value* objRef = new MallocInst(ci.getType(), NULL, TMP, ip); params[0] = - new CastInst(objRef, PointerType::get(Type::SByteTy), TMP, bb); // dest + new CastInst(objRef, PointerType::get(Type::SByteTy), TMP, ip); // dest params[1] = ConstantUInt::get(Type::UByteTy, 0); // value params[2] = ConstantExpr::getSizeOf(ci.getType()); // size params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment - new CallInst(memset_, params, "", bb); + new CallInst(memset_, params, "", ip); // Install the vtable pointer. - Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, currentBB_); - Value* vtable = new CastInst(vi.vtable, - VTableBaseRefTy, - TMP, currentBB_); - new CallInst(setVtable_, objBase, vtable, "", currentBB_); + Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, ip); + Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, ip); + new CallInst(setVtable_, objBase, vtable, "", ip); return objRef; } @@ -2271,11 +2270,12 @@ return new GetElementPtrInst(arrayRef, indices, TMP, currentBB_); } + template Value* allocateArray(const ClassInfo& ci, const Type* elementTy, const VTableInfo& vi, Value* count, - BasicBlock* bb) { + InsertionPointTy* ip) { static std::vector params(4); // The size of the element. @@ -2284,33 +2284,33 @@ // The size of the array part of the struct. Value* size = BinaryOperator::create( - Instruction::Mul, count, elementSize, TMP, bb); + Instruction::Mul, count, elementSize, TMP, ip); // The size of the rest of the array object. - llvm::Constant* arrayObjectSize = + llvm::Constant* arrayObjectSize = ConstantExpr::getCast(ConstantExpr::getSizeOf(ci.getType()), Type::UIntTy); // Add the array part plus the object part together. size = BinaryOperator::create( - Instruction::Add, size, arrayObjectSize, TMP, bb); + Instruction::Add, size, arrayObjectSize, TMP, ip); // Allocate memory for the object. - Value* objRef = new MallocInst(Type::SByteTy, size, TMP, bb); + Value* objRef = new MallocInst(Type::SByteTy, size, TMP, ip); params[0] = objRef; // dest params[1] = ConstantUInt::get(Type::UByteTy, 0); // value - params[2] = new CastInst(size, Type::ULongTy, TMP, bb); // size + params[2] = new CastInst(size, Type::ULongTy, TMP, ip); // size params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment - new CallInst(memset_, params, "", bb); + new CallInst(memset_, params, "", ip); // Store the size. Value* lengthPtr = getArrayLengthPtr(objRef); - new StoreInst(count, lengthPtr, bb); + new StoreInst(count, lengthPtr, ip); - new CastInst(objRef, PointerType::get(ci.getType()), TMP, bb); + new CastInst(objRef, PointerType::get(ci.getType()), TMP, ip); // Install the vtable pointer. - Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, bb); - Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, bb); - return new CallInst(setVtable_, objBase, vtable, "", bb); + Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, ip); + Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, ip); + return new CallInst(setVtable_, objBase, vtable, "", ip); } void do_newarray(JType type) { From alkis at cs.uiuc.edu Sat Mar 19 05:40:43 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 05:40:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200503191140.FAA21225@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.124 -> 1.125 --- Log message: Add new function getPtrPtrFromArrayPtr(). --- Diffs of the changes: (+7 -0) Constants.cpp | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.124 llvm/lib/VMCore/Constants.cpp:1.125 --- llvm/lib/VMCore/Constants.cpp:1.124 Wed Mar 9 09:19:41 2005 +++ llvm/lib/VMCore/Constants.cpp Sat Mar 19 05:40:31 2005 @@ -1298,6 +1298,13 @@ Type::ULongTy); } +Constant *ConstantExpr::getPtrPtrFromArrayPtr(Constant *C) { + // pointer from array is implemented as: getelementptr arr ptr, 0, 0 + static std::vector Indices(2, ConstantUInt::get(Type::UIntTy, 0)); + + return ConstantExpr::getGetElementPtr(C, Indices); +} + Constant *ConstantExpr::getTy(const Type *ReqTy, unsigned Opcode, Constant *C1, Constant *C2) { if (Opcode == Instruction::Shl || Opcode == Instruction::Shr) From alkis at cs.uiuc.edu Sat Mar 19 05:40:43 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 05:40:43 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200503191140.FAA21229@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.68 -> 1.69 --- Log message: Add new function getPtrPtrFromArrayPtr(). --- Diffs of the changes: (+4 -0) Constants.h | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.68 llvm/include/llvm/Constants.h:1.69 --- llvm/include/llvm/Constants.h:1.68 Fri Feb 4 20:00:12 2005 +++ llvm/include/llvm/Constants.h Sat Mar 19 05:40:31 2005 @@ -562,6 +562,10 @@ /// static Constant *getSizeOf(const Type *Ty); + /// getPtrPtrFromArrayPtr constant expr - given a pointer to a constant array, + /// return a pointer to a pointer of the array element type. + static Constant *getPtrPtrFromArrayPtr(Constant *C); + /// ConstantExpr::get - Return a binary or shift operator constant expression, /// folding if possible. /// From alkis at cs.uiuc.edu Sat Mar 19 07:06:08 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 07:06:08 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503191306.HAA00800@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.232 -> 1.233 --- Log message: Use new ConstantExpr::getPtrPtrFromArrayPtr() function. --- Diffs of the changes: (+5 -16) Compiler.cpp | 21 +++++---------------- 1 files changed, 5 insertions(+), 16 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.232 llvm-java/lib/Compiler/Compiler.cpp:1.233 --- llvm-java/lib/Compiler/Compiler.cpp:1.232 Sat Mar 19 04:56:30 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sat Mar 19 07:05:54 2005 @@ -600,9 +600,7 @@ return std::make_pair( vi.superVtables.size(), - ConstantExpr::getGetElementPtr( - vtablesArray, - std::vector(2, ConstantUInt::get(Type::UIntTy, 0)))); + ConstantExpr::getPtrPtrFromArrayPtr(vtablesArray)); } /// Builds an interface VTable for the specified @@ -731,9 +729,7 @@ return std::make_pair( int(vtables.size())-1, - ConstantExpr::getGetElementPtr( - interfacesArray, - std::vector(2, ConstantUInt::get(Type::UIntTy, 0)))); + ConstantExpr::getPtrPtrFromArrayPtr(interfacesArray)); } /// Given the classfile and its corresponding VTableInfo, @@ -952,10 +948,7 @@ elementTy->getDescription() + "[]", &module_); - typeInfoInit.push_back( - ConstantExpr::getGetElementPtr( - vtablesArray, - std::vector(2, ConstantUInt::get(Type::UIntTy, 0)))); + typeInfoInit.push_back(ConstantExpr::getPtrPtrFromArrayPtr(vtablesArray)); typeInfoInit.push_back(ConstantSInt::get(Type::IntTy, 0)); typeInfoInit.push_back( llvm::Constant::getNullValue( @@ -1058,9 +1051,7 @@ ConstantArray::get(vtablesArrayTy, vi.superVtables), "java/lang/Object[]", &module_); - init.push_back(ConstantExpr::getGetElementPtr( - vtablesArray, - std::vector(2, ConstantUInt::get(Type::UIntTy, 0)))); + init.push_back(ConstantExpr::getPtrPtrFromArrayPtr(vtablesArray)); // last interface index init.push_back(llvm::ConstantSInt::get(Type::IntTy, -1)); @@ -1179,9 +1170,7 @@ className + "[]", &module_); - typeInfoInit.push_back(ConstantExpr::getGetElementPtr( - vtablesArray, - std::vector(2, ConstantUInt::get(Type::UIntTy, 0)))); + typeInfoInit.push_back(ConstantExpr::getPtrPtrFromArrayPtr(vtablesArray)); // last interface index typeInfoInit.push_back(llvm::ConstantSInt::get(Type::IntTy, -1)); // interfaces vtable pointers From alkis at cs.uiuc.edu Sat Mar 19 07:15:08 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 07:15:08 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503191315.HAA00847@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.233 -> 1.234 --- Log message: Return the casted array type not the return value of the setVtable function. --- Diffs of the changes: (+3 -3) Compiler.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.233 llvm-java/lib/Compiler/Compiler.cpp:1.234 --- llvm-java/lib/Compiler/Compiler.cpp:1.233 Sat Mar 19 07:05:54 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sat Mar 19 07:14:57 2005 @@ -2294,12 +2294,12 @@ Value* lengthPtr = getArrayLengthPtr(objRef); new StoreInst(count, lengthPtr, ip); - new CastInst(objRef, PointerType::get(ci.getType()), TMP, ip); - // Install the vtable pointer. Value* objBase = new CastInst(objRef, ObjectBaseRefTy, TMP, ip); Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, ip); - return new CallInst(setVtable_, objBase, vtable, "", ip); + new CallInst(setVtable_, objBase, vtable, "", ip); + + return new CastInst(objRef, PointerType::get(ci.getType()), TMP, ip); } void do_newarray(JType type) { From alkis at cs.uiuc.edu Sat Mar 19 07:22:43 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 07:22:43 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503191322.HAA00888@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.234 -> 1.235 --- Log message: We need to cast to the array type before we store the length of the array. --- Diffs of the changes: (+4 -1) Compiler.cpp | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.234 llvm-java/lib/Compiler/Compiler.cpp:1.235 --- llvm-java/lib/Compiler/Compiler.cpp:1.234 Sat Mar 19 07:14:57 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sat Mar 19 07:22:32 2005 @@ -2290,6 +2290,9 @@ params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment new CallInst(memset_, params, "", ip); + // Cast back to array type. + objRef = new CastInst(objRef, PointerType::get(ci.getType()), TMP, ip); + // Store the size. Value* lengthPtr = getArrayLengthPtr(objRef); new StoreInst(count, lengthPtr, ip); @@ -2299,7 +2302,7 @@ Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, ip); new CallInst(setVtable_, objBase, vtable, "", ip); - return new CastInst(objRef, PointerType::get(ci.getType()), TMP, ip); + return objRef; } void do_newarray(JType type) { From alkis at cs.uiuc.edu Sat Mar 19 07:50:23 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sat, 19 Mar 2005 07:50:23 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503191350.HAA01062@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.235 -> 1.236 --- Log message: Parametrize getArrayObjectBaseBtr and getArrayLengthPtr with a code insertion point parameter. --- Diffs of the changes: (+8 -6) Compiler.cpp | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.235 llvm-java/lib/Compiler/Compiler.cpp:1.236 --- llvm-java/lib/Compiler/Compiler.cpp:1.235 Sat Mar 19 07:22:32 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sat Mar 19 07:50:12 2005 @@ -2241,22 +2241,24 @@ push(allocateObject(ci, vi, currentBB_)); } - Value* getArrayLengthPtr(Value* arrayRef) const { + template + Value* getArrayLengthPtr(Value* arrayRef, InsertionPointTy* ip) const { std::vector indices; indices.reserve(2); indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); indices.push_back(ConstantUInt::get(Type::UIntTy, 1)); - return new GetElementPtrInst(arrayRef, indices, TMP, currentBB_); + return new GetElementPtrInst(arrayRef, indices, TMP, ip); } - Value* getArrayObjectBasePtr(Value* arrayRef) const { + template + Value* getArrayObjectBasePtr(Value* arrayRef, InsertionPointTy* ip) const { std::vector indices; indices.reserve(2); indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); - return new GetElementPtrInst(arrayRef, indices, TMP, currentBB_); + return new GetElementPtrInst(arrayRef, indices, TMP, ip); } template @@ -2294,7 +2296,7 @@ objRef = new CastInst(objRef, PointerType::get(ci.getType()), TMP, ip); // Store the size. - Value* lengthPtr = getArrayLengthPtr(objRef); + Value* lengthPtr = getArrayLengthPtr(objRef, ip); new StoreInst(count, lengthPtr, ip); // Install the vtable pointer. @@ -2330,7 +2332,7 @@ void do_arraylength() { const ClassInfo& ci = getObjectArrayInfo(); Value* arrayRef = pop(PointerType::get(ci.getType())); - Value* lengthPtr = getArrayLengthPtr(arrayRef); + Value* lengthPtr = getArrayLengthPtr(arrayRef, currentBB_); Value* length = new LoadInst(lengthPtr, TMP, currentBB_); push(length); } From lattner at cs.uiuc.edu Sat Mar 19 11:35:27 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 11:35:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200503191735.j2JHZRD5027970@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.234 -> 1.235 --- Log message: Fix the 3 regressions last night, due to my buggy patch from yesterday. --- 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.234 llvm/lib/Target/CBackend/Writer.cpp:1.235 --- llvm/lib/Target/CBackend/Writer.cpp:1.234 Fri Mar 18 10:12:37 2005 +++ llvm/lib/Target/CBackend/Writer.cpp Sat Mar 19 11:35:11 2005 @@ -1247,7 +1247,7 @@ BasicBlock *Succ = cast(SI.getOperand(i+1)); printPHICopiesForSuccessor (SI.getParent(), Succ, 2); printBranchToBlock(SI.getParent(), Succ, 2); - if (Succ == next(Function::iterator(SI.getParent()))) + if (Function::iterator(Succ) == next(Function::iterator(SI.getParent()))) Out << " break;\n"; } Out << " }\n"; From lattner at cs.uiuc.edu Sat Mar 19 13:26:30 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 13:26:30 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/EquivalenceClasses.h Message-ID: <200503191926.j2JJQUI0030871@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: EquivalenceClasses.h updated: 1.9 -> 1.10 --- Log message: implement a proper copy ctor, operator= and add a helper method. --- Diffs of the changes: (+24 -0) EquivalenceClasses.h | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm/include/llvm/ADT/EquivalenceClasses.h diff -u llvm/include/llvm/ADT/EquivalenceClasses.h:1.9 llvm/include/llvm/ADT/EquivalenceClasses.h:1.10 --- llvm/include/llvm/ADT/EquivalenceClasses.h:1.9 Fri Mar 18 23:14:29 2005 +++ llvm/include/llvm/ADT/EquivalenceClasses.h Sat Mar 19 13:26:14 2005 @@ -112,6 +112,19 @@ std::set TheMapping; public: + EquivalenceClasses() {} + EquivalenceClasses(const EquivalenceClasses &RHS) { + operator=(RHS); + } + + const EquivalenceClasses &operator=(const EquivalenceClasses &RHS) { + for (iterator I = RHS.begin(), E = RHS.end(); I != E; ++I) + if (I->isLeader()) + insert(I->getData()); + else + unionSets(I->getData(), *RHS.findLeader(I)); + return *this; + } //===--------------------------------------------------------------------===// // Inspection methods @@ -133,6 +146,17 @@ return member_iterator(0); } + /// getNumClasses - Return the number of equivalence classes in this set. + /// Note that this is a linear time operation. + unsigned getNumClasses() const { + unsigned NC = 0; + for (iterator I = begin(), E = end(); I != E; ++I) + if (I->isLeader()) ++NC; + return NC; + } + + + //===--------------------------------------------------------------------===// // Mutation methods From lattner at cs.uiuc.edu Sat Mar 19 14:43:00 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 14:43:00 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/EquivalenceClasses.h Message-ID: <200503192043.j2JKgxKC002792@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: EquivalenceClasses.h updated: 1.10 -> 1.11 --- Log message: add some methods, fix a major bug in getLeader() that was causing things to not be unified correctly. --- Diffs of the changes: (+27 -3) EquivalenceClasses.h | 30 +++++++++++++++++++++++++++--- 1 files changed, 27 insertions(+), 3 deletions(-) Index: llvm/include/llvm/ADT/EquivalenceClasses.h diff -u llvm/include/llvm/ADT/EquivalenceClasses.h:1.10 llvm/include/llvm/ADT/EquivalenceClasses.h:1.11 --- llvm/include/llvm/ADT/EquivalenceClasses.h:1.10 Sat Mar 19 13:26:14 2005 +++ llvm/include/llvm/ADT/EquivalenceClasses.h Sat Mar 19 14:42:43 2005 @@ -73,7 +73,7 @@ const ECValue *getLeader() const { if (isLeader()) return this; - if (Leader->isLeader() == 0) return Leader; + if (Leader->isLeader()) return Leader; // Path compression. return Leader = Leader->getLeader(); } @@ -146,6 +146,30 @@ return member_iterator(0); } + /// findValue - Return an iterator to the specified value. If it does not + /// exist, end() is returned. + iterator findValue(const ElemTy &V) const { + return TheMapping.find(V); + } + + /// getLeaderValue - Return the leader for the specified value that is in the + /// set. It is an error to call this method for a value that is not yet in + /// the set. For that, call getOrInsertLeaderValue(V). + const ElemTy &getLeaderValue(const ElemTy &V) const { + member_iterator MI = findLeader(V); + assert(MI != member_end() && "Value is not in the set!"); + return *MI; + } + + /// getOrInsertLeaderValue - Return the leader for the specified value that is + /// in the set. If the member is not in the set, it is inserted, then + /// returned. + const ElemTy &getOrInsertLeaderValue(const ElemTy &V) const { + member_iterator MI = findLeader(insert(V)); + assert(MI != member_end() && "Value is not in the set!"); + return *MI; + } + /// getNumClasses - Return the number of equivalence classes in this set. /// Note that this is a linear time operation. unsigned getNumClasses() const { @@ -156,7 +180,6 @@ } - //===--------------------------------------------------------------------===// // Mutation methods @@ -183,7 +206,8 @@ /// union - Merge the two equivalence sets for the specified values, inserting /// them if they do not already exist in the equivalence set. member_iterator unionSets(const ElemTy &V1, const ElemTy &V2) { - return unionSets(findLeader(insert(V1)), findLeader(insert(V2))); + iterator V1I = insert(V1), V2I = insert(V2); + return unionSets(findLeader(V1I), findLeader(V2I)); } member_iterator unionSets(member_iterator L1, member_iterator L2) { assert(L1 != member_end() && L2 != member_end() && "Illegal inputs!"); From lattner at cs.uiuc.edu Sat Mar 19 15:02:28 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 15:02:28 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/EquivalenceClasses.h Message-ID: <200503192102.j2JL2SUM004702@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: EquivalenceClasses.h updated: 1.11 -> 1.12 --- Log message: Two fixes for the copy ctor/operator=: 1. Make sure to clear() 'this' before adding elements to it 2. Make sure that the leaders of the RHS EC are the leaders of the LHS EC. --- Diffs of the changes: (+7 -4) EquivalenceClasses.h | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) Index: llvm/include/llvm/ADT/EquivalenceClasses.h diff -u llvm/include/llvm/ADT/EquivalenceClasses.h:1.11 llvm/include/llvm/ADT/EquivalenceClasses.h:1.12 --- llvm/include/llvm/ADT/EquivalenceClasses.h:1.11 Sat Mar 19 14:42:43 2005 +++ llvm/include/llvm/ADT/EquivalenceClasses.h Sat Mar 19 15:02:12 2005 @@ -118,11 +118,14 @@ } const EquivalenceClasses &operator=(const EquivalenceClasses &RHS) { + TheMapping.clear(); for (iterator I = RHS.begin(), E = RHS.end(); I != E; ++I) - if (I->isLeader()) - insert(I->getData()); - else - unionSets(I->getData(), *RHS.findLeader(I)); + if (I->isLeader()) { + member_iterator MI = RHS.member_begin(I); + member_iterator LeaderIt = member_begin(insert(*MI)); + for (++MI; MI != member_end(); ++MI) + unionSets(LeaderIt, member_begin(insert(*MI))); + } return *this; } From lattner at cs.uiuc.edu Sat Mar 19 16:12:19 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 16:12:19 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSNode.h Message-ID: <200503192212.j2JMCJth006742@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSNode.h updated: 1.50 -> 1.51 --- Log message: add a method to clear globals from a node --- Diffs of the changes: (+1 -0) DSNode.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/Analysis/DataStructure/DSNode.h diff -u llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.50 llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.51 --- llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.50 Tue Feb 8 21:14:29 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSNode.h Sat Mar 19 16:12:03 2005 @@ -284,6 +284,7 @@ /// void addGlobal(GlobalValue *GV); void mergeGlobals(const std::vector &RHS); + void clearGlobals() { std::vector().swap(Globals); } const std::vector &getGlobals() const { return Globals; } typedef std::vector::const_iterator global_iterator; From lattner at cs.uiuc.edu Sat Mar 19 16:13:16 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 16:13:16 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h DataStructure.h Message-ID: <200503192213.j2JMDGDj006760@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: EquivClassGraphs.h updated: 1.18 -> 1.19 DataStructure.h updated: 1.85 -> 1.86 --- Log message: Each DS collection now contains an equivalence class of globals values. --- Diffs of the changes: (+27 -2) DataStructure.h | 21 +++++++++++++++++++++ EquivClassGraphs.h | 8 ++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h diff -u llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.18 llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.19 --- llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h:1.18 Tue Mar 15 00:21:40 2005 +++ llvm/include/llvm/Analysis/DataStructure/EquivClassGraphs.h Sat Mar 19 16:12:33 2005 @@ -16,9 +16,7 @@ #include "llvm/Analysis/DataStructure/DataStructure.h" #include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/hash_map" #include #include @@ -52,6 +50,10 @@ /// a call site. std::map OneCalledFunction; + /// GlobalECs - The equivalence classes for each global value that is merged + /// with other global values in the DSGraphs. + EquivalenceClasses GlobalECs; + public: /// EquivClassGraphs - Computes the equivalence classes and then the /// folded DS graphs for each class. @@ -62,6 +64,8 @@ /// void print(std::ostream &O, const Module *M) const; + EquivalenceClasses &getGlobalECs() { return GlobalECs; } + /// getDSGraph - Return the data structure graph for the specified function. /// This returns the folded graph. The folded graph is the same as the CBU /// graph iff the function is in a singleton equivalence class AND all its Index: llvm/include/llvm/Analysis/DataStructure/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.85 llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.86 --- llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.85 Mon Feb 7 10:09:01 2005 +++ llvm/include/llvm/Analysis/DataStructure/DataStructure.h Sat Mar 19 16:12:33 2005 @@ -18,11 +18,13 @@ #include "llvm/Target/TargetData.h" #include "llvm/ADT/hash_map" #include "llvm/ADT/hash_set" +#include "llvm/ADT/EquivalenceClasses.h" namespace llvm { class Type; class Instruction; +class GlobalValue; class DSGraph; class DSNode; class DSNodeHandle; @@ -46,6 +48,10 @@ // DSInfo, one graph for each function hash_map DSInfo; DSGraph *GlobalsGraph; + + /// GlobalECs - The equivalence classes for each global value that is merged + /// with other global values in the DSGraphs. + EquivalenceClasses GlobalECs; public: ~LocalDataStructures() { releaseMemory(); } @@ -66,6 +72,8 @@ DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + EquivalenceClasses &getGlobalECs() { return GlobalECs; } + /// print - Print out the analysis results... /// void print(std::ostream &O, const Module *M) const; @@ -98,6 +106,10 @@ // This map is only maintained during construction of BU Graphs std::map, std::pair > > *IndCallGraphMap; + + /// GlobalECs - The equivalence classes for each global value that is merged + /// with other global values in the DSGraphs. + EquivalenceClasses GlobalECs; public: ~BUDataStructures() { releaseMemory(); } @@ -118,6 +130,9 @@ DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + EquivalenceClasses &getGlobalECs() { return GlobalECs; } + + /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. /// These correspond to the interfaces defined in the AliasAnalysis class. void deleteValue(Value *V); @@ -162,6 +177,10 @@ hash_map DSInfo; hash_set ArgsRemainIncomplete; DSGraph *GlobalsGraph; + + /// GlobalECs - The equivalence classes for each global value that is merged + /// with other global values in the DSGraphs. + EquivalenceClasses GlobalECs; public: ~TDDataStructures() { releaseMyMemory(); } @@ -181,6 +200,8 @@ } DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + EquivalenceClasses &getGlobalECs() { return GlobalECs; } + /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. /// These correspond to the interfaces defined in the AliasAnalysis class. From lattner at cs.uiuc.edu Sat Mar 19 16:13:26 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 16:13:26 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200503192213.j2JMDQn5006771@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.94 -> 1.95 --- Log message: Make each scalar map contain a reference to an equivalence class of global variables. Do not insert a global into the scalar map unless it is the leader of its equivalence class. --- Diffs of the changes: (+79 -16) DSGraph.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 79 insertions(+), 16 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.94 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.95 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.94 Thu Mar 17 17:45:35 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Sat Mar 19 16:13:13 2005 @@ -17,6 +17,7 @@ #include "llvm/Analysis/DataStructure/DSNode.h" #include "llvm/ADT/hash_map" +#include "llvm/ADT/EquivalenceClasses.h" #include namespace llvm { @@ -40,7 +41,12 @@ typedef hash_set GlobalSetTy; GlobalSetTy GlobalSet; + + EquivalenceClasses &GlobalECs; public: + DSScalarMap(EquivalenceClasses &ECs) : GlobalECs(ECs) {} + + EquivalenceClasses &getGlobalECs() const { return GlobalECs; } // Compatibility methods: provide an interface compatible with a map of // Value* to DSNodeHandle's. @@ -50,11 +56,44 @@ iterator end() { return ValueMap.end(); } const_iterator begin() const { return ValueMap.begin(); } const_iterator end() const { return ValueMap.end(); } - iterator find(Value *V) { return ValueMap.find(V); } - const_iterator find(Value *V) const { return ValueMap.find(V); } - unsigned count(Value *V) const { return ValueMap.count(V); } - void erase(Value *V) { erase(find(V)); } + GlobalValue *getLeaderForGlobal(GlobalValue *GV) const { + EquivalenceClasses::iterator ECI = GlobalECs.findValue(GV); + if (ECI == GlobalECs.end()) return GV; + return *GlobalECs.findLeader(ECI); + } + + + iterator find(Value *V) { + iterator I = ValueMap.find(V); + if (I != ValueMap.end()) return I; + + if (GlobalValue *GV = dyn_cast(V)) { + // If this is a global, check to see if it is equivalenced to something + // in the map. + GlobalValue *Leader = getLeaderForGlobal(GV); + if (Leader != GV) + I = ValueMap.find((Value*)Leader); + } + return I; + } + const_iterator find(Value *V) const { + const_iterator I = ValueMap.find(V); + if (I != ValueMap.end()) return I; + + if (GlobalValue *GV = dyn_cast(V)) { + // If this is a global, check to see if it is equivalenced to something + // in the map. + GlobalValue *Leader = getLeaderForGlobal(GV); + if (Leader != GV) + I = ValueMap.find((Value*)Leader); + } + return I; + } + + unsigned count(Value *V) const { return ValueMap.find(V) != ValueMap.end(); } + + void erase(Value *V) { erase(ValueMap.find(V)); } void eraseIfExists(Value *V) { iterator I = find(V); @@ -79,14 +118,30 @@ ValueMap.insert(std::make_pair(New, I->second)); } + + /// operator[] - Return the DSNodeHandle for the specified value, creating a + /// new null handle if there is no entry yet. DSNodeHandle &operator[](Value *V) { - std::pair IP = - ValueMap.insert(std::make_pair(V, DSNodeHandle())); - if (IP.second) { // Inserted the new entry into the map. - if (GlobalValue *GV = dyn_cast(V)) - GlobalSet.insert(GV); + iterator I = ValueMap.find(V); + if (I != ValueMap.end()) + return I->second; // Return value if already exists. + + if (GlobalValue *GV = dyn_cast(V)) { + // If the node doesn't exist, check to see if it's a global that is + // equated to another global in the program. + EquivalenceClasses::iterator ECI = GlobalECs.findValue(GV); + if (ECI != GlobalECs.end()) { + GlobalValue *Leader = *GlobalECs.findLeader(ECI); + if (Leader != GV) + return operator[]((Value*)Leader); + } + + // Okay, this is either not an equivalenced global or it is the leader, it + // will be inserted into the scalar map now. + GlobalSet.insert(GV); } - return IP.first->second; + + return ValueMap.insert(std::make_pair(V, DSNodeHandle())).first->second; } void erase(iterator I) { @@ -167,14 +222,15 @@ const TargetData &TD; void operator=(const DSGraph &); // DO NOT IMPLEMENT - + DSGraph(const DSGraph&); // DO NOT IMPLEMENT public: // Create a new, empty, DSGraph. - DSGraph(const TargetData &td) - : GlobalsGraph(0), PrintAuxCalls(false), TD(td) {} + DSGraph(EquivalenceClasses &ECs, const TargetData &td) + : GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) {} // Compute the local DSGraph - DSGraph(const TargetData &td, Function &F, DSGraph *GlobalsGraph); + DSGraph(EquivalenceClasses &ECs, const TargetData &TD, + Function &F, DSGraph *GlobalsGraph); // Copy ctor - If you want to capture the node mapping between the source and // destination graph, you may optionally do this by specifying a map to record @@ -184,13 +240,20 @@ // source. You need to set a new GlobalsGraph with the setGlobalsGraph // method. // - DSGraph(const DSGraph &DSG); - DSGraph(const DSGraph &DSG, NodeMapTy &NodeMap); + DSGraph(const DSGraph &DSG, EquivalenceClasses &ECs); + DSGraph(const DSGraph &DSG, NodeMapTy &NodeMap, + EquivalenceClasses &ECs); ~DSGraph(); DSGraph *getGlobalsGraph() const { return GlobalsGraph; } void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; } + /// getGlobalECs - Return the set of equivalence classes that the global + /// variables in the program form. + EquivalenceClasses &getGlobalECs() const { + return ScalarMap.getGlobalECs(); + } + /// getTargetData - Return the TargetData object for the current target. /// const TargetData &getTargetData() const { return TD; } From lattner at cs.uiuc.edu Sat Mar 19 16:24:01 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 16:24:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp CompleteBottomUp.cpp DataStructure.cpp EquivClassGraphs.cpp Local.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200503192224.j2JMO1mM006813@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.98 -> 1.99 CompleteBottomUp.cpp updated: 1.22 -> 1.23 DataStructure.cpp updated: 1.211 -> 1.212 EquivClassGraphs.cpp updated: 1.34 -> 1.35 Local.cpp updated: 1.127 -> 1.128 Steensgaard.cpp updated: 1.46 -> 1.47 TopDownClosure.cpp updated: 1.75 -> 1.76 --- Log message: Create an equivalence class of global variables that DSA will never be able to tell apart anyway, and only track the leader for of these equivalence classes in our graphs. This dramatically reduces the number of GlobalValue*'s that appear in scalar maps, which A) reduces memory usage, by eliminating many many scalarmap entries and B) reduces time for operations that need to execute an operation for each global in the scalar map. As an example, this reduces the memory used to analyze 176.gcc from 1GB to 511MB, which (while it's still way too much) is better because it doesn't hit swap anymore. On eon, this shrinks the local graphs from 14MB to 6.8MB, shrinks the bu+td graphs of povray from 50M to 40M, shrinks the TD graphs of 130.li from 8.8M to 3.6M, etc. This change also speeds up DSA on large programs where this makes a big difference. For example, 130.li goes from 1.17s -> 0.56s, 134.perl goes from 2.14 -> 0.93s, povray goes from 15.63s->7.99s (!!!). This also apparently either fixes the problem that caused DSA to crash on perlbmk and gcc, or it hides it, because DSA now works on these. These both take entirely too much time in the TD pass (147s for perl, 538s for gcc, vs 7.67/5.9s in the bu pass for either one), but this is a known problem that I'll deal with later. --- Diffs of the changes: (+72 -48) BottomUpClosure.cpp | 11 +++++++---- CompleteBottomUp.cpp | 4 ++-- DataStructure.cpp | 42 +++++++++++++++--------------------------- EquivClassGraphs.cpp | 5 +++-- Local.cpp | 43 ++++++++++++++++++++++++++++++++++++------- Steensgaard.cpp | 8 +++++--- TopDownClosure.cpp | 7 ++++--- 7 files changed, 72 insertions(+), 48 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.98 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.99 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.98 Fri Mar 18 17:19:47 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Mar 19 16:23:45 2005 @@ -37,7 +37,9 @@ // bool BUDataStructures::runOnModule(Module &M) { LocalDataStructures &LocalDSA = getAnalysis(); - GlobalsGraph = new DSGraph(LocalDSA.getGlobalsGraph()); + GlobalECs = LocalDSA.getGlobalECs(); + + GlobalsGraph = new DSGraph(LocalDSA.getGlobalsGraph(), GlobalECs); GlobalsGraph->setPrintAuxCalls(); IndCallGraphMap = new std::map, @@ -112,7 +114,8 @@ if (Graph) return *Graph; // Copy the local version into DSInfo... - Graph = new DSGraph(getAnalysis().getDSGraph(*F)); + Graph = new DSGraph(getAnalysis().getDSGraph(*F), + GlobalECs); Graph->setGlobalsGraph(GlobalsGraph); Graph->setPrintAuxCalls(); @@ -379,7 +382,7 @@ E = CalledFuncs.end(); // Start with a copy of the first graph. - GI = IndCallGraph.first = new DSGraph(getDSGraph(**I)); + GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs); GI->setGlobalsGraph(Graph.getGlobalsGraph()); std::vector &Args = IndCallGraph.second; @@ -498,7 +501,7 @@ if (Function *FromF = dyn_cast(From)) { Function *ToF = cast(To); assert(!DSInfo.count(ToF) && "New Function already exists!"); - DSGraph *NG = new DSGraph(getDSGraph(*FromF)); + DSGraph *NG = new DSGraph(getDSGraph(*FromF), GlobalECs); DSInfo[ToF] = NG; assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!"); Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.22 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.23 --- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.22 Fri Mar 18 17:19:47 2005 +++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Sat Mar 19 16:23:45 2005 @@ -34,7 +34,7 @@ // bool CompleteBUDataStructures::runOnModule(Module &M) { BUDataStructures &BU = getAnalysis(); - GlobalsGraph = new DSGraph(BU.getGlobalsGraph()); + GlobalsGraph = new DSGraph(BU.getGlobalsGraph(), GlobalECs); GlobalsGraph->setPrintAuxCalls(); #if 1 // REMOVE ME EVENTUALLY @@ -121,7 +121,7 @@ if (Graph) return *Graph; // Copy the BU graph... - Graph = new DSGraph(getAnalysis().getDSGraph(F)); + Graph = new DSGraph(getAnalysis().getDSGraph(F), GlobalECs); Graph->setGlobalsGraph(GlobalsGraph); Graph->setPrintAuxCalls(); Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.211 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.212 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.211 Thu Mar 17 18:23:59 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Mar 19 16:23:45 2005 @@ -115,7 +115,7 @@ assert(ParentGraph && "Node has no parent?"); const DSScalarMap &SM = ParentGraph->getScalarMap(); for (unsigned i = 0, e = Globals.size(); i != e; ++i) { - assert(SM.count(Globals[i])); + assert(SM.global_count(Globals[i])); assert(SM.find(Globals[i])->second.getNode() == this); } } @@ -143,6 +143,10 @@ // marks the node with the 'G' flag if it does not already have it. // void DSNode::addGlobal(GlobalValue *GV) { + // First, check to make sure this is the leader if the global is in an + // equivalence class. + GV = getParentGraph()->getScalarMap().getLeaderForGlobal(GV); + // Keep the list sorted. std::vector::iterator I = std::lower_bound(Globals.begin(), Globals.end(), GV); @@ -1091,14 +1095,16 @@ } -DSGraph::DSGraph(const DSGraph &G) : GlobalsGraph(0), TD(G.TD) { +DSGraph::DSGraph(const DSGraph &G, EquivalenceClasses &ECs) + : GlobalsGraph(0), ScalarMap(ECs), TD(G.TD) { PrintAuxCalls = false; NodeMapTy NodeMap; cloneInto(G, ScalarMap, ReturnNodes, NodeMap); } -DSGraph::DSGraph(const DSGraph &G, NodeMapTy &NodeMap) - : GlobalsGraph(0), TD(G.TD) { +DSGraph::DSGraph(const DSGraph &G, NodeMapTy &NodeMap, + EquivalenceClasses &ECs) + : GlobalsGraph(0), ScalarMap(ECs), TD(G.TD) { PrintAuxCalls = false; cloneInto(G, ScalarMap, ReturnNodes, NodeMap); } @@ -1865,8 +1871,9 @@ DSGraph::StripIncompleteBit); // Mark all nodes reachable by (non-global) scalar nodes as alive... - { TIME_REGION(Y, "removeDeadNodes:scalarscan"); - for (DSScalarMap::iterator I = ScalarMap.begin(), E = ScalarMap.end(); I !=E;) +{ TIME_REGION(Y, "removeDeadNodes:scalarscan"); + for (DSScalarMap::iterator I = ScalarMap.begin(), E = ScalarMap.end(); + I != E; ++I) if (isa(I->first)) { // Keep track of global nodes assert(!I->second.isNull() && "Null global node?"); assert(I->second.getNode()->isGlobalNode() && "Should be a global node!"); @@ -1881,29 +1888,10 @@ else GGCloner.getClonedNH(I->second); } - ++I; } else { - DSNode *N = I->second.getNode(); -#if 0 - // Check to see if this is a worthless node generated for non-pointer - // values, such as integers. Consider an addition of long types: A+B. - // Assuming we can track all uses of the value in this context, and it is - // NOT used as a pointer, we can delete the node. We will be able to - // detect this situation if the node pointed to ONLY has Unknown bit set - // in the node. In this case, the node is not incomplete, does not point - // to any other nodes (no mod/ref bits set), and is therefore - // uninteresting for data structure analysis. If we run across one of - // these, prune the scalar pointing to it. - // - if (N->getNodeFlags() == DSNode::UnknownNode && !isa(I->first)) - ScalarMap.erase(I++); - else { -#endif - N->markReachableNodes(Alive); - ++I; - //} + I->second.getNode()->markReachableNodes(Alive); } - } +} // The return values are alive as well. for (ReturnNodesTy::iterator I = ReturnNodes.begin(), E = ReturnNodes.end(); Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.34 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.35 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.34 Fri Mar 18 23:15:27 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Sat Mar 19 16:23:45 2005 @@ -72,9 +72,10 @@ // bool EquivClassGraphs::runOnModule(Module &M) { CBU = &getAnalysis(); + GlobalECs = CBU->getGlobalECs(); DEBUG(CheckAllGraphs(&M, *CBU)); - GlobalsGraph = new DSGraph(CBU->getGlobalsGraph()); + GlobalsGraph = new DSGraph(CBU->getGlobalsGraph(), GlobalECs); GlobalsGraph->setPrintAuxCalls(); ActualCallees = CBU->getActualCallees(); @@ -305,7 +306,7 @@ DSGraph &CBUGraph = CBU->getDSGraph(F); // Copy the CBU graph... - Graph = new DSGraph(CBUGraph); // updates the map via reference + Graph = new DSGraph(CBUGraph, GlobalECs); // updates the map via reference Graph->setGlobalsGraph(&getGlobalsGraph()); Graph->setPrintAuxCalls(); Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.127 llvm/lib/Analysis/DataStructure/Local.cpp:1.128 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.127 Fri Mar 18 17:18:20 2005 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Mar 19 16:23:45 2005 @@ -164,8 +164,9 @@ //===----------------------------------------------------------------------===// // DSGraph constructor - Simply use the GraphBuilder to construct the local // graph. -DSGraph::DSGraph(const TargetData &td, Function &F, DSGraph *GG) - : GlobalsGraph(GG), TD(td) { +DSGraph::DSGraph(EquivalenceClasses &ECs, const TargetData &td, + Function &F, DSGraph *GG) + : GlobalsGraph(GG), ScalarMap(ECs), TD(td) { PrintAuxCalls = false; DEBUG(std::cerr << " [Loc] Calculating graph for: " << F.getName() << "\n"); @@ -1071,21 +1072,49 @@ bool LocalDataStructures::runOnModule(Module &M) { const TargetData &TD = getAnalysis(); - GlobalsGraph = new DSGraph(TD); - + // First step, build the globals graph. + GlobalsGraph = new DSGraph(GlobalECs, TD); { GraphBuilder GGB(*GlobalsGraph); - // Add initializers for all of the globals to the globals graph... - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) + // Add initializers for all of the globals to the globals graph. + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) if (!I->isExternal()) GGB.mergeInGlobalInitializer(I); } + // Next step, iterate through the nodes in the globals graph, unioning + // together the globals into equivalence classes. + for (DSGraph::node_iterator I = GlobalsGraph->node_begin(), + E = GlobalsGraph->node_end(); I != E; ++I) + if (I->getGlobals().size() > 1) { + // First, build up the equivalence set for this block of globals. + const std::vector &GVs = I->getGlobals(); + GlobalValue *First = GVs[0]; + for (unsigned i = 1, e = GVs.size(); i != e; ++i) + GlobalECs.unionSets(First, GVs[i]); + + // Next, get the leader element. + First = GlobalECs.getLeaderValue(First); + + // Next, remove all globals from the scalar map that are not the leader. + DSScalarMap &SM = GlobalsGraph->getScalarMap(); + for (unsigned i = 0, e = GVs.size(); i != e; ++i) + if (GVs[i] != First) + SM.erase(SM.find(GVs[i])); + + // Finally, change the global node to only contain the leader. + I->clearGlobals(); + I->addGlobal(First); + } + DEBUG(GlobalsGraph->AssertGraphOK()); + // Calculate all of the graphs... for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isExternal()) - DSInfo.insert(std::make_pair(I, new DSGraph(TD, *I, GlobalsGraph))); + DSInfo.insert(std::make_pair(I, new DSGraph(GlobalECs, TD, *I, + GlobalsGraph))); GlobalsGraph->removeTriviallyDeadNodes(); GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs); Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.46 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.47 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.46 Mon Mar 14 22:54:18 2005 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Sat Mar 19 16:23:45 2005 @@ -26,6 +26,8 @@ class Steens : public ModulePass, public AliasAnalysis { DSGraph *ResultGraph; DSGraph *GlobalsGraph; // FIXME: Eliminate globals graph stuff from DNE + + EquivalenceClasses GlobalECs; // Always empty public: Steens() : ResultGraph(0), GlobalsGraph(0) {} ~Steens() { @@ -112,8 +114,8 @@ LocalDataStructures &LDS = getAnalysis(); // Create a new, empty, graph... - ResultGraph = new DSGraph(getTargetData()); - GlobalsGraph = new DSGraph(getTargetData()); + ResultGraph = new DSGraph(GlobalECs, getTargetData()); + GlobalsGraph = new DSGraph(GlobalECs, getTargetData()); ResultGraph->setGlobalsGraph(GlobalsGraph); ResultGraph->setPrintAuxCalls(); @@ -128,7 +130,7 @@ unsigned Count = 0; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isExternal()) { - DSGraph::ScalarMapTy ValMap; + DSGraph::ScalarMapTy ValMap(GlobalECs); { // Scope to free NodeMap memory ASAP DSGraph::NodeMapTy NodeMap; const DSGraph &FDSG = LDS.getDSGraph(*I); Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.75 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.76 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.75 Tue Mar 15 10:55:04 2005 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Mar 19 16:23:45 2005 @@ -53,7 +53,8 @@ // bool TDDataStructures::runOnModule(Module &M) { BUDataStructures &BU = getAnalysis(); - GlobalsGraph = new DSGraph(BU.getGlobalsGraph()); + GlobalECs = BU.getGlobalECs(); + GlobalsGraph = new DSGraph(BU.getGlobalsGraph(), GlobalECs); GlobalsGraph->setPrintAuxCalls(); // Figure out which functions must not mark their arguments complete because @@ -115,7 +116,7 @@ DSGraph &TDDataStructures::getOrCreateDSGraph(Function &F) { DSGraph *&G = DSInfo[&F]; if (G == 0) { // Not created yet? Clone BU graph... - G = new DSGraph(getAnalysis().getDSGraph(F)); + G = new DSGraph(getAnalysis().getDSGraph(F), GlobalECs); G->getAuxFunctionCalls().clear(); G->setPrintAuxCalls(); G->setGlobalsGraph(GlobalsGraph); @@ -324,7 +325,7 @@ if (Function *FromF = dyn_cast(From)) { Function *ToF = cast(To); assert(!DSInfo.count(ToF) && "New Function already exists!"); - DSGraph *NG = new DSGraph(getDSGraph(*FromF)); + DSGraph *NG = new DSGraph(getDSGraph(*FromF), GlobalECs); DSInfo[ToF] = NG; assert(NG->getReturnNodes().size() == 1 && "Cannot copy SCC's yet!"); From jeffc at jolt-lang.org Sat Mar 19 16:36:50 2005 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 19 Mar 2005 16:36:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/EquivalenceClasses.h Message-ID: <200503192236.QAA03687@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: EquivalenceClasses.h updated: 1.12 -> 1.13 --- Log message: Silence VC++ warning about mixing intptr_t and bool, and about unused variable isL. --- Diffs of the changes: (+1 -1) EquivalenceClasses.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/ADT/EquivalenceClasses.h diff -u llvm/include/llvm/ADT/EquivalenceClasses.h:1.12 llvm/include/llvm/ADT/EquivalenceClasses.h:1.13 --- llvm/include/llvm/ADT/EquivalenceClasses.h:1.12 Sat Mar 19 15:02:12 2005 +++ llvm/include/llvm/ADT/EquivalenceClasses.h Sat Mar 19 16:36:39 2005 @@ -85,7 +85,7 @@ void setNext(const ECValue *NewNext) const { assert(getNext() == 0 && "Already has a next pointer!"); bool isL = isLeader(); - Next = (const ECValue*)((intptr_t)NewNext | isLeader()); + Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isL); } public: ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1), From brukman at cs.uiuc.edu Sat Mar 19 17:40:01 2005 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Sat, 19 Mar 2005 17:40:01 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/EquivalenceClasses.h Message-ID: <200503192340.RAA04015@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: EquivalenceClasses.h updated: 1.13 -> 1.14 --- Log message: Constant-propagate the value of `isL' variable and eliminate it. --- Diffs of the changes: (+1 -2) EquivalenceClasses.h | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/include/llvm/ADT/EquivalenceClasses.h diff -u llvm/include/llvm/ADT/EquivalenceClasses.h:1.13 llvm/include/llvm/ADT/EquivalenceClasses.h:1.14 --- llvm/include/llvm/ADT/EquivalenceClasses.h:1.13 Sat Mar 19 16:36:39 2005 +++ llvm/include/llvm/ADT/EquivalenceClasses.h Sat Mar 19 17:39:50 2005 @@ -84,8 +84,7 @@ void setNext(const ECValue *NewNext) const { assert(getNext() == 0 && "Already has a next pointer!"); - bool isL = isLeader(); - Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isL); + Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isLeader()); } public: ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1), From lattner at cs.uiuc.edu Sat Mar 19 19:18:16 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 19:18:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200503200118.j2K1IGJs014971@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.128 -> 1.129 --- Log message: comment cleanup --- Diffs of the changes: (+1 -1) Local.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.128 llvm/lib/Analysis/DataStructure/Local.cpp:1.129 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.128 Sat Mar 19 16:23:45 2005 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Mar 19 19:18:00 2005 @@ -223,7 +223,7 @@ // extract the actual value. DSNode* N; if (GlobalValue* GV = dyn_cast(V)) { - // Create a new global node for this global variable... + // Create a new global node for this global variable. N = createNode(GV->getType()->getElementType()); N->addGlobal(GV); } else if (Constant *C = dyn_cast(V)) { From lattner at cs.uiuc.edu Sat Mar 19 20:14:32 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:14:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp Message-ID: <200503200214.j2K2EW1q029392@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructureAA.cpp updated: 1.28 -> 1.29 --- Log message: #ifdef out a function only used by #ifdef'd code. --- Diffs of the changes: (+2 -0) DataStructureAA.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Analysis/DataStructure/DataStructureAA.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.28 llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.29 --- llvm/lib/Analysis/DataStructure/DataStructureAA.cpp:1.28 Fri Mar 18 17:18:30 2005 +++ llvm/lib/Analysis/DataStructure/DataStructureAA.cpp Sat Mar 19 20:14:15 2005 @@ -100,6 +100,7 @@ return 0; } +#if 0 // isSinglePhysicalObject - For now, the only case that we know that there is // only one memory object in the node is when there is a single global in the // node, and the only composition bit set is Global. @@ -109,6 +110,7 @@ return N->isGlobalNode() && N->getGlobals().size() == 1 && !N->isHeapNode() && !N->isAllocaNode() && !N->isUnknownNode(); } +#endif // alias - This is the only method here that does anything interesting... AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size, From lattner at cs.uiuc.edu Sat Mar 19 20:38:56 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:38:56 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSNode.h Message-ID: <200503200238.j2K2ctYt000732@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSNode.h updated: 1.51 -> 1.52 --- Log message: rename some methods and add some new methods for dealing with the globals list in a DSNode. --- Diffs of the changes: (+21 -4) DSNode.h | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/DSNode.h diff -u llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.51 llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.52 --- llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.51 Sat Mar 19 16:12:03 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSNode.h Sat Mar 19 20:38:39 2005 @@ -285,11 +285,28 @@ void addGlobal(GlobalValue *GV); void mergeGlobals(const std::vector &RHS); void clearGlobals() { std::vector().swap(Globals); } - const std::vector &getGlobals() const { return Globals; } - typedef std::vector::const_iterator global_iterator; - global_iterator global_begin() const { return Globals.begin(); } - global_iterator global_end() const { return Globals.end(); } + /// getGlobalsList - Return the set of global leaders that are represented by + /// this node. Note that globals that are in this equivalence class but are + /// not leaders are not returned: for that, use addFullGlobalsList(). + const std::vector &getGlobalsList() const { return Globals; } + + /// addFullGlobalsList - Compute the full set of global values that are + /// represented by this node. Unlike getGlobalsList(), this requires fair + /// amount of work to compute, so don't treat this method call as free. + void addFullGlobalsList(std::vector &List) const; + + /// addFullFunctionList - Identical to addFullGlobalsList, but only return the + /// functions in the full list. + void addFullFunctionList(std::vector &List) const; + + /// globals_iterator/begin/end - Provide iteration methods over the global + /// value leaders set that is merged into this node. Like the getGlobalsList + /// method, these iterators do not return globals that are part of the + /// equivalence classes for globals in this node, but aren't leaders. + typedef std::vector::const_iterator globals_iterator; + globals_iterator globals_begin() const { return Globals.begin(); } + globals_iterator globals_end() const { return Globals.end(); } /// maskNodeTypes - Apply a mask to the node types bitfield. From lattner at cs.uiuc.edu Sat Mar 19 20:40:17 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:40:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200503200240.j2K2eHET001578@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.129 -> 1.130 --- Log message: some methods got renamed --- Diffs of the changes: (+2 -2) Local.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.129 llvm/lib/Analysis/DataStructure/Local.cpp:1.130 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.129 Sat Mar 19 19:18:00 2005 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Mar 19 20:40:04 2005 @@ -1088,9 +1088,9 @@ // together the globals into equivalence classes. for (DSGraph::node_iterator I = GlobalsGraph->node_begin(), E = GlobalsGraph->node_end(); I != E; ++I) - if (I->getGlobals().size() > 1) { + if (I->getGlobalsList().size() > 1) { // First, build up the equivalence set for this block of globals. - const std::vector &GVs = I->getGlobals(); + const std::vector &GVs = I->getGlobalsList(); GlobalValue *First = GVs[0]; for (unsigned i = 1, e = GVs.size(); i != e; ++i) GlobalECs.unionSets(First, GVs[i]); From lattner at cs.uiuc.edu Sat Mar 19 20:40:24 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:40:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200503200240.j2K2eOlX001907@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.78 -> 1.79 --- Log message: print out equiv class info. --- Diffs of the changes: (+16 -2) Printer.cpp | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.78 llvm/lib/Analysis/DataStructure/Printer.cpp:1.79 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.78 Wed Mar 16 16:42:19 2005 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Sat Mar 19 20:40:11 2005 @@ -75,8 +75,22 @@ OS << "\n"; } - for (unsigned i = 0, e = N->getGlobals().size(); i != e; ++i) { - WriteAsOperand(OS, N->getGlobals()[i], false, true, M); + EquivalenceClasses *GlobalECs = 0; + if (G) GlobalECs = &G->getGlobalECs(); + + for (unsigned i = 0, e = N->getGlobalsList().size(); i != e; ++i) { + WriteAsOperand(OS, N->getGlobalsList()[i], false, true, M); + + // Figure out how many globals are equivalent to this one. + if (GlobalECs) { + EquivalenceClasses::iterator I = + GlobalECs->findValue(N->getGlobalsList()[i]); + if (I != GlobalECs->end()) { + unsigned NumMembers = + std::distance(GlobalECs->member_begin(I), GlobalECs->member_end()); + if (NumMembers != 1) OS << " + " << (NumMembers-1) << " EC"; + } + } OS << "\n"; } From lattner at cs.uiuc.edu Sat Mar 19 20:40:33 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:40:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Steensgaard.cpp Message-ID: <200503200240.j2K2eXXL002100@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.76 -> 1.77 Steensgaard.cpp updated: 1.47 -> 1.48 --- Log message: Make use of simpler DSNode methods. --- Diffs of the changes: (+8 -14) Steensgaard.cpp | 14 +++++--------- TopDownClosure.cpp | 8 +++----- 2 files changed, 8 insertions(+), 14 deletions(-) Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.76 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.77 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.76 Sat Mar 19 16:23:45 2005 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Mar 19 20:39:49 2005 @@ -37,11 +37,9 @@ for (unsigned i = 0, e = N->getNumLinks(); i != e; ++i) { DSNodeHandle &NH = N->getLink(i*N->getPointerSize()); if (DSNode *NN = NH.getNode()) { - const std::vector &Globals = NN->getGlobals(); - for (unsigned G = 0, e = Globals.size(); G != e; ++G) - if (Function *F = dyn_cast(Globals[G])) - ArgsRemainIncomplete.insert(F); - + std::vector Functions; + NN->addFullFunctionList(Functions); + ArgsRemainIncomplete.insert(Functions.begin(), Functions.end()); markReachableFunctionsExternallyAccessible(NN, Visited); } } Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.47 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.48 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.47 Sat Mar 19 16:23:45 2005 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Sat Mar 19 20:39:49 2005 @@ -165,21 +165,17 @@ DSCallSite &CurCall = *CI++; // Loop over the called functions, eliminating as many as possible... - std::vector CallTargets; + std::vector CallTargets; if (CurCall.isDirectCall()) CallTargets.push_back(CurCall.getCalleeFunc()); else - CallTargets = CurCall.getCalleeNode()->getGlobals(); + CurCall.getCalleeNode()->addFullFunctionList(CallTargets); for (unsigned c = 0; c != CallTargets.size(); ) { // If we can eliminate this function call, do so! - bool Eliminated = false; - if (Function *F = dyn_cast(CallTargets[c])) - if (!F->isExternal()) { - ResolveFunctionCall(F, CurCall, RetValMap[F]); - Eliminated = true; - } - if (Eliminated) { + Function *F = CallTargets[c]; + if (!F->isExternal()) { + ResolveFunctionCall(F, CurCall, RetValMap[F]); CallTargets[c] = CallTargets.back(); CallTargets.pop_back(); } else From lattner at cs.uiuc.edu Sat Mar 19 20:40:41 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:40:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructureStats.cpp Message-ID: <200503200240.j2K2efY8002115@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructureStats.cpp updated: 1.16 -> 1.17 --- Log message: method was renamed. --- Diffs of the changes: (+3 -2) DataStructureStats.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructureStats.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.16 llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.17 --- llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.16 Sun Jan 30 17:51:01 2005 +++ llvm/lib/Analysis/DataStructure/DataStructureStats.cpp Sat Mar 19 20:40:27 2005 @@ -79,8 +79,9 @@ I != E; ++I) if (isIndirectCallee(I->getCallSite().getCalledValue())) { // This is an indirect function call - const std::vector &Callees = - I->getCalleeNode()->getGlobals(); + std::vector Callees; + I->getCalleeNode()->addFullFunctionList(Callees); + if (Callees.size() > 0) { totalNumCallees += Callees.size(); ++numIndirectCalls; From lattner at cs.uiuc.edu Sat Mar 19 20:41:51 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:41:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503200241.j2K2fpmR003577@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.212 -> 1.213 --- Log message: Implement new methods for dealing with DSNode global lists, rename uses of old methods. --- Diffs of the changes: (+56 -16) DataStructure.cpp | 72 ++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 56 insertions(+), 16 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.212 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.213 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.212 Sat Mar 19 16:23:45 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Mar 19 20:41:38 2005 @@ -212,6 +212,44 @@ return getSize() == 1 && Ty == Type::VoidTy && isArray(); } +/// addFullGlobalsList - Compute the full set of global values that are +/// represented by this node. Unlike getGlobalsList(), this requires fair +/// amount of work to compute, so don't treat this method call as free. +void DSNode::addFullGlobalsList(std::vector &List) const { + if (globals_begin() == globals_end()) return; + + EquivalenceClasses &EC = getParentGraph()->getGlobalECs(); + + for (globals_iterator I = globals_begin(), E = globals_end(); I != E; ++I) { + EquivalenceClasses::iterator ECI = EC.findValue(*I); + if (ECI == EC.end()) + List.push_back(*I); + else + List.insert(List.end(), EC.member_begin(ECI), EC.member_end()); + } +} + +/// addFullFunctionList - Identical to addFullGlobalsList, but only return the +/// functions in the full list. +void DSNode::addFullFunctionList(std::vector &List) const { + if (globals_begin() == globals_end()) return; + + EquivalenceClasses &EC = getParentGraph()->getGlobalECs(); + + for (globals_iterator I = globals_begin(), E = globals_end(); I != E; ++I) { + EquivalenceClasses::iterator ECI = EC.findValue(*I); + if (ECI == EC.end()) { + if (Function *F = dyn_cast(*I)) + List.push_back(F); + } else { + for (EquivalenceClasses::member_iterator MI = + EC.member_begin(ECI), E = EC.member_end(); MI != E; ++MI) + if (Function *F = dyn_cast(*MI)) + List.push_back(F); + } + } +} + namespace { /// TypeElementWalker Class - Used for implementation of physical subtyping... /// @@ -822,9 +860,9 @@ // If SrcNH has globals and the destination graph has one of the same globals, // merge this node with the destination node, which is much more efficient. - if (SN->global_begin() != SN->global_end()) { + if (SN->globals_begin() != SN->globals_end()) { DSScalarMap &DestSM = Dest.getScalarMap(); - for (DSNode::global_iterator I = SN->global_begin(), E = SN->global_end(); + for (DSNode::globals_iterator I = SN->globals_begin(),E = SN->globals_end(); I != E; ++I) { GlobalValue *GV = *I; DSScalarMap::iterator GI = DestSM.find(GV); @@ -867,7 +905,7 @@ // If this node contains any globals, make sure they end up in the scalar // map with the correct offset. - for (DSNode::global_iterator I = SN->global_begin(), E = SN->global_end(); + for (DSNode::globals_iterator I = SN->globals_begin(), E = SN->globals_end(); I != E; ++I) { GlobalValue *GV = *I; const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV); @@ -879,7 +917,7 @@ if (CloneFlags & DSGraph::UpdateInlinedGlobals) Dest.getInlinedGlobals().insert(GV); } - NH.getNode()->mergeGlobals(SN->getGlobals()); + NH.getNode()->mergeGlobals(SN->getGlobalsList()); return DSNodeHandle(NH.getNode(), NH.getOffset()+SrcNH.getOffset()); } @@ -953,14 +991,14 @@ // If the source node contains any globals, make sure they end up in the // scalar map with the correct offset. - if (SN->global_begin() != SN->global_end()) { + if (SN->globals_begin() != SN->globals_end()) { // Update the globals in the destination node itself. - DN->mergeGlobals(SN->getGlobals()); + DN->mergeGlobals(SN->getGlobalsList()); // Update the scalar map for the graph we are merging the source node // into. - for (DSNode::global_iterator I = SN->global_begin(), E = SN->global_end(); - I != E; ++I) { + for (DSNode::globals_iterator I = SN->globals_begin(), + E = SN->globals_end(); I != E; ++I) { GlobalValue *GV = *I; const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV); DSNodeHandle &DestGNH = NodeMap[SrcGNH.getNode()]; @@ -971,7 +1009,7 @@ if (CloneFlags & DSGraph::UpdateInlinedGlobals) Dest.getInlinedGlobals().insert(GV); } - NH.getNode()->mergeGlobals(SN->getGlobals()); + NH.getNode()->mergeGlobals(SN->getGlobalsList()); } } else { // We cannot handle this case without allocating a temporary node. Fall @@ -993,8 +1031,8 @@ // If the source node contained any globals, make sure to create entries // in the scalar map for them! - for (DSNode::global_iterator I = SN->global_begin(), E = SN->global_end(); - I != E; ++I) { + for (DSNode::globals_iterator I = SN->globals_begin(), + E = SN->globals_end(); I != E; ++I) { GlobalValue *GV = *I; const DSNodeHandle &SrcGNH = Src.getNodeForValue(GV); DSNodeHandle &DestGNH = NodeMap[SrcGNH.getNode()]; @@ -1542,6 +1580,7 @@ Edge.setTo(0, 0); // Kill the edge! } +#if 0 static inline bool nodeContainsExternalFunction(const DSNode *N) { const std::vector &Globals = N->getGlobals(); for (unsigned i = 0, e = Globals.size(); i != e; ++i) @@ -1549,6 +1588,7 @@ return true; return false; } +#endif static void removeIdenticalCalls(std::list &Calls) { // Remove trivially identical function calls @@ -1570,7 +1610,7 @@ // eliminate it. if (CS.isIndirectCall() && CS.getCalleeNode()->getNumReferrers() == 1 && CS.getCalleeNode()->isComplete() && - CS.getCalleeNode()->getGlobals().empty()) { // No useful info? + CS.getCalleeNode()->getGlobalsList().empty()) { // No useful info? #ifndef NDEBUG std::cerr << "WARNING: Useless call site found.\n"; #endif @@ -1733,8 +1773,8 @@ // have all of these properties and still have incoming edges, due to the // scalar map, so we check those now. // - if (Node.getNumReferrers() == Node.getGlobals().size()) { - const std::vector &Globals = Node.getGlobals(); + if (Node.getNumReferrers() == Node.getGlobalsList().size()) { + const std::vector &Globals = Node.getGlobalsList(); // Loop through and make sure all of the globals are referring directly // to the node... @@ -1996,8 +2036,8 @@ } void DSGraph::AssertNodeContainsGlobal(const DSNode *N, GlobalValue *GV) const { - assert(std::find(N->getGlobals().begin(), N->getGlobals().end(), GV) != - N->getGlobals().end() && "Global value not in node!"); + assert(std::find(N->globals_begin(),N->globals_end(), GV) != + N->globals_end() && "Global value not in node!"); } void DSGraph::AssertCallSiteInGraph(const DSCallSite &CS) const { From lattner at cs.uiuc.edu Sat Mar 19 20:42:21 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:42:21 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DSCallSiteIterator.h Message-ID: <200503200242.j2K2gLX0004831@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.99 -> 1.100 DSCallSiteIterator.h (r1.10) removed --- Log message: Transform BU pass to not use the horrible DSCallSiteIterator class. --- Diffs of the changes: (+54 -40) BottomUpClosure.cpp | 94 +++++++++++++++++++++++++++++----------------------- 1 files changed, 54 insertions(+), 40 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.99 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.100 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.99 Sat Mar 19 16:23:45 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Mar 19 20:42:07 2005 @@ -15,10 +15,10 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/DataStructure/DataStructure.h" +#include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/Module.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Debug.h" -#include "DSCallSiteIterator.h" using namespace llvm; namespace { @@ -30,8 +30,6 @@ X("budatastructure", "Bottom-up Data Structure Analysis"); } -using namespace DS; - // run - Calculate the bottom up data structure graphs for each function in the // program. // @@ -125,6 +123,45 @@ return *Graph; } +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"; +} + +static bool isResolvableFunc(const Function* callee) { + return !callee->isExternal() || isVAHackFn(callee); +} + +static void GetAllCallees(const DSCallSite &CS, + std::vector &Callees) { + if (CS.isDirectCall()) { + if (isResolvableFunc(CS.getCalleeFunc())) + Callees.push_back(CS.getCalleeFunc()); + } else if (!CS.getCalleeNode()->isIncomplete()) { + // Get all callees. + unsigned OldSize = Callees.size(); + CS.getCalleeNode()->addFullFunctionList(Callees); + + // If any of the callees are unresolvable, remove the whole batch! + for (unsigned i = OldSize, e = Callees.size(); i != e; ++i) + if (!isResolvableFunc(Callees[i])) { + Callees.erase(Callees.begin()+OldSize, Callees.end()); + return; + } + } +} + + +/// GetAllAuxCallees - Return a list containing all of the resolvable callees in +/// the aux list for the specified graph in the Callees vector. +static void GetAllAuxCallees(DSGraph &G, std::vector &Callees) { + Callees.clear(); + for (DSGraph::afc_iterator I = G.afc_begin(), E = G.afc_end(); I != E; ++I) + GetAllCallees(*I, Callees); +} + unsigned BUDataStructures::calculateGraphs(Function *F, std::vector &Stack, unsigned &NextID, @@ -146,10 +183,13 @@ DSGraph &Graph = getOrCreateGraph(F); + // Find all callee functions. + std::vector CalleeFunctions; + GetAllAuxCallees(Graph, CalleeFunctions); + // The edges out of the current node are the call site targets... - for (DSCallSiteIterator I = DSCallSiteIterator::begin_aux(Graph), - E = DSCallSiteIterator::end_aux(Graph); I != E; ++I) { - Function *Callee = *I; + for (unsigned i = 0, e = CalleeFunctions.size(); i != e; ++i) { + Function *Callee = CalleeFunctions[i]; unsigned M; // Have we visited the destination function yet? hash_map::iterator It = ValMap.find(Callee); @@ -178,8 +218,10 @@ if (MaxSCC < 1) MaxSCC = 1; - // Should we revisit the graph? - if (DSCallSiteIterator::begin_aux(G) != DSCallSiteIterator::end_aux(G)) { + // Should we revisit the graph? Only do it if there are now new resolvable + // callees. + GetAllAuxCallees(Graph, CalleeFunctions); + if (!CalleeFunctions.empty()) { ValMap.erase(F); return calculateGraphs(F, Stack, NextID, ValMap); } else { @@ -278,20 +320,6 @@ 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! @@ -313,26 +341,12 @@ if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0) { TempFCs.erase(TempFCs.begin()); continue; + } else if (CS.isDirectCall() && isVAHackFn(CS.getCalleeFunc())) { + TempFCs.erase(TempFCs.begin()); + continue; } - if (CS.isDirectCall()) { - Function *F = CS.getCalleeFunc(); - if (isResolvableFunc(F)) - if (F->isExternal()) { // Call to fprintf, etc. - TempFCs.erase(TempFCs.begin()); - continue; - } else { - CalledFuncs.push_back(F); - } - } else { - DSNode *Node = CS.getCalleeNode(); - - 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.push_back(CF); - } + GetAllCallees(CS, CalledFuncs); if (CalledFuncs.empty()) { // Remember that we could not resolve this yet! From lattner at cs.uiuc.edu Sat Mar 19 20:42:30 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 20:42:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Message-ID: <200503200242.j2K2gUJo004925@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: CompleteBottomUp.cpp updated: 1.23 -> 1.24 --- Log message: use simpler methods. --- Diffs of the changes: (+3 -4) CompleteBottomUp.cpp | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.23 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.24 --- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.23 Sat Mar 19 16:23:45 2005 +++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Sat Mar 19 20:41:16 2005 @@ -56,11 +56,10 @@ Instruction *TheCall = CSI->getCallSite().getInstruction(); if (CSI->isIndirectCall()) { // indirect call: insert all callees - const std::vector &Callees = - CSI->getCalleeNode()->getGlobals(); + std::vector Callees; + CSI->getCalleeNode()->addFullFunctionList(Callees); for (unsigned i = 0, e = Callees.size(); i != e; ++i) - if (Function *F = dyn_cast(Callees[i])) - ActualCallees.insert(std::make_pair(TheCall, F)); + ActualCallees.insert(std::make_pair(TheCall, Callees[i])); } else { // direct call: insert the single callee directly ActualCallees.insert(std::make_pair(TheCall, CSI->getCalleeFunc())); From lattner at cs.uiuc.edu Sat Mar 19 21:29:55 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 21:29:55 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSNode.h Message-ID: <200503200329.j2K3Tt6X009702@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSNode.h updated: 1.52 -> 1.53 --- Log message: add a method --- Diffs of the changes: (+5 -0) DSNode.h | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/include/llvm/Analysis/DataStructure/DSNode.h diff -u llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.52 llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.53 --- llvm/include/llvm/Analysis/DataStructure/DSNode.h:1.52 Sat Mar 19 20:38:39 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSNode.h Sat Mar 19 21:29:39 2005 @@ -283,6 +283,11 @@ /// also marks the node with the 'G' flag if it does not already have it. /// void addGlobal(GlobalValue *GV); + + /// removeGlobal - Remove the specified global that is explicitly in the + /// globals list. + void removeGlobal(GlobalValue *GV); + void mergeGlobals(const std::vector &RHS); void clearGlobals() { std::vector().swap(Globals); } From lattner at cs.uiuc.edu Sat Mar 19 21:30:08 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 21:30:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503200330.j2K3U85l009720@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.213 -> 1.214 --- Log message: Add a new DSNode::removeGlobal method. --- Diffs of the changes: (+9 -0) DataStructure.cpp | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.213 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.214 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.213 Sat Mar 19 20:41:38 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Mar 19 21:29:54 2005 @@ -157,6 +157,15 @@ } } +// removeGlobal - Remove the specified global that is explicitly in the globals +// list. +void DSNode::removeGlobal(GlobalValue *GV) { + std::vector::iterator I = + std::lower_bound(Globals.begin(), Globals.end(), GV); + assert(I != Globals.end() && *I == GV && "Global not in node!"); + Globals.erase(I); +} + /// foldNodeCompletely - If we determine that this node has some funny /// behavior happening to it that we cannot represent, we fold it down to a /// single, completely pessimistic, node. This node is represented as a From lattner at cs.uiuc.edu Sat Mar 19 21:32:48 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 21:32:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200503200332.j2K3Wm4D009783@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.130 -> 1.131 --- Log message: Build EC's for globals twice. The first is after constructing the initial Globals Graph for the local pass, the second is after all of the locals graphs have been constructed. This allows for many additional global EC's to be recognized that weren't before. This speeds up analysis of programs like 177.mesa, where it changes DSA from taking 0.712s to 0.4018s. --- Diffs of the changes: (+99 -23) Local.cpp | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 99 insertions(+), 23 deletions(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.130 llvm/lib/Analysis/DataStructure/Local.cpp:1.131 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.130 Sat Mar 19 20:40:04 2005 +++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Mar 19 21:32:35 2005 @@ -1069,6 +1069,88 @@ } +/// BuildGlobalECs - Look at all of the nodes in the globals graph. If any node +/// contains multiple globals, DSA will never, ever, be able to tell the globals +/// apart. Instead of maintaining this information in all of the graphs +/// throughout the entire program, store only a single global (the "leader") in +/// the graphs, and build equivalence classes for the rest of the globals. +static void BuildGlobalECs(DSGraph &GG, std::set &ECGlobals) { + DSScalarMap &SM = GG.getScalarMap(); + EquivalenceClasses &GlobalECs = SM.getGlobalECs(); + for (DSGraph::node_iterator I = GG.node_begin(), E = GG.node_end(); + I != E; ++I) { + if (I->getGlobalsList().size() <= 1) continue; + + // First, build up the equivalence set for this block of globals. + const std::vector &GVs = I->getGlobalsList(); + GlobalValue *First = GVs[0]; + for (unsigned i = 1, e = GVs.size(); i != e; ++i) + GlobalECs.unionSets(First, GVs[i]); + + // Next, get the leader element. + assert(First == GlobalECs.getLeaderValue(First) && + "First did not end up being the leader?"); + + // Next, remove all globals from the scalar map that are not the leader. + assert(GVs[0] == First && "First had to be at the front!"); + for (unsigned i = 1, e = GVs.size(); i != e; ++i) { + ECGlobals.insert(GVs[i]); + SM.erase(SM.find(GVs[i])); + } + + // Finally, change the global node to only contain the leader. + I->clearGlobals(); + I->addGlobal(First); + } + + DEBUG(GG.AssertGraphOK()); +} + +/// EliminateUsesOfECGlobals - Once we have determined that some globals are in +/// really just equivalent to some other globals, remove the globals from the +/// specified DSGraph (if present), and merge any nodes with their leader nodes. +static void EliminateUsesOfECGlobals(DSGraph &G, + const std::set &ECGlobals) { + DSScalarMap &SM = G.getScalarMap(); + EquivalenceClasses &GlobalECs = SM.getGlobalECs(); + + bool MadeChange = false; + for (DSScalarMap::global_iterator GI = SM.global_begin(), E = SM.global_end(); + GI != E; ) { + GlobalValue *GV = *GI++; + if (!ECGlobals.count(GV)) continue; + + const DSNodeHandle &GVNH = SM[GV]; + assert(!GVNH.isNull() && "Global has null NH!?"); + + // Okay, this global is in some equivalence class. Start by finding the + // leader of the class. + GlobalValue *Leader = GlobalECs.getLeaderValue(GV); + + // If the leader isn't already in the graph, insert it into the node + // corresponding to GV. + if (!SM.global_count(Leader)) { + GVNH.getNode()->addGlobal(Leader); + SM[Leader] = GVNH; + } else { + // Otherwise, the leader is in the graph, make sure the nodes are the + // merged in the specified graph. + const DSNodeHandle &LNH = SM[Leader]; + if (LNH.getNode() != GVNH.getNode()) + LNH.mergeWith(GVNH); + } + + // Next step, remove the global from the DSNode. + GVNH.getNode()->removeGlobal(GV); + + // Finally, remove the global from the ScalarMap. + SM.erase(GV); + MadeChange = true; + } + + DEBUG(if(MadeChange) G.AssertGraphOK()); +} + bool LocalDataStructures::runOnModule(Module &M) { const TargetData &TD = getAnalysis(); @@ -1086,29 +1168,10 @@ // Next step, iterate through the nodes in the globals graph, unioning // together the globals into equivalence classes. - for (DSGraph::node_iterator I = GlobalsGraph->node_begin(), - E = GlobalsGraph->node_end(); I != E; ++I) - if (I->getGlobalsList().size() > 1) { - // First, build up the equivalence set for this block of globals. - const std::vector &GVs = I->getGlobalsList(); - GlobalValue *First = GVs[0]; - for (unsigned i = 1, e = GVs.size(); i != e; ++i) - GlobalECs.unionSets(First, GVs[i]); - - // Next, get the leader element. - First = GlobalECs.getLeaderValue(First); - - // Next, remove all globals from the scalar map that are not the leader. - DSScalarMap &SM = GlobalsGraph->getScalarMap(); - for (unsigned i = 0, e = GVs.size(); i != e; ++i) - if (GVs[i] != First) - SM.erase(SM.find(GVs[i])); - - // Finally, change the global node to only contain the leader. - I->clearGlobals(); - I->addGlobal(First); - } - DEBUG(GlobalsGraph->AssertGraphOK()); + std::set ECGlobals; + BuildGlobalECs(*GlobalsGraph, ECGlobals); + DEBUG(std::cerr << "Eliminating " << ECGlobals.size() << " EC Globals!\n"); + ECGlobals.clear(); // Calculate all of the graphs... for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) @@ -1118,6 +1181,19 @@ GlobalsGraph->removeTriviallyDeadNodes(); GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs); + + // Now that we've computed all of the graphs, and merged all of the info into + // the globals graph, see if we have further constrained the globals in the + // program if so, update GlobalECs and remove the extraneous globals from the + // program. + BuildGlobalECs(*GlobalsGraph, ECGlobals); + if (!ECGlobals.empty()) { + DEBUG(std::cerr << "Eliminating " << ECGlobals.size() << " EC Globals!\n"); + for (hash_map::iterator I = DSInfo.begin(), + E = DSInfo.end(); I != E; ++I) + EliminateUsesOfECGlobals(*I->second, ECGlobals); + } + return false; } From lattner at cs.uiuc.edu Sat Mar 19 22:24:11 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 22:24:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Steensgaard.cpp Message-ID: <200503200424.j2K4OBjt010419@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Steensgaard.cpp updated: 1.48 -> 1.49 --- Log message: -steens doesn't use the inlined globals facility. --- Diffs of the changes: (+1 -2) Steensgaard.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.48 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.49 --- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.48 Sat Mar 19 20:39:49 2005 +++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Sat Mar 19 22:23:57 2005 @@ -134,8 +134,7 @@ { // Scope to free NodeMap memory ASAP DSGraph::NodeMapTy NodeMap; const DSGraph &FDSG = LDS.getDSGraph(*I); - ResultGraph->cloneInto(FDSG, ValMap, RetValMap, NodeMap, - DSGraph::UpdateInlinedGlobals); + ResultGraph->cloneInto(FDSG, ValMap, RetValMap, NodeMap, 0); } // Incorporate the inlined Function's ScalarMap into the global From lattner at cs.uiuc.edu Sat Mar 19 22:30:07 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 22:30:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Message-ID: <200503200430.j2K4U75N017449@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.77 -> 1.78 --- Log message: This call is always a noop, remove it. --- Diffs of the changes: (+0 -9) TopDownClosure.cpp | 9 --------- 1 files changed, 9 deletions(-) Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.77 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.78 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.77 Sat Mar 19 20:39:49 2005 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sat Mar 19 22:29:54 2005 @@ -185,15 +185,6 @@ break; } - // Now fold in the necessary globals from the GlobalsGraph. A global G - // must be folded in if it exists in the current graph (i.e., is not dead) - // and it was not inlined from any of my callers. If it was inlined from - // a caller, it would have been fully consistent with the GlobalsGraph - // in the caller so folding in is not necessary. Otherwise, this node came - // solely from this function's BU graph and so has to be made consistent. - // - Graph.updateFromGlobalGraph(); - // Recompute the Incomplete markers. Depends on whether args are complete unsigned Flags = HasIncompleteArgs ? DSGraph::MarkFormalArgs : DSGraph::IgnoreFormalArgs; From lattner at cs.uiuc.edu Sat Mar 19 22:30:29 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 22:30:29 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DSGraph.h Message-ID: <200503200430.j2K4UTjJ017471@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DSGraph.h updated: 1.95 -> 1.96 --- Log message: Remove the InlinedGlobals set which is always empty. --- Diffs of the changes: (+0 -14) DSGraph.h | 14 -------------- 1 files changed, 14 deletions(-) Index: llvm/include/llvm/Analysis/DataStructure/DSGraph.h diff -u llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.95 llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.96 --- llvm/include/llvm/Analysis/DataStructure/DSGraph.h:1.95 Sat Mar 19 16:13:13 2005 +++ llvm/include/llvm/Analysis/DataStructure/DSGraph.h Sat Mar 19 22:30:16 2005 @@ -174,7 +174,6 @@ // Public data-type declarations... typedef DSScalarMap ScalarMapTy; typedef hash_map ReturnNodesTy; - typedef hash_set GlobalSetTy; typedef ilist NodeListTy; /// NodeMapTy - This data type is used when cloning one graph into another to @@ -212,11 +211,6 @@ // std::list AuxFunctionCalls; - // InlinedGlobals - This set records which globals have been inlined from - // other graphs (callers or callees, depending on the pass) into this one. - // - GlobalSetTy InlinedGlobals; - /// TD - This is the target data object for the machine this graph is /// constructed for. const TargetData &TD; @@ -318,13 +312,6 @@ afc_iterator afc_begin() const { return AuxFunctionCalls.begin(); } afc_iterator afc_end() const { return AuxFunctionCalls.end(); } - /// getInlinedGlobals - Get the set of globals that are have been inlined - /// (from callees in BU or from callers in TD) into the current graph. - /// - GlobalSetTy& getInlinedGlobals() { - return InlinedGlobals; - } - /// getNodeForValue - Given a value that is used or defined in the body of the /// current function, return the DSNode that it points to. /// @@ -443,7 +430,6 @@ DontCloneAuxCallNodes = 1 << 2, CloneAuxCallNodes = 0, StripModRefBits = 1 << 3, KeepModRefBits = 0, StripIncompleteBit = 1 << 4, KeepIncompleteBit = 0, - UpdateInlinedGlobals = 1 << 5, DontUpdateInlinedGlobals = 0, }; void updateFromGlobalGraph(); From lattner at cs.uiuc.edu Sat Mar 19 22:30:44 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 22:30:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200503200430.j2K4UiFd017483@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.214 -> 1.215 --- Log message: Remove the ability to keep track of inlined globals, which is always dead. --- Diffs of the changes: (+1 -36) DataStructure.cpp | 37 +------------------------------------ 1 files changed, 1 insertion(+), 36 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.214 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.215 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.214 Sat Mar 19 21:29:54 2005 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Mar 19 22:30:30 2005 @@ -922,9 +922,6 @@ assert(DestGNH.getNode() == NH.getNode() &&"Global mapping inconsistent"); Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(), DestGNH.getOffset()+SrcGNH.getOffset())); - - if (CloneFlags & DSGraph::UpdateInlinedGlobals) - Dest.getInlinedGlobals().insert(GV); } NH.getNode()->mergeGlobals(SN->getGlobalsList()); @@ -1014,9 +1011,6 @@ assert(DestGNH.getNode()==NH.getNode() &&"Global mapping inconsistent"); Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(), DestGNH.getOffset()+SrcGNH.getOffset())); - - if (CloneFlags & DSGraph::UpdateInlinedGlobals) - Dest.getInlinedGlobals().insert(GV); } NH.getNode()->mergeGlobals(SN->getGlobalsList()); } @@ -1049,9 +1043,6 @@ assert(SrcGNH.getNode() == SN && "Global mapping inconsistent"); Dest.getNodeForValue(GV).mergeWith(DSNodeHandle(DestGNH.getNode(), DestGNH.getOffset()+SrcGNH.getOffset())); - - if (CloneFlags & DSGraph::UpdateInlinedGlobals) - Dest.getInlinedGlobals().insert(GV); } } @@ -1159,7 +1150,6 @@ DSGraph::~DSGraph() { FunctionCalls.clear(); AuxFunctionCalls.clear(); - InlinedGlobals.clear(); ScalarMap.clear(); ReturnNodes.clear(); @@ -1189,28 +1179,6 @@ } } -/// updateFromGlobalGraph - This function rematerializes global nodes and -/// nodes reachable from them from the globals graph into the current graph. -/// It uses the vector InlinedGlobals to avoid cloning and merging globals that -/// are already up-to-date in the current graph. In practice, in the TD pass, -/// this is likely to be a large fraction of the live global nodes in each -/// function (since most live nodes are likely to have been brought up-to-date -/// in at _some_ caller or callee). -/// -void DSGraph::updateFromGlobalGraph() { - TIME_REGION(X, "updateFromGlobalGraph"); - ReachabilityCloner RC(*this, *GlobalsGraph, 0); - - // Clone the non-up-to-date global nodes into this graph. - for (DSScalarMap::global_iterator I = getScalarMap().global_begin(), - E = getScalarMap().global_end(); I != E; ++I) - if (InlinedGlobals.count(*I) == 0) { // GNode is not up-to-date - DSScalarMap::iterator It = GlobalsGraph->ScalarMap.find(*I); - if (It != GlobalsGraph->ScalarMap.end()) - RC.merge(getNodeForValue(*I), It->second); - } -} - /// addObjectToGraph - This method can be used to add global, stack, and heap /// objects to the graph. This can be used when updating DSGraphs due to the /// introduction of new temporary objects. The new object is not pointed to @@ -1287,11 +1255,8 @@ I->second.getOffset()+MappedNode.getOffset())); // If this is a global, add the global to this fn or merge if already exists - if (GlobalValue* GV = dyn_cast(I->first)) { + if (GlobalValue* GV = dyn_cast(I->first)) ScalarMap[GV].mergeWith(H); - if (CloneFlags & DSGraph::UpdateInlinedGlobals) - InlinedGlobals.insert(GV); - } } if (!(CloneFlags & DontCloneCallNodes)) { From lattner at cs.uiuc.edu Sat Mar 19 22:30:53 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 19 Mar 2005 22:30:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp CompleteBottomUp.cpp BottomUpClosure.cpp Message-ID: <200503200430.j2K4UrcZ017515@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: EquivClassGraphs.cpp updated: 1.35 -> 1.36 CompleteBottomUp.cpp updated: 1.24 -> 1.25 BottomUpClosure.cpp updated: 1.100 -> 1.101 --- Log message: remove some pointless asserts --- Diffs of the changes: (+0 -3) BottomUpClosure.cpp | 1 - CompleteBottomUp.cpp | 1 - EquivClassGraphs.cpp | 1 - 3 files changed, 3 deletions(-) Index: llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp diff -u llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.35 llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.36 --- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp:1.35 Sat Mar 19 16:23:45 2005 +++ llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp Sat Mar 19 22:29:39 2005 @@ -468,7 +468,6 @@ } // Recompute the Incomplete markers. - assert(G.getInlinedGlobals().empty()); G.maskIncompleteMarkers(); G.markIncompleteNodes(DSGraph::MarkFormalArgs); Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.24 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.25 --- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.24 Sat Mar 19 20:41:16 2005 +++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp Sat Mar 19 22:29:39 2005 @@ -252,7 +252,6 @@ } // Recompute the Incomplete markers - assert(G.getInlinedGlobals().empty()); G.maskIncompleteMarkers(); G.markIncompleteNodes(DSGraph::MarkFormalArgs); Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.100 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.101 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.100 Sat Mar 19 20:42:07 2005 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Sat Mar 19 22:29:39 2005 @@ -452,7 +452,6 @@ } // Recompute the Incomplete markers - assert(Graph.getInlinedGlobals().empty()); Graph.maskIncompleteMarkers(); Graph.markIncompleteNodes(DSGraph::MarkFormalArgs); From lattner at cs.uiuc.edu Sun Mar 20 12:03:12 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 20 Mar 2005 12:03:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Message-ID: <200503201803.j2KI3Cgb031020@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.78 -> 1.79 --- Log message: Don't strip modref bits when inlining down the call graph. This fixes the DSGraph/2003-06-30-TopDownResolve.ll regression from last night. --- Diffs of the changes: (+1 -1) TopDownClosure.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.78 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.79 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.78 Sat Mar 19 22:29:54 2005 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sun Mar 20 12:02:56 2005 @@ -243,7 +243,7 @@ DSGraph &CalleeGraph = *CSI->first; // Iterate through all of the call sites of this graph, cloning and merging // any nodes required by the call. - ReachabilityCloner RC(CalleeGraph, Graph, DSGraph::StripModRefBits); + ReachabilityCloner RC(CalleeGraph, Graph, 0); // Clone over any global nodes that appear in both graphs. for (DSScalarMap::global_iterator From alkis at cs.uiuc.edu Sun Mar 20 16:56:36 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 20 Mar 2005 16:56:36 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/AbstractClassDoesNotImplementInterface.java Message-ID: <200503202256.QAA25102@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: AbstractClassDoesNotImplementInterface.java added (r1.1) --- Log message: Add testcase --- Diffs of the changes: (+18 -0) AbstractClassDoesNotImplementInterface.java | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm-java/test/Programs/SingleSource/UnitTests/AbstractClassDoesNotImplementInterface.java diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/AbstractClassDoesNotImplementInterface.java:1.1 *** /dev/null Sun Mar 20 16:56:35 2005 --- llvm-java/test/Programs/SingleSource/UnitTests/AbstractClassDoesNotImplementInterface.java Sun Mar 20 16:56:25 2005 *************** *** 0 **** --- 1,18 ---- + public class AbstractClassDoesNotImplementInterface { + + private static interface Interface { + public void iMethod(); + } + + private static abstract class Abstract implements Interface { + + } + + private static class Concrete extends Abstract { + public void iMethod() { } + } + + public static void main(String[] args) { + Abstract a = new Concrete(); + } + } From alkis at cs.uiuc.edu Sun Mar 20 17:24:09 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 20 Mar 2005 17:24:09 -0600 Subject: [llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp Message-ID: <200503202324.RAA25248@zion.cs.uiuc.edu> Changes in directory llvm-java/lib/Compiler: Compiler.cpp updated: 1.236 -> 1.237 --- Log message: Fix case where abstract class implements an interface, but none of the current methods does so far. --- Diffs of the changes: (+11 -5) Compiler.cpp | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) Index: llvm-java/lib/Compiler/Compiler.cpp diff -u llvm-java/lib/Compiler/Compiler.cpp:1.236 llvm-java/lib/Compiler/Compiler.cpp:1.237 --- llvm-java/lib/Compiler/Compiler.cpp:1.236 Sat Mar 19 07:50:12 2005 +++ llvm-java/lib/Compiler/Compiler.cpp Sun Mar 20 17:23:58 2005 @@ -627,11 +627,17 @@ for (VTableInfo::Method2IndexMap::const_iterator i = interfaceVI.m2iMap.begin(), e = interfaceVI.m2iMap.end(); i != e; ++i) { - assert(classVI.m2iMap.find(i->first) != classVI.m2iMap.end() && - "Interface method not found in class definition!"); - unsigned classMethodIdx = classVI.m2iMap.find(i->first)->second; - init[i->second] = cast( - classVI.vtable->getInitializer())->getOperand(classMethodIdx); + if (!cf->isAbstract()) { + assert(classVI.m2iMap.find(i->first) != classVI.m2iMap.end() && + "Interface method not found in class definition!"); + unsigned classMethodIdx = classVI.m2iMap.find(i->first)->second; + init[i->second] = cast( + classVI.vtable->getInitializer())->getOperand(classMethodIdx); + } + else + init[i->second] = + llvm::Constant::getNullValue( + PointerType::get(VTableInfo::VTableTy)); } llvm::Constant* vtable = ConstantStruct::get(init); From alkis at cs.uiuc.edu Sun Mar 20 17:29:25 2005 From: alkis at cs.uiuc.edu (Alkis Evlogimenos) Date: Sun, 20 Mar 2005 17:29:25 -0600 Subject: [llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/InterfaceStaticInitializers.java Message-ID: <200503202329.RAA25283@zion.cs.uiuc.edu> Changes in directory llvm-java/test/Programs/SingleSource/UnitTests: InterfaceStaticInitializers.java added (r1.1) --- Log message: Add file. Apparently interfaces can with public gloabls as well ;-) --- Diffs of the changes: (+12 -0) InterfaceStaticInitializers.java | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm-java/test/Programs/SingleSource/UnitTests/InterfaceStaticInitializers.java diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/InterfaceStaticInitializers.java:1.1 *** /dev/null Sun Mar 20 17:29:24 2005 --- llvm-java/test/Programs/SingleSource/UnitTests/InterfaceStaticInitializers.java Sun Mar 20 17:29:14 2005 *************** *** 0 **** --- 1,12 ---- + public class InterfaceStaticInitializers + { + public static class I1 { + public static int i1 = 1; + public static int i2 = 2; + } + + public static void main(String[] args) { + Test.println(I1.i1); + Test.println(I1.i2); + } + } From lattner at cs.uiuc.edu Sun Mar 20 19:36:52 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 20 Mar 2005 19:36:52 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/EquivalenceClasses.h Message-ID: <200503210136.j2L1aqHg021237@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: EquivalenceClasses.h updated: 1.14 -> 1.15 --- Log message: Provide a guaranteed definition of intptr_t. Thansk to Evan Jones for pointing this out! --- Diffs of the changes: (+1 -0) EquivalenceClasses.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/ADT/EquivalenceClasses.h diff -u llvm/include/llvm/ADT/EquivalenceClasses.h:1.14 llvm/include/llvm/ADT/EquivalenceClasses.h:1.15 --- llvm/include/llvm/ADT/EquivalenceClasses.h:1.14 Sat Mar 19 17:39:50 2005 +++ llvm/include/llvm/ADT/EquivalenceClasses.h Sun Mar 20 19:36:35 2005 @@ -16,6 +16,7 @@ #define LLVM_ADT_EQUIVALENCECLASSES_H #include "llvm/ADT/iterator" +#include "llvm/Support/DataTypes.h" #include namespace llvm { From lattner at cs.uiuc.edu Sun Mar 20 22:46:51 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 20 Mar 2005 22:46:51 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DataStructure.h Message-ID: <200503210446.j2L4kpgs001953@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DataStructure.h updated: 1.86 -> 1.87 --- Log message: rename a method add a data structure. --- Diffs of the changes: (+21 -1) DataStructure.h | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Analysis/DataStructure/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.86 llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.87 --- llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.86 Sat Mar 19 16:12:33 2005 +++ llvm/include/llvm/Analysis/DataStructure/DataStructure.h Sun Mar 20 22:46:35 2005 @@ -26,6 +26,7 @@ class Instruction; class GlobalValue; class DSGraph; +class DSCallSite; class DSNode; class DSNodeHandle; @@ -181,6 +182,25 @@ /// GlobalECs - The equivalence classes for each global value that is merged /// with other global values in the DSGraphs. EquivalenceClasses GlobalECs; + + /// CallerCallEdges - For a particular graph, we keep a list of these records + /// which indicates which graphs call this function and from where. + struct CallerCallEdge { + DSGraph *CallerGraph; // The graph of the caller function. + const DSCallSite *CS; // The actual call site. + Function *CalledFunction; // The actual function being called. + + CallerCallEdge(DSGraph *G, const DSCallSite *cs, Function *CF) + : CallerGraph(G), CS(cs), CalledFunction(CF) {} + + bool operator<(const CallerCallEdge &RHS) const { + return CallerGraph < RHS.CallerGraph || + (CallerGraph == RHS.CallerGraph && CS < RHS.CS); + } + }; + + std::map > CallerEdges; + public: ~TDDataStructures() { releaseMyMemory(); } @@ -227,7 +247,7 @@ void markReachableFunctionsExternallyAccessible(DSNode *N, hash_set &Visited); - void inlineGraphIntoCallees(DSGraph &G); + void InlineCallersIntoGraph(DSGraph &G); DSGraph &getOrCreateDSGraph(Function &F); void ComputePostOrder(Function &F, hash_set &Visited, std::vector &PostOrder, From lattner at cs.uiuc.edu Sun Mar 20 22:55:52 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 20 Mar 2005 22:55:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Message-ID: <200503210455.j2L4tp6d002099@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.79 -> 1.80 --- Log message: Change the way that the TD pass inlines graphs. Instead of inlining each graph into all of the functions it calls when we visit a graph, change it so that the graph visitor inlines all of the callers of a graph into the current graph when it visits it. While we're at it, inline global information from the GG instead of from each of the callers. The GG contains a superset of the info that the callers do anyway, and this way we only need to do it one time (not one for each caller). This speeds up the TD pass substantially on several programs, and there is still room for improvement. For example, the TD pass used to take 147s on perlbmk, it now takes 36s. On povray, we went from about 5s to 1.97s. 134.perl is down from ~1s for Loc+BU+TD to .6s. The TD pass needs a lot of improvement though, which will occur with later patches. --- Diffs of the changes: (+87 -72) TopDownClosure.cpp | 159 +++++++++++++++++++++++++++++------------------------ 1 files changed, 87 insertions(+), 72 deletions(-) Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.79 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.80 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.79 Sun Mar 20 12:02:56 2005 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Sun Mar 20 22:55:35 2005 @@ -100,7 +100,7 @@ // Visit each of the graphs in reverse post-order now! while (!PostOrder.empty()) { - inlineGraphIntoCallees(*PostOrder.back()); + InlineCallersIntoGraph(*PostOrder.back()); PostOrder.pop_back(); } @@ -171,15 +171,82 @@ GlobalsGraph = 0; } -void TDDataStructures::inlineGraphIntoCallees(DSGraph &Graph) { - // Recompute the Incomplete markers and eliminate unreachable nodes. - Graph.maskIncompleteMarkers(); +/// InlineCallersIntoGraph - Inline all of the callers of the specified DS graph +/// into it, then recompute completeness of nodes in the resultant graph. +void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) { + // Inline caller graphs into this graph. First step, get the list of call + // sites that call into this graph. + std::vector EdgesFromCaller; + std::map >::iterator + CEI = CallerEdges.find(&DSG); + if (CEI != CallerEdges.end()) { + std::swap(CEI->second, EdgesFromCaller); + CallerEdges.erase(CEI); + } + + // Sort the caller sites to provide a by-caller-graph ordering. + std::sort(EdgesFromCaller.begin(), EdgesFromCaller.end()); + + + // Merge information from the globals graph into this graph. + // FIXME: is this necessary? + { + DSGraph &GG = *DSG.getGlobalsGraph(); + ReachabilityCloner RC(DSG, GG, + DSGraph::DontCloneCallNodes | + DSGraph::DontCloneAuxCallNodes); + for (DSScalarMap::global_iterator + GI = DSG.getScalarMap().global_begin(), + E = DSG.getScalarMap().global_end(); GI != E; ++GI) + RC.getClonedNH(GG.getNodeForValue(*GI)); + + + } + + DEBUG(std::cerr << "[TD] Inlining callers into '" << DSG.getFunctionNames() + << "'\n"); + + // Iteratively inline caller graphs into this graph. + while (!EdgesFromCaller.empty()) { + DSGraph &CallerGraph = *EdgesFromCaller.back().CallerGraph; + + // Iterate through all of the call sites of this graph, cloning and merging + // any nodes required by the call. + ReachabilityCloner RC(DSG, CallerGraph, + DSGraph::DontCloneCallNodes | + DSGraph::DontCloneAuxCallNodes); + + // Inline all call sites from this caller graph. + do { + const DSCallSite &CS = *EdgesFromCaller.back().CS; + Function &CF = *EdgesFromCaller.back().CalledFunction; + DEBUG(std::cerr << " [TD] Inlining graph for call to Fn '" + << CF.getName() << "' from Fn '" + << CS.getCallSite().getInstruction()-> + getParent()->getParent()->getName() + << "': " << CF.getFunctionType()->getNumParams() + << " args\n"); + + // Get the formal argument and return nodes for the called function and + // merge them with the cloned subgraph. + RC.mergeCallSite(DSG.getCallSiteForArguments(CF), CS); + ++NumTDInlines; + + EdgesFromCaller.pop_back(); + } while (!EdgesFromCaller.empty() && + EdgesFromCaller.back().CallerGraph == &CallerGraph); + } + + + // Next, now that this graph is finalized, we need to recompute the + // incompleteness markers for this graph and remove unreachable nodes. + DSG.maskIncompleteMarkers(); // If any of the functions has incomplete incoming arguments, don't mark any // of them as complete. bool HasIncompleteArgs = false; - for (DSGraph::retnodes_iterator I = Graph.retnodes_begin(), - E = Graph.retnodes_end(); I != E; ++I) + for (DSGraph::retnodes_iterator I = DSG.retnodes_begin(), + E = DSG.retnodes_end(); I != E; ++I) if (ArgsRemainIncomplete.count(I->first)) { HasIncompleteArgs = true; break; @@ -188,38 +255,23 @@ // Recompute the Incomplete markers. Depends on whether args are complete unsigned Flags = HasIncompleteArgs ? DSGraph::MarkFormalArgs : DSGraph::IgnoreFormalArgs; - Graph.markIncompleteNodes(Flags | DSGraph::IgnoreGlobals); + DSG.markIncompleteNodes(Flags | DSGraph::IgnoreGlobals); // Delete dead nodes. Treat globals that are unreachable as dead also. - Graph.removeDeadNodes(DSGraph::RemoveUnreachableGlobals); - - // We are done with computing the current TD Graph! Now move on to - // inlining the current graph into the graphs for its callees, if any. - // - if (Graph.fc_begin() == Graph.fc_end()) { - DEBUG(std::cerr << " [TD] No callees for: " << Graph.getFunctionNames() - << "\n"); - return; - } + DSG.removeDeadNodes(DSGraph::RemoveUnreachableGlobals); - // Now that we have information about all of the callees, propagate the - // current graph into the callees. Clone only the reachable subgraph at - // each call-site, not the entire graph (even though the entire graph - // would be cloned only once, this should still be better on average). - // - DEBUG(std::cerr << " [TD] Inlining '" << Graph.getFunctionNames() <<"' into " - << Graph.getFunctionCalls().size() << " call nodes.\n"); + // We are done with computing the current TD Graph! Finally, before we can + // finish processing this function, we figure out which functions it calls and + // records these call graph edges, so that we have them when we process the + // callee graphs. + if (DSG.fc_begin() == DSG.fc_end()) return; const BUDataStructures::ActualCalleesTy &ActualCallees = getAnalysis().getActualCallees(); - // Loop over all the call sites and all the callees at each call site. Build - // a mapping from called DSGraph's to the call sites in this function that - // invoke them. This is useful because we can be more efficient if there are - // multiple call sites to the callees in the graph from this caller. - std::multimap > CallSites; - - for (DSGraph::fc_iterator CI = Graph.fc_begin(), E = Graph.fc_end(); + // Loop over all the call sites and all the callees at each call site, and add + // edges to the CallerEdges structure for each callee. + for (DSGraph::fc_iterator CI = DSG.fc_begin(), E = DSG.fc_end(); CI != E; ++CI) { Instruction *CallI = CI->getCallSite().getInstruction(); // For each function in the invoked function list at this call site... @@ -230,51 +282,14 @@ for (BUDataStructures::ActualCalleesTy::const_iterator I = IP.first; I != IP.second; ++I) { DSGraph& CalleeGraph = getDSGraph(*I->second); - if (&CalleeGraph != &Graph) - CallSites.insert(std::make_pair(&CalleeGraph, - std::make_pair(I->second, &*CI))); + if (&CalleeGraph != &DSG) + CallerEdges[&CalleeGraph].push_back(CallerCallEdge(&DSG, &*CI, + I->second)); } } - - // Now that we built the mapping, actually perform the inlining a callee graph - // at a time. - std::multimap >::iterator CSI; - for (CSI = CallSites.begin(); CSI != CallSites.end(); ) { - DSGraph &CalleeGraph = *CSI->first; - // Iterate through all of the call sites of this graph, cloning and merging - // any nodes required by the call. - ReachabilityCloner RC(CalleeGraph, Graph, 0); - - // Clone over any global nodes that appear in both graphs. - for (DSScalarMap::global_iterator - SI = CalleeGraph.getScalarMap().global_begin(), - SE = CalleeGraph.getScalarMap().global_end(); SI != SE; ++SI) { - DSScalarMap::const_iterator GI = Graph.getScalarMap().find(*SI); - if (GI != Graph.getScalarMap().end()) - RC.merge(CalleeGraph.getNodeForValue(*SI), GI->second); - } - - // Loop over all of the distinct call sites in the caller of the callee. - for (; CSI != CallSites.end() && CSI->first == &CalleeGraph; ++CSI) { - Function &CF = *CSI->second.first; - const DSCallSite &CS = *CSI->second.second; - DEBUG(std::cerr << " [TD] Resolving arguments for callee graph '" - << CalleeGraph.getFunctionNames() - << "': " << CF.getFunctionType()->getNumParams() - << " args\n at call site (DSCallSite*) 0x" << &CS << "\n"); - - // Get the formal argument and return nodes for the called function and - // merge them with the cloned subgraph. - RC.mergeCallSite(CalleeGraph.getCallSiteForArguments(CF), CS); - ++NumTDInlines; - } - } - - DEBUG(std::cerr << " [TD] Done inlining into callees for: " - << Graph.getFunctionNames() << " [" << Graph.getGraphSize() << "+" - << Graph.getFunctionCalls().size() << "]\n"); } + static const Function *getFnForValue(const Value *V) { if (const Instruction *I = dyn_cast(V)) return I->getParent()->getParent();