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
This commit is contained in:
Dan Gohman 2008-12-19 18:13:39 +00:00
parent ab63152871
commit 0b53d98c29

View File

@ -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 {