LLVM 22.0.0git
X86FrameLowering.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "x86-fl"

Functions

 STATISTIC (NumFrameLoopProbe, "Number of loop stack probes used in prologue")
 STATISTIC (NumFrameExtraProbe, "Number of extra stack probes generated in prologue")
 STATISTIC (NumFunctionUsingPush2Pop2, "Number of functions using push2/pop2")
static unsigned getSUBriOpcode (bool IsLP64)
static unsigned getADDriOpcode (bool IsLP64)
static unsigned getSUBrrOpcode (bool IsLP64)
static unsigned getADDrrOpcode (bool IsLP64)
static unsigned getANDriOpcode (bool IsLP64, int64_t Imm)
static unsigned getLEArOpcode (bool IsLP64)
static unsigned getMOVriOpcode (bool Use64BitReg, int64_t Imm)
static unsigned getPUSHOpcode (const X86Subtarget &ST)
static unsigned getPOPOpcode (const X86Subtarget &ST)
static unsigned getPUSH2Opcode (const X86Subtarget &ST)
static unsigned getPOP2Opcode (const X86Subtarget &ST)
static bool isEAXLiveIn (MachineBasicBlock &MBB)
static bool flagsNeedToBePreservedBeforeTheTerminators (const MachineBasicBlock &MBB)
 Check if the flags need to be preserved before the terminators.
static unsigned calculateSetFPREG (uint64_t SPAdjust)
static bool isOpcodeRep (unsigned Opcode)
 Return true if an opcode is part of the REP group of instructions.
static bool isFuncletReturnInstr (MachineInstr &MI)
static bool isTailCallOpcode (unsigned Opc)
static bool HasNestArgument (const MachineFunction *MF)
static unsigned GetScratchRegister (bool Is64Bit, bool IsLP64, const MachineFunction &MF, bool Primary)
 GetScratchRegister - Get a temp register for performing work in the segmented stack and the Erlang/HiPE stack prologue.
static unsigned getHiPELiteral (NamedMDNode *HiPELiteralsMD, const StringRef LiteralName)
 Lookup an ERTS parameter in the !hipe.literals named metadata node.
static bool blockEndIsUnreachable (const MachineBasicBlock &MBB, MachineBasicBlock::const_iterator MBBI)
static int computeFPBPAlignmentGap (MachineFunction &MF, const TargetRegisterClass *RC, unsigned NumSpilledRegs)
static bool isFPBPAccess (const MachineInstr &MI, Register FP, Register BP, const TargetRegisterInfo *TRI, bool &AccessFP, bool &AccessBP)
static bool isInvoke (const MachineInstr &MI, bool InsideEHLabels)

Variables

constexpr uint64_t MaxSPChunk = (1ULL << 31) - 1
static const uint64_t kSplitStackAvailable = 256

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86-fl"

Definition at line 40 of file X86FrameLowering.cpp.

Function Documentation

◆ blockEndIsUnreachable()

bool blockEndIsUnreachable ( const MachineBasicBlock & MBB,
MachineBasicBlock::const_iterator MBBI )
static

Definition at line 3552 of file X86FrameLowering.cpp.

References llvm::all_of(), MBB, MBBI, and MI.

Referenced by llvm::X86FrameLowering::eliminateCallFramePseudoInstr().

◆ calculateSetFPREG()

◆ computeFPBPAlignmentGap()

◆ flagsNeedToBePreservedBeforeTheTerminators()

bool flagsNeedToBePreservedBeforeTheTerminators ( const MachineBasicBlock & MBB)
static

Check if the flags need to be preserved before the terminators.

This would be the case, if the eflags is live-in of the region composed by the terminators or live-out of that region, without being defined by a terminator.

Definition at line 194 of file X86FrameLowering.cpp.

References MBB, MI, and Reg.

Referenced by llvm::X86FrameLowering::canUseAsEpilogue().

◆ getADDriOpcode()

unsigned getADDriOpcode ( bool IsLP64)
static

◆ getADDrrOpcode()

unsigned getADDrrOpcode ( bool IsLP64)
static

Definition at line 122 of file X86FrameLowering.cpp.

Referenced by llvm::X86FrameLowering::emitSPUpdate().

◆ getANDriOpcode()

unsigned getANDriOpcode ( bool IsLP64,
int64_t Imm )
static

Definition at line 126 of file X86FrameLowering.cpp.

◆ getHiPELiteral()

unsigned getHiPELiteral ( NamedMDNode * HiPELiteralsMD,
const StringRef LiteralName )
static

Lookup an ERTS parameter in the !hipe.literals named metadata node.

HiPE provides Erlang Runtime System-internal parameters, such as PCB offsets to fields it needs, through a named metadata node "hipe.literals" containing name-value pairs.

Definition at line 3530 of file X86FrameLowering.cpp.

