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

Chris Lattner lattner at cs.uiuc.edu
Sat Jul 9 17:07:05 PDT 2005



Changes in directory llvm/include/llvm/CodeGen:

SelectionDAG.h updated: 1.27 -> 1.28
SelectionDAGNodes.h updated: 1.41 -> 1.42
---
Log message:

Introduce a new VTSDNode class with the ultimate goal of eliminating the
MVTSDNode class.  This class is used to provide an operand to operators
that require an extra type.  We start by converting FP_ROUND_INREG and
SIGN_EXTEND_INREG over to using it.


---
Diffs of the changes:  (+26 -10)

 SelectionDAG.h      |    2 ++
 SelectionDAGNodes.h |   34 ++++++++++++++++++++++++----------
 2 files changed, 26 insertions(+), 10 deletions(-)


Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.27 llvm/include/llvm/CodeGen/SelectionDAG.h:1.28
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.27	Sat May 14 02:36:02 2005
+++ llvm/include/llvm/CodeGen/SelectionDAG.h	Sat Jul  9 19:06:54 2005
@@ -100,6 +100,7 @@
   SDOperand getConstantPool(unsigned CPIdx, MVT::ValueType VT);
   SDOperand getBasicBlock(MachineBasicBlock *MBB);
   SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT);
+  SDOperand getValueType(MVT::ValueType);
 
   SDOperand getCopyToReg(SDOperand Chain, SDOperand N, unsigned Reg) {
     // Note: these are auto-CSE'd because the caller doesn't make requests that
@@ -225,6 +226,7 @@
   std::map<int, SDNode*> FrameIndices;
   std::map<unsigned, SDNode*> ConstantPoolIndices;
   std::map<MachineBasicBlock *, SDNode*> BBNodes;
+  std::vector<SDNode*> ValueTypeNodes;
   std::map<std::pair<unsigned,
                      std::pair<MVT::ValueType, std::vector<SDOperand> > >,
            SDNode*> OneResultNodes;


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.41 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.42
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.41	Sat May 14 01:19:11 2005
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h	Sat Jul  9 19:06:54 2005
@@ -55,7 +55,7 @@
 
     // Various leaf nodes.
     Constant, ConstantFP, GlobalAddress, FrameIndex, ConstantPool,
-    BasicBlock, ExternalSymbol,
+    BasicBlock, ExternalSymbol, VALUETYPE,
 
     // CopyToReg - This node has chain and child nodes, and an associated
     // register number.  The instruction selector must guarantee that the value
@@ -148,8 +148,8 @@
     // SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to
     // sign extend a small value in a large integer register (e.g. sign
     // extending the low 8 bits of a 32-bit register to fill the top 24 bits
-    // with the 7th bit).  The size of the smaller type is indicated by the
-    // ExtraValueType in the MVTSDNode for the operator.
+    // with the 7th bit).  The size of the smaller type is indicated by the 1th
+    // operand, a ValueType node.
     SIGN_EXTEND_INREG,
 
     // FP_TO_[US]INT - Convert a floating point value to a signed or unsigned
@@ -164,8 +164,8 @@
     // FP_ROUND_INREG - This operator takes a floating point register, and
     // rounds it to a floating point value.  It then promotes it and returns it
     // in a register of the same size.  This operation effectively just discards
-    // excess precision.  The type to round down to is specified by the
-    // ExtraValueType in the MVTSDNode (currently always 64->32->64).
+    // excess precision.  The type to round down to is specified by the 1th
+    // operation, a VTSDNode (currently always 64->32->64).
     FP_ROUND_INREG,
 
     // FP_EXTEND - Extend a smaller FP type into a larger FP type.
@@ -843,6 +843,25 @@
   }
 };
 
+/// VTSDNode - This class is used to represent MVT::ValueType's, which are used
+/// to parameterize some operations.
+class VTSDNode : public SDNode {
+  MVT::ValueType ValueType;
+protected:
+  friend class SelectionDAG;
+  VTSDNode(MVT::ValueType VT)
+    : SDNode(ISD::VALUETYPE, MVT::Other), ValueType(VT) {}
+public:
+
+  MVT::ValueType getVT() const { return ValueType; }
+
+  static bool classof(const VTSDNode *) { return true; }
+  static bool classof(const SDNode *N) {
+    return N->getOpcode() == ISD::VALUETYPE;
+  }
+};
+
+
 /// MVTSDNode - This class is used for operators that require an extra
 /// value-type to be kept with the node.
 class MVTSDNode : public SDNode {
@@ -871,8 +890,6 @@
   static bool classof(const MVTSDNode *) { return true; }
   static bool classof(const SDNode *N) {
     return
-      N->getOpcode() == ISD::SIGN_EXTEND_INREG ||
-      N->getOpcode() == ISD::FP_ROUND_INREG ||
       N->getOpcode() == ISD::EXTLOAD  ||
       N->getOpcode() == ISD::SEXTLOAD ||
       N->getOpcode() == ISD::ZEXTLOAD ||
@@ -931,9 +948,6 @@
   }
 };
 
-
-
-
 } // end llvm namespace
 
 #endif






More information about the llvm-commits mailing list