Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- PTXISelLowering.h - PTX DAG Lowering Interface ----------*- C++ -*-===// |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 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 { |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 21 | |
| 22 | namespace PTXISD { |
| 23 | enum NodeType { |
| 24 | FIRST_NUMBER = ISD::BUILTIN_OP_END, |
Justin Holewinski | a5ccb4e | 2011-06-23 18:10:05 +0000 | [diff] [blame] | 25 | LOAD_PARAM, |
Justin Holewinski | 67a9184 | 2011-06-23 18:10:03 +0000 | [diff] [blame] | 26 | STORE_PARAM, |
Justin Holewinski | 5422a0f | 2011-09-22 16:45:46 +0000 | [diff] [blame] | 27 | READ_PARAM, |
| 28 | WRITE_PARAM, |
Che-Liang Chiou | f9930da | 2010-09-25 07:46:17 +0000 | [diff] [blame] | 29 | EXIT, |
Justin Holewinski | 8af78c9 | 2011-03-18 19:24:28 +0000 | [diff] [blame] | 30 | RET, |
Justin Holewinski | 4bdd4ed | 2011-08-09 17:36:31 +0000 | [diff] [blame] | 31 | COPY_ADDRESS, |
| 32 | CALL |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 33 | }; |
Justin Holewinski | 67a9184 | 2011-06-23 18:10:03 +0000 | [diff] [blame] | 34 | } // namespace PTXISD |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 35 | |
| 36 | class PTXTargetLowering : public TargetLowering { |
| 37 | public: |
| 38 | explicit PTXTargetLowering(TargetMachine &TM); |
| 39 | |
| 40 | virtual const char *getTargetNodeName(unsigned Opcode) const; |
| 41 | |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 42 | virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; |
| 43 | |
Justin Holewinski | 2d525c5 | 2011-04-28 00:19:56 +0000 | [diff] [blame] | 44 | virtual SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const; |
Justin Holewinski | ec3141b | 2011-06-16 15:17:11 +0000 | [diff] [blame] | 45 | |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 46 | 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 Holewinski | ec3141b | 2011-06-16 15:17:11 +0000 | [diff] [blame] | 63 | |
Justin Holewinski | 4bdd4ed | 2011-08-09 17:36:31 +0000 | [diff] [blame] | 64 | virtual SDValue |
Evan Cheng | 4bfcd4a | 2012-02-28 18:51:51 +0000 | [diff] [blame] | 65 | LowerCall(SDValue Chain, SDValue Callee, CallingConv::ID CallConv, |
| 66 | bool isVarArg, bool doesNotRet, bool &isTailCall, |
Justin Holewinski | 4bdd4ed | 2011-08-09 17:36:31 +0000 | [diff] [blame] | 67 | 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 Sands | 28b77e9 | 2011-09-06 19:07:46 +0000 | [diff] [blame] | 73 | virtual EVT getSetCCResultType(EVT VT) const; |
Justin Holewinski | ec3141b | 2011-06-16 15:17:11 +0000 | [diff] [blame] | 74 | |
Justin Holewinski | 68226a4 | 2011-10-09 15:42:02 +0000 | [diff] [blame] | 75 | virtual unsigned getNumRegisters(LLVMContext &Context, EVT VT); |
| 76 | |
Che-Liang Chiou | fc7072c | 2010-12-22 10:38:51 +0000 | [diff] [blame] | 77 | private: |
| 78 | SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const; |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 79 | }; // class PTXTargetLowering |
| 80 | } // namespace llvm |
| 81 | |
| 82 | #endif // PTX_ISEL_LOWERING_H |