[PATCH] D59023: [RISCV] Support -target-abi at the MC layer and for codegen

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 06:23:21 PST 2019


asb created this revision.
asb added reviewers: apazos, shiva0217, kito-cheng, rogfer01.
Herald added subscribers: jdoerfert, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, niosHD, sabuasal, simoncook, johnrusso, rbar.

This patch adds proper handling of -target-abi, as accepted by llvm-mc and llc. Lowering (codegen) for the hard-float ABIs will follow in a subsequent patch. However, this patch does add MC layer support for the hard float ABIs (emission of the appropriate ELF flags https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#-file-header).

ABI parsing must be shared between codegen and the MC layer, so we add computeTargetABI to RISCVUtils. Without a much wider scale change I don't see a better approach than report_fatal_error for bailing out when an unsupported ABI is encountered. However, I make use of Expected<T> and createStringError so this could potentially be improved in the future without changing computeTargetABI.


https://reviews.llvm.org/D59023

Files:
  lib/Target/RISCV/MCTargetDesc/LLVMBuild.txt
  lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
  lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
  lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
  lib/Target/RISCV/RISCVISelLowering.cpp
  lib/Target/RISCV/RISCVSubtarget.cpp
  lib/Target/RISCV/RISCVSubtarget.h
  lib/Target/RISCV/RISCVTargetMachine.cpp
  lib/Target/RISCV/Utils/RISCVBaseInfo.cpp
  lib/Target/RISCV/Utils/RISCVBaseInfo.h
  test/CodeGen/RISCV/target-abi-invalid.ll
  test/CodeGen/RISCV/target-abi-valid.ll
  test/MC/RISCV/target-abi-invalid.s
  test/MC/RISCV/target-abi-valid.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59023.189497.patch
Type: text/x-patch
Size: 23602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190306/699d0ceb/attachment.bin>


More information about the llvm-commits mailing list