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 LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
16 #define LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
18 #include "MCTargetDesc/MipsABIInfo.h"
19 #include "MCTargetDesc/MipsBaseInfo.h"
20 #include "MCTargetDesc/MipsMCTargetDesc.h"
22 #include "llvm/CodeGen/CallingConvLower.h"
23 #include "llvm/CodeGen/ISDOpcodes.h"
24 #include "llvm/CodeGen/MachineMemOperand.h"
25 #include "llvm/CodeGen/SelectionDAG.h"
26 #include "llvm/CodeGen/SelectionDAGNodes.h"
27 #include "llvm/CodeGen/TargetLowering.h"
28 #include "llvm/CodeGen/ValueTypes.h"
29 #include "llvm/IR/CallingConv.h"
30 #include "llvm/IR/InlineAsm.h"
31 #include "llvm/IR/Type.h"
32 #include "llvm/Support/MachineValueType.h"
33 #include "llvm/Target/TargetMachine.h"
47 class FunctionLoweringInfo
;
48 class MachineBasicBlock
;
49 class MachineFrameInfo
;
52 class MipsFunctionInfo
;
54 class MipsTargetMachine
;
55 class TargetLibraryInfo
;
56 class TargetRegisterClass
;
60 enum NodeType
: unsigned {
61 // Start the numbering from where ISD NodeType finishes.
62 FIRST_NUMBER
= ISD::BUILTIN_OP_END
,
64 // Jump and link (call)
70 // Get the Highest (63-48) 16 bits from a 64-bit immediate
73 // Get the Higher (47-32) 16 bits from a 64-bit immediate
76 // Get the High 16 bits from a 32/64-bit immediate
77 // No relation with Mips Hi register
80 // Get the Lower 16 bits from a 32/64-bit immediate
81 // No relation with Mips Lo register
84 // Get the High 16 bits from a 32 bit immediate for accessing the GOT.
87 // Get the High 16 bits from a 32-bit immediate for accessing TLS.
90 // Handle gp_rel (small data/bss sections) relocation.
96 // Vector Floating Point Multiply and Subtract
99 // Floating Point Branch Conditional
102 // Floating Point Compare
105 // Floating point select
108 // Node used to generate an MTC1 i32 to f64 instruction
111 // Floating Point Conditional Moves
115 // FP-to-int truncation node.
121 // Interrupt, exception, error trap Return
124 // Software Exception Return.
127 // Node used to extract integer from accumulator.
131 // Node used to insert integers to accumulator.
163 // EXTR.W instrinsic nodes.
173 // DPA.W intrinsic nodes.
209 // DSP setcc and select_cc nodes.
213 // Vector comparisons.
214 // These take a vector and return a boolean.
220 // These take a vector and return a vector bitmask.
227 // Vector Shuffle with mask as an operand
228 VSHF
, // Generic shuffle
229 SHF
, // 4-element set shuffle.
230 ILVEV
, // Interleave even elements
231 ILVOD
, // Interleave odd elements
232 ILVL
, // Interleave left elements
233 ILVR
, // Interleave right elements
234 PCKEV
, // Pack even elements
235 PCKOD
, // Pack odd elements
238 INSVE
, // Copy element from one vector to another
240 // Combined (XOR (OR $a, $b), -1)
243 // Extended vector element extraction
247 // Load/Store Left/Right nodes.
248 LWL
= ISD::FIRST_TARGET_MEMORY_OPCODE
,
258 } // ene namespace MipsISD
260 //===--------------------------------------------------------------------===//
261 // TargetLowering Implementation
262 //===--------------------------------------------------------------------===//
264 class MipsTargetLowering
: public TargetLowering
{
268 explicit MipsTargetLowering(const MipsTargetMachine
&TM
,
269 const MipsSubtarget
&STI
);
271 static const MipsTargetLowering
*create(const MipsTargetMachine
&TM
,
272 const MipsSubtarget
&STI
);
274 /// createFastISel - This method returns a target specific FastISel object,
275 /// or null if the target does not support "fast" ISel.
276 FastISel
*createFastISel(FunctionLoweringInfo
&funcInfo
,
277 const TargetLibraryInfo
*libInfo
) const override
;
279 MVT
getScalarShiftAmountTy(const DataLayout
&, EVT
) const override
{
283 EVT
getTypeForExtReturn(LLVMContext
&Context
, EVT VT
,
284 ISD::NodeType
) const override
;
286 bool isCheapToSpeculateCttz() const override
;
287 bool isCheapToSpeculateCtlz() const override
;
289 /// Return the register type for a given MVT, ensuring vectors are treated
290 /// as a series of gpr sized integers.
291 MVT
getRegisterTypeForCallingConv(LLVMContext
&Context
, CallingConv::ID CC
,
292 EVT VT
) const override
;
294 /// Return the number of registers for a given MVT, ensuring vectors are
295 /// treated as a series of gpr sized integers.
296 unsigned getNumRegistersForCallingConv(LLVMContext
&Context
,
298 EVT VT
) const override
;
300 /// Break down vectors to the correct number of gpr sized integers.
301 unsigned getVectorTypeBreakdownForCallingConv(
302 LLVMContext
&Context
, CallingConv::ID CC
, EVT VT
, EVT
&IntermediateVT
,
303 unsigned &NumIntermediates
, MVT
&RegisterVT
) const override
;
305 /// Return the correct alignment for the current calling convention.
306 unsigned getABIAlignmentForCallingConv(Type
*ArgTy
,
307 DataLayout DL
) const override
{
308 if (ArgTy
->isVectorTy())
309 return std::min(DL
.getABITypeAlignment(ArgTy
), 8U);
310 return DL
.getABITypeAlignment(ArgTy
);
313 ISD::NodeType
getExtendForAtomicOps() const override
{
314 return ISD::SIGN_EXTEND
;
317 void LowerOperationWrapper(SDNode
*N
,
318 SmallVectorImpl
<SDValue
> &Results
,
319 SelectionDAG
&DAG
) const override
;
321 /// LowerOperation - Provide custom lowering hooks for some operations.
322 SDValue
LowerOperation(SDValue Op
, SelectionDAG
&DAG
) const override
;
324 /// ReplaceNodeResults - Replace the results of node with an illegal result
325 /// type with new values built out of custom code.
327 void ReplaceNodeResults(SDNode
*N
, SmallVectorImpl
<SDValue
>&Results
,
328 SelectionDAG
&DAG
) const override
;
330 /// getTargetNodeName - This method returns the name of a target specific
332 const char *getTargetNodeName(unsigned Opcode
) const override
;
334 /// getSetCCResultType - get the ISD::SETCC result ValueType
335 EVT
getSetCCResultType(const DataLayout
&DL
, LLVMContext
&Context
,
336 EVT VT
) const override
;
338 SDValue
PerformDAGCombine(SDNode
*N
, DAGCombinerInfo
&DCI
) const override
;
341 EmitInstrWithCustomInserter(MachineInstr
&MI
,
342 MachineBasicBlock
*MBB
) const override
;
344 void HandleByVal(CCState
*, unsigned &, unsigned) const override
;
346 unsigned getRegisterByName(const char* RegName
, EVT VT
,
347 SelectionDAG
&DAG
) const override
;
349 /// If a physical register, this returns the register that receives the
350 /// exception address on entry to an EH pad.
352 getExceptionPointerRegister(const Constant
*PersonalityFn
) const override
{
353 return ABI
.IsN64() ? Mips::A0_64
: Mips::A0
;
356 /// If a physical register, this returns the register that receives the
357 /// exception typeid on entry to a landing pad.
359 getExceptionSelectorRegister(const Constant
*PersonalityFn
) const override
{
360 return ABI
.IsN64() ? Mips::A1_64
: Mips::A1
;
363 /// Returns true if a cast between SrcAS and DestAS is a noop.
364 bool isNoopAddrSpaceCast(unsigned SrcAS
, unsigned DestAS
) const override
{
365 // Mips doesn't have any special address spaces so we just reserve
366 // the first 256 for software use (e.g. OpenCL) and treat casts
367 // between them as noops.
368 return SrcAS
< 256 && DestAS
< 256;
371 bool isJumpTableRelative() const override
{
372 return getTargetMachine().isPositionIndependent();
375 CCAssignFn
*CCAssignFnForCall() const;
377 CCAssignFn
*CCAssignFnForReturn() const;
380 SDValue
getGlobalReg(SelectionDAG
&DAG
, EVT Ty
) const;
382 // This method creates the following nodes, which are necessary for
383 // computing a local symbol's address:
385 // (add (load (wrapper $gp, %got(sym)), %lo(sym))
386 template <class NodeTy
>
387 SDValue
getAddrLocal(NodeTy
*N
, const SDLoc
&DL
, EVT Ty
, SelectionDAG
&DAG
,
388 bool IsN32OrN64
) const {
389 unsigned GOTFlag
= IsN32OrN64
? MipsII::MO_GOT_PAGE
: MipsII::MO_GOT
;
390 SDValue GOT
= DAG
.getNode(MipsISD::Wrapper
, DL
, Ty
, getGlobalReg(DAG
, Ty
),
391 getTargetNode(N
, Ty
, DAG
, GOTFlag
));
393 DAG
.getLoad(Ty
, DL
, DAG
.getEntryNode(), GOT
,
394 MachinePointerInfo::getGOT(DAG
.getMachineFunction()));
395 unsigned LoFlag
= IsN32OrN64
? MipsII::MO_GOT_OFST
: MipsII::MO_ABS_LO
;
396 SDValue Lo
= DAG
.getNode(MipsISD::Lo
, DL
, Ty
,
397 getTargetNode(N
, Ty
, DAG
, LoFlag
));
398 return DAG
.getNode(ISD::ADD
, DL
, Ty
, Load
, Lo
);
401 // This method creates the following nodes, which are necessary for
402 // computing a global symbol's address:
404 // (load (wrapper $gp, %got(sym)))
405 template <class NodeTy
>
406 SDValue
getAddrGlobal(NodeTy
*N
, const SDLoc
&DL
, EVT Ty
, SelectionDAG
&DAG
,
407 unsigned Flag
, SDValue Chain
,
408 const MachinePointerInfo
&PtrInfo
) const {
409 SDValue Tgt
= DAG
.getNode(MipsISD::Wrapper
, DL
, Ty
, getGlobalReg(DAG
, Ty
),
410 getTargetNode(N
, Ty
, DAG
, Flag
));
411 return DAG
.getLoad(Ty
, DL
, Chain
, Tgt
, PtrInfo
);
414 // This method creates the following nodes, which are necessary for
415 // computing a global symbol's address in large-GOT mode:
417 // (load (wrapper (add %hi(sym), $gp), %lo(sym)))
418 template <class NodeTy
>
419 SDValue
getAddrGlobalLargeGOT(NodeTy
*N
, const SDLoc
&DL
, EVT Ty
,
420 SelectionDAG
&DAG
, unsigned HiFlag
,
421 unsigned LoFlag
, SDValue Chain
,
422 const MachinePointerInfo
&PtrInfo
) const {
423 SDValue Hi
= DAG
.getNode(MipsISD::GotHi
, DL
, Ty
,
424 getTargetNode(N
, Ty
, DAG
, HiFlag
));
425 Hi
= DAG
.getNode(ISD::ADD
, DL
, Ty
, Hi
, getGlobalReg(DAG
, Ty
));
426 SDValue Wrapper
= DAG
.getNode(MipsISD::Wrapper
, DL
, Ty
, Hi
,
427 getTargetNode(N
, Ty
, DAG
, LoFlag
));
428 return DAG
.getLoad(Ty
, DL
, Chain
, Wrapper
, PtrInfo
);
431 // This method creates the following nodes, which are necessary for
432 // computing a symbol's address in non-PIC mode:
434 // (add %hi(sym), %lo(sym))
436 // This method covers O32, N32 and N64 in sym32 mode.
437 template <class NodeTy
>
438 SDValue
getAddrNonPIC(NodeTy
*N
, const SDLoc
&DL
, EVT Ty
,
439 SelectionDAG
&DAG
) const {
440 SDValue Hi
= getTargetNode(N
, Ty
, DAG
, MipsII::MO_ABS_HI
);
441 SDValue Lo
= getTargetNode(N
, Ty
, DAG
, MipsII::MO_ABS_LO
);
442 return DAG
.getNode(ISD::ADD
, DL
, Ty
,
443 DAG
.getNode(MipsISD::Hi
, DL
, Ty
, Hi
),
444 DAG
.getNode(MipsISD::Lo
, DL
, Ty
, Lo
));
447 // This method creates the following nodes, which are necessary for
448 // computing a symbol's address in non-PIC mode for N64.
450 // (add (shl (add (shl (add %highest(sym), %higher(sim)), 16), %high(sym)),
453 // FIXME: This method is not efficent for (micro)MIPS64R6.
454 template <class NodeTy
>
455 SDValue
getAddrNonPICSym64(NodeTy
*N
, const SDLoc
&DL
, EVT Ty
,
456 SelectionDAG
&DAG
) const {
457 SDValue Hi
= getTargetNode(N
, Ty
, DAG
, MipsII::MO_ABS_HI
);
458 SDValue Lo
= getTargetNode(N
, Ty
, DAG
, MipsII::MO_ABS_LO
);
461 DAG
.getNode(MipsISD::Highest
, DL
, Ty
,
462 getTargetNode(N
, Ty
, DAG
, MipsII::MO_HIGHEST
));
463 SDValue Higher
= getTargetNode(N
, Ty
, DAG
, MipsII::MO_HIGHER
);
465 DAG
.getNode(ISD::ADD
, DL
, Ty
, Highest
,
466 DAG
.getNode(MipsISD::Higher
, DL
, Ty
, Higher
));
467 SDValue Cst
= DAG
.getConstant(16, DL
, MVT::i32
);
468 SDValue Shift
= DAG
.getNode(ISD::SHL
, DL
, Ty
, HigherPart
, Cst
);
469 SDValue Add
= DAG
.getNode(ISD::ADD
, DL
, Ty
, Shift
,
470 DAG
.getNode(MipsISD::Hi
, DL
, Ty
, Hi
));
471 SDValue Shift2
= DAG
.getNode(ISD::SHL
, DL
, Ty
, Add
, Cst
);
473 return DAG
.getNode(ISD::ADD
, DL
, Ty
, Shift2
,
474 DAG
.getNode(MipsISD::Lo
, DL
, Ty
, Lo
));
477 // This method creates the following nodes, which are necessary for
478 // computing a symbol's address using gp-relative addressing:
480 // (add $gp, %gp_rel(sym))
481 template <class NodeTy
>
482 SDValue
getAddrGPRel(NodeTy
*N
, const SDLoc
&DL
, EVT Ty
,
483 SelectionDAG
&DAG
, bool IsN64
) const {
484 SDValue GPRel
= getTargetNode(N
, Ty
, DAG
, MipsII::MO_GPREL
);
487 DAG
.getRegister(IsN64
? Mips::GP_64
: Mips::GP
, Ty
),
488 DAG
.getNode(MipsISD::GPRel
, DL
, DAG
.getVTList(Ty
), GPRel
));
491 /// This function fills Ops, which is the list of operands that will later
492 /// be used when a function call node is created. It also generates
493 /// copyToReg nodes to set up argument registers.
495 getOpndList(SmallVectorImpl
<SDValue
> &Ops
,
496 std::deque
<std::pair
<unsigned, SDValue
>> &RegsToPass
,
497 bool IsPICCall
, bool GlobalOrExternal
, bool InternalLinkage
,
498 bool IsCallReloc
, CallLoweringInfo
&CLI
, SDValue Callee
,
499 SDValue Chain
) const;
502 SDValue
lowerLOAD(SDValue Op
, SelectionDAG
&DAG
) const;
503 SDValue
lowerSTORE(SDValue Op
, SelectionDAG
&DAG
) const;
506 const MipsSubtarget
&Subtarget
;
507 // Cache the ABI from the TargetMachine, we use it everywhere.
508 const MipsABIInfo
&ABI
;
511 // Create a TargetGlobalAddress node.
512 SDValue
getTargetNode(GlobalAddressSDNode
*N
, EVT Ty
, SelectionDAG
&DAG
,
513 unsigned Flag
) const;
515 // Create a TargetExternalSymbol node.
516 SDValue
getTargetNode(ExternalSymbolSDNode
*N
, EVT Ty
, SelectionDAG
&DAG
,
517 unsigned Flag
) const;
519 // Create a TargetBlockAddress node.
520 SDValue
getTargetNode(BlockAddressSDNode
*N
, EVT Ty
, SelectionDAG
&DAG
,
521 unsigned Flag
) const;
523 // Create a TargetJumpTable node.
524 SDValue
getTargetNode(JumpTableSDNode
*N
, EVT Ty
, SelectionDAG
&DAG
,
525 unsigned Flag
) const;
527 // Create a TargetConstantPool node.
528 SDValue
getTargetNode(ConstantPoolSDNode
*N
, EVT Ty
, SelectionDAG
&DAG
,
529 unsigned Flag
) const;
531 // Lower Operand helpers
532 SDValue
LowerCallResult(SDValue Chain
, SDValue InFlag
,
533 CallingConv::ID CallConv
, bool isVarArg
,
534 const SmallVectorImpl
<ISD::InputArg
> &Ins
,
535 const SDLoc
&dl
, SelectionDAG
&DAG
,
536 SmallVectorImpl
<SDValue
> &InVals
,
537 TargetLowering::CallLoweringInfo
&CLI
) const;
539 // Lower Operand specifics
540 SDValue
lowerBRCOND(SDValue Op
, SelectionDAG
&DAG
) const;
541 SDValue
lowerConstantPool(SDValue Op
, SelectionDAG
&DAG
) const;
542 SDValue
lowerGlobalAddress(SDValue Op
, SelectionDAG
&DAG
) const;
543 SDValue
lowerBlockAddress(SDValue Op
, SelectionDAG
&DAG
) const;
544 SDValue
lowerGlobalTLSAddress(SDValue Op
, SelectionDAG
&DAG
) const;
545 SDValue
lowerJumpTable(SDValue Op
, SelectionDAG
&DAG
) const;
546 SDValue
lowerSELECT(SDValue Op
, SelectionDAG
&DAG
) const;
547 SDValue
lowerSETCC(SDValue Op
, SelectionDAG
&DAG
) const;
548 SDValue
lowerVASTART(SDValue Op
, SelectionDAG
&DAG
) const;
549 SDValue
lowerVAARG(SDValue Op
, SelectionDAG
&DAG
) const;
550 SDValue
lowerFCOPYSIGN(SDValue Op
, SelectionDAG
&DAG
) const;
551 SDValue
lowerFABS(SDValue Op
, SelectionDAG
&DAG
) const;
552 SDValue
lowerFRAMEADDR(SDValue Op
, SelectionDAG
&DAG
) const;
553 SDValue
lowerRETURNADDR(SDValue Op
, SelectionDAG
&DAG
) const;
554 SDValue
lowerEH_RETURN(SDValue Op
, SelectionDAG
&DAG
) const;
555 SDValue
lowerATOMIC_FENCE(SDValue Op
, SelectionDAG
& DAG
) const;
556 SDValue
lowerShiftLeftParts(SDValue Op
, SelectionDAG
& DAG
) const;
557 SDValue
lowerShiftRightParts(SDValue Op
, SelectionDAG
& DAG
,
559 SDValue
lowerEH_DWARF_CFA(SDValue Op
, SelectionDAG
&DAG
) const;
560 SDValue
lowerFP_TO_SINT(SDValue Op
, SelectionDAG
&DAG
) const;
562 /// isEligibleForTailCallOptimization - Check whether the call is eligible
563 /// for tail call optimization.
565 isEligibleForTailCallOptimization(const CCState
&CCInfo
,
566 unsigned NextStackOffset
,
567 const MipsFunctionInfo
&FI
) const = 0;
569 /// copyByValArg - Copy argument registers which were used to pass a byval
570 /// argument to the stack. Create a stack frame object for the byval
572 void copyByValRegs(SDValue Chain
, const SDLoc
&DL
,
573 std::vector
<SDValue
> &OutChains
, SelectionDAG
&DAG
,
574 const ISD::ArgFlagsTy
&Flags
,
575 SmallVectorImpl
<SDValue
> &InVals
,
576 const Argument
*FuncArg
, unsigned FirstReg
,
577 unsigned LastReg
, const CCValAssign
&VA
,
578 MipsCCState
&State
) const;
580 /// passByValArg - Pass a byval argument in registers or on stack.
581 void passByValArg(SDValue Chain
, const SDLoc
&DL
,
582 std::deque
<std::pair
<unsigned, SDValue
>> &RegsToPass
,
583 SmallVectorImpl
<SDValue
> &MemOpChains
, SDValue StackPtr
,
584 MachineFrameInfo
&MFI
, SelectionDAG
&DAG
, SDValue Arg
,
585 unsigned FirstReg
, unsigned LastReg
,
586 const ISD::ArgFlagsTy
&Flags
, bool isLittle
,
587 const CCValAssign
&VA
) const;
589 /// writeVarArgRegs - Write variable function arguments passed in registers
590 /// to the stack. Also create a stack frame object for the first variable
592 void writeVarArgRegs(std::vector
<SDValue
> &OutChains
, SDValue Chain
,
593 const SDLoc
&DL
, SelectionDAG
&DAG
,
594 CCState
&State
) const;
597 LowerFormalArguments(SDValue Chain
, CallingConv::ID CallConv
, bool isVarArg
,
598 const SmallVectorImpl
<ISD::InputArg
> &Ins
,
599 const SDLoc
&dl
, SelectionDAG
&DAG
,
600 SmallVectorImpl
<SDValue
> &InVals
) const override
;
602 SDValue
passArgOnStack(SDValue StackPtr
, unsigned Offset
, SDValue Chain
,
603 SDValue Arg
, const SDLoc
&DL
, bool IsTailCall
,
604 SelectionDAG
&DAG
) const;
606 SDValue
LowerCall(TargetLowering::CallLoweringInfo
&CLI
,
607 SmallVectorImpl
<SDValue
> &InVals
) const override
;
609 bool CanLowerReturn(CallingConv::ID CallConv
, MachineFunction
&MF
,
611 const SmallVectorImpl
<ISD::OutputArg
> &Outs
,
612 LLVMContext
&Context
) const override
;
614 SDValue
LowerReturn(SDValue Chain
, CallingConv::ID CallConv
, bool isVarArg
,
615 const SmallVectorImpl
<ISD::OutputArg
> &Outs
,
616 const SmallVectorImpl
<SDValue
> &OutVals
,
617 const SDLoc
&dl
, SelectionDAG
&DAG
) const override
;
619 SDValue
LowerInterruptReturn(SmallVectorImpl
<SDValue
> &RetOps
,
620 const SDLoc
&DL
, SelectionDAG
&DAG
) const;
622 bool shouldSignExtendTypeInLibCall(EVT Type
, bool IsSigned
) const override
;
624 // Inline asm support
625 ConstraintType
getConstraintType(StringRef Constraint
) const override
;
627 /// Examine constraint string and operand type and determine a weight value.
628 /// The operand object must already have been set up with the operand type.
629 ConstraintWeight
getSingleConstraintMatchWeight(
630 AsmOperandInfo
&info
, const char *constraint
) const override
;
632 /// This function parses registers that appear in inline-asm constraints.
633 /// It returns pair (0, 0) on failure.
634 std::pair
<unsigned, const TargetRegisterClass
*>
635 parseRegForInlineAsmConstraint(StringRef C
, MVT VT
) const;
637 std::pair
<unsigned, const TargetRegisterClass
*>
638 getRegForInlineAsmConstraint(const TargetRegisterInfo
*TRI
,
639 StringRef Constraint
, MVT VT
) const override
;
641 /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
642 /// vector. If it is invalid, don't add anything to Ops. If hasMemory is
643 /// true it means one of the asm constraint of the inline asm instruction
644 /// being processed is 'm'.
645 void LowerAsmOperandForConstraint(SDValue Op
,
646 std::string
&Constraint
,
647 std::vector
<SDValue
> &Ops
,
648 SelectionDAG
&DAG
) const override
;
651 getInlineAsmMemConstraint(StringRef ConstraintCode
) const override
{
652 if (ConstraintCode
== "R")
653 return InlineAsm::Constraint_R
;
654 else if (ConstraintCode
== "ZC")
655 return InlineAsm::Constraint_ZC
;
656 return TargetLowering::getInlineAsmMemConstraint(ConstraintCode
);
659 bool isLegalAddressingMode(const DataLayout
&DL
, const AddrMode
&AM
,
660 Type
*Ty
, unsigned AS
,
661 Instruction
*I
= nullptr) const override
;
663 bool isOffsetFoldingLegal(const GlobalAddressSDNode
*GA
) const override
;
665 EVT
getOptimalMemOpType(uint64_t Size
, unsigned DstAlign
,
667 bool IsMemset
, bool ZeroMemset
,
669 MachineFunction
&MF
) const override
;
671 /// isFPImmLegal - Returns true if the target can instruction select the
672 /// specified FP immediate natively. If false, the legalizer will
673 /// materialize the FP immediate as a load from a constant pool.
674 bool isFPImmLegal(const APFloat
&Imm
, EVT VT
) const override
;
676 unsigned getJumpTableEncoding() const override
;
677 bool useSoftFloat() const override
;
679 bool shouldInsertFencesForAtomic(const Instruction
*I
) const override
{
683 /// Emit a sign-extension using sll/sra, seb, or seh appropriately.
684 MachineBasicBlock
*emitSignExtendToI32InReg(MachineInstr
&MI
,
685 MachineBasicBlock
*BB
,
686 unsigned Size
, unsigned DstReg
,
687 unsigned SrcRec
) const;
689 MachineBasicBlock
*emitAtomicBinary(MachineInstr
&MI
,
690 MachineBasicBlock
*BB
) const;
691 MachineBasicBlock
*emitAtomicBinaryPartword(MachineInstr
&MI
,
692 MachineBasicBlock
*BB
,
693 unsigned Size
) const;
694 MachineBasicBlock
*emitAtomicCmpSwap(MachineInstr
&MI
,
695 MachineBasicBlock
*BB
) const;
696 MachineBasicBlock
*emitAtomicCmpSwapPartword(MachineInstr
&MI
,
697 MachineBasicBlock
*BB
,
698 unsigned Size
) const;
699 MachineBasicBlock
*emitSEL_D(MachineInstr
&MI
, MachineBasicBlock
*BB
) const;
700 MachineBasicBlock
*emitPseudoSELECT(MachineInstr
&MI
, MachineBasicBlock
*BB
,
701 bool isFPCmp
, unsigned Opc
) const;
704 /// Create MipsTargetLowering objects.
705 const MipsTargetLowering
*
706 createMips16TargetLowering(const MipsTargetMachine
&TM
,
707 const MipsSubtarget
&STI
);
708 const MipsTargetLowering
*
709 createMipsSETargetLowering(const MipsTargetMachine
&TM
,
710 const MipsSubtarget
&STI
);
714 FastISel
*createFastISel(FunctionLoweringInfo
&funcInfo
,
715 const TargetLibraryInfo
*libInfo
);
717 } // end namespace Mips
719 } // end namespace llvm
721 #endif // LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H