LLVM  14.0.0git
Macros | Functions | Variables
X86FrameLowering.cpp File Reference
#include "X86FrameLowering.h"
#include "X86InstrBuilder.h"
#include "X86InstrInfo.h"
#include "X86MachineFunctionInfo.h"
#include "X86Subtarget.h"
#include "X86TargetMachine.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Debug.h"
#include "llvm/Target/TargetOptions.h"
#include <cstdlib>
Include dependency graph for X86FrameLowering.cpp:

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")
 
static unsigned getSUBriOpcode (bool IsLP64, int64_t Imm)
 
static unsigned getADDriOpcode (bool IsLP64, int64_t Imm)
 
static unsigned getSUBrrOpcode (bool IsLP64)
 
static unsigned getADDrrOpcode (bool IsLP64)
 
static unsigned getANDriOpcode (bool IsLP64, int64_t Imm)
 
static unsigned getLEArOpcode (bool IsLP64)
 
static bool isEAXLiveIn (MachineBasicBlock &MBB)
 
static bool flagsNeedToBePreservedBeforeTheTerminators (const MachineBasicBlock &MBB)
 Check if the flags need to be preserved before the terminators. More...
 
static unsigned calculateSetFPREG (uint64_t SPAdjust)
 
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. More...
 
static unsigned getHiPELiteral (NamedMDNode *HiPELiteralsMD, const StringRef LiteralName)
 Lookup an ERTS parameter in the !hipe.literals named metadata node. More...
 
static bool blockEndIsUnreachable (const MachineBasicBlock &MBB, MachineBasicBlock::const_iterator MBBI)
 

Variables

static const uint64_t kSplitStackAvailable = 256
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86-fl"

Definition at line 37 of file X86FrameLowering.cpp.

Function Documentation

◆ blockEndIsUnreachable()

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

◆ calculateSetFPREG()

static unsigned calculateSetFPREG ( uint64_t  SPAdjust)
static

◆ flagsNeedToBePreservedBeforeTheTerminators()

static 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 169 of file X86FrameLowering.cpp.

References MBB, MI, Reg, llvm::MachineBasicBlock::successors(), and llvm::MachineBasicBlock::terminators().

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

◆ getADDriOpcode()

static unsigned getADDriOpcode ( bool  IsLP64,
int64_t  Imm 
)
static

◆ getADDrrOpcode()

static unsigned getADDrrOpcode ( bool  IsLP64)
static

Definition at line 133 of file X86FrameLowering.cpp.

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

◆ getANDriOpcode()

static unsigned getANDriOpcode ( bool  IsLP64,
int64_t  Imm 
)
static

Definition at line 137 of file X86FrameLowering.cpp.

References llvm::isInt< 8 >().

◆ getHiPELiteral()

static 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 3004 of file X86FrameLowering.cpp.

References llvm::numbers::e, llvm::NamedMDNode::getNumOperands(), and i.

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

◆ getLEArOpcode()

static unsigned getLEArOpcode ( bool  IsLP64)
static

Definition at line 148 of file X86FrameLowering.cpp.

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

◆ GetScratchRegister()

static 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 2719 of file X86FrameLowering.cpp.

References llvm::N86::EAX, llvm::N86::EBX, llvm::N86::ECX, llvm::N86::EDI, llvm::N86::EDX, 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()

static unsigned getSUBriOpcode ( bool  IsLP64,
int64_t  Imm 
)
static

Definition at line 105 of file X86FrameLowering.cpp.

References llvm::isInt< 8 >().

◆ getSUBrrOpcode()

static unsigned getSUBrrOpcode ( bool  IsLP64)
static

Definition at line 129 of file X86FrameLowering.cpp.

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

◆ HasNestArgument()

static bool HasNestArgument ( const MachineFunction MF)
static

◆ isEAXLiveIn()

static bool isEAXLiveIn ( MachineBasicBlock MBB)
static

◆ isFuncletReturnInstr()

static bool isFuncletReturnInstr ( MachineInstr MI)
static

◆ isTailCallOpcode()

static bool isTailCallOpcode ( unsigned  Opc)
static

Definition at line 2009 of file X86FrameLowering.cpp.

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

◆ STATISTIC() [1/2]

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

◆ STATISTIC() [2/2]

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

Variable Documentation

◆ kSplitStackAvailable

const uint64_t kSplitStackAvailable = 256
static