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 @@