aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmtAsm.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-09-03 20:40:52 +0000
committerChad Rosier <mcrosier@apple.com>2012-09-03 20:40:52 +0000
commit1b497f26ab7861b22383b22f35cf799c0b312c9b (patch)
treea38aed3323cbb390da6fd8357c68fd15714e22c1 /lib/Sema/SemaStmtAsm.cpp
parentfcbc0fbaa480e6707af6ef437f5c43ea9f477d3a (diff)
[ms-inline asm] Use the new GetMCInstOperandNum() interface in the front-end.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmtAsm.cpp')
-rw-r--r--lib/Sema/SemaStmtAsm.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp
index d3d646d246..148604d97e 100644
--- a/lib/Sema/SemaStmtAsm.cpp
+++ b/lib/Sema/SemaStmtAsm.cpp
@@ -568,14 +568,31 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
// Build the list of clobbers, outputs and inputs.
unsigned NumDefs = Desc.getNumDefs();
- for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) {
- const llvm::MCOperand &Op = Inst.getOperand(i);
+ for (unsigned i = 1, e = Operands.size(); i != e; ++i) {
+ unsigned NumMCOperands;
+ unsigned MCIdx = TargetParser->GetMCInstOperandNum(Kind, Inst, Operands, i,
+ NumMCOperands);
+ assert (NumMCOperands && "Expected at least 1 MCOperand!");
+ // If we have a one-to-many mapping, then search for the MCExpr.
+ if (NumMCOperands > 1) {
+ bool foundExpr = false;
+ for (unsigned j = MCIdx, e = MCIdx + NumMCOperands; j != e; ++j) {
+ if (Inst.getOperand(j).isExpr()) {
+ foundExpr = true;
+ MCIdx = j;
+ break;
+ }
+ }
+ assert (foundExpr && "Expected for find an expression!");
+ }
+
+ const llvm::MCOperand &Op = Inst.getOperand(MCIdx);
// Immediate.
if (Op.isImm() || Op.isFPImm())
continue;
- bool isDef = NumDefs && (i < NumDefs);
+ bool isDef = NumDefs && (MCIdx < NumDefs);
// Register/Clobber.
if (Op.isReg() && isDef) {