[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Sep 28 09:58:17 PDT 2005
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.44 -> 1.45
---
Log message:
Select Constant nodes to TargetConstant nodes
---
Diffs of the changes: (+19 -5)
DAGISelEmitter.cpp | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.44 llvm/utils/TableGen/DAGISelEmitter.cpp:1.45
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.44 Mon Sep 26 17:10:24 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Wed Sep 28 11:58:06 2005
@@ -1088,14 +1088,28 @@
if (Val[0] == 'T' && Val[1] == 'm' && Val[2] == 'p') {
// Already selected this operand, just return the tmpval.
return atoi(Val.c_str()+3);
+ }
+
+ unsigned ResNo = Ctr++;
+ if (!N->isLeaf() && N->getOperator()->getName() == "imm") {
+ switch (N->getType()) {
+ default: assert(0 && "Unknown type for constant node!");
+ case MVT::i1: OS << " bool Tmp"; break;
+ case MVT::i8: OS << " unsigned char Tmp"; break;
+ case MVT::i16: OS << " unsigned short Tmp"; break;
+ case MVT::i32: OS << " unsigned Tmp"; break;
+ case MVT::i64: OS << " uint64_t Tmp"; break;
+ }
+ OS << ResNo << "C = cast<ConstantSDNode>(" << Val << ")->getValue();\n";
+ OS << " SDOperand Tmp" << ResNo << " = CurDAG->getTargetConstant(Tmp"
+ << ResNo << "C, MVT::" << getEnumName(N->getType()) << ");\n";
} else {
- unsigned ResNo = Ctr++;
OS << " SDOperand Tmp" << ResNo << " = Select(" << Val << ");\n";
- // Add Tmp<ResNo> to VariableMap, so that we don't multiply select this
- // value if used multiple times by this pattern result.
- Val = "Tmp"+utostr(ResNo);
- return ResNo;
}
+ // Add Tmp<ResNo> to VariableMap, so that we don't multiply select this
+ // value if used multiple times by this pattern result.
+ Val = "Tmp"+utostr(ResNo);
+ return ResNo;
}
if (N->isLeaf()) {
More information about the llvm-commits
mailing list