LLVM  3.7.0
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/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/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/Debug.h"
#include <cstdlib>
Include dependency graph for X86FrameLowering.cpp:

Go to the source code of this file.

Functions

static unsigned getSUBriOpcode (unsigned IsLP64, int64_t Imm)
 
static unsigned getADDriOpcode (unsigned IsLP64, int64_t Imm)
 
static unsigned getSUBrrOpcode (unsigned isLP64)
 
static unsigned getADDrrOpcode (unsigned isLP64)
 
static unsigned getANDriOpcode (bool IsLP64, int64_t Imm)
 
static unsigned getLEArOpcode (unsigned IsLP64)
 
static unsigned findDeadCallerSavedReg (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const TargetRegisterInfo *TRI, bool Is64Bit)
 findDeadCallerSavedReg - Return a caller-saved register that isn't live when it reaches the "return" instruction. More...
 
static bool isEAXLiveIn (MachineFunction &MF)
 
static bool terminatorsNeedFlagsAsInput (const MachineBasicBlock &MBB)
 Check whether or not the terminators of MBB needs to read EFLAGS. More...
 
static void mergeSPUpdatesUp (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, uint64_t *NumBytes=nullptr)
 mergeSPUpdatesUp - Merge two stack-manipulating instructions upper iterator. More...
 
static bool usesTheStack (const MachineFunction &MF)
 usesTheStack - This function checks if any of the users of EFLAGS copies the EFLAGS. More...
 
static unsigned calculateSetFPREG (uint64_t SPAdjust)
 
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...
 

Variables

cl::opt< boolForceStackAlign
 
static const uint64_t kSplitStackAvailable = 256
 

Function Documentation

static unsigned calculateSetFPREG ( uint64_t  SPAdjust)
static
static unsigned findDeadCallerSavedReg ( MachineBasicBlock MBB,
MachineBasicBlock::iterator MBBI,
const TargetRegisterInfo TRI,
bool  Is64Bit 
)
static

findDeadCallerSavedReg - Return a caller-saved register that isn't live when it reaches the "return" instruction.

We can then pop a stack object to this register without worry about clobbering it.

Definition at line 149 of file X86FrameLowering.cpp.

References llvm::MachineModuleInfo::callsEHReturn(), llvm::SmallSet< T, N, C >::count(), llvm::CS, llvm::ISD::EH_RETURN, F(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getMMI(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::SmallSet< T, N, C >::insert(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), and llvm::MCRegAliasIterator::isValid().

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

static unsigned getADDriOpcode ( unsigned  IsLP64,
int64_t  Imm 
)
static

Definition at line 111 of file X86FrameLowering.cpp.

References llvm::isInt< 8 >().

static unsigned getADDrrOpcode ( unsigned  isLP64)
static

Definition at line 127 of file X86FrameLowering.cpp.

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

static unsigned getANDriOpcode ( bool  IsLP64,
int64_t  Imm 
)
static

Definition at line 131 of file X86FrameLowering.cpp.

References llvm::isInt< 8 >().

static unsigned getLEArOpcode ( unsigned  IsLP64)
static

Definition at line 142 of file X86FrameLowering.cpp.

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

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

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

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

static unsigned getSUBriOpcode ( unsigned  IsLP64,
int64_t  Imm 
)
static

Definition at line 99 of file X86FrameLowering.cpp.

References llvm::isInt< 8 >().

static unsigned getSUBrrOpcode ( unsigned  isLP64)
static

Definition at line 123 of file X86FrameLowering.cpp.

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

static bool HasNestArgument ( const MachineFunction MF)
static
static bool isEAXLiveIn ( MachineFunction MF)
static
static void mergeSPUpdatesUp ( MachineBasicBlock MBB,
MachineBasicBlock::iterator MBBI,
unsigned  StackPtr,
uint64_t *  NumBytes = nullptr 
)
static

mergeSPUpdatesUp - Merge two stack-manipulating instructions upper iterator.

Definition at line 352 of file X86FrameLowering.cpp.

References llvm::MachineBasicBlock::begin(), and llvm::MachineBasicBlock::erase().

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

static bool terminatorsNeedFlagsAsInput ( const MachineBasicBlock MBB)
static

Check whether or not the terminators of MBB needs to read EFLAGS.

Definition at line 218 of file X86FrameLowering.cpp.

References llvm::AArch64CC::MI, and llvm::MachineBasicBlock::terminators().

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

static bool usesTheStack ( const MachineFunction MF)
static

usesTheStack - This function checks if any of the users of EFLAGS copies the EFLAGS.

We know that the code that lowers COPY of EFLAGS has to use the stack, and if we don't adjust the stack we clobber the first frame index. See X86InstrInfo::copyPhysReg.

Definition at line 444 of file X86FrameLowering.cpp.

References llvm::MachineFunction::getRegInfo(), llvm::MachineRegisterInfo::reg_instr_begin(), and llvm::MachineRegisterInfo::reg_instr_end().

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

Variable Documentation

cl::opt<bool> ForceStackAlign
const uint64_t kSplitStackAvailable = 256
static