summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-29 20:01:35 +0000
committerChris Lattner <sabre@nondot.org>2006-01-29 20:01:35 +0000
commit7859313bae07a5c46cbec7e5012483425fcda7c0 (patch)
tree95ad920351230e59fdc2157e6a60174eb958711f /utils/TableGen/DAGISelEmitter.cpp
parent024c0b34c4871059b4a6d9540b54fd4441f241f9 (diff)
downloadllvm-7859313bae07a5c46cbec7e5012483425fcda7c0.tar.gz
llvm-7859313bae07a5c46cbec7e5012483425fcda7c0.tar.bz2
llvm-7859313bae07a5c46cbec7e5012483425fcda7c0.tar.xz
simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25791 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 4d0c1601a1..c384f53623 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -2069,20 +2069,17 @@ 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;
+ std::string CastType;
switch (N->getTypeNum(0)) {
default: assert(0 && "Unknown type for constant node!");
- 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;
+ case MVT::i1: CastType = "bool"; break;
+ case MVT::i8: CastType = "unsigned char"; break;
+ case MVT::i16: CastType = "unsigned short"; break;
+ case MVT::i32: CastType = "unsigned"; break;
+ case MVT::i64: CastType = "uint64_t"; break;
}
- emitCode(Code + utostr(ResNo) + "C = (" + CastType +
+ emitCode(CastType + " Tmp" + utostr(ResNo) + "C = (" + CastType +
")cast<ConstantSDNode>(" + Val + ")->getValue();");
emitCode("SDOperand Tmp" + utostr(ResNo) +
" = CurDAG->getTargetConstant(Tmp" + utostr(ResNo) +