blob: 6a7e3e6611bd61d3075ea3bd12bf991dd68918d8 [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,
Che-Liang Chiou8e5d01c2011-02-10 12:01:24 +000027 READ_PARAM,
Che-Liang Chiouf9930da2010-09-25 07:46:17 +000028 EXIT,
Justin Holewinski8af78c92011-03-18 19:24:28 +000029 RET,
30 COPY_ADDRESS
Eric Christopher50880d02010-09-18 18:52:28 +000031 };
32} // namespace PTXISD
33
34class PTXTargetLowering : public TargetLowering {
35 public:
36 explicit PTXTargetLowering(TargetMachine &TM);
37
38 virtual const char *getTargetNodeName(unsigned Opcode) const;
39
40 virtual unsigned getFunctionAlignment(const Function *F) const {
41 return 2; }
42
Che-Liang Chioufc7072c2010-12-22 10:38:51 +000043 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
44
Justin Holewinski2d525c52011-04-28 00:19:56 +000045 virtual SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
46
Eric Christopher50880d02010-09-18 18:52:28 +000047 virtual SDValue
48 LowerFormalArguments(SDValue Chain,
49 CallingConv::ID CallConv,
50 bool isVarArg,
51 const SmallVectorImpl<ISD::InputArg> &Ins,
52 DebugLoc dl,
53 SelectionDAG &DAG,
54 SmallVectorImpl<SDValue> &InVals) const;
55
56 virtual SDValue
57 LowerReturn(SDValue Chain,
58 CallingConv::ID CallConv,
59 bool isVarArg,
60 const SmallVectorImpl<ISD::OutputArg> &Outs,
61 const SmallVectorImpl<SDValue> &OutVals,
62 DebugLoc dl,
63 SelectionDAG &DAG) const;
Justin Holewinski2d525c52011-04-28 00:19:56 +000064
65 virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const;
66
Che-Liang Chioufc7072c2010-12-22 10:38:51 +000067 private:
68 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
Eric Christopher50880d02010-09-18 18:52:28 +000069}; // class PTXTargetLowering
70} // namespace llvm
71
72#endif // PTX_ISEL_LOWERING_H