[llvm-commits] [llvm] r100792 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Chris Lattner
sabre at nondot.org
Thu Apr 8 11:20:52 PDT 2010
Author: lattner
Date: Thu Apr 8 13:20:52 2010
New Revision: 100792
URL: http://llvm.org/viewvc/llvm-project?rev=100792&view=rev
Log:
implicit defs get added to the end of machine instrs sometimes. Scan the whole instruction for the metadata operand instead of assuming it will be at the end of the instruction.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp?rev=100792&r1=100791&r2=100792&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Thu Apr 8 13:20:52 2010
@@ -127,10 +127,15 @@
// Get the !srcloc metadata node if we have it, and decode the loc cookie from
// it.
unsigned LocCookie = 0;
- if (const MDNode *SrcLoc = MI->getOperand(NumOperands-1).getMetadata()) {
- if (SrcLoc->getNumOperands() != 0)
- if (const ConstantInt *CI = dyn_cast<ConstantInt>(SrcLoc->getOperand(0)))
- LocCookie = CI->getZExtValue();
+ for (unsigned i = MI->getNumOperands(); i != 0; --i) {
+ if (MI->getOperand(i-1).isMetadata())
+ if (const MDNode *SrcLoc = MI->getOperand(i-1).getMetadata())
+ if (SrcLoc->getNumOperands() != 0)
+ if (const ConstantInt *CI =
+ dyn_cast<ConstantInt>(SrcLoc->getOperand(0))) {
+ LocCookie = CI->getZExtValue();
+ break;
+ }
}
// Emit the inline asm to a temporary string so we can emit it through
More information about the llvm-commits
mailing list