[RISCV] Add basic RV32E definitions and MC layer support
authorAlex Bradbury <asb@lowrisc.org>
Fri, 22 Mar 2019 11:21:40 +0000 (11:21 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Fri, 22 Mar 2019 11:21:40 +0000 (11:21 +0000)
commitdab1f6fc4e025a0d6ceeaae48a5e569bb85e6696
treef2fef421c1c06ab1fe547523e58576fb4a588d70
parent91e5cdfc93729c61c757db4efd4a82670ac7f929
[RISCV] Add basic RV32E definitions and MC layer support

The RISC-V ISA defines RV32E as an alternative "base" instruction set
encoding, that differs from RV32I by having only 16 rather than 32 registers.
This patch adds basic definitions for RV32E as well as MC layer support
(assembling, disassembling) and tests. The only supported ABI on RV32E is
ILP32E.

Add a new RISCVFeatures::validate() helper to RISCVUtils which can be called
from codegen or MC layer libraries to validate the combination of TargetTriple
and FeatureBitSet. Other targets have similar checks (e.g. erroring if SPE is
enabled on PPC64 or oddspreg + o32 ABI on Mips), but they either duplicate the
checks (Mips), or fail to check for both codegen and MC codepaths (PPC).

Codegen for the ILP32E ABI support and RV32E codegen are left for a future
patch/patches.

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

llvm-svn: 356744
16 files changed:
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
llvm/lib/Target/RISCV/RISCV.td
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVSubtarget.cpp
llvm/lib/Target/RISCV/RISCVSubtarget.h
llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.cpp
llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.h
llvm/test/CodeGen/RISCV/mattr-invalid-combination.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rv32e.ll [new file with mode: 0644]
llvm/test/MC/RISCV/elf-flags.s
llvm/test/MC/RISCV/mattr-invalid-combination.s [new file with mode: 0644]
llvm/test/MC/RISCV/rv32e-invalid.s [new file with mode: 0644]
llvm/test/MC/RISCV/rv32e-valid.s [new file with mode: 0644]
llvm/test/MC/RISCV/target-abi-invalid.s