aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorSam Elliott <aelliott@qti.qualcomm.com>2025-08-12 09:02:48 +0100
committerGitHub <noreply@github.com>2025-08-12 09:02:48 +0100
commit9e8f7acd2b3a71dad473565a6a6f3ba51a3e6bca (patch)
tree250b7d58effb5b91c4cb9657f6c69c95d990c747 /llvm/lib/Transforms/Utils/LoopUtils.cpp
parent76942a2f8f17377225e94f34b4782fb814d9d292 (diff)
downloadllvm-9e8f7acd2b3a71dad473565a6a6f3ba51a3e6bca.zip
llvm-9e8f7acd2b3a71dad473565a6a6f3ba51a3e6bca.tar.gz
llvm-9e8f7acd2b3a71dad473565a6a6f3ba51a3e6bca.tar.bz2
[RISCV] Track Linker Relaxable through Assembly Relaxation (#152602)
Span-dependent instructions on RISC-V interact in a complex manner with linker relaxation. The span-dependent assembler algorithm implemented in LLVM has to start with the smallest version of an instruction and then only make it larger, so we compress instructions before emitting them to the streamer. When the instruction is streamed, the information that the instruction (or rather, the fixup on the instruction) is linker relaxable must be accurate, even though the assembler relaxation process may transform a not-linker-relaxable instruction/fixup into one that that is linker relaxable, for instance `c.jal` becoming `qc.e.jal`, or `bne` getting turned into `beq; jal` (the `jal` is linker relaxable). In order for this to work, the following things have to happen: - Any instruction/fixup which might be relaxed to a linker-relaxable instruction/fixup, gets marked as `RelaxCandidate = true` in RISCVMCCodeEmitter. - In RISCVAsmBackend, when emitting the `R_RISCV_RELAX` relocation, we have to check that the relocation/fixup kind is one that may need a relax relocation, as well as that it is marked as linker relaxable (the latter will not be set if relaxation is disabled). - Linker Relaxable instructions streamed to a Relaxable fragment need to mark the fragment and its section as linker relaxable. I also added more debug output for Sections/Fixups which are marked Linker Relaxable. This results in more relocations, when these PC-relative fixups cross an instruction with a fixup that is resolved as not linker-relaxable but caused the fragment to be marked linker relaxable at streaming time (i.e. `c.j`). Fixes: #150071
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
0 files changed, 0 insertions, 0 deletions