[all-commits] [llvm/llvm-project] 227496: [RISCV] Generate correct ELF EFlags when .ll file ...

luxufan via All-commits all-commits at lists.llvm.org
Wed Mar 23 09:50:19 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 227496dc09cf46df233aad041d6dc6113822e4bb
      https://github.com/llvm/llvm-project/commit/227496dc09cf46df233aad041d6dc6113822e4bb
  Author: luxufan <xufan at nj.iscas.ac.cn>
  Date:   2022-03-24 (Thu, 24 Mar 2022)

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

  Log Message:
  -----------
  [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.

Differential Revision: https://reviews.llvm.org/D121183


  Commit: 5800fb41a6b95797e0dc9fe009bc7183ab370b17
      https://github.com/llvm/llvm-project/commit/5800fb41a6b95797e0dc9fe009bc7183ab370b17
  Author: luxufan <luxufan at iscas.ac.cn>
  Date:   2022-03-24 (Thu, 24 Mar 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
    M llvm/test/CodeGen/RISCV/mattr-invalid-combination.ll
    M llvm/test/MC/RISCV/mattr-invalid-combination.s

  Log Message:
  -----------
  [RISCV] Remove check and update test file in D121183

Differential Revision: https://reviews.llvm.org/D122290


Compare: https://github.com/llvm/llvm-project/compare/5bb5704c1b35...5800fb41a6b9


More information about the All-commits mailing list