]> granicus.if.org Git - clang/commitdiff
Examine the last, not the first, instruction from the MC matcher.
authorBob Wilson <bob.wilson@apple.com>
Tue, 25 Sep 2012 16:30:16 +0000 (16:30 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 25 Sep 2012 16:30:16 +0000 (16:30 +0000)
If an MS-style inline asm is matched to multiple instructions, e.g., with a
a WAIT-prefix, then we need to examine the operands of the last instruction
instruction, not the prefix instruction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164608 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaStmtAsm.cpp

index 922777e07de5577b45b6b870f6ea0441a494ff01..792a91332ee1a25168efdcb36821d986ee74b648 100644 (file)
@@ -567,7 +567,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc,
     if (HadError) { DEF_SIMPLE_MSASM(EmptyAsmStr); return Owned(NS); }
 
     // Get the instruction descriptor.
-    llvm::MCInst Inst = Instrs[0];
+    llvm::MCInst Inst = Instrs.back();
     const llvm::MCInstrInfo *MII = TheTarget->createMCInstrInfo();
     const llvm::MCInstrDesc &Desc = MII->get(Inst.getOpcode());
     llvm::MCInstPrinter *IP =