Add a way to construct an arbitrary node, cleanly.
[oota-llvm.git] / include / llvm / CodeGen / SelectionDAG.h
index a8b42e7155d56de4987805b7bbd7ac29b10dbcb4..26e792221725ce5ea5a4a751798b51b81897e45c 100644 (file)
@@ -129,8 +129,9 @@ public:
   /// getCall - Note that this destroys the vector of RetVals passed in.
   ///
   SDNode *getCall(std::vector<MVT::ValueType> &RetVals, SDOperand Chain,
-                  SDOperand Callee) {
-    SDNode *NN = new SDNode(ISD::CALL, Chain, Callee);
+                  SDOperand Callee, bool isTailCall = false) {
+    SDNode *NN = new SDNode(isTailCall ? ISD::TAILCALL : ISD::CALL, Chain,
+                            Callee);
     NN->setValueTypes(RetVals);
     AllNodes.push_back(NN);
     return NN;
@@ -140,10 +141,11 @@ public:
   /// where arguments are passed in physical registers.  This destroys the
   /// RetVals and ArgsInRegs vectors.
   SDNode *getCall(std::vector<MVT::ValueType> &RetVals, SDOperand Chain,
-                  SDOperand Callee, std::vector<SDOperand> &ArgsInRegs) {
+                  SDOperand Callee, std::vector<SDOperand> &ArgsInRegs,
+                  bool isTailCall = false) {
     ArgsInRegs.insert(ArgsInRegs.begin(), Callee);
     ArgsInRegs.insert(ArgsInRegs.begin(), Chain);
-    SDNode *NN = new SDNode(ISD::CALL, ArgsInRegs);
+    SDNode *NN = new SDNode(isTailCall ? ISD::TAILCALL : ISD::CALL, ArgsInRegs);
     NN->setValueTypes(RetVals);
     AllNodes.push_back(NN);
     return NN;
@@ -169,6 +171,8 @@ public:
                     SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4);
   SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
                     std::vector<SDOperand> &Children);
+  SDOperand getNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys,
+                    std::vector<SDOperand> &Ops);
 
   // getNode - These versions take an extra value type for extending and
   // truncating loads, stores, rounds, extends etc.
@@ -179,12 +183,15 @@ public:
   SDOperand getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N1,
                     SDOperand N2, SDOperand N3, MVT::ValueType EVT);
   SDOperand getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N1,
-                    SDOperand N2, SDOperand N3, SDOperand N4, MVT::ValueType EVT);
+                    SDOperand N2, SDOperand N3, SDOperand N4,
+                    MVT::ValueType EVT);
+
 
   /// getLoad - Loads are not normal binary operators: their result type is not
   /// determined by their operands, and they produce a value AND a token chain.
   ///
-  SDOperand getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV);
+  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, int offset = 0);
@@ -218,6 +225,11 @@ private:
   std::map<int, SDNode*> FrameIndices;
   std::map<unsigned, SDNode*> ConstantPoolIndices;
   std::map<MachineBasicBlock *, SDNode*> BBNodes;
+  std::map<std::pair<unsigned,
+                     std::pair<std::vector<MVT::ValueType>,
+                               std::vector<SDOperand> > >,
+           SDNode*> ArbitraryNodes;
+
   std::map<std::string, SDNode*> ExternalSymbols;
   struct EVTStruct {
     unsigned Opcode;