1 //===-- MipsISelLowering.h - Mips DAG Lowering Interface --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the interfaces that Mips uses to lower LLVM code into a
13 //===----------------------------------------------------------------------===//
15 #ifndef MipsISELLOWERING_H
16 #define MipsISELLOWERING_H
18 #include "llvm/CodeGen/SelectionDAG.h"
19 #include "llvm/Target/TargetLowering.h"
21 #include "MipsSubtarget.h"
26 // Start the numbering from where ISD NodeType finishes.
27 FIRST_NUMBER = ISD::BUILTIN_OP_END+Mips::INSTRUCTION_LIST_END,
29 // Jump and link (call)
32 // Get the Higher 16 bits from a 32-bit immediate
33 // No relation with Mips Hi register
36 // Get the Lower 16 bits from a 32-bit immediate
37 // No relation with Mips Lo register
40 // Handle gp_rel (small data/bss sections) relocation.
43 // Select CC Pseudo Instruction
46 // Floating Point Select CC Pseudo Instruction
49 // Floating Point Branch Conditional
52 // Floating Point Compare
60 //===--------------------------------------------------------------------===//
61 // TargetLowering Implementation
62 //===--------------------------------------------------------------------===//
63 class MipsTargetLowering : public TargetLowering
65 // FrameIndex for return slot.
69 explicit MipsTargetLowering(MipsTargetMachine &TM);
71 /// LowerOperation - Provide custom lowering hooks for some operations.
72 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
74 /// getTargetNodeName - This method returns the name of a target specific
76 virtual const char *getTargetNodeName(unsigned Opcode) const;
78 /// getSetCCResultType - get the ISD::SETCC result ValueType
79 MVT getSetCCResultType(const SDValue &) const;
83 const MipsSubtarget *Subtarget;
85 // Lower Operand helpers
86 SDValue LowerCCCArguments(SDValue Op, SelectionDAG &DAG);
87 SDValue LowerCCCCallTo(SDValue Op, SelectionDAG &DAG, unsigned CC);
88 SDNode *LowerCallResult(SDValue Chain, SDValue InFlag, SDNode*TheCall,
89 unsigned CallingConv, SelectionDAG &DAG);
90 bool IsGlobalInSmallSection(GlobalValue *GV);
91 bool IsInSmallSection(unsigned Size);
93 // Lower Operand specifics
94 SDValue LowerRET(SDValue Op, SelectionDAG &DAG);
95 SDValue LowerCALL(SDValue Op, SelectionDAG &DAG);
96 SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG);
97 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG);
98 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG);
99 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG);
100 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG);
101 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG);
102 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG);
103 SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG);
104 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG);
106 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
107 MachineBasicBlock *MBB);
109 // Inline asm support
110 ConstraintType getConstraintType(const std::string &Constraint) const;
112 std::pair<unsigned, const TargetRegisterClass*>
113 getRegForInlineAsmConstraint(const std::string &Constraint,
116 std::vector<unsigned>
117 getRegClassForInlineAsmConstraint(const std::string &Constraint,
122 #endif // MipsISELLOWERING_H