From: Owen Anderson Date: Thu, 28 Apr 2011 17:51:45 +0000 (+0000) Subject: Fix a bug in tblgen that caused incorrect encodings on instructions that specified... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4cdcb4772d95b9e801a0f3cd43776cef3af3b530;p=oota-llvm.git Fix a bug in tblgen that caused incorrect encodings on instructions that specified operands with "bit" instead of "bits<1>". Unfortunately, my only testcase for this is fragile, and the ARM AsmParser can't round trip the instruction in question. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130410 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index 957dd19da1c..9d4dc5c4607 100644 --- a/utils/TableGen/CodeEmitterGen.cpp +++ b/utils/TableGen/CodeEmitterGen.cpp @@ -63,10 +63,14 @@ void CodeEmitterGen::reverseBits(std::vector &Insts) { // return the variable bit position. Otherwise return -1. int CodeEmitterGen::getVariableBit(const std::string &VarName, BitsInit *BI, int bit) { - if (VarBitInit *VBI = dynamic_cast(BI->getBit(bit))) + if (VarBitInit *VBI = dynamic_cast(BI->getBit(bit))) { if (VarInit *VI = dynamic_cast(VBI->getVariable())) if (VI->getName() == VarName) return VBI->getBitNum(); + } else if (VarInit *VI = dynamic_cast(BI->getBit(bit))) { + if (VI->getName() == VarName) + return 0; + } return -1; }