[llvm-commits] [llvm] r103178 - in /llvm/trunk: lib/MC/MCParser/AsmLexer.cpp test/MC/AsmParser/X86/x86_operands.s test/MC/AsmParser/labels.s
Daniel Dunbar
daniel at zuster.org
Thu May 6 07:46:38 PDT 2010
Author: ddunbar
Date: Thu May 6 09:46:38 2010
New Revision: 103178
URL: http://llvm.org/viewvc/llvm-project?rev=103178&view=rev
Log:
Revert r103137, fix for $ in labels. It looks like we can't actually handle this
at the token level. Consider the following horrible test case:
a = 1
.globl $a
movl ($a), %eax
movl $a, %eax
movl $$a, %eax
Modified:
llvm/trunk/lib/MC/MCParser/AsmLexer.cpp
llvm/trunk/test/MC/AsmParser/X86/x86_operands.s
llvm/trunk/test/MC/AsmParser/labels.s
Modified: llvm/trunk/lib/MC/MCParser/AsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmLexer.cpp?rev=103178&r1=103177&r2=103178&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmLexer.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmLexer.cpp Thu May 6 09:46:38 2010
@@ -69,26 +69,16 @@
}
}
-/// LexIdentifier: [a-zA-Z_.$][a-zA-Z0-9_$.@]*
-/// LexIdentifier: .
-/// LexIdentifier: $
+/// LexIdentifier: [a-zA-Z_.][a-zA-Z0-9_$.@]*
AsmToken AsmLexer::LexIdentifier() {
while (isalnum(*CurPtr) || *CurPtr == '_' || *CurPtr == '$' ||
*CurPtr == '.' || *CurPtr == '@')
++CurPtr;
// Handle . as a special case.
- if (CurPtr == TokStart+1)
- if (TokStart[0] == '.')
- return AsmToken(AsmToken::Dot, StringRef(TokStart, 1));
-
- // Handle $ as a special case. $foo is an identifier, $42 is not.
- if (TokStart[0] == '$' &&
- (CurPtr-TokStart == 1 || isdigit(TokStart[1]) || TokStart[1] == '"')) {
- CurPtr = TokStart+1;
- return AsmToken(AsmToken::Dollar, StringRef(TokStart, 1));
- }
-
+ if (CurPtr == TokStart+1 && TokStart[0] == '.')
+ return AsmToken(AsmToken::Dot, StringRef(TokStart, 1));
+
return AsmToken(AsmToken::Identifier, StringRef(TokStart, CurPtr - TokStart));
}
@@ -262,8 +252,8 @@
switch (CurChar) {
default:
- // Handle identifier: [a-zA-Z_.$][a-zA-Z0-9_$.@]*
- if (isalpha(CurChar) || CurChar == '_' || CurChar == '.' || CurChar == '$')
+ // Handle identifier: [a-zA-Z_.][a-zA-Z0-9_$.@]*
+ if (isalpha(CurChar) || CurChar == '_' || CurChar == '.')
return LexIdentifier();
// Unknown character, emit an error.
@@ -289,6 +279,7 @@
case '}': return AsmToken(AsmToken::RCurly, StringRef(TokStart, 1));
case '*': return AsmToken(AsmToken::Star, StringRef(TokStart, 1));
case ',': return AsmToken(AsmToken::Comma, StringRef(TokStart, 1));
+ case '$': return AsmToken(AsmToken::Dollar, StringRef(TokStart, 1));
case '=':
if (*CurPtr == '=')
return ++CurPtr, AsmToken(AsmToken::EqualEqual, StringRef(TokStart, 2));
Modified: llvm/trunk/test/MC/AsmParser/X86/x86_operands.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_operands.s?rev=103178&r1=103177&r2=103178&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/X86/x86_operands.s (original)
+++ llvm/trunk/test/MC/AsmParser/X86/x86_operands.s Thu May 6 09:46:38 2010
@@ -1,3 +1,5 @@
+// FIXME: Actually test that we get the expected results.
+
// RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
# Immediates
@@ -5,7 +7,7 @@
addl $1, %eax
# CHECK: addl $3, %eax
addl $(1+2), %eax
-# CHECK: addl ($a), %eax
+# CHECK: addl $a, %eax
addl $a, %eax
# CHECK: addl $3, %eax
addl $1 + 2, %eax
Modified: llvm/trunk/test/MC/AsmParser/labels.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/labels.s?rev=103178&r1=103177&r2=103178&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/labels.s (original)
+++ llvm/trunk/test/MC/AsmParser/labels.s Thu May 6 09:46:38 2010
@@ -57,10 +57,3 @@
// CHECK: .long "a 9"
.long "a 9"
-
-
-// rdar://7946934
-// CHECK: .globl $abc
- .globl $abc
-
-
\ No newline at end of file
More information about the llvm-commits
mailing list