PTX: Add intrinsic support for ntid, ctaid, and nctaid registers
[oota-llvm.git] / lib / Target / PTX / PTXISelLowering.h
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     READ_PARAM,
28     EXIT,
29     RET
30   };
31 } // namespace PTXISD
32
33 class PTXTargetLowering : public TargetLowering {
34   public:
35     explicit PTXTargetLowering(TargetMachine &TM);
36
37     virtual const char *getTargetNodeName(unsigned Opcode) const;
38
39     virtual unsigned getFunctionAlignment(const Function *F) const {
40       return 2; }
41
42     virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
43
44     virtual SDValue
45       LowerFormalArguments(SDValue Chain,
46                            CallingConv::ID CallConv,
47                            bool isVarArg,
48                            const SmallVectorImpl<ISD::InputArg> &Ins,
49                            DebugLoc dl,
50                            SelectionDAG &DAG,
51                            SmallVectorImpl<SDValue> &InVals) const;
52
53     virtual SDValue
54       LowerReturn(SDValue Chain,
55                   CallingConv::ID CallConv,
56                   bool isVarArg,
57                   const SmallVectorImpl<ISD::OutputArg> &Outs,
58                   const SmallVectorImpl<SDValue> &OutVals,
59                   DebugLoc dl,
60                   SelectionDAG &DAG) const;
61
62   private:
63     SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
64 }; // class PTXTargetLowering
65 } // namespace llvm
66
67 #endif // PTX_ISEL_LOWERING_H