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

Chad Rosier mcrosier at apple.com
Fri Oct 12 14:37:00 PDT 2012


Author: mcrosier
Date: Fri Oct 12 16:37:00 2012
New Revision: 165825

URL: http://llvm.org/viewvc/llvm-project?rev=165825&view=rev
Log:
[ms-inline asm] Remove a bunch of parsing code from the front-end, which will be
reimplemented in the AsmParser where it belongs.

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=165825&r1=165824&r2=165825&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Fri Oct 12 16:37:00 2012
@@ -320,17 +320,6 @@
   return Owned(NS);
 }
 
-// isMSAsmKeyword - Return true if this is an MS-style inline asm keyword. These
-// require special handling.
-static bool isMSAsmKeyword(StringRef Name) {
-  bool Ret = llvm::StringSwitch<bool>(Name)
-    .Cases("EVEN", "ALIGN", true) // Alignment directives.
-    .Cases("LENGTH", "SIZE", "TYPE", true) // Type and variable sizes.
-    .Case("_emit", true) // _emit Pseudoinstruction.
-    .Default(false);
-  return Ret;
-}
-
 // getSpelling - Get the spelling of the AsmTok token.
 static StringRef getSpelling(Sema &SemaRef, Token AsmTok) {
   StringRef Asm;
@@ -342,28 +331,9 @@
   return Asm;
 }
 
-// Determine if we should bail on this MSAsm instruction.
-static bool bailOnMSAsm(std::vector<StringRef> Piece) {
-  for (unsigned i = 0, e = Piece.size(); i != e; ++i)
-    if (isMSAsmKeyword(Piece[i]))
-      return true;
-  return false;
-}
-
-// Determine if we should bail on this MSAsm block.
-static bool bailOnMSAsm(std::vector<std::vector<StringRef> > Pieces) {
-  for (unsigned i = 0, e = Pieces.size(); i != e; ++i)
-    if (bailOnMSAsm(Pieces[i]))
-      return true;
-  return false;
-}
-
 // Determine if this is a simple MSAsm instruction.
 static bool isSimpleMSAsm(std::vector<StringRef> &Pieces,
                           const TargetInfo &TI) {
-  if (isMSAsmKeyword(Pieces[0]))
-      return false;
-
   for (unsigned i = 1, e = Pieces.size(); i != e; ++i) {
     if (!TI.isValidGCCRegisterName(Pieces[i]))
       return false;
@@ -479,9 +449,6 @@
 
   bool IsSimple = isSimpleMSAsm(Pieces, Context.getTargetInfo());
 
-  // AsmParser doesn't fully support these asm statements.
-  if (bailOnMSAsm(Pieces)) { DEF_SIMPLE_MSASM(EmptyAsmStr); return Owned(NS); }
-
   // Get the target specific parser.
   std::string Error;
   const std::string &TT = Context.getTargetInfo().getTriple().getTriple();

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=165825&r1=165824&r2=165825&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Fri Oct 12 16:37:00 2012
@@ -97,41 +97,12 @@
 }
 
 void t11(void) {
-  __asm EVEN
-  __asm ALIGN
-// CHECK: t11
-// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"() nounwind
-// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"() nounwind
-}
-
-void t12(void) {
-  __asm {
-    _emit 0x4A
-    _emit 0x43
-    _emit 0x4B
-  }
-// CHECK: t12
-// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"() nounwind
-}
-
-void t13(void) {
-  unsigned arr[10];
-  __asm LENGTH arr ; sizeof(arr)/sizeof(arr[0])
-  __asm SIZE arr   ; sizeof(arr)
-  __asm TYPE arr   ; sizeof(arr[0])
-// CHECK: t13
-// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"() nounwind
-// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"() nounwind
-// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"() nounwind
-}
-
-void t14(void) {
   __asm mov eax, 1
-// CHECK: t14
+// CHECK: t11
 // CHECK: call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
 }
 
-unsigned t15(void) {
+unsigned t12(void) {
   unsigned i = 1, j, l = 1, m;
   __asm {
     mov eax, i
@@ -140,6 +111,6 @@
     mov m, eax
   }
   return j + m;
-// CHECK: t15
+// 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
 }





More information about the cfe-commits mailing list