R600: Add support for vector local memory loads
[oota-llvm.git] / lib / Target / R600 / SIISelLowering.h
1 //===-- SIISelLowering.h - SI DAG Lowering Interface ------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file
11 /// \brief SI DAG Lowering interface definition
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef SIISELLOWERING_H
16 #define SIISELLOWERING_H
17
18 #include "AMDGPUISelLowering.h"
19 #include "SIInstrInfo.h"
20
21 namespace llvm {
22
23 class SITargetLowering : public AMDGPUTargetLowering {
24   SDValue LowerParameter(SelectionDAG &DAG, EVT VT, SDLoc DL,
25                          SDValue Chain, unsigned Offset) const;
26   SDValue LowerSampleIntrinsic(unsigned Opcode, const SDValue &Op,
27                                SelectionDAG &DAG) const;
28   SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
29   SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG) const;
30   SDValue LowerZERO_EXTEND(SDValue Op, SelectionDAG &DAG) const;
31   SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
32
33   SDValue ResourceDescriptorToi128(SDValue Op, SelectionDAG &DAG) const;
34   bool foldImm(SDValue &Operand, int32_t &Immediate,
35                bool &ScalarSlotUsed) const;
36   const TargetRegisterClass *getRegClassForNode(SelectionDAG &DAG,
37                                                 const SDValue &Op) const;
38   bool fitsRegClass(SelectionDAG &DAG, const SDValue &Op,
39                     unsigned RegClass) const;
40   void ensureSRegLimit(SelectionDAG &DAG, SDValue &Operand,
41                        unsigned RegClass, bool &ScalarSlotUsed) const;
42
43   SDNode *foldOperands(MachineSDNode *N, SelectionDAG &DAG) const;
44   void adjustWritemask(MachineSDNode *&N, SelectionDAG &DAG) const;
45   MachineSDNode *AdjustRegClass(MachineSDNode *N, SelectionDAG &DAG) const;
46
47 public:
48   SITargetLowering(TargetMachine &tm);
49   bool allowsUnalignedMemoryAccesses(EVT  VT, bool *IsFast) const;
50   virtual bool shouldSplitVectorElementType(EVT VT) const;
51
52   SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
53                                bool isVarArg,
54                                const SmallVectorImpl<ISD::InputArg> &Ins,
55                                SDLoc DL, SelectionDAG &DAG,
56                                SmallVectorImpl<SDValue> &InVals) const;
57
58   virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr * MI,
59                                               MachineBasicBlock * BB) const;
60   virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const;
61   virtual MVT getScalarShiftAmountTy(EVT VT) const;
62   virtual bool isFMAFasterThanFMulAndFAdd(EVT VT) const;
63   virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
64   virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
65   virtual SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const;
66   virtual void AdjustInstrPostInstrSelection(MachineInstr *MI,
67                                              SDNode *Node) const;
68
69   int32_t analyzeImmediate(const SDNode *N) const;
70   SDValue CreateLiveInRegister(SelectionDAG &DAG, const TargetRegisterClass *RC,
71                                unsigned Reg, EVT VT) const;
72 };
73
74 } // End namespace llvm
75
76 #endif //SIISELLOWERING_H