Revert "include/llvm: Add R600 Intrinsics v6"
[oota-llvm.git] / lib / Target / AMDGPU / AMDILISelLowering.h
1 //===-- AMDILISelLowering.h - AMDIL 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 // This file defines the interfaces that AMDIL uses to lower LLVM code into a
11 // selection DAG.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef AMDIL_ISELLOWERING_H_
16 #define AMDIL_ISELLOWERING_H_
17 #include "AMDIL.h"
18 #include "llvm/CodeGen/CallingConvLower.h"
19 #include "llvm/CodeGen/MachineInstrBuilder.h"
20 #include "llvm/CodeGen/SelectionDAG.h"
21 #include "llvm/Target/TargetLowering.h"
22
23 namespace llvm
24 {
25   namespace AMDILISD
26   {
27     enum
28     {
29       FIRST_NUMBER = ISD::BUILTIN_OP_END,
30       CMOVLOG,     // 32bit FP Conditional move logical instruction
31       MAD,         // 32bit Fused Multiply Add instruction
32       VBUILD,      // scalar to vector mov instruction
33       CALL,        // Function call based on a single integer
34       SELECT_CC,   // Select the correct conditional instruction
35       UMUL,        // 32bit unsigned multiplication
36       DIV_INF,      // Divide with infinity returned on zero divisor
37       CMP,
38       IL_CC_I_GT,
39       IL_CC_I_LT,
40       IL_CC_I_GE,
41       IL_CC_I_LE,
42       IL_CC_I_EQ,
43       IL_CC_I_NE,
44       RET_FLAG,
45       BRANCH_COND,
46       LAST_ISD_NUMBER
47     };
48   } // AMDILISD
49
50   class MachineBasicBlock;
51   class MachineInstr;
52   class DebugLoc;
53   class TargetInstrInfo;
54
55   class AMDILTargetLowering : public TargetLowering
56   {
57     public:
58       AMDILTargetLowering(TargetMachine &TM);
59
60       virtual SDValue
61         LowerOperation(SDValue Op, SelectionDAG &DAG) const;
62
63       /// computeMaskedBitsForTargetNode - Determine which of
64       /// the bits specified
65       /// in Mask are known to be either zero or one and return them in
66       /// the
67       /// KnownZero/KnownOne bitsets.
68       virtual void
69         computeMaskedBitsForTargetNode(
70             const SDValue Op,
71             APInt &KnownZero,
72             APInt &KnownOne,
73             const SelectionDAG &DAG,
74             unsigned Depth = 0
75             ) const;
76
77       virtual bool 
78         getTgtMemIntrinsic(IntrinsicInfo &Info,
79                                   const CallInst &I, unsigned Intrinsic) const;
80       virtual const char*
81         getTargetNodeName(
82             unsigned Opcode
83             ) const;
84       // We want to mark f32/f64 floating point values as
85       // legal
86       bool
87         isFPImmLegal(const APFloat &Imm, EVT VT) const;
88       // We don't want to shrink f64/f32 constants because
89       // they both take up the same amount of space and
90       // we don't want to use a f2d instruction.
91       bool ShouldShrinkFPConstant(EVT VT) const;
92
93       /// getFunctionAlignment - Return the Log2 alignment of this
94       /// function.
95       virtual unsigned int
96         getFunctionAlignment(const Function *F) const;
97
98     private:
99       CCAssignFn*
100         CCAssignFnForNode(unsigned int CC) const;
101
102       SDValue LowerCallResult(SDValue Chain,
103           SDValue InFlag,
104           CallingConv::ID CallConv,
105           bool isVarArg,
106           const SmallVectorImpl<ISD::InputArg> &Ins,
107           DebugLoc dl,
108           SelectionDAG &DAG,
109           SmallVectorImpl<SDValue> &InVals) const;
110
111       SDValue LowerMemArgument(SDValue Chain,
112           CallingConv::ID CallConv,
113           const SmallVectorImpl<ISD::InputArg> &ArgInfo,
114           DebugLoc dl, SelectionDAG &DAG,
115           const CCValAssign &VA,  MachineFrameInfo *MFI,
116           unsigned i) const;
117
118       SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr,
119           SDValue Arg,
120           DebugLoc dl, SelectionDAG &DAG,
121           const CCValAssign &VA,
122           ISD::ArgFlagsTy Flags) const;
123
124       virtual SDValue
125         LowerFormalArguments(SDValue Chain,
126             CallingConv::ID CallConv, bool isVarArg,
127             const SmallVectorImpl<ISD::InputArg> &Ins,
128             DebugLoc dl, SelectionDAG &DAG,
129             SmallVectorImpl<SDValue> &InVals) const;
130
131       virtual SDValue
132         LowerCall(CallLoweringInfo &CLI,
133         SmallVectorImpl<SDValue> &InVals) const;
134
135       virtual SDValue
136         LowerReturn(SDValue Chain,
137             CallingConv::ID CallConv, bool isVarArg,
138             const SmallVectorImpl<ISD::OutputArg> &Outs,
139             const SmallVectorImpl<SDValue> &OutVals,
140             DebugLoc dl, SelectionDAG &DAG) const;
141
142       SDValue
143         LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
144
145       SDValue
146         LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
147
148       SDValue
149         LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
150
151       SDValue
152         LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) const;
153
154       SDValue
155         LowerSREM(SDValue Op, SelectionDAG &DAG) const;
156       SDValue
157         LowerSREM8(SDValue Op, SelectionDAG &DAG) const;
158       SDValue
159         LowerSREM16(SDValue Op, SelectionDAG &DAG) const;
160       SDValue
161         LowerSREM32(SDValue Op, SelectionDAG &DAG) const;
162       SDValue
163         LowerSREM64(SDValue Op, SelectionDAG &DAG) const;
164
165       SDValue
166         LowerSDIV(SDValue Op, SelectionDAG &DAG) const;
167       SDValue
168         LowerSDIV24(SDValue Op, SelectionDAG &DAG) const;
169       SDValue
170         LowerSDIV32(SDValue Op, SelectionDAG &DAG) const;
171       SDValue
172         LowerSDIV64(SDValue Op, SelectionDAG &DAG) const;
173
174       SDValue
175         LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
176
177       SDValue
178         LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
179
180       SDValue
181         LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
182
183       SDValue
184         LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const;
185
186       EVT
187         genIntType(uint32_t size = 32, uint32_t numEle = 1) const;
188
189       SDValue
190         LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
191
192       SDValue
193         LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
194
195       SDValue
196         LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
197       SDValue
198         LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const;
199
200   }; // AMDILTargetLowering
201 } // end namespace llvm
202
203 #endif    // AMDIL_ISELLOWERING_H_