Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 1 | //===-- MipsISelLowering.h - Mips DAG Lowering Interface --------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Bruno Cardoso Lopes and is distributed under the |
| 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines the interfaces that Mips uses to lower LLVM code into a |
| 11 | // selection DAG. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef MipsISELLOWERING_H |
| 16 | #define MipsISELLOWERING_H |
| 17 | |
| 18 | #include "llvm/CodeGen/SelectionDAG.h" |
| 19 | #include "llvm/Target/TargetLowering.h" |
| 20 | #include "Mips.h" |
| 21 | #include "MipsSubtarget.h" |
| 22 | |
| 23 | namespace llvm { |
| 24 | namespace MipsISD { |
| 25 | enum NodeType { |
| 26 | // Start the numbering from where ISD NodeType finishes. |
| 27 | FIRST_NUMBER = ISD::BUILTIN_OP_END+Mips::INSTRUCTION_LIST_END, |
| 28 | |
| 29 | // Jump and link (call) |
| 30 | JmpLink, |
| 31 | |
| 32 | // Get the Higher 16 bits from a 32-bit immediate |
| 33 | // No relation with Mips Hi register |
| 34 | Hi, |
| 35 | |
| 36 | // Get the Lower 16 bits from a 32-bit immediate |
| 37 | // No relation with Mips Lo register |
| 38 | Lo, |
| 39 | |
| 40 | // Return |
Bruno Cardoso Lopes | c7db561 | 2007-11-05 03:02:32 +0000 | [diff] [blame^] | 41 | Ret |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 42 | }; |
| 43 | } |
| 44 | |
| 45 | //===--------------------------------------------------------------------===// |
| 46 | // TargetLowering Implementation |
| 47 | //===--------------------------------------------------------------------===// |
| 48 | class MipsTargetLowering : public TargetLowering |
| 49 | { |
| 50 | // FrameIndex for return slot. |
| 51 | int ReturnAddrIndex; |
| 52 | |
| 53 | // const MipsSubtarget &MipsSubTarget; |
| 54 | public: |
| 55 | |
Dan Gohman | 61e729e | 2007-08-02 21:21:54 +0000 | [diff] [blame] | 56 | explicit MipsTargetLowering(MipsTargetMachine &TM); |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 57 | |
| 58 | /// LowerOperation - Provide custom lowering hooks for some operations. |
| 59 | virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); |
| 60 | |
| 61 | /// getTargetNodeName - This method returns the name of a target specific |
| 62 | // DAG node. |
| 63 | virtual const char *getTargetNodeName(unsigned Opcode) const; |
| 64 | |
| 65 | private: |
| 66 | // Lower Operand helpers |
| 67 | SDOperand LowerCCCArguments(SDOperand Op, SelectionDAG &DAG); |
| 68 | SDOperand LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC); |
| 69 | SDNode *LowerCallResult(SDOperand Chain, SDOperand InFlag, SDNode*TheCall, |
| 70 | unsigned CallingConv, SelectionDAG &DAG); |
| 71 | SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG); |
| 72 | |
| 73 | // Lower Operand specifics |
| 74 | SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG); |
| 75 | SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG); |
| 76 | SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG); |
| 77 | SDOperand LowerGlobalAddress(SDOperand Op, SelectionDAG &DAG); |
Lauro Ramos Venancio | 75ce010 | 2007-07-11 17:19:51 +0000 | [diff] [blame] | 78 | SDOperand LowerGlobalTLSAddress(SDOperand Op, SelectionDAG &DAG); |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 79 | |
Bruno Cardoso Lopes | 84f47c5 | 2007-08-21 16:09:25 +0000 | [diff] [blame] | 80 | // Inline asm support |
| 81 | ConstraintType getConstraintType(const std::string &Constraint) const; |
| 82 | |
| 83 | std::pair<unsigned, const TargetRegisterClass*> |
| 84 | getRegForInlineAsmConstraint(const std::string &Constraint, |
| 85 | MVT::ValueType VT) const; |
| 86 | |
| 87 | std::vector<unsigned> |
| 88 | getRegClassForInlineAsmConstraint(const std::string &Constraint, |
| 89 | MVT::ValueType VT) const; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 90 | }; |
| 91 | } |
| 92 | |
| 93 | #endif // MipsISELLOWERING_H |