diff options
author | Dan Gohman <gohman@apple.com> | 2008-12-19 18:13:39 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-12-19 18:13:39 +0000 |
commit | 0b53d98c298b2846d36a4bfaf7a1a77d819430a6 (patch) | |
tree | 8bf8c41e6a4d0b4dc7f4035fdcd66eb1979b9090 | |
parent | ab63152871f4144050d0a58d592a95e089fe40d4 (diff) |
Use dyn_cast intead of isa + cast in the generated DAGISel code. This
reduces the amount of code slightly when assertions are enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61249 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | utils/TableGen/DAGISelEmitter.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index a6e3730ab1..ed807b308a 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -583,11 +583,14 @@ public: emitInit("SDValue " + RootName + "1" + " = " + RootName + ".getOperand(" + utostr(1) + ");"); - emitCheck("isa<ConstantSDNode>(" + RootName + "1)"); + unsigned NTmp = TmpNo++; + emitCode("ConstantSDNode *Tmp" + utostr(NTmp) + + " = dyn_cast<ConstantSDNode>(" + RootName + "1);"); + emitCheck("Tmp" + utostr(NTmp)); const char *MaskPredicate = N->getOperator()->getName() == "or" ? "CheckOrMask(" : "CheckAndMask("; - emitCheck(MaskPredicate + RootName + "0, cast<ConstantSDNode>(" + - RootName + "1), INT64_C(" + itostr(II->getValue()) + "))"); + emitCheck(MaskPredicate + RootName + "0, Tmp" + utostr(NTmp) + + ", INT64_C(" + itostr(II->getValue()) + "))"); EmitChildMatchCode(N->getChild(0), N, RootName + utostr(0), RootName, ChainSuffix + utostr(0), FoundChain); @@ -738,11 +741,14 @@ public: ".getNode())"); } else if (IntInit *II = dynamic_cast<IntInit*>(Child->getLeafValue())) { - emitCheck("isa<ConstantSDNode>(" + RootName + ")"); + unsigned NTmp = TmpNo++; + emitCode("ConstantSDNode *Tmp"+ utostr(NTmp) + + " = dyn_cast<ConstantSDNode>("+ + RootName + ");"); + emitCheck("Tmp" + utostr(NTmp)); unsigned CTmp = TmpNo++; - emitCode("int64_t CN"+utostr(CTmp)+" = cast<ConstantSDNode>("+ - RootName + ")->getSExtValue();"); - + emitCode("int64_t CN"+ utostr(CTmp) + + " = Tmp" + utostr(NTmp) + "->getSExtValue();"); emitCheck("CN" + utostr(CTmp) + " == " "INT64_C(" +itostr(II->getValue()) + ")"); } else { |