aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-17 00:33:30 +0000
committerChris Lattner <sabre@nondot.org>2005-08-17 00:33:30 +0000
commit056f9f61d071c6c583951678f2bf543a1316efcc (patch)
treeaaa8f076843814c52de69259e45c6a6c9a7af09d
parent456f1e890cb059fedb9f5d3f315c80e4f98f429b (diff)
add some helper methods, and a new TargetConstant node, which is not
subjected to folding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22812 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h15
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h11
2 files changed, 22 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index 755cbfd3c5..bebcd1d944 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -94,6 +94,7 @@ public:
void RemoveDeadNodes(SDNode *N = 0);
SDOperand getConstant(uint64_t Val, MVT::ValueType VT);
+ SDOperand getTargetConstant(uint64_t Val, MVT::ValueType VT);
SDOperand getConstantFP(double Val, MVT::ValueType VT);
SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT);
SDOperand getFrameIndex(int FI, MVT::ValueType VT);
@@ -226,7 +227,18 @@ public:
void SelectNodeTo(SDNode *N, MVT::ValueType VT, unsigned TargetOpc,
SDOperand Op1, SDOperand Op2, SDOperand Op3);
-
+ SDOperand getTargetNode(unsigned Opcode, MVT::ValueType VT,
+ SDOperand Op1) {
+ return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1);
+ }
+ SDOperand getTargetNode(unsigned Opcode, MVT::ValueType VT,
+ SDOperand Op1, SDOperand Op2) {
+ return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1, Op2);
+ }
+ SDOperand getTargetNode(unsigned Opcode, MVT::ValueType VT,
+ SDOperand Op1, SDOperand Op2, SDOperand Op3) {
+ return getNode(ISD::BUILTIN_OP_END+Opcode, VT, Op1, Op2, Op3);
+ }
void dump() const;
private:
@@ -258,6 +270,7 @@ private:
std::map<const GlobalValue*, SDNode*> GlobalValues;
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> Constants;
+ std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstants;
std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> ConstantFPs;
std::map<int, SDNode*> FrameIndices;
std::map<unsigned, SDNode*> ConstantPoolIndices;
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index 4eecb0a6b7..00b94037ad 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -56,6 +56,10 @@ namespace ISD {
// Various leaf nodes.
Constant, ConstantFP, GlobalAddress, FrameIndex, ConstantPool,
BasicBlock, ExternalSymbol, VALUETYPE, CONDCODE, Register,
+
+ // TargetConstant - Like Constant, but the DAG does not do any folding or
+ // simplification of the constant. This is used by the DAG->DAG selector.
+ TargetConstant,
// CopyToReg - This node has three operands: a chain, a register number to
// set to this value, and a value.
@@ -681,8 +685,8 @@ class ConstantSDNode : public SDNode {
uint64_t Value;
protected:
friend class SelectionDAG;
- ConstantSDNode(uint64_t val, MVT::ValueType VT)
- : SDNode(ISD::Constant, VT), Value(val) {
+ ConstantSDNode(bool isTarget, uint64_t val, MVT::ValueType VT)
+ : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, VT), Value(val) {
}
public:
@@ -702,7 +706,8 @@ public:
static bool classof(const ConstantSDNode *) { return true; }
static bool classof(const SDNode *N) {
- return N->getOpcode() == ISD::Constant;
+ return N->getOpcode() == ISD::Constant ||
+ N->getOpcode() == ISD::TargetConstant;
}
};