[llvm-commits] [llvm] r130410 - /llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
Owen Anderson
resistor at mac.com
Thu Apr 28 10:51:45 PDT 2011
Author: resistor
Date: Thu Apr 28 12:51:45 2011
New Revision: 130410
URL: http://llvm.org/viewvc/llvm-project?rev=130410&view=rev
Log:
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.
<rdar://problem/9345702>
Modified:
llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=130410&r1=130409&r2=130410&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Thu Apr 28 12:51:45 2011
@@ -63,10 +63,14 @@
// return the variable bit position. Otherwise return -1.
int CodeEmitterGen::getVariableBit(const std::string &VarName,
BitsInit *BI, int bit) {
- if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(BI->getBit(bit)))
+ if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(BI->getBit(bit))) {
if (VarInit *VI = dynamic_cast<VarInit*>(VBI->getVariable()))
if (VI->getName() == VarName)
return VBI->getBitNum();
+ } else if (VarInit *VI = dynamic_cast<VarInit*>(BI->getBit(bit))) {
+ if (VI->getName() == VarName)
+ return 0;
+ }
return -1;
}
More information about the llvm-commits
mailing list