blob: 2b954dab5582d3d4bdabd85f6dfad4fae29ba0ae [file] [log] [blame]
Tom Stellard75aadc22012-12-11 21:25:42 +00001//===-- R600ISelLowering.h - R600 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 R600 DAG Lowering interface definition
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef R600ISELLOWERING_H
16#define R600ISELLOWERING_H
17
18#include "AMDGPUISelLowering.h"
19
20namespace llvm {
21
22class R600InstrInfo;
23
24class R600TargetLowering : public AMDGPUTargetLowering {
25public:
26 R600TargetLowering(TargetMachine &TM);
27 virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI,
28 MachineBasicBlock * BB) const;
29 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
30 virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
31 void ReplaceNodeResults(SDNode * N,
32 SmallVectorImpl<SDValue> &Results,
33 SelectionDAG &DAG) const;
34 virtual SDValue LowerFormalArguments(
35 SDValue Chain,
36 CallingConv::ID CallConv,
37 bool isVarArg,
38 const SmallVectorImpl<ISD::InputArg> &Ins,
39 DebugLoc DL, SelectionDAG &DAG,
40 SmallVectorImpl<SDValue> &InVals) const;
41 virtual EVT getSetCCResultType(EVT VT) const;
42private:
43 const R600InstrInfo * TII;
44
45 /// Each OpenCL kernel has nine implicit parameters that are stored in the
46 /// first nine dwords of a Vertex Buffer. These implicit parameters are
47 /// lowered to load instructions which retreive the values from the Vertex
48 /// Buffer.
49 SDValue LowerImplicitParameter(SelectionDAG &DAG, EVT VT,
50 DebugLoc DL, unsigned DwordOffset) const;
51
52 void lowerImplicitParameter(MachineInstr *MI, MachineBasicBlock &BB,
53 MachineRegisterInfo & MRI, unsigned dword_offset) const;
54
55 SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
56
57 /// \brief Lower ROTL opcode to BITALIGN
58 SDValue LowerROTL(SDValue Op, SelectionDAG &DAG) const;
59
60 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
61 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
62 SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
63 SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const;
64 SDValue LowerFPTOUINT(SDValue Op, SelectionDAG &DAG) const;
65 SDValue LowerFPOW(SDValue Op, SelectionDAG &DAG) const;
66
67 bool isZero(SDValue Op) const;
68};
69
70} // End namespace llvm;
71
72#endif // R600ISELLOWERING_H