blob: f88349f865c54385db68f777fe771ab8f6098f31 [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,
Justin Holewinski5422a0f2011-09-22 16:45:46 +000029 READ_PARAM,
30 WRITE_PARAM,
Che-Liang Chiouf9930da2010-09-25 07:46:17 +000031 EXIT,
Justin Holewinski8af78c92011-03-18 19:24:28 +000032 RET,
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +000033 COPY_ADDRESS,
34 CALL
Eric Christopher50880d02010-09-18 18:52:28 +000035 };
Justin Holewinski67a91842011-06-23 18:10:03 +000036} // namespace PTXISD
Eric Christopher50880d02010-09-18 18:52:28 +000037
38class PTXTargetLowering : public TargetLowering {
39 public:
40 explicit PTXTargetLowering(TargetMachine &TM);
41
42 virtual const char *getTargetNodeName(unsigned Opcode) const;
43
Che-Liang Chioufc7072c2010-12-22 10:38:51 +000044 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
45
Justin Holewinski2d525c52011-04-28 00:19:56 +000046 virtual SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
Justin Holewinskiec3141b2011-06-16 15:17:11 +000047
Eric Christopher50880d02010-09-18 18:52:28 +000048 virtual SDValue
49 LowerFormalArguments(SDValue Chain,
50 CallingConv::ID CallConv,
51 bool isVarArg,
52 const SmallVectorImpl<ISD::InputArg> &Ins,
53 DebugLoc dl,
54 SelectionDAG &DAG,
55 SmallVectorImpl<SDValue> &InVals) const;
56
57 virtual SDValue
58 LowerReturn(SDValue Chain,
59 CallingConv::ID CallConv,
60 bool isVarArg,
61 const SmallVectorImpl<ISD::OutputArg> &Outs,
62 const SmallVectorImpl<SDValue> &OutVals,
63 DebugLoc dl,
64 SelectionDAG &DAG) const;
Justin Holewinskiec3141b2011-06-16 15:17:11 +000065
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +000066 virtual SDValue
67 LowerCall(SDValue Chain, SDValue Callee,
68 CallingConv::ID CallConv, bool isVarArg,
69 bool &isTailCall,
70 const SmallVectorImpl<ISD::OutputArg> &Outs,
71 const SmallVectorImpl<SDValue> &OutVals,
72 const SmallVectorImpl<ISD::InputArg> &Ins,
73 DebugLoc dl, SelectionDAG &DAG,
74 SmallVectorImpl<SDValue> &InVals) const;
75
Duncan Sands28b77e92011-09-06 19:07:46 +000076 virtual EVT getSetCCResultType(EVT VT) const;
Justin Holewinskiec3141b2011-06-16 15:17:11 +000077
Che-Liang Chioufc7072c2010-12-22 10:38:51 +000078 private:
79 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
Eric Christopher50880d02010-09-18 18:52:28 +000080}; // class PTXTargetLowering
81} // namespace llvm
82
83#endif // PTX_ISEL_LOWERING_H