PTX: support for select_cc and fixes for setcc
[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     COPY_ADDRESS
31   };
32 } // namespace PTXISD
33
34 class 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
43     virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
44
45     virtual SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
46     
47     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;
64     
65     virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const;
66     
67   private:
68     SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
69 }; // class PTXTargetLowering
70 } // namespace llvm
71
72 #endif // PTX_ISEL_LOWERING_H