summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2006-01-29 05:17:22 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2006-01-29 05:17:22 +0000
commit2cba57cb09e4324201555e10aa28cdbcee07cb2c (patch)
tree1c73ab24a3cff4710e599da007dd273bd950939f /utils
parent5c6bdf71d4c78c4bada45650fc7c1f0c038b62a4 (diff)
downloadllvm-2cba57cb09e4324201555e10aa28cdbcee07cb2c.tar.gz
llvm-2cba57cb09e4324201555e10aa28cdbcee07cb2c.tar.bz2
llvm-2cba57cb09e4324201555e10aa28cdbcee07cb2c.tar.xz
make the casts actually cast to the variable type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25765 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 5643065720..bc026640ba 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -2069,18 +2069,21 @@ public:
unsigned ResNo = TmpNo++;
unsigned NumRes = 1;
if (!N->isLeaf() && N->getOperator()->getName() == "imm") {
+ const char* CastType;
assert(N->getExtTypes().size() == 1 && "Multiple types not handled!");
const char *Code;
switch (N->getTypeNum(0)) {
default: assert(0 && "Unknown type for constant node!");
- case MVT::i1: Code = "bool Tmp"; break;
- case MVT::i8: Code = "unsigned char Tmp"; break;
- case MVT::i16: Code = "unsigned short Tmp"; break;
- case MVT::i32: Code = "unsigned Tmp"; break;
- case MVT::i64: Code = "uint64_t Tmp"; break;
+ case MVT::i1: CastType = "bool"; Code = "bool Tmp"; break;
+ case MVT::i8:
+ CastType = "unsigned char"; Code = "unsigned char Tmp"; break;
+ case MVT::i16:
+ CastType = "unsigned short"; Code = "unsigned short Tmp"; break;
+ case MVT::i32: CastType = "unsigned"; Code = "unsigned Tmp"; break;
+ case MVT::i64: CastType = "uint64_t"; Code = "uint64_t Tmp"; break;
}
- emitCode(Code + utostr(ResNo) + "C = (uint64_t)cast<ConstantSDNode>(" +
- Val + ")->getValue();");
+ emitCode(Code + utostr(ResNo) + "C = (" + CastType +
+ ")cast<ConstantSDNode>(" + Val + ")->getValue();");
emitCode("SDOperand Tmp" + utostr(ResNo) +
" = CurDAG->getTargetConstant(Tmp" + utostr(ResNo) +
"C, MVT::" + getEnumName(N->getTypeNum(0)) + ");");