Fix TableGen -gen-disassembler output for bit fields with an offset.
This fixes bit assignments like this
Inst{7-0} = Foo{9-2}
Patch by Steve King.
llvm-svn: 218560
diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
index 084bef2..810bd11 100644
--- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
+++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
@@ -1051,7 +1051,11 @@
OperandInfo::const_iterator OI = OpInfo.begin();
o.indent(Indentation) << "tmp = fieldFromInstruction"
<< "(insn, " << OI->Base << ", " << OI->Width
- << ");\n";
+ << ")";
+ if (OI->Offset)
+ o << " << " << OI->Offset;
+ o << ";\n";
+
} else {
o.indent(Indentation) << "tmp = 0;\n";
for (OperandInfo::const_iterator OI = OpInfo.begin(), OE = OpInfo.end();