From 1cbafa143493210bbd490505083c5544f0987e4f Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 19 Dec 2008 18:13:39 +0000 Subject: [PATCH] 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 --- utils/TableGen/DAGISelEmitter.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index a6e3730ab12..ed807b308a4 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(" + RootName + "1)"); + unsigned NTmp = TmpNo++; + emitCode("ConstantSDNode *Tmp" + utostr(NTmp) + + " = dyn_cast(" + RootName + "1);"); + emitCheck("Tmp" + utostr(NTmp)); const char *MaskPredicate = N->getOperator()->getName() == "or" ? "CheckOrMask(" : "CheckAndMask("; - emitCheck(MaskPredicate + RootName + "0, cast(" + - 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(Child->getLeafValue())) { - emitCheck("isa(" + RootName + ")"); + unsigned NTmp = TmpNo++; + emitCode("ConstantSDNode *Tmp"+ utostr(NTmp) + + " = dyn_cast("+ + RootName + ");"); + emitCheck("Tmp" + utostr(NTmp)); unsigned CTmp = TmpNo++; - emitCode("int64_t CN"+utostr(CTmp)+" = cast("+ - RootName + ")->getSExtValue();"); - + emitCode("int64_t CN"+ utostr(CTmp) + + " = Tmp" + utostr(NTmp) + "->getSExtValue();"); emitCheck("CN" + utostr(CTmp) + " == " "INT64_C(" +itostr(II->getValue()) + ")"); } else { -- 2.11.0