LLVM 24.0.0git
M68kISelLowering.cpp File Reference

This file defines the interfaces that M68k uses to lower LLVM code into a selection DAG. More...

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "M68k-isel"
#define GET_CALLING_CONV_IMPL

Enumerations

enum  StructReturnType { NotStructReturn , RegStructReturn , StackStructReturn }

Functions

 STATISTIC (NumTailCalls, "Number of tail calls")
static StructReturnType callIsStructReturn (const SmallVectorImpl< ISD::OutputArg > &Outs)
static StructReturnType argsAreStructReturn (const SmallVectorImpl< ISD::InputArg > &Ins)
 Determines whether a function uses struct return semantics.
static SDValue CreateCopyOfByValArgument (SDValue Src, SDValue Dst, SDValue Chain, ISD::ArgFlagsTy Flags, SelectionDAG &DAG, const SDLoc &DL)
 Make a copy of an aggregate at address specified by "Src" to address "Dst" with size and alignment information specified by the specific parameter attribute.
static bool canGuaranteeTCO (CallingConv::ID CC)
 Return true if the calling convention is one that we can guarantee TCO for.
static bool mayTailCallThisCC (CallingConv::ID CC)
 Return true if we might ever do TCO for calls with this calling convention.
static bool shouldGuaranteeTCO (CallingConv::ID CC, bool GuaranteedTailCallOpt)
 Return true if the function is being made into a tailcall target by changing its ABI.
static bool MatchingStackOffset (SDValue Arg, unsigned Offset, ISD::ArgFlagsTy Flags, MachineFrameInfo &MFI, const MachineRegisterInfo *MRI, const M68kInstrInfo *TII, const CCValAssign &VA)
 Return true if the given stack call argument is already available in the same position (relatively) of the caller's incoming argument stack.
static SDValue getSETCC (M68k::CondCode Cond, SDValue CCR, const SDLoc &dl, SelectionDAG &DAG)
static bool isOverflowArithmetic (unsigned Opcode)
static void lowerOverflowArithmetic (SDValue Op, SelectionDAG &DAG, SDValue &Result, SDValue &CCR, M68k::CondCode &CC)
static SDValue getBitTestCondition (SDValue Src, SDValue BitNo, ISD::CondCode CC, const SDLoc &DL, SelectionDAG &DAG)
 Create a BTST (Bit Test) node - Test bit BitNo in Src and set condition according to equal/not-equal condition code CC.
static SDValue LowerAndToBTST (SDValue And, ISD::CondCode CC, const SDLoc &DL, SelectionDAG &DAG)
 Result of 'and' is compared against zero. Change to a BTST node if possible.
static M68k::CondCode TranslateIntegerM68kCC (ISD::CondCode SetCCOpcode)
static M68k::CondCode TranslateM68kCC (ISD::CondCode SetCCOpcode, const SDLoc &DL, bool IsFP, SDValue &LHS, SDValue &RHS, SelectionDAG &DAG)
 Do a one-to-one translation of a ISD::CondCode to the M68k-specific condition code, returning the condition code and the LHS/RHS of the comparison to make.
static SDValue LowerTruncateToBTST (SDValue Op, ISD::CondCode CC, const SDLoc &DL, SelectionDAG &DAG)
static bool hasNonFlagsUse (SDValue Op)
 return true if Op has a use that doesn't just read flags.
static bool isM68kLogicalCmp (SDValue Op)
 Return true if opcode is a M68k logical comparison.
static bool isTruncWithZeroHighBitsInput (SDValue V, SelectionDAG &DAG)
static bool isAndOrOfSetCCs (SDValue Op, unsigned &Opc)
 Return true if node is an ISD::AND or ISD::OR of two M68k::SETcc nodes each of which has no other use apart from the AND / OR.
static bool isXor1OfSetCC (SDValue Op)
 Return true if node is an ISD::XOR of a M68kISD::SETCC and 1 and that the SETCC node has a single use.
