diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-10-19 20:36:37 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-10-19 20:36:37 +0000 |
commit | 793c405c28581f24543f021bd833b8c47af28ed3 (patch) | |
tree | 66e9b1292d1a872630b1a6f5d86d03cfbc0826e4 | |
parent | 1f432eec1a4151c7a9bcb5e98ae32f36486ef4af (diff) |
[ms-inline asm] Set the SemaCallback in the TargetAsmParser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166310 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaStmtAsm.cpp | 4 | ||||
-rw-r--r-- | test/CodeGen/ms-inline-asm.c | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp index 939685599c..8eae03c987 100644 --- a/lib/Sema/SemaStmtAsm.cpp +++ b/lib/Sema/SemaStmtAsm.cpp @@ -462,13 +462,15 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, Parser->setParsingInlineAsm(true); TargetParser->setParsingInlineAsm(true); + MCAsmParserSemaCallbackImpl MCAPSI(this); + TargetParser->setSemaCallback(&MCAPSI); + unsigned NumOutputs; unsigned NumInputs; std::string AsmStringIR; SmallVector<void *, 4> OpDecls; SmallVector<std::string, 4> Constraints; SmallVector<std::string, 4> Clobbers; - MCAsmParserSemaCallbackImpl MCAPSI(this); if (Parser->ParseMSInlineAsm(AsmLoc.getPtrEncoding(), AsmStringIR, NumOutputs, NumInputs, OpDecls, Constraints, Clobbers, MII, IP, MCAPSI)) diff --git a/test/CodeGen/ms-inline-asm.c b/test/CodeGen/ms-inline-asm.c index 387a49cfd2..a925128cb1 100644 --- a/test/CodeGen/ms-inline-asm.c +++ b/test/CodeGen/ms-inline-asm.c @@ -1,6 +1,6 @@ // REQUIRES: x86-64-registered-target // RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -O0 -fms-extensions -fenable-experimental-ms-inline-asm -w -emit-llvm -o - | FileCheck %s - +#if 0 void t1() { // CHECK: @t1 // CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"() nounwind @@ -114,3 +114,26 @@ unsigned t12(void) { // CHECK: t12 // CHECK: call void asm sideeffect inteldialect "mov eax, $2\0A\09mov $0, eax\0A\09mov eax, $3\0A\09mov $1, eax", "=*m,=*m,*m,*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}}) nounwind } +#endif +void t13() { + char i = 1; + short j = 2; + __asm movzx eax, i + __asm movzx eax, j +} +#if 0 +void t13() { + unsigned i = 1, j = 2; +// __asm mov eax, [ebx] +// __asm mov eax, [4*ecx] +// __asm mov eax, [4] +// __asm mov eax, [ebx + 4*ecx] +// __asm mov eax, [ebx + 4*ecx + 4] + __asm mov eax, [i] +// __asm mov eax, [i + 4*ecx] +// __asm mov eax, [i + 4*ecx + 4] +// __asm mov eax, [4*i] +// __asm mov eax, [ebx + 4*i] +// __asm mov eax, [ebx + 4*i + 4] +} +#endif |