diff options
author | Alex Bradbury <asb@lowrisc.org> | 2017-10-19 21:37:38 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2017-10-19 21:37:38 +0000 |
commit | 8971842f43b978e72aa40cf0a94c3d39c7a74c85 (patch) | |
tree | cc7114765471a34e5a0c66ea8170c2ff95898b1b /llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | |
parent | f27d161bf05a90f02a3588b45726650b19533239 (diff) | |
download | llvm-8971842f43b978e72aa40cf0a94c3d39c7a74c85.zip llvm-8971842f43b978e72aa40cf0a94c3d39c7a74c85.tar.gz llvm-8971842f43b978e72aa40cf0a94c3d39c7a74c85.tar.bz2 |
[RISCV] Initial codegen support for ALU operations
This adds the minimum necessary to support codegen for simple ALU operations
on RV32. Prolog and epilog insertion, support for memory operations etc etc
follow in future patches.
Leave guessInstructionProperties=1 until https://reviews.llvm.org/D37065 is
reviewed and lands.
Differential Revision: https://reviews.llvm.org/D29933
llvm-svn: 316188
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp index 78d9cf5..34da6de 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "RISCV.h" #include "RISCVTargetMachine.h" #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/Passes.h" @@ -58,10 +59,31 @@ RISCVTargetMachine::RISCVTargetMachine(const Target &T, const Triple &TT, : LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options, getEffectiveRelocModel(TT, RM), getEffectiveCodeModel(CM), OL), - TLOF(make_unique<TargetLoweringObjectFileELF>()) { + TLOF(make_unique<TargetLoweringObjectFileELF>()), + Subtarget(TT, CPU, FS, *this) { initAsmInfo(); } +namespace { +class RISCVPassConfig : public TargetPassConfig { +public: + RISCVPassConfig(RISCVTargetMachine &TM, PassManagerBase &PM) + : TargetPassConfig(TM, PM) {} + + RISCVTargetMachine &getRISCVTargetMachine() const { + return getTM<RISCVTargetMachine>(); + } + + bool addInstSelector() override; +}; +} + TargetPassConfig *RISCVTargetMachine::createPassConfig(PassManagerBase &PM) { - return new TargetPassConfig(*this, PM); + return new RISCVPassConfig(*this, PM); +} + +bool RISCVPassConfig::addInstSelector() { + addPass(createRISCVISelDag(getRISCVTargetMachine())); + + return false; } |