[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jun 8 11:00:59 PDT 2006
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.78 -> 1.79
---
Log message:
Fix an assert-on-inline-inline-asm bug.
---
Diffs of the changes: (+18 -12)
AsmPrinter.cpp | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.78 llvm/lib/CodeGen/AsmPrinter.cpp:1.79
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.78 Fri May 12 12:50:35 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Thu Jun 8 13:00:47 2006
@@ -656,24 +656,30 @@
// operand!
if (CurVariant == -1 || CurVariant == AsmPrinterVariant) {
unsigned OpNo = 1;
-
+
+ bool Error = false;
+
// Scan to find the machine operand number for the operand.
for (; Val; --Val) {
+ if (OpNo >= MI->getNumOperands()) break;
unsigned OpFlags = MI->getOperand(OpNo).getImmedValue();
OpNo += (OpFlags >> 3) + 1;
}
-
- unsigned OpFlags = MI->getOperand(OpNo).getImmedValue();
- ++OpNo; // Skip over the ID number.
-
- bool Error;
- AsmPrinter *AP = const_cast<AsmPrinter*>(this);
- if ((OpFlags & 7) == 4 /*ADDR MODE*/) {
- Error = AP->PrintAsmMemoryOperand(MI, OpNo, AsmPrinterVariant,
- Modifier[0] ? Modifier : 0);
+
+ if (OpNo >= MI->getNumOperands()) {
+ Error = true;
} else {
- Error = AP->PrintAsmOperand(MI, OpNo, AsmPrinterVariant,
- Modifier[0] ? Modifier : 0);
+ unsigned OpFlags = MI->getOperand(OpNo).getImmedValue();
+ ++OpNo; // Skip over the ID number.
+
+ AsmPrinter *AP = const_cast<AsmPrinter*>(this);
+ if ((OpFlags & 7) == 4 /*ADDR MODE*/) {
+ Error = AP->PrintAsmMemoryOperand(MI, OpNo, AsmPrinterVariant,
+ Modifier[0] ? Modifier : 0);
+ } else {
+ Error = AP->PrintAsmOperand(MI, OpNo, AsmPrinterVariant,
+ Modifier[0] ? Modifier : 0);
+ }
}
if (Error) {
std::cerr << "Invalid operand found in inline asm: '"
More information about the llvm-commits
mailing list