LLVM API Documentation

R600ISelLowering.h
Go to the documentation of this file.
00001 //===-- R600ISelLowering.h - R600 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 R600 DAG Lowering interface definition
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_LIB_TARGET_R600_R600ISELLOWERING_H
00016 #define LLVM_LIB_TARGET_R600_R600ISELLOWERING_H
00017 
00018 #include "AMDGPUISelLowering.h"
00019 
00020 namespace llvm {
00021 
00022 class R600InstrInfo;
00023 
00024 class R600TargetLowering : public AMDGPUTargetLowering {
00025 public:
00026   R600TargetLowering(TargetMachine &TM);
00027   MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI,
00028       MachineBasicBlock * BB) const override;
00029   SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
00030   SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
00031   void ReplaceNodeResults(SDNode * N,
00032                           SmallVectorImpl<SDValue> &Results,
00033                           SelectionDAG &DAG) const override;
00034   SDValue LowerFormalArguments(
00035                               SDValue Chain,
00036                               CallingConv::ID CallConv,
00037                               bool isVarArg,
00038                               const SmallVectorImpl<ISD::InputArg> &Ins,
00039                               SDLoc DL, SelectionDAG &DAG,
00040                               SmallVectorImpl<SDValue> &InVals) const override;
00041   EVT getSetCCResultType(LLVMContext &, EVT VT) const override;
00042 private:
00043   unsigned Gen;
00044   /// Each OpenCL kernel has nine implicit parameters that are stored in the
00045   /// first nine dwords of a Vertex Buffer.  These implicit parameters are
00046   /// lowered to load instructions which retrieve the values from the Vertex
00047   /// Buffer.
00048   SDValue LowerImplicitParameter(SelectionDAG &DAG, EVT VT,
00049                                  SDLoc DL, unsigned DwordOffset) const;
00050 
00051   void lowerImplicitParameter(MachineInstr *MI, MachineBasicBlock &BB,
00052       MachineRegisterInfo & MRI, unsigned dword_offset) const;
00053   SDValue OptimizeSwizzle(SDValue BuildVector, SDValue Swz[], SelectionDAG &DAG) const;
00054   SDValue vectorToVerticalVector(SelectionDAG &DAG, SDValue Vector) const;
00055 
00056   SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
00057   SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
00058   SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
00059   SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const;
00060   SDValue LowerFPTOUINT(SDValue Op, SelectionDAG &DAG) const;
00061   SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const;
00062   SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
00063   SDValue LowerTrig(SDValue Op, SelectionDAG &DAG) const;
00064   SDValue LowerSHLParts(SDValue Op, SelectionDAG &DAG) const;
00065   SDValue LowerSRXParts(SDValue Op, SelectionDAG &DAG) const;
00066 
00067   SDValue stackPtrToRegIndex(SDValue Ptr, unsigned StackWidth,
00068                                           SelectionDAG &DAG) const;
00069   void getStackAddress(unsigned StackWidth, unsigned ElemIdx,
00070                        unsigned &Channel, unsigned &PtrIncr) const;
00071   bool isZero(SDValue Op) const;
00072   SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const override;
00073 };
00074 
00075 } // End namespace llvm;
00076 
00077 #endif