1 //===-- AMDGPUISelLowering.h - AMDGPU Lowering Interface --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the interface defintiion of the TargetLowering class
11 // that is common to all AMD GPUs.
13 //===----------------------------------------------------------------------===//
15 #ifndef AMDGPUISELLOWERING_H
16 #define AMDGPUISELLOWERING_H
18 #include "llvm/Target/TargetLowering.h"
22 class MachineRegisterInfo
;
24 class AMDGPUTargetLowering
: public TargetLowering
27 SDValue
LowerINTRINSIC_WO_CHAIN(SDValue Op
, SelectionDAG
&DAG
) const;
28 SDValue
LowerUDIVREM(SDValue Op
, SelectionDAG
&DAG
) const;
32 /// addLiveIn - This functions adds reg to the live in list of the entry block
33 /// and emits a copy from reg to MI.getOperand(0).
35 // Some registers are loaded with values before the program
36 /// begins to execute. The loading of these values is modeled with pseudo
37 /// instructions which are lowered using this function.
38 void addLiveIn(MachineInstr
* MI
, MachineFunction
* MF
,
39 MachineRegisterInfo
& MRI
, const TargetInstrInfo
* TII
,
42 bool isHWTrueValue(SDValue Op
) const;
43 bool isHWFalseValue(SDValue Op
) const;
46 AMDGPUTargetLowering(TargetMachine
&TM
);
48 virtual SDValue
LowerFormalArguments(SDValue Chain
, CallingConv::ID CallConv
,
50 const SmallVectorImpl
<ISD::InputArg
> &Ins
,
51 DebugLoc DL
, SelectionDAG
&DAG
,
52 SmallVectorImpl
<SDValue
> &InVals
) const;
54 virtual SDValue
LowerReturn(SDValue Chain
, CallingConv::ID CallConv
,
56 const SmallVectorImpl
<ISD::OutputArg
> &Outs
,
57 const SmallVectorImpl
<SDValue
> &OutVals
,
58 DebugLoc DL
, SelectionDAG
&DAG
) const;
60 virtual SDValue
LowerOperation(SDValue Op
, SelectionDAG
&DAG
) const;
61 SDValue
LowerIntrinsicIABS(SDValue Op
, SelectionDAG
&DAG
) const;
62 SDValue
LowerIntrinsicLRP(SDValue Op
, SelectionDAG
&DAG
) const;
63 virtual const char* getTargetNodeName(unsigned Opcode
) const;
65 // Functions defined in AMDILISelLowering.cpp
68 /// computeMaskedBitsForTargetNode - Determine which of the bits specified
69 /// in Mask are known to be either zero or one and return them in the
70 /// KnownZero/KnownOne bitsets.
71 virtual void computeMaskedBitsForTargetNode(const SDValue Op
,
74 const SelectionDAG
&DAG
,
75 unsigned Depth
= 0) const;
77 virtual bool getTgtMemIntrinsic(IntrinsicInfo
&Info
,
78 const CallInst
&I
, unsigned Intrinsic
) const;
80 /// isFPImmLegal - We want to mark f32/f64 floating point values as legal.
81 bool isFPImmLegal(const APFloat
&Imm
, EVT VT
) const;
83 /// ShouldShrinkFPConstant - We don't want to shrink f64/f32 constants.
84 bool ShouldShrinkFPConstant(EVT VT
) const;
87 void InitAMDILLowering();
88 SDValue
LowerSREM(SDValue Op
, SelectionDAG
&DAG
) const;
89 SDValue
LowerSREM8(SDValue Op
, SelectionDAG
&DAG
) const;
90 SDValue
LowerSREM16(SDValue Op
, SelectionDAG
&DAG
) const;
91 SDValue
LowerSREM32(SDValue Op
, SelectionDAG
&DAG
) const;
92 SDValue
LowerSREM64(SDValue Op
, SelectionDAG
&DAG
) const;
93 SDValue
LowerSDIV(SDValue Op
, SelectionDAG
&DAG
) const;
94 SDValue
LowerSDIV24(SDValue Op
, SelectionDAG
&DAG
) const;
95 SDValue
LowerSDIV32(SDValue Op
, SelectionDAG
&DAG
) const;
96 SDValue
LowerSDIV64(SDValue Op
, SelectionDAG
&DAG
) const;
97 SDValue
LowerBUILD_VECTOR(SDValue Op
, SelectionDAG
&DAG
) const;
98 SDValue
LowerSIGN_EXTEND_INREG(SDValue Op
, SelectionDAG
&DAG
) const;
99 EVT
genIntType(uint32_t size
= 32, uint32_t numEle
= 1) const;
100 SDValue
LowerBRCOND(SDValue Op
, SelectionDAG
&DAG
) const;
101 SDValue
LowerFP_ROUND(SDValue Op
, SelectionDAG
&DAG
) const;
110 FIRST_NUMBER
= ISD::BUILTIN_OP_END
,
111 MAD
, // 32bit Fused Multiply Add instruction
112 VBUILD
, // scalar to vector mov instruction
113 CALL
, // Function call based on a single integer
114 UMUL
, // 32bit unsigned multiplication
115 DIV_INF
, // Divide with infinity returned on zero divisor
118 // End AMDIL ISD Opcodes
128 LAST_AMDGPU_ISD_NUMBER
132 } // End namespace AMDGPUISD
137 SI_FIRST
= AMDGPUISD::LAST_AMDGPU_ISD_NUMBER
,
142 } // End namespace SIISD
144 } // End namespace llvm
146 #endif // AMDGPUISELLOWERING_H