diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-04-27 20:10:01 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-04-27 20:10:01 +0000 |
commit | 2d86ea21dd76647cb054fd5d27df9e49efc672b6 (patch) | |
tree | 87a965525520ccbd1d200407f54627b3697cdb6a /include/llvm/CodeGen/SelectionDAGNodes.h | |
parent | 22cab6c752c75f81c05c679befd437e613138f6f (diff) |
Implement Value* tracking for loads and stores in the selection DAG. This enables one to use alias analysis in the backends.
(TRUNK)Stores and (EXT|ZEXT|SEXT)Loads have an extra SDOperand which is a SrcValueSDNode which contains the Value*. Note that if the operation is introduced by the backend, it will still have the operand, but the value* will be null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/SelectionDAGNodes.h')
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 35993d986a..1df651381c 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -20,6 +20,7 @@ #define LLVM_CODEGEN_SELECTIONDAGNODES_H #include "llvm/CodeGen/ValueTypes.h" +#include "llvm/Value.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" @@ -251,6 +252,11 @@ namespace ISD { // PCMARKER - This corresponds to the pcmarker intrinsic. PCMARKER, + // SRCVALUE - This corresponds to a Value*, and is used to carry associate + // memory operations with their corrosponding load. This lets one use the + // pointer analysis information in the backend + SRCVALUE, + // BUILTIN_OP_END - This must be the last enum value in this list. BUILTIN_OP_END, }; @@ -529,6 +535,22 @@ protected: N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this); N3.Val->Uses.push_back(this); } + SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4) + : NodeType(NT) { + unsigned ND = N1.Val->getNodeDepth(); + if (ND < N2.Val->getNodeDepth()) + ND = N2.Val->getNodeDepth(); + if (ND < N3.Val->getNodeDepth()) + ND = N3.Val->getNodeDepth(); + if (ND < N4.Val->getNodeDepth()) + ND = N4.Val->getNodeDepth(); + NodeDepth = ND+1; + + Operands.reserve(3); 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); + } SDNode(unsigned NT, std::vector<SDOperand> &Nodes) : NodeType(NT) { Operands.swap(Nodes); unsigned ND = 0; @@ -724,6 +746,22 @@ public: } }; +class SrcValueSDNode : public SDNode { + const Value *V; +protected: + friend class SelectionDAG; + SrcValueSDNode(const Value* v) + : SDNode(ISD::SRCVALUE, MVT::Other), V(v) {} + +public: + const Value *getValue() const { return V; } + + static bool classof(const SrcValueSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::SRCVALUE; + } +}; + class RegSDNode : public SDNode { unsigned Reg; @@ -791,13 +829,14 @@ protected: setValueTypes(VT1); } MVTSDNode(unsigned Opc, MVT::ValueType VT1, MVT::ValueType VT2, - SDOperand Op0, SDOperand Op1, MVT::ValueType EVT) - : SDNode(Opc, Op0, Op1), ExtraValueType(EVT) { + SDOperand Op0, SDOperand Op1, SDOperand Op2, MVT::ValueType EVT) + : SDNode(Opc, Op0, Op1, Op2), ExtraValueType(EVT) { setValueTypes(VT1, VT2); } + MVTSDNode(unsigned Opc, MVT::ValueType VT, - SDOperand Op0, SDOperand Op1, SDOperand Op2, MVT::ValueType EVT) - : SDNode(Opc, Op0, Op1, Op2), ExtraValueType(EVT) { + SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3, MVT::ValueType EVT) + : SDNode(Opc, Op0, Op1, Op2, Op3), ExtraValueType(EVT) { setValueTypes(VT); } public: |