blob: 1ac6e0dfcd73d577f00f351dea02a66387af0893 [file] [log] [blame]
Tom Stellard75aadc22012-12-11 21:25:42 +00001//===-- SIISelLowering.h - SI 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 SI DAG Lowering interface definition
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef SIISELLOWERING_H
16#define SIISELLOWERING_H
17
18#include "AMDGPUISelLowering.h"
19#include "SIInstrInfo.h"
20
21namespace llvm {
22
23class SITargetLowering : public AMDGPUTargetLowering {
Tom Stellardaf775432013-10-23 00:44:32 +000024 SDValue LowerParameter(SelectionDAG &DAG, EVT VT, EVT MemVT, SDLoc DL,
Tom Stellard94593ee2013-06-03 17:40:18 +000025 SDValue Chain, unsigned Offset) const;
Tom Stellard9fa17912013-08-14 23:24:45 +000026 SDValue LowerSampleIntrinsic(unsigned Opcode, const SDValue &Op,
27 SelectionDAG &DAG) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000028 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
Tom Stellard046039e2013-06-03 17:40:03 +000029 SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG) const;
Tom Stellard98f675a2013-08-01 15:23:26 +000030 SDValue LowerZERO_EXTEND(SDValue Op, SelectionDAG &DAG) const;
Tom Stellardf8794352012-12-19 22:10:31 +000031 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000032
Tom Stellard9fa17912013-08-14 23:24:45 +000033 SDValue ResourceDescriptorToi128(SDValue Op, SelectionDAG &DAG) const;
Christian Konigf82901a2013-02-26 17:52:23 +000034 bool foldImm(SDValue &Operand, int32_t &Immediate,
35 bool &ScalarSlotUsed) const;
Tom Stellard4c0ffcc2013-08-06 23:08:18 +000036 const TargetRegisterClass *getRegClassForNode(SelectionDAG &DAG,
37 const SDValue &Op) const;
Tom Stellardb35efba2013-05-20 15:02:01 +000038 bool fitsRegClass(SelectionDAG &DAG, const SDValue &Op,
39 unsigned RegClass) const;
Matt Arsenault758659232013-05-18 00:21:46 +000040 void ensureSRegLimit(SelectionDAG &DAG, SDValue &Operand,
Christian Konigf82901a2013-02-26 17:52:23 +000041 unsigned RegClass, bool &ScalarSlotUsed) const;
42
Christian Konig8e06e2a2013-04-10 08:39:08 +000043 SDNode *foldOperands(MachineSDNode *N, SelectionDAG &DAG) const;
44 void adjustWritemask(MachineSDNode *&N, SelectionDAG &DAG) const;
Tom Stellard0518ff82013-06-03 17:39:58 +000045 MachineSDNode *AdjustRegClass(MachineSDNode *N, SelectionDAG &DAG) const;
Christian Konig8e06e2a2013-04-10 08:39:08 +000046
Tom Stellard75aadc22012-12-11 21:25:42 +000047public:
48 SITargetLowering(TargetMachine &tm);
Tom Stellard0125f2a2013-06-25 02:39:35 +000049 bool allowsUnalignedMemoryAccesses(EVT VT, bool *IsFast) const;
Tom Stellardd86003e2013-08-14 23:25:00 +000050 virtual bool shouldSplitVectorElementType(EVT VT) const;
Christian Konig2c8f6d52013-03-07 09:03:52 +000051
52 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
53 bool isVarArg,
54 const SmallVectorImpl<ISD::InputArg> &Ins,
Andrew Trickef9de2a2013-05-25 02:42:55 +000055 SDLoc DL, SelectionDAG &DAG,
Christian Konig2c8f6d52013-03-07 09:03:52 +000056 SmallVectorImpl<SDValue> &InVals) const;
57
Tom Stellard75aadc22012-12-11 21:25:42 +000058 virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr * MI,
59 MachineBasicBlock * BB) const;
Matt Arsenault758659232013-05-18 00:21:46 +000060 virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const;
Christian Konig082a14a2013-03-18 11:34:05 +000061 virtual MVT getScalarShiftAmountTy(EVT VT) const;
Niels Ole Salscheiderd3a039f2013-08-10 10:38:54 +000062 virtual bool isFMAFasterThanFMulAndFAdd(EVT VT) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000063 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
64 virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
Christian Konigd910b7d2013-02-26 17:52:16 +000065 virtual SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const;
Christian Konig8b1ed282013-04-10 08:39:16 +000066 virtual void AdjustInstrPostInstrSelection(MachineInstr *MI,
67 SDNode *Node) const;
Christian Konigf82901a2013-02-26 17:52:23 +000068
69 int32_t analyzeImmediate(const SDNode *N) const;
Tom Stellard94593ee2013-06-03 17:40:18 +000070 SDValue CreateLiveInRegister(SelectionDAG &DAG, const TargetRegisterClass *RC,
71 unsigned Reg, EVT VT) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000072};
73
74} // End namespace llvm
75
76#endif //SIISELLOWERING_H