Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 1 | //===-- SparcISelLowering.h - Sparc 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 Sparc uses to lower LLVM code into a |
| 11 | // selection DAG. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef SPARC_ISELLOWERING_H |
| 16 | #define SPARC_ISELLOWERING_H |
| 17 | |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 18 | #include "Sparc.h" |
Craig Topper | 79aa341 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetLowering.h" |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 20 | |
| 21 | namespace llvm { |
| 22 | namespace SPISD { |
| 23 | enum { |
Dan Gohman | 0ba2bcf | 2008-09-23 18:42:32 +0000 | [diff] [blame] | 24 | FIRST_NUMBER = ISD::BUILTIN_OP_END, |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 25 | CMPICC, // Compare two GPR operands, set icc. |
| 26 | CMPFCC, // Compare two FP operands, set fcc. |
| 27 | BRICC, // Branch to dest on icc condition |
| 28 | BRFCC, // Branch to dest on fcc condition |
| 29 | SELECT_ICC, // Select between two values using the current ICC flags. |
| 30 | SELECT_FCC, // Select between two values using the current FCC flags. |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 31 | |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 32 | Hi, Lo, // Hi/Lo operations, typically on a global address. |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 33 | |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 34 | FTOI, // FP to Int within a FP register. |
| 35 | ITOF, // Int to FP within a FP register. |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 36 | |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 37 | CALL, // A call instruction. |
Chris Lattner | db486a6 | 2009-09-15 17:46:24 +0000 | [diff] [blame] | 38 | RET_FLAG, // Return with a flag operand. |
Venkatraman Govindaraju | 860b64c | 2011-01-12 05:08:36 +0000 | [diff] [blame] | 39 | GLOBAL_BASE_REG, // Global base reg for PIC |
Venkatraman Govindaraju | fc3faa7 | 2011-01-21 22:00:00 +0000 | [diff] [blame] | 40 | FLUSHW // FLUSH register windows to stack |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 41 | }; |
| 42 | } |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 43 | |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 44 | class SparcTargetLowering : public TargetLowering { |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 45 | public: |
| 46 | SparcTargetLowering(TargetMachine &TM); |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 47 | virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 48 | |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 49 | /// computeMaskedBitsForTargetNode - Determine which of the bits specified |
| 50 | /// in Mask are known to be either zero or one and return them in the |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 51 | /// KnownZero/KnownOne bitsets. |
Dan Gohman | 475871a | 2008-07-27 21:46:04 +0000 | [diff] [blame] | 52 | virtual void computeMaskedBitsForTargetNode(const SDValue Op, |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 53 | APInt &KnownZero, |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 54 | APInt &KnownOne, |
| 55 | const SelectionDAG &DAG, |
| 56 | unsigned Depth = 0) const; |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 57 | |
Dan Gohman | af1d8ca | 2010-05-01 00:01:06 +0000 | [diff] [blame] | 58 | virtual MachineBasicBlock * |
| 59 | EmitInstrWithCustomInserter(MachineInstr *MI, |
| 60 | MachineBasicBlock *MBB) const; |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 61 | |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 62 | virtual const char *getTargetNodeName(unsigned Opcode) const; |
Anton Korobeynikov | 0eefda1 | 2008-10-10 20:28:10 +0000 | [diff] [blame] | 63 | |
| 64 | ConstraintType getConstraintType(const std::string &Constraint) const; |
| 65 | std::pair<unsigned, const TargetRegisterClass*> |
Owen Anderson | e50ed30 | 2009-08-10 22:56:29 +0000 | [diff] [blame] | 66 | getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const; |
Dan Gohman | 6520e20 | 2008-10-18 02:06:02 +0000 | [diff] [blame] | 67 | |
| 68 | virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; |
Bill Wendling | 20c568f | 2009-06-30 22:38:32 +0000 | [diff] [blame] | 69 | |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 70 | virtual SDValue |
| 71 | LowerFormalArguments(SDValue Chain, |
Sandeep Patel | 65c3c8f | 2009-09-02 08:44:58 +0000 | [diff] [blame] | 72 | CallingConv::ID CallConv, |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 73 | bool isVarArg, |
| 74 | const SmallVectorImpl<ISD::InputArg> &Ins, |
| 75 | DebugLoc dl, SelectionDAG &DAG, |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 76 | SmallVectorImpl<SDValue> &InVals) const; |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 77 | |
| 78 | virtual SDValue |
Justin Holewinski | d2ea0e1 | 2012-05-25 16:35:28 +0000 | [diff] [blame] | 79 | LowerCall(TargetLowering::CallLoweringInfo &CLI, |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 80 | SmallVectorImpl<SDValue> &InVals) const; |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 81 | |
| 82 | virtual SDValue |
| 83 | LowerReturn(SDValue Chain, |
Sandeep Patel | 65c3c8f | 2009-09-02 08:44:58 +0000 | [diff] [blame] | 84 | CallingConv::ID CallConv, bool isVarArg, |
Dan Gohman | 98ca4f2 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 85 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
Dan Gohman | c940365 | 2010-07-07 15:54:55 +0000 | [diff] [blame] | 86 | const SmallVectorImpl<SDValue> &OutVals, |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 87 | DebugLoc dl, SelectionDAG &DAG) const; |
Chris Lattner | db486a6 | 2009-09-15 17:46:24 +0000 | [diff] [blame] | 88 | |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 89 | SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const; |
| 90 | SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const; |
Venkatraman Govindaraju | 58269b9 | 2011-02-21 03:42:44 +0000 | [diff] [blame] | 91 | |
| 92 | unsigned getSRetArgSize(SelectionDAG &DAG, SDValue Callee) const; |
Chris Lattner | d23405e | 2008-03-17 03:21:36 +0000 | [diff] [blame] | 93 | }; |
| 94 | } // end namespace llvm |
| 95 | |
| 96 | #endif // SPARC_ISELLOWERING_H |