[RISCV] Support .option relax and .option norelax

Authored by asb on Nov 12 2018, 6:25 AM.


[RISCV] Support .option relax and .option norelax

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


asbNov 12 2018, 6:25 AM
Differential Revision
D46423: [RISCV] Support .option relax and .option norelax
rGa395e2df569c: [DAGCombiner] Fix load-store forwarding of indexed loads.