[PATCH] D43328: [RISCV] Update MC compression tests
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 1 00:33:52 PST 2018
asb added inline comments.
Comment at: test/MC/RISCV/compress-relocations.s:1-13
+# RUN: llvm-mc -triple riscv32 -mattr=+c -riscv-no-aliases < %s -show-encoding \
+# RUN: | FileCheck -check-prefix=INSTR -check-prefix=FIXUP %s
+# Check prefixes:
+# FIXUP - Check the fixup on the instruction.
+# INSTR - Check the instruction is handled properly by the ASMPrinter
> asb wrote:
> > asb wrote:
> > > You've lost the RELOC checks.
> > Also if we're going to separate this to a separate file, relocations-compressed.s would be more consistent with naming of other files (such as fixups-compressed.s).
> I actually didn't forget. This is a bit tricky.
> MC for RISCV , as of now, only generates relocations if the target for the branch\jump is unresolved. MC also relaxes branches\jumps to unresolved targets (look at MCAssembler::handleFixup and MCAssembler::fixupNeedsRelaxation).
> With relaxation implemented, a compressed branch\jump to an undefined reference will always get relaxed to the expanded form and the relocation generated will be that of the expanded form.
> One way this could be circumvented (if we need to) is by implementing shouldForceRelocation, this way a compressed branch to a local (resolved) symbol will also get a relocation.
I think the correct thing to do is to leave the RELOC checks in this patch, then update the checks in the patch that actually changes the behaviour.
More information about the llvm-commits