References llvm::dyn_cast(), llvm::dyn_cast_or_null(), llvm::NamedMDNode::getNumOperands(), llvm::NamedMDNode::getOperand(), llvm::MDString::getString(), llvm::ValueAsMetadata::getValue(), llvm::ConstantInt::getZExtValue(), and llvm::report_fatal_error().

Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue().

◆ getLEArOpcode()

unsigned getLEArOpcode ( bool IsLP64)
static

Definition at line 130 of file X86FrameLowering.cpp.

Referenced by llvm::X86FrameLowering::emitEpilogue().

◆ getMOVriOpcode()

unsigned getMOVriOpcode ( bool Use64BitReg,
int64_t Imm )
static

◆ getPOP2Opcode()

unsigned getPOP2Opcode ( const X86Subtarget & ST)
static

◆ getPOPOpcode()

◆ getPUSH2Opcode()

unsigned getPUSH2Opcode ( const X86Subtarget & ST)
static

◆ getPUSHOpcode()

◆ GetScratchRegister()

unsigned GetScratchRegister ( bool Is64Bit,
bool IsLP64,
const MachineFunction & MF,
bool Primary )
static

GetScratchRegister - Get a temp register for performing work in the segmented stack and the Erlang/HiPE stack prologue.

Depending on platform and the properties of the function either one or two registers will be needed. Set primary to true for the first register, false for the second.

Definition at line 3231 of file X86FrameLowering.cpp.

References llvm::CallingConv::Fast, llvm::Function::getCallingConv(), llvm::MachineFunction::getFunction(), HasNestArgument(), llvm::CallingConv::HiPE, llvm::report_fatal_error(), llvm::CallingConv::Tail, and llvm::CallingConv::X86_FastCall.

Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), and llvm::X86FrameLowering::adjustForSegmentedStacks().

◆ getSUBriOpcode()

unsigned getSUBriOpcode ( bool IsLP64)
static

Definition at line 110 of file X86FrameLowering.cpp.

◆ getSUBrrOpcode()

unsigned getSUBrrOpcode ( bool IsLP64)
static

Definition at line 118 of file X86FrameLowering.cpp.

Referenced by llvm::X86FrameLowering::emitSPUpdate().

◆ HasNestArgument()

bool HasNestArgument ( const MachineFunction * MF)
static

◆ isEAXLiveIn()

bool isEAXLiveIn ( MachineBasicBlock & MBB)
static

Definition at line 177 of file X86FrameLowering.cpp.

References MBB, and Reg.

Referenced by llvm::X86FrameLowering::emitPrologue(), and llvm::X86FrameLowering::emitSPUpdate().

◆ isFPBPAccess()

bool isFPBPAccess ( const MachineInstr & MI,
Register FP,
Register BP,
const TargetRegisterInfo * TRI,
bool & AccessFP,
bool & AccessBP )
static

Definition at line 4476 of file X86FrameLowering.cpp.

References FP, MI, and TRI.

Referenced by llvm::X86FrameLowering::spillFPBP().

◆ isFuncletReturnInstr()

bool isFuncletReturnInstr ( MachineInstr & MI)
static

Definition at line 2333 of file X86FrameLowering.cpp.

References llvm_unreachable, and MI.

◆ isInvoke()

bool isInvoke ( const MachineInstr & MI,
bool InsideEHLabels )
static

Definition at line 4496 of file X86FrameLowering.cpp.

References MBB, MBBI, and MI.

Referenced by llvm::X86FrameLowering::spillFPBP().

◆ isOpcodeRep()

bool isOpcodeRep ( unsigned Opcode)
static

Return true if an opcode is part of the REP group of instructions.

Definition at line 1475 of file X86FrameLowering.cpp.

Referenced by llvm::X86FrameLowering::emitPrologue().

◆ isTailCallOpcode()

bool isTailCallOpcode ( unsigned Opc)
static

Definition at line 2399 of file X86FrameLowering.cpp.

References Opc.

◆ STATISTIC() [1/3]

STATISTIC ( NumFrameExtraProbe ,
"Number of extra stack probes generated in prologue"  )

◆ STATISTIC() [2/3]

STATISTIC ( NumFrameLoopProbe ,
"Number of loop stack probes used in prologue"  )

◆ STATISTIC() [3/3]

STATISTIC ( NumFunctionUsingPush2Pop2 ,
"Number of functions using push2/pop2"  )

Variable Documentation

◆ kSplitStackAvailable

const uint64_t kSplitStackAvailable = 256
static

Definition at line 3267 of file X86FrameLowering.cpp.

◆ MaxSPChunk

uint64_t MaxSPChunk = (1ULL << 31) - 1
constexpr

Definition at line 228 of file X86FrameLowering.cpp.

Referenced by llvm::X86FrameLowering::emitSPUpdate().