14#ifndef LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
15#define LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
42class FunctionLoweringInfo;
43class MachineBasicBlock;
44class MachineFrameInfo;
47class MipsFunctionInfo;
49class MipsTargetMachine;
50class TargetLibraryInfo;
51class TargetRegisterClass;
299 EVT VT)
const override;
305 EVT VT)
const override;
310 unsigned &NumIntermediates,
MVT &RegisterVT)
const override;
315 const Align ABIAlign =
DL.getABITypeAlign(ArgTy);
317 return std::min(ABIAlign,
Align(8));
340 EVT VT)
const override;
360 return ABI.
IsN64() ? Mips::A0_64 : Mips::A0;
367 return ABI.
IsN64() ? Mips::A1_64 : Mips::A1;
387 template <
class NodeTy>
389 bool IsN32OrN64)
const {
392 getTargetNode(
N, Ty, DAG, GOTFlag));
398 getTargetNode(
N, Ty, DAG, LoFlag));
406 template <
class NodeTy>
411 getTargetNode(
N, Ty, DAG, Flag));
412 return DAG.
getLoad(Ty,
DL, Chain, Tgt, PtrInfo);
419 template <
class NodeTy>
422 unsigned LoFlag,
SDValue Chain,
425 getTargetNode(
N, Ty, DAG, HiFlag));
428 getTargetNode(
N, Ty, DAG, LoFlag));
438 template <
class NodeTy>
455 template <
class NodeTy>
482 template <
class NodeTy>
488 DAG.
getRegister(IsN64 ? Mips::GP_64 : Mips::GP, Ty),
496 template <
class NodeTy>
511 template <
class NodeTy>
524 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
525 bool IsPICCall,
bool GlobalOrExternal,
bool InternalLinkage,
526 bool IsCallReloc, CallLoweringInfo &CLI,
SDValue Callee,
541 unsigned Flag)
const;
545 unsigned Flag)
const;
549 unsigned Flag)
const;
553 unsigned Flag)
const;
557 unsigned Flag)
const;
581 bool HasExtractInsert)
const;
583 bool HasExtractInsert)
const;
598 isEligibleForTailCallOptimization(
const CCState &CCInfo,
599 unsigned NextStackOffset,
609 const Argument *FuncArg,
unsigned FirstReg,
615 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
618 unsigned FirstReg,
unsigned LastReg,
625 void writeVarArgRegs(std::vector<SDValue> &OutChains,
SDValue Chain,
655 bool shouldSignExtendTypeInLibCall(
Type *Ty,
bool IsSigned)
const override;
667 std::pair<unsigned, const TargetRegisterClass *>
670 std::pair<unsigned, const TargetRegisterClass *>
679 std::vector<SDValue> &Ops,
683 getInlineAsmMemConstraint(
StringRef ConstraintCode)
const override {
684 if (ConstraintCode ==
"o")
686 if (ConstraintCode ==
"R")
688 if (ConstraintCode ==
"ZC")
694 Type *Ty,
unsigned AS,
706 bool ForCodeSize)
const override;
708 unsigned getJumpTableEncoding()
const override;
709 bool useSoftFloat()
const override;
711 bool shouldInsertFencesForAtomic(
const Instruction *
I)
const override {
716 MachineBasicBlock *emitSignExtendToI32InReg(MachineInstr &
MI,
717 MachineBasicBlock *BB,
718 unsigned Size,
unsigned DstReg,
719 unsigned SrcRec)
const;
721 MachineBasicBlock *emitAtomicBinary(MachineInstr &
MI,
722 MachineBasicBlock *BB)
const;
723 MachineBasicBlock *emitAtomicBinaryPartword(MachineInstr &
MI,
724 MachineBasicBlock *BB,
725 unsigned Size)
const;
726 MachineBasicBlock *emitAtomicCmpSwap(MachineInstr &
MI,
727 MachineBasicBlock *BB)
const;
728 MachineBasicBlock *emitAtomicCmpSwapPartword(MachineInstr &
MI,
729 MachineBasicBlock *BB,
730 unsigned Size)
const;
731 MachineBasicBlock *emitSEL_D(MachineInstr &
MI, MachineBasicBlock *BB)
const;
732 MachineBasicBlock *emitPseudoSELECT(MachineInstr &
MI, MachineBasicBlock *BB,
733 bool isFPCmp,
unsigned Opc)
const;
734 MachineBasicBlock *emitPseudoD_SELECT(MachineInstr &
MI,
735 MachineBasicBlock *BB)
const;
736 MachineBasicBlock *emitLDR_W(MachineInstr &
MI, MachineBasicBlock *BB)
const;
737 MachineBasicBlock *emitLDR_D(MachineInstr &
MI, MachineBasicBlock *BB)
const;
738 MachineBasicBlock *emitSTR_W(MachineInstr &
MI, MachineBasicBlock *BB)
const;
739 MachineBasicBlock *emitSTR_D(MachineInstr &
MI, MachineBasicBlock *BB)
const;
743 const MipsTargetLowering *
745 const MipsSubtarget &STI);
746 const MipsTargetLowering *
748 const MipsSubtarget &STI);
753 const TargetLibraryInfo *libInfo);
amdgpu aa AMDGPU Address space based Alias Analysis Wrapper
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
unsigned const TargetRegisterInfo * TRI
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
This file describes how to lower LLVM code to machine code.
This class represents an incoming formal argument to a Function.
CCState - This class holds information needed while lowering arguments and return values.
CCValAssign - Represent assignment of one arg/retval to a location.
This is an important base class in LLVM.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
This is an important class for using LLVM in a threaded context.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Representation of each machine instruction.
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
Register getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Return the register type for a given MVT, ensuring vectors are treated as a series of gpr sized integ...
bool hasBitTest(SDValue X, SDValue Y) const override
Return true if the target has a bit-test instruction: (X & (1 << Y)) ==/!= 0 This knowledge can be us...
static const MipsTargetLowering * create(const MipsTargetMachine &TM, const MipsSubtarget &STI)
Register getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN64) const
unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const override
Break down vectors to the correct number of gpr sized integers.
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
const char * getTargetNodeName(unsigned Opcode) const override
getTargetNodeName - This method returns the name of a target specific
SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override
Return the type to use for a scalar shift opcode, given the shifted amount type.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - get the ISD::SETCC result ValueType
SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, unsigned Flag, SDValue Chain, const MachinePointerInfo &PtrInfo) const
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo) const override
createFastISel - This method returns a target specific FastISel object, or null if the target does no...
SDValue getAddrGlobalLargeGOT(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, unsigned HiFlag, unsigned LoFlag, SDValue Chain, const MachinePointerInfo &PtrInfo) const
SDValue getDllimportVariable(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, SDValue Chain, const MachinePointerInfo &PtrInfo) const
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
CCAssignFn * CCAssignFnForReturn() const
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
ReplaceNodeResults - Replace the results of node with an illegal result type with new values built ou...
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
SDValue getDllimportSymbol(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
CCAssignFn * CCAssignFnForCall() const
unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Return the number of registers for a given MVT, ensuring vectors are treated as a series of gpr sized...
SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag.
virtual void getOpndList(SmallVectorImpl< SDValue > &Ops, std::deque< std::pair< unsigned, SDValue > > &RegsToPass, bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage, bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const
This function fills Ops, which is the list of operands that will later be used when a function call n...
EVT getTypeForExtReturn(LLVMContext &Context, EVT VT, ISD::NodeType) const override
Return the type that should be used to zero or sign extend a zeroext/signext integer return value.
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
bool isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
bool shouldFoldConstantShiftPairToMask(const SDNode *N, CombineLevel Level) const override
Return true if it is profitable to fold a pair of shifts into a mask.
SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN32OrN64) const
bool softPromoteHalfType() const override
SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const
const MipsSubtarget & Subtarget
ISD::NodeType getExtendForAtomicOps() const override
Returns how the platform's atomic operations are extended (ZERO_EXTEND, SIGN_EXTEND,...
void HandleByVal(CCState *, unsigned &, Align) const override
Target-specific cleanup for formal ByVal parameters.
bool isJumpTableRelative() const override
SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const
Align getABIAlignmentForCallingConv(Type *ArgTy, const DataLayout &DL) const override
Return the correct alignment for the current calling convention.
Wrapper class representing virtual and physical registers.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
SDValue getRegister(Register Reg, EVT VT)
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands,...
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
MachineFunction & getMachineFunction() const
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Provides information about what library functions are available for the current target.
const TargetMachine & getTargetMachine() const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
virtual InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const
bool isPositionIndependent() const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
@ C
The default llvm calling convention, compatible with C.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
@ ADD
Simple integer binary arithmetic operators.
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
@ SIGN_EXTEND
Conversion operators.
@ SHL
Shift and rotation operations.
@ MO_GOT
MO_GOT - Represents the offset into the global offset table at which the address the relocation entry...
@ MO_ABS_HI
MO_ABS_HI/LO - Represents the hi or low part of an absolute symbol address.
@ MO_DLLIMPORT
MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the reference is actually to the "__imp...
@ MO_GPREL
MO_GPREL - Represents the offset from the current gp value to be used for the relocatable object file...
@ MO_HIGHER
MO_HIGHER/HIGHEST - Represents the highest or higher half word of a 64-bit symbol address.
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
This is an optimization pass for GlobalISel generic memory operations.
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
const MipsTargetLowering * createMips16TargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
Create MipsTargetLowering objects.
const MipsTargetLowering * createMipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
This struct is a compact representation of a valid (non-zero power of two) alignment.
This class contains a discriminated union of information about pointers in memory operands,...
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
This contains information for each constraint that we are lowering.
This structure contains all information that is necessary for lowering calls.