• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //==-- 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 
20 namespace llvm {
21 class PTXSubtarget;
22 class PTXTargetMachine;
23 
24 namespace PTXISD {
25   enum NodeType {
26     FIRST_NUMBER = ISD::BUILTIN_OP_END,
27     LOAD_PARAM,
28     STORE_PARAM,
29     READ_PARAM,
30     WRITE_PARAM,
31     EXIT,
32     RET,
33     COPY_ADDRESS,
34     CALL
35   };
36 }                               // namespace PTXISD
37 
38 class PTXTargetLowering : public TargetLowering {
39   public:
40     explicit PTXTargetLowering(TargetMachine &TM);
41 
42     virtual const char *getTargetNodeName(unsigned Opcode) const;
43 
44     virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
45 
46     virtual SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
47 
48     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;
65 
66     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 
76     virtual EVT getSetCCResultType(EVT VT) const;
77 
78     virtual unsigned getNumRegisters(LLVMContext &Context, EVT VT);
79 
80   private:
81     SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
82 }; // class PTXTargetLowering
83 } // namespace llvm
84 
85 #endif // PTX_ISEL_LOWERING_H
86