static bool isCMOVPseudo (MachineInstr &MI)
static bool checkAndUpdateCCRKill (MachineBasicBlock::iterator SelectItr, MachineBasicBlock *BB, const TargetRegisterInfo *TRI)
static SDValue combineCarryThroughADD (SDValue CCR, bool NeedX)
static SDValue combineSetCCCCR (SDValue CCR, M68k::CondCode &CC, SelectionDAG &DAG, const M68kSubtarget &Subtarget)
 Optimize a CCR definition used according to the condition code CC into a simpler CCR value, potentially returning a new CC and replacing uses of chain values.
static SDValue combineM68kSetCC (SDNode *N, SelectionDAG &DAG, const M68kSubtarget &Subtarget)
static SDValue combineM68kBrCond (SDNode *N, SelectionDAG &DAG, const M68kSubtarget &Subtarget)
static SDValue combineSUBX (SDNode *N, SelectionDAG &DAG)
static SDValue combineADDX (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI)

Detailed Description

This file defines the interfaces that M68k uses to lower LLVM code into a selection DAG.

Definition in file M68kISelLowering.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "M68k-isel"

Definition at line 44 of file M68kISelLowering.cpp.

◆ GET_CALLING_CONV_IMPL

#define GET_CALLING_CONV_IMPL

Definition at line 248 of file M68kISelLowering.cpp.

Enumeration Type Documentation

◆ StructReturnType

Enumerator
NotStructReturn 
RegStructReturn 
StackStructReturn 

Definition at line 251 of file M68kISelLowering.cpp.

Function Documentation

◆ argsAreStructReturn()

StructReturnType argsAreStructReturn ( const SmallVectorImpl< ISD::InputArg > & Ins)
static

Determines whether a function uses struct return semantics.

Definition at line 268 of file M68kISelLowering.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::empty(), NotStructReturn, RegStructReturn, and StackStructReturn.

◆ callIsStructReturn()

◆ canGuaranteeTCO()

bool canGuaranteeTCO ( CallingConv::ID CC)
static

Return true if the calling convention is one that we can guarantee TCO for.

Definition at line 296 of file M68kISelLowering.cpp.

References CC.

◆ checkAndUpdateCCRKill()

◆ combineADDX()

◆ combineCarryThroughADD()

◆ combineM68kBrCond()

SDValue combineM68kBrCond ( SDNode * N,
SelectionDAG & DAG,
const M68kSubtarget & Subtarget )
static

◆ combineM68kSetCC()

SDValue combineM68kSetCC ( SDNode * N,
SelectionDAG & DAG,
const M68kSubtarget & Subtarget )
static

Definition at line 3464 of file M68kISelLowering.cpp.

References CC, combineSetCCCCR(), DL, getSETCC(), and N.

◆ combineSetCCCCR()

SDValue combineSetCCCCR ( SDValue CCR,
M68k::CondCode & CC,
SelectionDAG & DAG,
const M68kSubtarget & Subtarget )
static

Optimize a CCR definition used according to the condition code CC into a simpler CCR value, potentially returning a new CC and replacing uses of chain values.

Definition at line 3453 of file M68kISelLowering.cpp.

References CC, combineCarryThroughADD(), and llvm::M68k::COND_CS.

Referenced by combineM68kBrCond(), and combineM68kSetCC().

◆ combineSUBX()

SDValue combineSUBX ( SDNode * N,
SelectionDAG & DAG )
static

◆ CreateCopyOfByValArgument()

SDValue CreateCopyOfByValArgument ( SDValue Src,
SDValue Dst,
SDValue Chain,
ISD::ArgFlagsTy Flags,
SelectionDAG & DAG,
const SDLoc & DL )
static

Make a copy of an aggregate at address specified by "Src" to address "Dst" with size and alignment information specified by the specific parameter attribute.

The copy will be passed as a byval function parameter.

Definition at line 283 of file M68kISelLowering.cpp.

References DL, llvm::SelectionDAG::getConstant(), and llvm::SelectionDAG::getMemcpy().

