mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
7a49f52054
- This patch attempts to implement the location counter syntax (*) for the HLASM variant for PC-relative instructions. - In the HLASM variant, for purely constant relocatable values, we expect a * token preceding it, with special support for " *" which is parsed as "<pc-rel-insn 0>" - For combinations of absolute values and relocatable values, we don't expect the "*" preceding the token. When you have a " * " what’s accepted is: ``` *<space>.*{.*} -> <pc-rel-insn> 0 *[+|-][constant-value] -> <pc-rel-insn> [+|-]constant-value ``` When you don’t have a " * " what’s accepted is: ``` brasl 1,func is allowed (MCSymbolRef type) brasl 1,func+4 is allowed (MCBinary type) brasl 1,4+func is allowed (MCBinary type) brasl 1,-4+func is allowed (MCBinary type) brasl 1,func-4 is allowed (MCBinary type) brasl 1,*func is not allowed (* cannot be used for non-MCConstantExprs) brasl 1,*+func is not allowed (* cannot be used for non-MCConstantExprs) brasl 1,*+func+4 is not allowed (* cannot be used for non-MCConstantExprs) brasl 1,*+4+func is not allowed (* cannot be used for non-MCConstantExprs) brasl 1,*-4+8+func is not allowed (* cannot be used for non-MCConstantExprs) ``` Reviewed By: Kai Differential Revision: https://reviews.llvm.org/D100987
42 lines
773 B
ArmAsm
42 lines
773 B
ArmAsm
# RUN: not llvm-mc -triple i686-elf -filetype asm -o /dev/null %s 2>&1 \
|
|
# RUN: | FileCheck %s
|
|
|
|
.data
|
|
|
|
.global invalid_expression
|
|
.type invalid_expression,@object
|
|
invalid_expression:
|
|
.rept *
|
|
|
|
# CHECK: error: invalid token in expression
|
|
# CHECK: .rept *
|
|
# CHECK: ^
|
|
|
|
.global bad_token
|
|
.type bad_token,@object
|
|
bad_token:
|
|
.rept bad_token
|
|
|
|
# CHECK: error: unexpected token in '.rept' directive
|
|
# CHECK: .rept bad_token
|
|
# CHECK: ^
|
|
|
|
.global negative
|
|
.type negative,@object
|
|
negative:
|
|
.rept -32
|
|
|
|
# CHECK: error: Count is negative
|
|
# CHECK: .rept -32
|
|
# CHECK: ^
|
|
|
|
.global trailer
|
|
.type trailer,@object
|
|
trailer:
|
|
.rep 0 trailer
|
|
|
|
# CHECK: :[[#@LINE-2]]:9: error: expected newline
|
|
# CHECK: .rep 0 trailer
|
|
# CHECK: ^
|
|
|