From e66f42634fac5eeac7de52ed87af2cad2117e046 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 11 Oct 2012 21:28:29 +0000 Subject: [PATCH] [ms-inline asm] Lookup the IdentifierInfo using the Idents table and remove the now unused static helper function. The test case needs to be remove temporarily until I can better filter memory operands that aren't actual variable reference. llvm-svn: 165751 --- clang/lib/Sema/SemaStmtAsm.cpp | 18 +----------------- clang/test/CodeGen/ms-inline-asm.c | 9 --------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index 3c3a9eb..9b6b6c9 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -353,19 +353,6 @@ static StringRef getMSInlineAsmExprName(StringRef Name) { return Name; } -// getIdentifierInfo - Given a Name and a range of tokens, find the associated -// IdentifierInfo*. -static IdentifierInfo *getIdentifierInfo(StringRef Name, - ArrayRef AsmToks, - unsigned Begin, unsigned End) { - for (unsigned i = Begin; i <= End; ++i) { - IdentifierInfo *II = AsmToks[i].getIdentifierInfo(); - if (II && II->getName() == Name) - return II; - } - return 0; -} - // getSpelling - Get the spelling of the AsmTok token. static StringRef getSpelling(Sema &SemaRef, Token AsmTok) { StringRef Asm; @@ -624,10 +611,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, if (Context.getTargetInfo().isValidGCCRegisterName(Name)) continue; - IdentifierInfo *II = getIdentifierInfo(Name, AsmToks, - AsmTokRanges[StrIdx].first, - AsmTokRanges[StrIdx].second); - if (II) { + if (IdentifierInfo *II = &Context.Idents.get(Name)) { CXXScopeSpec SS; UnqualifiedId Id; SourceLocation Loc; diff --git a/clang/test/CodeGen/ms-inline-asm.c b/clang/test/CodeGen/ms-inline-asm.c index 30d9220..0064340 100644 --- a/clang/test/CodeGen/ms-inline-asm.c +++ b/clang/test/CodeGen/ms-inline-asm.c @@ -167,12 +167,3 @@ unsigned t19(void) { // CHECK: t19 // 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 } - -void t20(void) { - __asm { - mov eax, fs:[0x10] - mov eax, [eax] - } -// CHECK: t20 -// call void asm sideeffect inteldialect "mov eax, fs:[0x10]\0A\09mov eax, [eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind -} -- 2.7.4