mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
59ae392352
This extends the .option support from D45864 to enable/disable the relax feature flag from D44886 During parsing of the relax/norelax directives, the RISCV::FeatureRelax feature bits of the SubtargetInfo stored in the AsmParser are updated appropriately to reflect whether relaxation is currently enabled in the parser. When an instruction is parsed, the parser checks if relaxation is currently enabled and if so, gets a handle to the AsmBackend and sets the ForceRelocs flag. The AsmBackend uses a combination of the original RISCV::FeatureRelax feature bits set by e.g -mattr=+/-relax and the ForceRelocs flag to determine whether to emit relocations for symbol and branch diffs. Diff relocations should therefore only not be emitted if the relax flag was not set on the command line and no instruction was ever parsed in a section with relaxation enabled to ensure correct diffs are emitted. Differential Revision: https://reviews.llvm.org/D46423 Patch by Lewis Revill. llvm-svn: 346655
21 lines
762 B
LLVM
21 lines
762 B
LLVM
; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=+relax %s -o - \
|
|
; RUN: | llvm-readobj -r | FileCheck -check-prefix=RELAX %s
|
|
; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=-relax %s -o - \
|
|
; RUN: | llvm-readobj -r | FileCheck -check-prefix=NORELAX %s
|
|
|
|
; This test checks that a diff inserted via inline assembly only causes
|
|
; relocations when relaxation is enabled. This isn't an assembly test
|
|
; as the assembler takes a different path through LLVM, which is
|
|
; already covered by the fixups-expr.s test.
|
|
|
|
define i32 @main() {
|
|
entry:
|
|
%retval = alloca i32, align 4
|
|
store i32 0, i32* %retval, align 4
|
|
; RELAX: R_RISCV_ADD64 b
|
|
; RELAX: R_RISCV_SUB64 a
|
|
; NORELAX-NOT: R_RISCV
|
|
call void asm sideeffect "a:\0Ab:\0A.dword b-a", ""()
|
|
ret i32 0
|
|
}
|