This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Remove RISCVFeatures::validate function
Needs ReviewPublic

Authored by StephenFan on Mar 6 2022, 6:46 AM.

Details

Summary

Feature validation is done by parseFeature function. This RISCVFeature::validate function is redundant.

Diff Detail

Event Timeline

StephenFan created this revision.Mar 6 2022, 6:46 AM
StephenFan requested review of this revision.Mar 6 2022, 6:46 AM
StephenFan retitled this revision from [RISCV] Remove feature validate function to [RISCV] Remove RISCVFeatures::validate function.Mar 6 2022, 7:23 AM
StephenFan edited the summary of this revision. (Show Details)
StephenFan updated this revision to Diff 413699.Mar 7 2022, 9:31 PM

[RISCV] Generate correct ELF EFlags when .ll file has target-abi attribute

In the past, when construct RISCVAsmBackend, MCTargetOptions.ABIName would be passed and stored in RISCVAsmBackend.
But MCTargetOptions.ABIName can only be specified by -target-abi xxx in command line, if the .ll file has target-abi attribute, the codegen module will ignore it. And the generated object file would have incorrect EFlags value.

https://github.com/llvm/llvm-project/issues/50591 also caused by this problem.

This patch override the AsmPrinter::emitFunctionEntryLabel function and use it to set the target abi value that get from .ll file's target-abi attribute. And storing the target-abi in RISCVTargetStreamer instead of RISCVAsmBackend.

[RISCV] Generate correct ELF EFlags when .ll file has target-abi attribute

In the past, when construct RISCVAsmBackend, MCTargetOptions.ABIName would be passed and stored in RISCVAsmBackend.
But MCTargetOptions.ABIName can only be specified by -target-abi xxx in command line, if the .ll file has target-abi attribute, the codegen module will ignore it. And the generated object file would have incorrect EFlags value.

https://github.com/llvm/llvm-project/issues/50591 also caused by this problem.

This patch override the AsmPrinter::emitFunctionEntryLabel function and use it to set the target abi value that get from .ll file's target-abi attribute. And storing the target-abi in RISCVTargetStreamer instead of RISCVAsmBackend.

Was this supposed to be a new review?