[cfe-commits] r163126 - /cfe/trunk/lib/Sema/SemaStmtAsm.cpp

Chad Rosier mcrosier at apple.com
Mon Sep 3 13:40:52 PDT 2012


Author: mcrosier
Date: Mon Sep  3 15:40:52 2012
New Revision: 163126

URL: http://llvm.org/viewvc/llvm-project?rev=163126&view=rev
Log:
[ms-inline asm] Use the new GetMCInstOperandNum() interface in the front-end.

Modified:
    cfe/trunk/lib/Sema/SemaStmtAsm.cpp

Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=163126&r1=163125&r2=163126&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Mon Sep  3 15:40:52 2012
@@ -568,14 +568,31 @@
 
     // 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) {





More information about the cfe-commits mailing list