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 Branch Conditional
49 // Floating Point Compare
57 //===--------------------------------------------------------------------===//
58 // TargetLowering Implementation
59 //===--------------------------------------------------------------------===//
60 class MipsTargetLowering : public TargetLowering
62 // FrameIndex for return slot.
66 explicit MipsTargetLowering(MipsTargetMachine &TM);
68 /// LowerOperation - Provide custom lowering hooks for some operations.
69 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
71 /// getTargetNodeName - This method returns the name of a target specific
73 virtual const char *getTargetNodeName(unsigned Opcode) const;
75 /// getSetCCResultType - get the ISD::SETCC result ValueType
76 MVT getSetCCResultType(const SDValue &) const;
80 const MipsSubtarget *Subtarget;
82 // Lower Operand helpers
83 SDValue LowerCCCArguments(SDValue Op, SelectionDAG &DAG);
84 SDValue LowerCCCCallTo(SDValue Op, SelectionDAG &DAG, unsigned CC);
85 SDNode *LowerCallResult(SDValue Chain, SDValue InFlag, SDNode*TheCall,
86 unsigned CallingConv, SelectionDAG &DAG);
87 bool IsGlobalInSmallSection(GlobalValue *GV);
88 bool IsInSmallSection(unsigned Size);
90 // Lower Operand specifics
91 SDValue LowerRET(SDValue Op, SelectionDAG &DAG);
92 SDValue LowerCALL(SDValue Op, SelectionDAG &DAG);
93 SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG);
94 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG);
95 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG);
96 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG);
97 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG);
98 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG);
100 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
101 MachineBasicBlock *MBB);
103 // Inline asm support
104 ConstraintType getConstraintType(const std::string &Constraint) const;
106 std::pair<unsigned, const TargetRegisterClass*>
107 getRegForInlineAsmConstraint(const std::string &Constraint,
110 std::vector<unsigned>
111 getRegClassForInlineAsmConstraint(const std::string &Constraint,
116 #endif // MipsISELLOWERING_H