LLVM API Documentation
00001 //===-- MipsISelLowering.h - Mips DAG Lowering Interface --------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the interfaces that Mips uses to lower LLVM code into a 00011 // selection DAG. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef MipsISELLOWERING_H 00016 #define MipsISELLOWERING_H 00017 00018 #include "llvm/CodeGen/SelectionDAG.h" 00019 #include "llvm/Target/TargetLowering.h" 00020 #include "Mips.h" 00021 #include "MipsSubtarget.h" 00022 00023 namespace llvm { 00024 namespace MipsISD { 00025 enum NodeType { 00026 // Start the numbering from where ISD NodeType finishes. 00027 FIRST_NUMBER = ISD::BUILTIN_OP_END, 00028 00029 // Jump and link (call) 00030 JmpLink, 00031 00032 // Get the Higher 16 bits from a 32-bit immediate 00033 // No relation with Mips Hi register 00034 Hi, 00035 00036 // Get the Lower 16 bits from a 32-bit immediate 00037 // No relation with Mips Lo register 00038 Lo, 00039 00040 // Handle gp_rel (small data/bss sections) relocation. 00041 GPRel, 00042 00043 // Conditional Move 00044 CMov, 00045 00046 // Select CC Pseudo Instruction 00047 SelectCC, 00048 00049 // Floating Point Select CC Pseudo Instruction 00050 FPSelectCC, 00051 00052 // Floating Point Branch Conditional 00053 FPBrcond, 00054 00055 // Floating Point Compare 00056 FPCmp, 00057 00058 // Floating Point Rounding 00059 FPRound, 00060 00061 // Return 00062 Ret 00063 }; 00064 } 00065 00066 //===--------------------------------------------------------------------===// 00067 // TargetLowering Implementation 00068 //===--------------------------------------------------------------------===// 00069 00070 class MipsTargetLowering : public TargetLowering { 00071 public: 00072 00073 explicit MipsTargetLowering(MipsTargetMachine &TM); 00074 00075 /// LowerOperation - Provide custom lowering hooks for some operations. 00076 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00077 00078 /// getTargetNodeName - This method returns the name of a target specific 00079 // DAG node. 00080 virtual const char *getTargetNodeName(unsigned Opcode) const; 00081 00082 /// getSetCCResultType - get the ISD::SETCC result ValueType 00083 MVT::SimpleValueType getSetCCResultType(EVT VT) const; 00084 00085 /// getFunctionAlignment - Return the Log2 alignment of this function. 00086 virtual unsigned getFunctionAlignment(const Function *F) const; 00087 private: 00088 // Subtarget Info 00089 const MipsSubtarget *Subtarget; 00090 00091 00092 // Lower Operand helpers 00093 SDValue LowerCallResult(SDValue Chain, SDValue InFlag, 00094 unsigned CallConv, bool isVarArg, 00095 const SmallVectorImpl<ISD::InputArg> &Ins, 00096 DebugLoc dl, SelectionDAG &DAG, 00097 SmallVectorImpl<SDValue> &InVals); 00098 00099 // Lower Operand specifics 00100 SDValue LowerANDOR(SDValue Op, SelectionDAG &DAG); 00101 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG); 00102 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG); 00103 SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG); 00104 SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG); 00105 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG); 00106 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG); 00107 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG); 00108 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG); 00109 SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG); 00110 00111 virtual SDValue 00112 LowerFormalArguments(SDValue Chain, 00113 unsigned CallConv, bool isVarArg, 00114 const SmallVectorImpl<ISD::InputArg> &Ins, 00115 DebugLoc dl, SelectionDAG &DAG, 00116 SmallVectorImpl<SDValue> &InVals); 00117 00118 virtual SDValue 00119 LowerCall(SDValue Chain, SDValue Callee, 00120 unsigned CallConv, bool isVarArg, 00121 bool isTailCall, 00122 const SmallVectorImpl<ISD::OutputArg> &Outs, 00123 const SmallVectorImpl<ISD::InputArg> &Ins, 00124 DebugLoc dl, SelectionDAG &DAG, 00125 SmallVectorImpl<SDValue> &InVals); 00126 00127 virtual SDValue 00128 LowerReturn(SDValue Chain, 00129 unsigned CallConv, bool isVarArg, 00130 const SmallVectorImpl<ISD::OutputArg> &Outs, 00131 DebugLoc dl, SelectionDAG &DAG); 00132 00133 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, 00134 MachineBasicBlock *MBB) const; 00135 00136 // Inline asm support 00137 ConstraintType getConstraintType(const std::string &Constraint) const; 00138 00139 std::pair<unsigned, const TargetRegisterClass*> 00140 getRegForInlineAsmConstraint(const std::string &Constraint, 00141 EVT VT) const; 00142 00143 std::vector<unsigned> 00144 getRegClassForInlineAsmConstraint(const std::string &Constraint, 00145 EVT VT) const; 00146 00147 virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; 00148 }; 00149 } 00150 00151 #endif // MipsISELLOWERING_H