[cfe-commits] r166489 - in /cfe/trunk: lib/Sema/SemaStmtAsm.cpp test/CodeGen/ms-inline-asm.c

Chad Rosier mcrosier at apple.com
Tue Oct 23 10:44:40 PDT 2012


Author: mcrosier
Date: Tue Oct 23 12:44:40 2012
New Revision: 166489

URL: http://llvm.org/viewvc/llvm-project?rev=166489&view=rev
Log:
[ms-inline asm] Update for r166433.

Modified:
    cfe/trunk/lib/Sema/SemaStmtAsm.cpp
    cfe/trunk/test/CodeGen/ms-inline-asm.c

Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=166489&r1=166488&r2=166489&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Tue Oct 23 12:44:40 2012
@@ -513,7 +513,7 @@
   unsigned NumOutputs;
   unsigned NumInputs;
   std::string AsmStringIR;
-  SmallVector<void *, 4> OpDecls;
+  SmallVector<std::pair<void *, bool>, 4> OpDecls;
   SmallVector<std::string, 4> Constraints;
   SmallVector<std::string, 4> Clobbers;
   if (Parser->ParseMSInlineAsm(AsmLoc.getPtrEncoding(), AsmStringIR,
@@ -533,7 +533,7 @@
   ConstraintRefs.resize(NumExprs);
   Exprs.resize(NumExprs);
   for (unsigned i = 0, e = NumExprs; i != e; ++i) {
-    NamedDecl *OpDecl = static_cast<NamedDecl *>(OpDecls[i]);
+    NamedDecl *OpDecl = static_cast<NamedDecl *>(OpDecls[i].first);
     if (!OpDecl)
       return StmtError();
 
@@ -542,7 +542,12 @@
                                                  OpDecl);
     if (OpExpr.isInvalid())
       return StmtError();
-    
+
+    // Need offset of variable.
+    if (OpDecls[i].second)
+      OpExpr = BuildUnaryOp(getCurScope(), AsmLoc, clang::UO_AddrOf,
+                            OpExpr.take());
+
     Names[i] = OpDecl->getIdentifier();
     ConstraintRefs[i] = StringRef(Constraints[i]);
     Exprs[i] = OpExpr.take();

Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=166489&r1=166488&r2=166489&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Tue Oct 23 12:44:40 2012
@@ -144,4 +144,5 @@
   __asm mov eax, offset var ; eax = address of myvar
 // CHECK: t15
 // CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}) nounwind
+// CHECK: call void asm sideeffect inteldialect "mov eax, $0", "r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}) nounwind
 }





More information about the cfe-commits mailing list