[RISCV] Support -target-abi at the MC layer and for codegen
authorAlex Bradbury <asb@lowrisc.org>
Sat, 9 Mar 2019 09:28:06 +0000 (09:28 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Sat, 9 Mar 2019 09:28:06 +0000 (09:28 +0000)
commitfea4957177315f83746dca90cb4c9013eb465c46
treeb9a9b764109fbfabbc1d2453688f2ae8c889b187
parent972d7d514b2fbed4c256ce3a7e258e9e5e5a5ab9
[RISCV] Support -target-abi at the MC layer and for codegen

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 and
RVE 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. A warning will be printed if an invalid or
unrecognized ABI is given.

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

llvm-svn: 355771
14 files changed:
llvm/lib/Target/RISCV/MCTargetDesc/LLVMBuild.txt
llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVSubtarget.cpp
llvm/lib/Target/RISCV/RISCVSubtarget.h
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.cpp
llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.h
llvm/test/CodeGen/RISCV/target-abi-invalid.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/target-abi-valid.ll [new file with mode: 0644]
llvm/test/MC/RISCV/target-abi-invalid.s [new file with mode: 0644]
llvm/test/MC/RISCV/target-abi-valid.s [new file with mode: 0644]