R600: Improve support for < 32-bit 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 LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
27   SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG) const;
28   SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
29
30   bool foldImm(SDValue &Operand, int32_t &Immediate,
31                bool &ScalarSlotUsed) const;
32   bool fitsRegClass(SelectionDAG &DAG, const SDValue &Op,
33                     unsigned RegClass) const;
34   void ensureSRegLimit(SelectionDAG &DAG, SDValue &Operand,
35                        unsigned RegClass, bool &ScalarSlotUsed) const;
36
37   SDNode *foldOperands(MachineSDNode *N, SelectionDAG &DAG) const;
38   void adjustWritemask(MachineSDNode *&N, SelectionDAG &DAG) const;
39   MachineSDNode *AdjustRegClass(MachineSDNode *N, SelectionDAG &DAG) const;
40
41 public:
42   SITargetLowering(TargetMachine &tm);
43   bool allowsUnalignedMemoryAccesses(EVT  VT, bool *IsFast) const;
44
45   SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
46                                bool isVarArg,
47                                const SmallVectorImpl<ISD::InputArg> &Ins,
48                                SDLoc DL, SelectionDAG &DAG,
49                                SmallVectorImpl<SDValue> &InVals) const;
50
51   virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr * MI,
52                                               MachineBasicBlock * BB) const;
53   virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const;
54   virtual MVT getScalarShiftAmountTy(EVT VT) const;
55   virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
56   virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
57   virtual SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const;
58   virtual void AdjustInstrPostInstrSelection(MachineInstr *MI,
59                                              SDNode *Node) const;
60
61   int32_t analyzeImmediate(const SDNode *N) const;
62   SDValue CreateLiveInRegister(SelectionDAG &DAG, const TargetRegisterClass *RC,
63                                unsigned Reg, EVT VT) const;
64 };
65
66 } // End namespace llvm
67
68 #endif //SIISELLOWERING_H