AsmToken Buf[1];
Lexer.peekTokens(Buf, false);
- if (Buf[0].isNot(AsmToken::Identifier))
+ if (Buf[0].isNot(AsmToken::Identifier) && Buf[0].isNot(AsmToken::Integer))
return true;
- // We have a '$' or '@' followed by an identifier, make sure they are adjacent.
+ // We have a '$' or '@' followed by an identifier or integer token, make
+ // sure they are adjacent.
if (PrefixLoc.getPointer() + 1 != Buf[0].getLoc().getPointer())
return true;
// eat $ or @
Lexer.Lex(); // Lexer's Lex guarantees consecutive token.
// Construct the joined identifier and consume the token.
- Res =
- StringRef(PrefixLoc.getPointer(), getTok().getIdentifier().size() + 1);
+ Res = StringRef(PrefixLoc.getPointer(), getTok().getString().size() + 1);
Lex(); // Parser Lex to maintain invariants.
return false;
}
@------------------------------------------------------------------------------
.global $foo
+ .global $4
b $foo
bl $foo
beq $foo
blx $foo
b $foo + 4
+ bl $4
+ beq $4 + 4
@ CHECK: b ($foo) @ encoding: [A,A,A,0xea]
@ CHECK: bl ($foo) @ encoding: [A,A,A,0xeb]
@ CHECK: beq ($foo) @ encoding: [A,A,A,0x0a]
@ CHECK: blx ($foo) @ encoding: [A,A,A,0xfa]
@ CHECK: b #($foo)+4 @ encoding: [A,A,A,0xea]
+@ CHECK: bl ($4) @ encoding: [A,A,A,0xeb]
+@ CHECK: beq #($4)+4 @ encoding: [A,A,A,0x0a]
@------------------------------------------------------------------------------
@ Leading '$' should be allowed to introduce an expression
+++ /dev/null
-// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err > %t
-// RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s
-
-.long $1
-// CHECK-ERROR: 4:7: error: invalid token in expression
--- /dev/null
+// RUN: llvm-mc -triple x86_64-apple-darwin10 %s | FileCheck %s
+
+.long $1
+// CHECK: .long ($1)
# ASM: :[[@LINE-1]]:23: error: expected save register or stack offset
.cpsetup $31, $32, __cerror
# ASM: :[[@LINE-1]]:23: error: invalid register
- .cpsetup $25, $2, $3
-# ASM: :[[@LINE-1]]:27: error: expected expression
.cpsetup $25, $2, 4
# ASM: :[[@LINE-1]]:28: error: expected symbol
.cpsetup $25, $2, 4+65
$2, $1, $25
-# ALL: error: unexpected token at start of statement
+# ALL: error: unknown instruction
# ALL-NEXT: $2, $1, $25
# ALL-NEXT: ^