Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 1 | //===-- 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 | |
Matt Arsenault | 6b6a2c3 | 2016-03-11 08:00:27 +0000 | [diff] [blame] | 15 | #ifndef LLVM_LIB_TARGET_AMDGPU_R600ISELLOWERING_H |
| 16 | #define LLVM_LIB_TARGET_AMDGPU_R600ISELLOWERING_H |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 17 | |
| 18 | #include "AMDGPUISelLowering.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | |
| 22 | class R600InstrInfo; |
Matt Arsenault | 43e92fe | 2016-06-24 06:30:11 +0000 | [diff] [blame] | 23 | class R600Subtarget; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 24 | |
Matt Arsenault | 6b6a2c3 | 2016-03-11 08:00:27 +0000 | [diff] [blame] | 25 | class R600TargetLowering final : public AMDGPUTargetLowering { |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 26 | public: |
Matt Arsenault | 43e92fe | 2016-06-24 06:30:11 +0000 | [diff] [blame] | 27 | R600TargetLowering(const TargetMachine &TM, const R600Subtarget &STI); |
| 28 | |
| 29 | const R600Subtarget *getSubtarget() const; |
| 30 | |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 31 | MachineBasicBlock * |
| 32 | EmitInstrWithCustomInserter(MachineInstr &MI, |
| 33 | MachineBasicBlock *BB) const override; |
Craig Topper | 5656db4 | 2014-04-29 07:57:24 +0000 | [diff] [blame] | 34 | SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; |
| 35 | SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; |
| 36 | void ReplaceNodeResults(SDNode * N, |
| 37 | SmallVectorImpl<SDValue> &Results, |
| 38 | SelectionDAG &DAG) const override; |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 39 | SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, |
| 40 | bool isVarArg, |
| 41 | const SmallVectorImpl<ISD::InputArg> &Ins, |
| 42 | const SDLoc &DL, SelectionDAG &DAG, |
| 43 | SmallVectorImpl<SDValue> &InVals) const override; |
Mehdi Amini | 44ede33 | 2015-07-09 02:09:04 +0000 | [diff] [blame] | 44 | EVT getSetCCResultType(const DataLayout &DL, LLVMContext &, |
| 45 | EVT VT) const override; |
| 46 | |
Matt Arsenault | fa67bdb | 2016-02-22 21:04:16 +0000 | [diff] [blame] | 47 | bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, |
| 48 | unsigned Align, |
| 49 | bool *IsFast) const override; |
| 50 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 51 | private: |
Vincent Lejeune | b55940c | 2013-07-09 15:03:11 +0000 | [diff] [blame] | 52 | unsigned Gen; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 53 | /// Each OpenCL kernel has nine implicit parameters that are stored in the |
| 54 | /// first nine dwords of a Vertex Buffer. These implicit parameters are |
Alp Toker | cb40291 | 2014-01-24 17:20:08 +0000 | [diff] [blame] | 55 | /// lowered to load instructions which retrieve the values from the Vertex |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 56 | /// Buffer. |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 57 | SDValue LowerImplicitParameter(SelectionDAG &DAG, EVT VT, const SDLoc &DL, |
| 58 | unsigned DwordOffset) const; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 59 | |
| 60 | void lowerImplicitParameter(MachineInstr *MI, MachineBasicBlock &BB, |
| 61 | MachineRegisterInfo & MRI, unsigned dword_offset) const; |
Sergey Dmitrouk | 842a51b | 2015-04-28 14:05:47 +0000 | [diff] [blame] | 62 | SDValue OptimizeSwizzle(SDValue BuildVector, SDValue Swz[], SelectionDAG &DAG, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 63 | const SDLoc &DL) const; |
Tom Stellard | 880a80a | 2014-06-17 16:53:14 +0000 | [diff] [blame] | 64 | SDValue vectorToVerticalVector(SelectionDAG &DAG, SDValue Vector) const; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 65 | |
Matt Arsenault | 81d0601 | 2016-03-07 21:10:13 +0000 | [diff] [blame] | 66 | SDValue lowerFrameIndex(SDValue Op, SelectionDAG &DAG) const; |
Tom Stellard | 880a80a | 2014-06-17 16:53:14 +0000 | [diff] [blame] | 67 | SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; |
| 68 | SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; |
Tom Stellard | 27233b7 | 2016-05-02 18:05:17 +0000 | [diff] [blame] | 69 | SDValue LowerGlobalAddress(AMDGPUMachineFunction *MFI, SDValue Op, |
Reid Kleckner | 0549ab6 | 2016-05-02 19:45:10 +0000 | [diff] [blame] | 70 | SelectionDAG &DAG) const override; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 71 | SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const; |
Matt Arsenault | 9524566 | 2016-02-11 05:32:46 +0000 | [diff] [blame] | 72 | |
| 73 | SDValue lowerPrivateTruncStore(StoreSDNode *Store, SelectionDAG &DAG) const; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 74 | SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const; |
| 75 | SDValue LowerFPTOUINT(SDValue Op, SelectionDAG &DAG) const; |
Matt Arsenault | 6dfda96 | 2016-02-10 18:21:39 +0000 | [diff] [blame] | 76 | |
| 77 | SDValue lowerPrivateExtLoad(SDValue Op, SelectionDAG &DAG) const; |
Tom Stellard | 365366f | 2013-01-23 02:09:06 +0000 | [diff] [blame] | 78 | SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const; |
Matt Arsenault | 1d555c4 | 2014-06-23 18:00:55 +0000 | [diff] [blame] | 79 | SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const; |
Vincent Lejeune | b55940c | 2013-07-09 15:03:11 +0000 | [diff] [blame] | 80 | SDValue LowerTrig(SDValue Op, SelectionDAG &DAG) const; |
Jan Vesely | 25f3627 | 2014-06-18 12:27:13 +0000 | [diff] [blame] | 81 | SDValue LowerSHLParts(SDValue Op, SelectionDAG &DAG) const; |
Jan Vesely | 900ff2e | 2014-06-18 12:27:15 +0000 | [diff] [blame] | 82 | SDValue LowerSRXParts(SDValue Op, SelectionDAG &DAG) const; |
Jan Vesely | 808fff5 | 2015-04-30 17:15:56 +0000 | [diff] [blame] | 83 | SDValue LowerUADDSUBO(SDValue Op, SelectionDAG &DAG, |
| 84 | unsigned mainop, unsigned ovf) const; |
Tom Stellard | f3b2a1e | 2013-02-06 17:32:29 +0000 | [diff] [blame] | 85 | |
| 86 | SDValue stackPtrToRegIndex(SDValue Ptr, unsigned StackWidth, |
| 87 | SelectionDAG &DAG) const; |
| 88 | void getStackAddress(unsigned StackWidth, unsigned ElemIdx, |
| 89 | unsigned &Channel, unsigned &PtrIncr) const; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 90 | bool isZero(SDValue Op) const; |
Matt Arsenault | 6b6a2c3 | 2016-03-11 08:00:27 +0000 | [diff] [blame] | 91 | bool isHWTrueValue(SDValue Op) const; |
| 92 | bool isHWFalseValue(SDValue Op) const; |
| 93 | |
Matt Arsenault | 43e92fe | 2016-06-24 06:30:11 +0000 | [diff] [blame] | 94 | bool FoldOperand(SDNode *ParentNode, unsigned SrcIdx, SDValue &Src, |
| 95 | SDValue &Neg, SDValue &Abs, SDValue &Sel, SDValue &Imm, |
| 96 | SelectionDAG &DAG) const; |
| 97 | |
Craig Topper | 5656db4 | 2014-04-29 07:57:24 +0000 | [diff] [blame] | 98 | SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const override; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 99 | }; |
| 100 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 101 | } // End namespace llvm; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 102 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 103 | #endif |