diff options
author | Alex Bradbury <asb@lowrisc.org> | 2019-03-09 09:28:06 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2019-03-09 09:28:06 +0000 |
commit | fea4957177315f83746dca90cb4c9013eb465c46 (patch) | |
tree | b9a9b764109fbfabbc1d2453688f2ae8c889b187 /llvm/lib/Target/RISCV/RISCVISelLowering.cpp | |
parent | 972d7d514b2fbed4c256ce3a7e258e9e5e5a5ab9 (diff) | |
download | bcm5719-llvm-fea4957177315f83746dca90cb4c9013eb465c46.tar.gz bcm5719-llvm-fea4957177315f83746dca90cb4c9013eb465c46.zip |
[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
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index f46a21a9bff..d844a8364eb 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -42,6 +42,12 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, const RISCVSubtarget &STI) : TargetLowering(TM), Subtarget(STI) { + RISCVABI::ABI ABI = Subtarget.getTargetABI(); + assert(ABI != RISCVABI::ABI_Unknown && "Improperly initialised target ABI"); + + if (ABI != RISCVABI::ABI_ILP32 && ABI != RISCVABI::ABI_LP64) + report_fatal_error("Don't know how to lower this ABI"); + MVT XLenVT = Subtarget.getXLenVT(); // Set up the register classes. |