SIISelLowering.h revision d3b5509b8099b72104bd8a0d9a998a69eb56ab2a
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
21namespace llvm {
22
23class SITargetLowering : public AMDGPUTargetLowering {
24  const SIInstrInfo * TII;
25  const TargetRegisterInfo * TRI;
26
27  void LowerMOV_IMM(MachineInstr *MI, MachineBasicBlock &BB,
28              MachineBasicBlock::iterator I, unsigned Opocde) const;
29  void LowerSI_INTERP(MachineInstr *MI, MachineBasicBlock &BB,
30              MachineBasicBlock::iterator I, MachineRegisterInfo & MRI) const;
31  void LowerSI_WQM(MachineInstr *MI, MachineBasicBlock &BB,
32              MachineBasicBlock::iterator I, MachineRegisterInfo & MRI) const;
33
34  SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const;
35  SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
36  SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
37
38  bool foldImm(SDValue &Operand, int32_t &Immediate,
39               bool &ScalarSlotUsed) const;
40  bool fitsRegClass(SelectionDAG &DAG, SDValue &Op, unsigned RegClass) const;
41  void ensureSRegLimit(SelectionDAG &DAG, SDValue &Operand,
42                       unsigned RegClass, bool &ScalarSlotUsed) const;
43
44public:
45  SITargetLowering(TargetMachine &tm);
46  virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr * MI,
47                                              MachineBasicBlock * BB) const;
48  virtual EVT getSetCCResultType(EVT VT) const;
49  virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
50  virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
51  virtual SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const;
52
53  int32_t analyzeImmediate(const SDNode *N) const;
54};
55
56} // End namespace llvm
57
58#endif //SIISELLOWERING_H
59