diff options
author | Reed Kotler <rkotler@mips.com> | 2014-04-17 22:15:34 +0000 |
---|---|---|
committer | Reed Kotler <rkotler@mips.com> | 2014-04-17 22:15:34 +0000 |
commit | f90e2bb56a7aac8df296a7f21eebd3e44252b859 (patch) | |
tree | 2376570c72b36e79dd30ad8d1017bb0c8aef3cc0 | |
parent | fc8fa8238d403c244c077e44208a0dc71377f250 (diff) | |
download | llvm-f90e2bb56a7aac8df296a7f21eebd3e44252b859.tar.gz llvm-f90e2bb56a7aac8df296a7f21eebd3e44252b859.tar.bz2 llvm-f90e2bb56a7aac8df296a7f21eebd3e44252b859.tar.xz |
Start pushing changes for Mips Fast-Isel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206505 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/Mips/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/Target/Mips/MipsFastISel.cpp | 28 | ||||
-rw-r--r-- | lib/Target/Mips/MipsISelLowering.cpp | 14 | ||||
-rw-r--r-- | lib/Target/Mips/MipsISelLowering.h | 10 |
4 files changed, 53 insertions, 0 deletions
diff --git a/lib/Target/Mips/CMakeLists.txt b/lib/Target/Mips/CMakeLists.txt index c304ee31fa..ff4dd3ec3e 100644 --- a/lib/Target/Mips/CMakeLists.txt +++ b/lib/Target/Mips/CMakeLists.txt @@ -26,6 +26,7 @@ add_llvm_target(MipsCodeGen MipsCodeEmitter.cpp MipsConstantIslandPass.cpp MipsDelaySlotFiller.cpp + MipsFastISel.cpp MipsJITInfo.cpp MipsInstrInfo.cpp MipsISelDAGToDAG.cpp diff --git a/lib/Target/Mips/MipsFastISel.cpp b/lib/Target/Mips/MipsFastISel.cpp new file mode 100644 index 0000000000..70579bd270 --- /dev/null +++ b/lib/Target/Mips/MipsFastISel.cpp @@ -0,0 +1,28 @@ +//===-- MipsastISel.cpp - Mips FastISel implementation +//---------------------===// + +#include "llvm/CodeGen/FunctionLoweringInfo.h" +#include "llvm/CodeGen/FastISel.h" +#include "llvm/Target/TargetLibraryInfo.h" +#include "MipsISelLowering.h" + +using namespace llvm; + +namespace { + +class MipsFastISel final : public FastISel { + +public: + explicit MipsFastISel(FunctionLoweringInfo &funcInfo, + const TargetLibraryInfo *libInfo) + : FastISel(funcInfo, libInfo) {} + bool TargetSelectInstruction(const Instruction *I) override { return false; } +}; +} + +namespace llvm { +FastISel *Mips::createFastISel(FunctionLoweringInfo &funcInfo, + const TargetLibraryInfo *libInfo) { + return new MipsFastISel(funcInfo, libInfo); +} +} diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp index e7120edb84..7ca7876040 100644 --- a/lib/Target/Mips/MipsISelLowering.cpp +++ b/lib/Target/Mips/MipsISelLowering.cpp @@ -50,6 +50,11 @@ NoZeroDivCheck("mno-check-zero-division", cl::Hidden, cl::desc("MIPS: Don't trap on integer division by zero."), cl::init(false)); +cl::opt<bool> +EnableMipsFastISel("mips-fast-isel", cl::Hidden, + cl::desc("Allow mips-fast-isel to be used"), + cl::init(false)); + static const MCPhysReg O32IntRegs[4] = { Mips::A0, Mips::A1, Mips::A2, Mips::A3 }; @@ -396,6 +401,15 @@ const MipsTargetLowering *MipsTargetLowering::create(MipsTargetMachine &TM) { return llvm::createMipsSETargetLowering(TM); } +// Create a fast isel object. +FastISel * +MipsTargetLowering::createFastISel(FunctionLoweringInfo &funcInfo, + const TargetLibraryInfo *libInfo) const { + if (!EnableMipsFastISel) + return TargetLowering::createFastISel(funcInfo, libInfo); + return Mips::createFastISel(funcInfo, libInfo); +} + EVT MipsTargetLowering::getSetCCResultType(LLVMContext &, EVT VT) const { if (!VT.isVector()) return MVT::i32; diff --git a/lib/Target/Mips/MipsISelLowering.h b/lib/Target/Mips/MipsISelLowering.h index ab9dfe9fed..a12c9a7b43 100644 --- a/lib/Target/Mips/MipsISelLowering.h +++ b/lib/Target/Mips/MipsISelLowering.h @@ -218,6 +218,11 @@ namespace llvm { static const MipsTargetLowering *create(MipsTargetMachine &TM); + /// createFastISel - This method returns a target specific FastISel object, + /// or null if the target does not support "fast" ISel. + FastISel *createFastISel(FunctionLoweringInfo &funcInfo, + const TargetLibraryInfo *libInfo) const override; + virtual MVT getScalarShiftAmountTy(EVT LHSTy) const { return MVT::i32; } virtual void LowerOperationWrapper(SDNode *N, @@ -608,6 +613,11 @@ namespace llvm { /// Create MipsTargetLowering objects. const MipsTargetLowering *createMips16TargetLowering(MipsTargetMachine &TM); const MipsTargetLowering *createMipsSETargetLowering(MipsTargetMachine &TM); + + namespace Mips { + FastISel *createFastISel(FunctionLoweringInfo &funcInfo, + const TargetLibraryInfo *libInfo); + } } #endif // MipsISELLOWERING_H |