[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h

Andrew Lenharth alenhar2 at cs.uiuc.edu
Tue May 3 10:19:54 PDT 2005



Changes in directory llvm/include/llvm/CodeGen:

SelectionDAG.h updated: 1.22 -> 1.23
SelectionDAGNodes.h updated: 1.35 -> 1.36
---
Log message:

Implement count leading zeros (ctlz), count trailing zeros (cttz), and count
population (ctpop).  Generic lowering is implemented, however only promotion 
is implemented for SelectionDAG at the moment.

More coming soon.



---
Diffs of the changes:  (+13 -4)

 SelectionDAG.h      |    6 +++++-
 SelectionDAGNodes.h |   11 ++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.22 llvm/include/llvm/CodeGen/SelectionDAG.h:1.23
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.22	Wed Apr 27 15:10:01 2005
+++ llvm/include/llvm/CodeGen/SelectionDAG.h	Tue May  3 12:19:29 2005
@@ -44,6 +44,10 @@
 
   // AllNodes - All of the nodes in the DAG
   std::vector<SDNode*> AllNodes;
+
+  // ValueNodes - track SrcValue nodes
+  std::map<std::pair<const Value*, int>, SDNode*> ValueNodes;
+
 public:
   SelectionDAG(TargetLowering &tli, MachineFunction &mf) : TLI(tli), MF(mf) {
     EntryNode = Root = getNode(ISD::EntryToken, MVT::Other);
@@ -183,7 +187,7 @@
   SDOperand getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV);
 
   // getSrcValue - construct a node to track a Value* through the backend
-  SDOperand getSrcValue(const Value* I);
+  SDOperand getSrcValue(const Value* I, int offset = 0);
 
   void replaceAllUsesWith(SDOperand Old, SDOperand New) {
     assert(Old != New && "RAUW self!");


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.35 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.36
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.35	Thu Apr 28 16:43:25 2005
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h	Tue May  3 12:19:29 2005
@@ -100,6 +100,9 @@
     // Bitwise operators.
     AND, OR, XOR, SHL, SRA, SRL,
 
+    // Counting operators
+    CTTZ, CTLZ, CTPOP,
+
     // Select operator.
     SELECT,
 
@@ -546,7 +549,7 @@
       ND = N4.Val->getNodeDepth();
     NodeDepth = ND+1;
 
-    Operands.reserve(3); Operands.push_back(N1); Operands.push_back(N2);
+    Operands.reserve(4); Operands.push_back(N1); Operands.push_back(N2);
     Operands.push_back(N3); Operands.push_back(N4);
     N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this);
     N3.Val->Uses.push_back(this); N4.Val->Uses.push_back(this);
@@ -748,13 +751,15 @@
 
 class SrcValueSDNode : public SDNode {
   const Value *V;
+  int offset;
 protected:
   friend class SelectionDAG;
-  SrcValueSDNode(const Value* v)
-    : SDNode(ISD::SRCVALUE, MVT::Other), V(v) {}
+  SrcValueSDNode(const Value* v, int o)
+    : SDNode(ISD::SRCVALUE, MVT::Other), V(v), offset(o) {}
 
 public:
   const Value *getValue() const { return V; }
+  int getOffset() const { return offset; }
 
   static bool classof(const SrcValueSDNode *) { return true; }
   static bool classof(const SDNode *N) {






More information about the llvm-commits mailing list