Add support for a new STRING and LOCATION node for line number support, patch
authorChris Lattner <sabre@nondot.org>
Tue, 29 Nov 2005 06:15:39 +0000 (06:15 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 29 Nov 2005 06:15:39 +0000 (06:15 +0000)
contributed by Daniel Berlin, with a few cleanups here and there by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24512 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAG.h
include/llvm/CodeGen/SelectionDAGNodes.h

index 1decf5eb8b265eb90c476517ada22ef16df7903d..2523b5ef912384a5176db1a7aae7552d831b94ac 100644 (file)
@@ -105,6 +105,7 @@ public:
   /// argument, it is used as the seed for node deletion.
   void RemoveDeadNodes(SDNode *N = 0);
 
+  SDOperand getString(const std::string &Val);
   SDOperand getConstant(uint64_t Val, MVT::ValueType VT);
   SDOperand getTargetConstant(uint64_t Val, MVT::ValueType VT);
   SDOperand getConstantFP(double Val, MVT::ValueType VT);
@@ -406,6 +407,7 @@ private:
   std::vector<SDNode*> ValueTypeNodes;
   std::map<std::string, SDNode*> ExternalSymbols;
   std::map<std::string, SDNode*> TargetExternalSymbols;
+  std::map<std::string, StringSDNode*> StringNodes;
   std::map<std::pair<unsigned,
                      std::pair<MVT::ValueType, std::vector<SDOperand> > >,
            SDNode*> OneResultNodes;
index 6e6b88223d2b92fa32323d296c22aa5d6f1d5c42..f6a6201678512a2a18a726f828681e44bcb3425b 100644 (file)
@@ -63,7 +63,8 @@ namespace ISD {
     AssertSext, AssertZext,
 
     // Various leaf nodes.
-    Constant, ConstantFP, GlobalAddress, FrameIndex, ConstantPool,
+    Constant, ConstantFP, STRING,
+    GlobalAddress, FrameIndex, ConstantPool,
     BasicBlock, ExternalSymbol, VALUETYPE, CONDCODE, Register,
     
     // TargetConstant - Like Constant, but the DAG does not do any folding or
@@ -341,6 +342,12 @@ namespace ISD {
     // HANDLENODE node - Used as a handle for various purposes.
     HANDLENODE,
 
+    // LOCATION - This node is used to represent a source location for debug
+    // info.  It takes token chain as input, then a line number, then a column
+    // number, then a filename, then a working dir.  It produces a token chain
+    // as output.
+    LOCATION,
+    
     // BUILTIN_OP_END - This must be the last enum value in this list.
     BUILTIN_OP_END,
   };
@@ -846,6 +853,20 @@ public:
   SDOperand getValue() const { return getOperand(0); }
 };
 
+class StringSDNode : public SDNode {
+  std::string Value;
+protected:
+  friend class SelectionDAG;
+  StringSDNode(const std::string &val)
+    : SDNode(ISD::STRING, MVT::Other), Value(val) {
+  }
+public:
+  const std::string &getValue() const { return Value; }
+  static bool classof(const StringSDNode *) { return true; }
+  static bool classof(const SDNode *N) {
+    return N->getOpcode() == ISD::STRING;
+  }
+};  
 
 class ConstantSDNode : public SDNode {
   uint64_t Value;