LLVM API Documentation
00001 //===-- SIISelLowering.h - SI DAG Lowering Interface ------------*- C++ -*-===// 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 /// \file 00011 /// \brief SI DAG Lowering interface definition 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_LIB_TARGET_R600_SIISELLOWERING_H 00016 #define LLVM_LIB_TARGET_R600_SIISELLOWERING_H 00017 00018 #include "AMDGPUISelLowering.h" 00019 #include "SIInstrInfo.h" 00020 00021 namespace llvm { 00022 00023 class SITargetLowering : public AMDGPUTargetLowering { 00024 SDValue LowerParameter(SelectionDAG &DAG, EVT VT, EVT MemVT, SDLoc DL, 00025 SDValue Chain, unsigned Offset, bool Signed) const; 00026 SDValue LowerSampleIntrinsic(unsigned Opcode, const SDValue &Op, 00027 SelectionDAG &DAG) const; 00028 SDValue LowerGlobalAddress(AMDGPUMachineFunction *MFI, SDValue Op, 00029 SelectionDAG &DAG) const override; 00030 00031 SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const; 00032 SDValue LowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const; 00033 SDValue LowerFrameIndex(SDValue Op, SelectionDAG &DAG) const; 00034 SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const; 00035 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const; 00036 SDValue LowerFastFDIV(SDValue Op, SelectionDAG &DAG) const; 00037 SDValue LowerFDIV32(SDValue Op, SelectionDAG &DAG) const; 00038 SDValue LowerFDIV64(SDValue Op, SelectionDAG &DAG) const; 00039 SDValue LowerFDIV(SDValue Op, SelectionDAG &DAG) const; 00040 SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const; 00041 SDValue LowerTrig(SDValue Op, SelectionDAG &DAG) const; 00042 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const; 00043 00044 bool foldImm(SDValue &Operand, int32_t &Immediate, 00045 bool &ScalarSlotUsed) const; 00046 const TargetRegisterClass *getRegClassForNode(SelectionDAG &DAG, 00047 const SDValue &Op) const; 00048 bool fitsRegClass(SelectionDAG &DAG, const SDValue &Op, 00049 unsigned RegClass) const; 00050 void ensureSRegLimit(SelectionDAG &DAG, SDValue &Operand, 00051 unsigned RegClass, bool &ScalarSlotUsed) const; 00052 00053 SDNode *legalizeOperands(MachineSDNode *N, SelectionDAG &DAG) const; 00054 void adjustWritemask(MachineSDNode *&N, SelectionDAG &DAG) const; 00055 MachineSDNode *AdjustRegClass(MachineSDNode *N, SelectionDAG &DAG) const; 00056 00057 static SDValue performUCharToFloatCombine(SDNode *N, 00058 DAGCombinerInfo &DCI); 00059 SDValue performSHLPtrCombine(SDNode *N, 00060 unsigned AS, 00061 DAGCombinerInfo &DCI) const; 00062 00063 public: 00064 SITargetLowering(TargetMachine &tm); 00065 00066 bool isLegalAddressingMode(const AddrMode &AM, 00067 Type *Ty) const override; 00068 00069 bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, 00070 unsigned Align, 00071 bool *IsFast) const override; 00072 00073 EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, 00074 unsigned SrcAlign, bool IsMemset, 00075 bool ZeroMemset, 00076 bool MemcpyStrSrc, 00077 MachineFunction &MF) const override; 00078 00079 TargetLoweringBase::LegalizeTypeAction 00080 getPreferredVectorAction(EVT VT) const override; 00081 00082 bool shouldConvertConstantLoadToIntImm(const APInt &Imm, 00083 Type *Ty) const override; 00084 00085 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, 00086 bool isVarArg, 00087 const SmallVectorImpl<ISD::InputArg> &Ins, 00088 SDLoc DL, SelectionDAG &DAG, 00089 SmallVectorImpl<SDValue> &InVals) const override; 00090 00091 MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr * MI, 00092 MachineBasicBlock * BB) const override; 00093 EVT getSetCCResultType(LLVMContext &Context, EVT VT) const override; 00094 MVT getScalarShiftAmountTy(EVT VT) const override; 00095 bool isFMAFasterThanFMulAndFAdd(EVT VT) const override; 00096 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; 00097 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; 00098 SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const override; 00099 void AdjustInstrPostInstrSelection(MachineInstr *MI, 00100 SDNode *Node) const override; 00101 00102 int32_t analyzeImmediate(const SDNode *N) const; 00103 SDValue CreateLiveInRegister(SelectionDAG &DAG, const TargetRegisterClass *RC, 00104 unsigned Reg, EVT VT) const override; 00105 }; 00106 00107 } // End namespace llvm 00108 00109 #endif