[llvm-commits] [llvm] r136660 - /llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
Owen Anderson
resistor at mac.com
Mon Aug 1 15:45:43 PDT 2011
Author: resistor
Date: Mon Aug 1 17:45:43 2011
New Revision: 136660
URL: http://llvm.org/viewvc/llvm-project?rev=136660&view=rev
Log:
Make the FixedLengthDecoderEmitter smart enough to autogenerate decoders for encodings like "let Inst{11-7} = foo;", where the RHS has no bitwidth specifiers.
Modified:
llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=136660&r1=136659&r2=136660&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Mon Aug 1 17:45:43 2011
@@ -1267,8 +1267,14 @@
unsigned Offset = 0;
for (unsigned bi = 0; bi < Bits.getNumBits(); ++bi) {
+ VarInit *Var = 0;
VarBitInit *BI = dynamic_cast<VarBitInit*>(Bits.getBit(bi));
- if (!BI) {
+ if (BI)
+ Var = dynamic_cast<VarInit*>(BI->getVariable());
+ else
+ Var = dynamic_cast<VarInit*>(Bits.getBit(bi));
+
+ if (!Var) {
if (Base != ~0U) {
OpInfo.addField(Base, Width, Offset);
Base = ~0U;
@@ -1278,8 +1284,6 @@
continue;
}
- VarInit *Var = dynamic_cast<VarInit*>(BI->getVariable());
- assert(Var);
if (Var->getName() != NI->second &&
Var->getName() != TiedNames[NI->second]) {
if (Base != ~0U) {
@@ -1294,8 +1298,8 @@
if (Base == ~0U) {
Base = bi;
Width = 1;
- Offset = BI->getBitNum();
- } else if (BI->getBitNum() != Offset + Width) {
+ Offset = BI ? BI->getBitNum() : 0;
+ } else if (BI && BI->getBitNum() != Offset + Width) {
OpInfo.addField(Base, Width, Offset);
Base = bi;
Width = 1;
More information about the llvm-commits
mailing list