LLVM API Documentation

MipsSEISelDAGToDAG.h
Go to the documentation of this file.
00001 //===-- MipsSEISelDAGToDAG.h - A Dag to Dag Inst Selector for MipsSE -----===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // Subclass of MipsDAGToDAGISel specialized for mips32/64.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_MIPS_MIPSSEISELDAGTODAG_H
00015 #define LLVM_LIB_TARGET_MIPS_MIPSSEISELDAGTODAG_H
00016 
00017 #include "MipsISelDAGToDAG.h"
00018 
00019 namespace llvm {
00020 
00021 class MipsSEDAGToDAGISel : public MipsDAGToDAGISel {
00022 
00023 public:
00024   explicit MipsSEDAGToDAGISel(MipsTargetMachine &TM) : MipsDAGToDAGISel(TM) {}
00025 
00026 private:
00027 
00028   bool runOnMachineFunction(MachineFunction &MF) override;
00029 
00030   void addDSPCtrlRegOperands(bool IsDef, MachineInstr &MI,
00031                              MachineFunction &MF);
00032 
00033   unsigned getMSACtrlReg(const SDValue RegIdx) const;
00034 
00035   bool replaceUsesWithZeroReg(MachineRegisterInfo *MRI, const MachineInstr&);
00036 
00037   std::pair<SDNode*, SDNode*> selectMULT(SDNode *N, unsigned Opc, SDLoc dl,
00038                                          EVT Ty, bool HasLo, bool HasHi);
00039 
00040   SDNode *selectAddESubE(unsigned MOp, SDValue InFlag, SDValue CmpLHS,
00041                          SDLoc DL, SDNode *Node) const;
00042 
00043   bool selectAddrFrameIndex(SDValue Addr, SDValue &Base, SDValue &Offset) const;
00044   bool selectAddrFrameIndexOffset(SDValue Addr, SDValue &Base, SDValue &Offset,
00045                                   unsigned OffsetBits) const;
00046 
00047   bool selectAddrRegImm(SDValue Addr, SDValue &Base,
00048                         SDValue &Offset) const override;
00049 
00050   bool selectAddrRegReg(SDValue Addr, SDValue &Base,
00051                         SDValue &Offset) const override;
00052 
00053   bool selectAddrDefault(SDValue Addr, SDValue &Base,
00054                          SDValue &Offset) const override;
00055 
00056   bool selectIntAddr(SDValue Addr, SDValue &Base,
00057                      SDValue &Offset) const override;
00058 
00059   bool selectAddrRegImm10(SDValue Addr, SDValue &Base,
00060                           SDValue &Offset) const;
00061 
00062   bool selectAddrRegImm12(SDValue Addr, SDValue &Base,
00063                           SDValue &Offset) const;
00064 
00065   bool selectIntAddrMM(SDValue Addr, SDValue &Base,
00066                        SDValue &Offset) const override;
00067 
00068   bool selectIntAddrMSA(SDValue Addr, SDValue &Base,
00069                         SDValue &Offset) const override;
00070 
00071   /// \brief Select constant vector splats.
00072   bool selectVSplat(SDNode *N, APInt &Imm) const override;
00073   /// \brief Select constant vector splats whose value fits in a given integer.
00074   bool selectVSplatCommon(SDValue N, SDValue &Imm, bool Signed,
00075                                   unsigned ImmBitSize) const;
00076   /// \brief Select constant vector splats whose value fits in a uimm1.
00077   bool selectVSplatUimm1(SDValue N, SDValue &Imm) const override;
00078   /// \brief Select constant vector splats whose value fits in a uimm2.
00079   bool selectVSplatUimm2(SDValue N, SDValue &Imm) const override;
00080   /// \brief Select constant vector splats whose value fits in a uimm3.
00081   bool selectVSplatUimm3(SDValue N, SDValue &Imm) const override;
00082   /// \brief Select constant vector splats whose value fits in a uimm4.
00083   bool selectVSplatUimm4(SDValue N, SDValue &Imm) const override;
00084   /// \brief Select constant vector splats whose value fits in a uimm5.
00085   bool selectVSplatUimm5(SDValue N, SDValue &Imm) const override;
00086   /// \brief Select constant vector splats whose value fits in a uimm6.
00087   bool selectVSplatUimm6(SDValue N, SDValue &Imm) const override;
00088   /// \brief Select constant vector splats whose value fits in a uimm8.
00089   bool selectVSplatUimm8(SDValue N, SDValue &Imm) const override;
00090   /// \brief Select constant vector splats whose value fits in a simm5.
00091   bool selectVSplatSimm5(SDValue N, SDValue &Imm) const override;
00092   /// \brief Select constant vector splats whose value is a power of 2.
00093   bool selectVSplatUimmPow2(SDValue N, SDValue &Imm) const override;
00094   /// \brief Select constant vector splats whose value is the inverse of a
00095   /// power of 2.
00096   bool selectVSplatUimmInvPow2(SDValue N, SDValue &Imm) const override;
00097   /// \brief Select constant vector splats whose value is a run of set bits
00098   /// ending at the most significant bit
00099   bool selectVSplatMaskL(SDValue N, SDValue &Imm) const override;
00100   /// \brief Select constant vector splats whose value is a run of set bits
00101   /// starting at bit zero.
00102   bool selectVSplatMaskR(SDValue N, SDValue &Imm) const override;
00103 
00104   std::pair<bool, SDNode*> selectNode(SDNode *Node) override;
00105 
00106   void processFunctionAfterISel(MachineFunction &MF) override;
00107 
00108   // Insert instructions to initialize the global base register in the
00109   // first MBB of the function.
00110   void initGlobalBaseReg(MachineFunction &MF);
00111 };
00112 
00113 FunctionPass *createMipsSEISelDag(MipsTargetMachine &TM);
00114 
00115 }
00116 
00117 #endif