blob: ec0105283876c830c477fd81607f245a8bf07609 [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 {
24 const SIInstrInfo * TII;
Christian Konigf82901a2013-02-26 17:52:23 +000025 const TargetRegisterInfo * TRI;
Tom Stellard75aadc22012-12-11 21:25:42 +000026
Tom Stellard754f80f2013-04-05 23:31:51 +000027 SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000028 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
Tom Stellardf8794352012-12-19 22:10:31 +000029 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000030
Christian Konigf82901a2013-02-26 17:52:23 +000031 bool foldImm(SDValue &Operand, int32_t &Immediate,
32 bool &ScalarSlotUsed) const;
Tom Stellardb35efba2013-05-20 15:02:01 +000033 bool fitsRegClass(SelectionDAG &DAG, const SDValue &Op,
34 unsigned RegClass) const;
Matt Arsenault758659232013-05-18 00:21:46 +000035 void ensureSRegLimit(SelectionDAG &DAG, SDValue &Operand,
Christian Konigf82901a2013-02-26 17:52:23 +000036 unsigned RegClass, bool &ScalarSlotUsed) const;
37
Christian Konig8e06e2a2013-04-10 08:39:08 +000038 SDNode *foldOperands(MachineSDNode *N, SelectionDAG &DAG) const;
39 void adjustWritemask(MachineSDNode *&N, SelectionDAG &DAG) const;
40
Tom Stellard75aadc22012-12-11 21:25:42 +000041public:
42 SITargetLowering(TargetMachine &tm);
Christian Konig2c8f6d52013-03-07 09:03:52 +000043
44 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
45 bool isVarArg,
46 const SmallVectorImpl<ISD::InputArg> &Ins,
Andrew Trickef9de2a2013-05-25 02:42:55 +000047 SDLoc DL, SelectionDAG &DAG,
Christian Konig2c8f6d52013-03-07 09:03:52 +000048 SmallVectorImpl<SDValue> &InVals) const;
49
Tom Stellard75aadc22012-12-11 21:25:42 +000050 virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr * MI,
51 MachineBasicBlock * BB) const;
Matt Arsenault758659232013-05-18 00:21:46 +000052 virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const;
Christian Konig082a14a2013-03-18 11:34:05 +000053 virtual MVT getScalarShiftAmountTy(EVT VT) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000054 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
55 virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
Christian Konigd910b7d2013-02-26 17:52:16 +000056 virtual SDNode *PostISelFolding(MachineSDNode *N, SelectionDAG &DAG) const;
Christian Konig8b1ed282013-04-10 08:39:16 +000057 virtual void AdjustInstrPostInstrSelection(MachineInstr *MI,
58 SDNode *Node) const;
Christian Konigf82901a2013-02-26 17:52:23 +000059
60 int32_t analyzeImmediate(const SDNode *N) const;
Tom Stellard75aadc22012-12-11 21:25:42 +000061};
62
63} // End namespace llvm
64
65#endif //SIISELLOWERING_H