blob: 3112b03d4b1cbc64fee33fe505418e5cb3b52bf5 [file] [log] [blame]
Eric Christopher50880d02010-09-18 18:52:28 +00001//==-- PTXISelLowering.h - PTX 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// This file defines the interfaces that PTX uses to lower LLVM code into a
11// selection DAG.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef PTX_ISEL_LOWERING_H
16#define PTX_ISEL_LOWERING_H
17
18#include "llvm/Target/TargetLowering.h"
19
20namespace llvm {
21class PTXSubtarget;
22class PTXTargetMachine;
23
24namespace PTXISD {
25 enum NodeType {
26 FIRST_NUMBER = ISD::BUILTIN_OP_END,
Justin Holewinskia5ccb4e2011-06-23 18:10:05 +000027 LOAD_PARAM,
Justin Holewinski67a91842011-06-23 18:10:03 +000028 STORE_PARAM,
Che-Liang Chiouf9930da2010-09-25 07:46:17 +000029 EXIT,
Justin Holewinski8af78c92011-03-18 19:24:28 +000030 RET,
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +000031 COPY_ADDRESS,
32 CALL
Eric Christopher50880d02010-09-18 18:52:28 +000033 };
Justin Holewinski67a91842011-06-23 18:10:03 +000034} // namespace PTXISD
Eric Christopher50880d02010-09-18 18:52:28 +000035
36class PTXTargetLowering : public TargetLowering {
37 public:
38 explicit PTXTargetLowering(TargetMachine &TM);
39
40 virtual const char *getTargetNodeName(unsigned Opcode) const;
41
Che-Liang Chioufc7072c2010-12-22 10:38:51 +000042 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
43
Justin Holewinski2d525c52011-04-28 00:19:56 +000044 virtual SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
Justin Holewinskiec3141b2011-06-16 15:17:11 +000045
Eric Christopher50880d02010-09-18 18:52:28 +000046 virtual SDValue
47 LowerFormalArguments(SDValue Chain,
48 CallingConv::ID CallConv,
49 bool isVarArg,
50 const SmallVectorImpl<ISD::InputArg> &Ins,
51 DebugLoc dl,
52 SelectionDAG &DAG,
53 SmallVectorImpl<SDValue> &InVals) const;
54
55 virtual SDValue
56 LowerReturn(SDValue Chain,
57 CallingConv::ID CallConv,
58 bool isVarArg,
59 const SmallVectorImpl<ISD::OutputArg> &Outs,
60 const SmallVectorImpl<SDValue> &OutVals,
61 DebugLoc dl,
62 SelectionDAG &DAG) const;
Justin Holewinskiec3141b2011-06-16 15:17:11 +000063
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +000064 virtual SDValue
65 LowerCall(SDValue Chain, SDValue Callee,
66 CallingConv::ID CallConv, bool isVarArg,
67 bool &isTailCall,
68 const SmallVectorImpl<ISD::OutputArg> &Outs,
69 const SmallVectorImpl<SDValue> &OutVals,
70 const SmallVectorImpl<ISD::InputArg> &Ins,
71 DebugLoc dl, SelectionDAG &DAG,
72 SmallVectorImpl<SDValue> &InVals) const;
73
Duncan Sands28b77e92011-09-06 19:07:46 +000074 virtual EVT getSetCCResultType(EVT VT) const;
Justin Holewinskiec3141b2011-06-16 15:17:11 +000075
Che-Liang Chioufc7072c2010-12-22 10:38:51 +000076 private:
77 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
Eric Christopher50880d02010-09-18 18:52:28 +000078}; // class PTXTargetLowering
79} // namespace llvm
80
81#endif // PTX_ISEL_LOWERING_H