blob: d0ac11b56257955f839477ae89f7ccea884f25af [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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000015#ifndef LLVM_LIB_TARGET_R600_R600ISELLOWERING_H
16#define LLVM_LIB_TARGET_R600_R600ISELLOWERING_H
Tom Stellard75aadc22012-12-11 21:25:42 +000017
18#include "AMDGPUISelLowering.h"
19
20namespace llvm {
21
22class R600InstrInfo;
23
24class R600TargetLowering : public AMDGPUTargetLowering {
25public:
Eric Christopher7792e322015-01-30 23:24:40 +000026 R600TargetLowering(TargetMachine &TM, const AMDGPUSubtarget &STI);
Craig Topper5656db42014-04-29 07:57:24 +000027 MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI,
28 MachineBasicBlock * BB) const override;
29 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
30 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
31 void ReplaceNodeResults(SDNode * N,
32 SmallVectorImpl<SDValue> &Results,
33 SelectionDAG &DAG) const override;
34 SDValue LowerFormalArguments(
35 SDValue Chain,
36 CallingConv::ID CallConv,
37 bool isVarArg,
38 const SmallVectorImpl<ISD::InputArg> &Ins,
39 SDLoc DL, SelectionDAG &DAG,
40 SmallVectorImpl<SDValue> &InVals) const override;
Mehdi Amini44ede332015-07-09 02:09:04 +000041 EVT getSetCCResultType(const DataLayout &DL, LLVMContext &,
42 EVT VT) const override;
43
Tom Stellard75aadc22012-12-11 21:25:42 +000044private:
Vincent Lejeuneb55940c2013-07-09 15:03:11 +000045 unsigned Gen;
Tom Stellard75aadc22012-12-11 21:25:42 +000046 /// Each OpenCL kernel has nine implicit parameters that are stored in the
47 /// first nine dwords of a Vertex Buffer. These implicit parameters are
Alp Tokercb402912014-01-24 17:20:08 +000048 /// lowered to load instructions which retrieve the values from the Vertex
Tom Stellard75aadc22012-12-11 21:25:42 +000049 /// Buffer.
50 SDValue LowerImplicitParameter(SelectionDAG &DAG, EVT VT,
Andrew Trickef9de2a2013-05-25 02:42:55 +000051 SDLoc DL, unsigned DwordOffset) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000052
53 void lowerImplicitParameter(MachineInstr *MI, MachineBasicBlock &BB,
54 MachineRegisterInfo & MRI, unsigned dword_offset) const;
Sergey Dmitrouk842a51b2015-04-28 14:05:47 +000055 SDValue OptimizeSwizzle(SDValue BuildVector, SDValue Swz[], SelectionDAG &DAG,
56 SDLoc DL) const;
Tom Stellard880a80a2014-06-17 16:53:14 +000057 SDValue vectorToVerticalVector(SelectionDAG &DAG, SDValue Vector) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000058
Tom Stellard880a80a2014-06-17 16:53:14 +000059 SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
60 SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000061 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
Matt Arsenault95245662016-02-11 05:32:46 +000062
63 SDValue lowerPrivateTruncStore(StoreSDNode *Store, SelectionDAG &DAG) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000064 SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const;
65 SDValue LowerFPTOUINT(SDValue Op, SelectionDAG &DAG) const;
Matt Arsenault6dfda962016-02-10 18:21:39 +000066
67 SDValue lowerPrivateExtLoad(SDValue Op, SelectionDAG &DAG) const;
Tom Stellard365366f2013-01-23 02:09:06 +000068 SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const;
Matt Arsenault1d555c42014-06-23 18:00:55 +000069 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
Vincent Lejeuneb55940c2013-07-09 15:03:11 +000070 SDValue LowerTrig(SDValue Op, SelectionDAG &DAG) const;
Jan Vesely25f36272014-06-18 12:27:13 +000071 SDValue LowerSHLParts(SDValue Op, SelectionDAG &DAG) const;
Jan Vesely900ff2e2014-06-18 12:27:15 +000072 SDValue LowerSRXParts(SDValue Op, SelectionDAG &DAG) const;
Jan Vesely808fff52015-04-30 17:15:56 +000073 SDValue LowerUADDSUBO(SDValue Op, SelectionDAG &DAG,
74 unsigned mainop, unsigned ovf) const;
Tom Stellardf3b2a1e2013-02-06 17:32:29 +000075
76 SDValue stackPtrToRegIndex(SDValue Ptr, unsigned StackWidth,
77 SelectionDAG &DAG) const;
78 void getStackAddress(unsigned StackWidth, unsigned ElemIdx,
79 unsigned &Channel, unsigned &PtrIncr) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000080 bool isZero(SDValue Op) const;
Craig Topper5656db42014-04-29 07:57:24 +000081 SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const override;
Tom Stellard75aadc22012-12-11 21:25:42 +000082};
83
Alexander Kornienkof00654e2015-06-23 09:49:53 +000084} // End namespace llvm;
Tom Stellard75aadc22012-12-11 21:25:42 +000085
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000086#endif