◆ getBitTestCondition()

SDValue getBitTestCondition ( SDValue Src,
SDValue BitNo,
ISD::CondCode CC,
const SDLoc & DL,
SelectionDAG & DAG )
static

Create a BTST (Bit Test) node - Test bit BitNo in Src and set condition according to equal/not-equal condition code CC.

Definition at line 1675 of file M68kISelLowering.cpp.

References llvm::ISD::ANY_EXTEND, CC, Cond, llvm::M68k::COND_EQ, llvm::M68k::COND_NE, DL, llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getNode(), llvm::SDValue::getValueType(), and llvm::ISD::SETEQ.

Referenced by LowerAndToBTST(), and LowerTruncateToBTST().

◆ getSETCC()

SDValue getSETCC ( M68k::CondCode Cond,
SDValue CCR,
const SDLoc & dl,
SelectionDAG & DAG )
static

◆ hasNonFlagsUse()

bool hasNonFlagsUse ( SDValue Op)
static

return true if Op has a use that doesn't just read flags.

Definition at line 1871 of file M68kISelLowering.cpp.

References llvm::ISD::BRCOND, llvm::Use::getOperandNo(), llvm::Use::getUser(), llvm::Value::hasOneUse(), llvm::ISD::SELECT, llvm::ISD::SETCC, llvm::ISD::TRUNCATE, and llvm::Value::use_begin().

Referenced by EmitTest().

◆ isAndOrOfSetCCs()

bool isAndOrOfSetCCs ( SDValue Op,
unsigned & Opc )
static

Return true if node is an ISD::AND or ISD::OR of two M68k::SETcc nodes each of which has no other use apart from the AND / OR.

Definition at line 2338 of file M68kISelLowering.cpp.

References llvm::ISD::AND, llvm::M68k::IsSETCC(), Opc, and llvm::ISD::OR.

Referenced by combineCompareEqual().

◆ isCMOVPseudo()

bool isCMOVPseudo ( MachineInstr & MI)
static

Definition at line 2942 of file M68kISelLowering.cpp.

References MI.

◆ isM68kLogicalCmp()

bool isM68kLogicalCmp ( SDValue Op)
static

Return true if opcode is a M68k logical comparison.

Definition at line 2218 of file M68kISelLowering.cpp.

References Opc.

◆ isOverflowArithmetic()

bool isOverflowArithmetic ( unsigned Opcode)
static

◆ isTruncWithZeroHighBitsInput()

◆ isXor1OfSetCC()

bool isXor1OfSetCC ( SDValue Op)
static

Return true if node is an ISD::XOR of a M68kISD::SETCC and 1 and that the SETCC node has a single use.

Definition at line 2350 of file M68kISelLowering.cpp.

References llvm::isOneConstant(), and llvm::ISD::XOR.

◆ LowerAndToBTST()

◆ lowerOverflowArithmetic()

◆ LowerTruncateToBTST()

SDValue LowerTruncateToBTST ( SDValue Op,
ISD::CondCode CC,
const SDLoc & DL,
SelectionDAG & DAG )
static

◆ MatchingStackOffset()

◆ mayTailCallThisCC()

bool mayTailCallThisCC ( CallingConv::ID CC)
static

Return true if we might ever do TCO for calls with this calling convention.

Definition at line 299 of file M68kISelLowering.cpp.

References llvm::CallingConv::C, canGuaranteeTCO(), and CC.

◆ shouldGuaranteeTCO()

bool shouldGuaranteeTCO ( CallingConv::ID CC,
bool GuaranteedTailCallOpt )
static

Return true if the function is being made into a tailcall target by changing its ABI.

Definition at line 311 of file M68kISelLowering.cpp.

References canGuaranteeTCO(), and CC.

Referenced by llvm::X86::isCalleePop().

◆ STATISTIC()

STATISTIC ( NumTailCalls ,
"Number of tail calls"  )

◆ TranslateIntegerM68kCC()

◆ TranslateM68kCC()