summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-08 18:20:52 +0000
committerChris Lattner <sabre@nondot.org>2010-04-08 18:20:52 +0000
commit294a90d87aac3029c2fa005942590deff87e2072 (patch)
tree41cceb393e9f7682f8e629414950df1a87e4438a /llvm/lib/CodeGen/AsmPrinter
parent01e09d9d91ac65d85cb0f4ccbcd42204cf343410 (diff)
downloadbcm5719-llvm-294a90d87aac3029c2fa005942590deff87e2072.tar.gz
bcm5719-llvm-294a90d87aac3029c2fa005942590deff87e2072.zip
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.
llvm-svn: 100792
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index a3a408f5118..37d10e5c4cc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -127,10 +127,15 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
// 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
OpenPOWER on IntegriCloud