[PATCH] D121073: [RISCV] Remove RISCVFeatures::validate function

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 21:31:13 PST 2022


StephenFan updated this revision to Diff 413699.
StephenFan added a comment.

[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`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121073/new/

https://reviews.llvm.org/D121073

Files:
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.h
  llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
  llvm/lib/Target/RISCV/RISCVSubtarget.cpp
  llvm/test/CodeGen/RISCV/module-target-abi2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121073.413699.patch
Type: text/x-patch
Size: 11927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220308/a3467976/attachment.bin>


More information about the llvm-commits mailing list