1 //===-- MBlazeISelLowering.h - MBlaze 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 MBlaze uses to lower LLVM code into a
13 //===----------------------------------------------------------------------===//
15 #ifndef MBlazeISELLOWERING_H
16 #define MBlazeISELLOWERING_H
18 #include "llvm/CodeGen/SelectionDAG.h"
19 #include "llvm/Target/TargetLowering.h"
21 #include "MBlazeSubtarget.h"
38 // Start the numbering from where ISD NodeType finishes.
39 FIRST_NUMBER = ISD::BUILTIN_OP_END,
41 // Jump and link (call)
44 // Handle gp_rel (small data/bss sections) relocation.
47 // Select CC Pseudo Instruction
50 // Wrap up multiple types of instructions
61 //===--------------------------------------------------------------------===//
62 // TargetLowering Implementation
63 //===--------------------------------------------------------------------===//
65 class MBlazeTargetLowering : public TargetLowering {
67 explicit MBlazeTargetLowering(MBlazeTargetMachine &TM);
69 /// LowerOperation - Provide custom lowering hooks for some operations.
70 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
72 /// getTargetNodeName - This method returns the name of a target specific
74 virtual const char *getTargetNodeName(unsigned Opcode) const;
76 /// getSetCCResultType - get the ISD::SETCC result ValueType
77 MVT::SimpleValueType getSetCCResultType(EVT VT) const;
79 virtual unsigned getFunctionAlignment(const Function *F) const;
82 const MBlazeSubtarget *Subtarget;
85 // Lower Operand helpers
86 SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
87 CallingConv::ID CallConv, bool isVarArg,
88 const SmallVectorImpl<ISD::InputArg> &Ins,
89 DebugLoc dl, SelectionDAG &DAG,
90 SmallVectorImpl<SDValue> &InVals) const;
92 // Lower Operand specifics
93 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
94 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
95 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
96 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
97 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
98 SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
101 LowerFormalArguments(SDValue Chain,
102 CallingConv::ID CallConv, bool isVarArg,
103 const SmallVectorImpl<ISD::InputArg> &Ins,
104 DebugLoc dl, SelectionDAG &DAG,
105 SmallVectorImpl<SDValue> &InVals) const;
108 LowerCall(SDValue Chain, SDValue Callee,
109 CallingConv::ID CallConv, bool isVarArg,
111 const SmallVectorImpl<ISD::OutputArg> &Outs,
112 const SmallVectorImpl<ISD::InputArg> &Ins,
113 DebugLoc dl, SelectionDAG &DAG,
114 SmallVectorImpl<SDValue> &InVals) const;
117 LowerReturn(SDValue Chain,
118 CallingConv::ID CallConv, bool isVarArg,
119 const SmallVectorImpl<ISD::OutputArg> &Outs,
120 DebugLoc dl, SelectionDAG &DAG) const;
122 virtual MachineBasicBlock *
123 EmitInstrWithCustomInserter(MachineInstr *MI,
124 MachineBasicBlock *MBB) const;
126 // Inline asm support
127 ConstraintType getConstraintType(const std::string &Constraint) const;
129 std::pair<unsigned, const TargetRegisterClass*>
130 getRegForInlineAsmConstraint(const std::string &Constraint,
133 std::vector<unsigned>
134 getRegClassForInlineAsmConstraint(const std::string &Constraint,
137 virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
139 /// isFPImmLegal - Returns true if the target can instruction select the
140 /// specified FP immediate natively. If false, the legalizer will
141 /// materialize the FP immediate as a load from a constant pool.
142 virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const;
146 #endif // MBlazeISELLOWERING_H