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 // Return 00059 Ret 00060 }; 00061 } 00062 00063 //===--------------------------------------------------------------------===// 00064 // TargetLowering Implementation 00065 //===--------------------------------------------------------------------===// 00066 class MipsTargetLowering : public TargetLowering 00067 { 00068 // FrameIndex for return slot. 00069 int ReturnAddrIndex; 00070 public: 00071 00072 explicit MipsTargetLowering(MipsTargetMachine &TM); 00073 00074 /// LowerOperation - Provide custom lowering hooks for some operations. 00075 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00076 00077 /// getTargetNodeName - This method returns the name of a target specific 00078 // DAG node. 00079 virtual const char *getTargetNodeName(unsigned Opcode) const; 00080 00081 /// getSetCCResultType - get the ISD::SETCC result ValueType 00082 MVT getSetCCResultType(MVT VT) const; 00083 00084 private: 00085 // Subtarget Info 00086 const MipsSubtarget *Subtarget; 00087 00088 // Lower Operand helpers 00089 SDNode *LowerCallResult(SDValue Chain, SDValue InFlag, CallSDNode *TheCall, 00090 unsigned CallingConv, SelectionDAG &DAG); 00091 bool IsGlobalInSmallSection(GlobalValue *GV); 00092 bool IsInSmallSection(unsigned Size); 00093 00094 // Lower Operand specifics 00095 SDValue LowerANDOR(SDValue Op, SelectionDAG &DAG); 00096 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG); 00097 SDValue LowerCALL(SDValue Op, SelectionDAG &DAG); 00098 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG); 00099 SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG); 00100 SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG); 00101 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG); 00102 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG); 00103 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG); 00104 SDValue LowerRET(SDValue Op, SelectionDAG &DAG); 00105 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG); 00106 SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG); 00107 00108 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, 00109 MachineBasicBlock *MBB); 00110 00111 // Inline asm support 00112 ConstraintType getConstraintType(const std::string &Constraint) const; 00113 00114 std::pair<unsigned, const TargetRegisterClass*> 00115 getRegForInlineAsmConstraint(const std::string &Constraint, 00116 MVT VT) const; 00117 00118 std::vector<unsigned> 00119 getRegClassForInlineAsmConstraint(const std::string &Constraint, 00120 MVT VT) const; 00121 00122 virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; 00123 }; 00124 } 00125 00126 #endif // MipsISELLOWERING_H