blob: 33220f4dc3466f80b72a24cc816070045312e9be [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- PTXISelLowering.h - PTX DAG Lowering Interface ----------*- C++ -*-===//
Eric Christopher50880d02010-09-18 18:52:28 +00002//
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 {
Eric Christopher50880d02010-09-18 18:52:28 +000021
22namespace PTXISD {
23 enum NodeType {
24 FIRST_NUMBER = ISD::BUILTIN_OP_END,
Justin Holewinskia5ccb4e2011-06-23 18:10:05 +000025 LOAD_PARAM,
Justin Holewinski67a91842011-06-23 18:10:03 +000026 STORE_PARAM,
Justin Holewinski5422a0f2011-09-22 16:45:46 +000027 READ_PARAM,
28 WRITE_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
Evan Cheng4bfcd4a2012-02-28 18:51:51 +000065 LowerCall(SDValue Chain, SDValue Callee, CallingConv::ID CallConv,
66 bool isVarArg, bool doesNotRet, bool &isTailCall,
Justin Holewinski4bdd4ed2011-08-09 17:36:31 +000067 const SmallVectorImpl<ISD::OutputArg> &Outs,
68 const SmallVectorImpl<SDValue> &OutVals,
69 const SmallVectorImpl<ISD::InputArg> &Ins,
70 DebugLoc dl, SelectionDAG &DAG,
71 SmallVectorImpl<SDValue> &InVals) const;
72
Duncan Sands28b77e92011-09-06 19:07:46 +000073 virtual EVT getSetCCResultType(EVT VT) const;
Justin Holewinskiec3141b2011-06-16 15:17:11 +000074
Justin Holewinski68226a42011-10-09 15:42:02 +000075 virtual unsigned getNumRegisters(LLVMContext &Context, EVT VT);
76
Che-Liang Chioufc7072c2010-12-22 10:38:51 +000077 private:
78 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
Eric Christopher50880d02010-09-18 18:52:28 +000079}; // class PTXTargetLowering
80} // namespace llvm
81
82#endif // PTX_ISEL_LOWERING_H