LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 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 getLEArOpcode (unsigned IsLP64)
 
static unsigned findDeadCallerSavedReg (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const TargetRegisterInfo &TRI, bool Is64Bit)
 
static void emitSPUpdate (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, int64_t NumBytes, bool Is64Bit, bool IsLP64, bool UseLEA, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI)
 
static void mergeSPUpdatesUp (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, uint64_t *NumBytes=NULL)
 mergeSPUpdatesUp - Merge two stack-manipulating instructions upper iterator. More...
 
static void mergeSPUpdatesDown (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, uint64_t *NumBytes=NULL)
 mergeSPUpdatesDown - Merge two stack-manipulating instructions lower iterator. More...
 
static int mergeSPUpdates (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, bool doMergeWithPrevious)
 
static bool isEAXLiveIn (MachineFunction &MF)
 
static bool usesTheStack (const MachineFunction &MF)
 
static bool HasNestArgument (const MachineFunction *MF)
 
static unsigned GetScratchRegister (bool Is64Bit, const MachineFunction &MF, bool Primary)
 

Variables

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

Function Documentation

static void emitSPUpdate ( MachineBasicBlock MBB,
MachineBasicBlock::iterator MBBI,
unsigned  StackPtr,
int64_t  NumBytes,
bool  Is64Bit,
bool  IsLP64,
bool  UseLEA,
const TargetInstrInfo TII,
const TargetRegisterInfo TRI 
)
static
static unsigned findDeadCallerSavedReg ( MachineBasicBlock MBB,
MachineBasicBlock::iterator MBBI,
const TargetRegisterInfo TRI,
bool  Is64Bit 
)
static
static unsigned getADDriOpcode ( unsigned  IsLP64,
int64_t  Imm 
)
static
static unsigned getLEArOpcode ( unsigned  IsLP64)
static

Definition at line 82 of file X86FrameLowering.cpp.

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

static unsigned GetScratchRegister ( bool  Is64Bit,
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 1117 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(), and llvm::CallingConv::X86_FastCall.

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

static unsigned getSUBriOpcode ( unsigned  IsLP64,
int64_t  Imm 
)
static
static bool HasNestArgument ( const MachineFunction MF)
static
static bool isEAXLiveIn ( MachineFunction MF)
static
static int mergeSPUpdates ( MachineBasicBlock MBB,
MachineBasicBlock::iterator MBBI,
unsigned  StackPtr,
bool  doMergeWithPrevious 
)
static

mergeSPUpdates - Checks the instruction before/after the passed instruction. If it is an ADD/SUB/LEA instruction it is deleted argument and the stack adjustment is returned as a positive value for ADD/LEA and a negative for SUB.

Definition at line 261 of file X86FrameLowering.cpp.

References llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::erase(), llvm::next(), and llvm::prior().

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

static void mergeSPUpdatesDown ( MachineBasicBlock MBB,
MachineBasicBlock::iterator MBBI,
unsigned  StackPtr,
uint64_t *  NumBytes = NULL 
)
static

mergeSPUpdatesDown - Merge two stack-manipulating instructions lower iterator.

Definition at line 228 of file X86FrameLowering.cpp.

References llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::erase(), and llvm::next().

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

static void mergeSPUpdatesUp ( MachineBasicBlock MBB,
MachineBasicBlock::iterator MBBI,
unsigned  StackPtr,
uint64_t *  NumBytes = NULL 
)
static

mergeSPUpdatesUp - Merge two stack-manipulating instructions upper iterator.

Definition at line 204 of file X86FrameLowering.cpp.

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

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

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

References llvm::MachineFunction::getRegInfo(), MRI, llvm::MachineRegisterInfo::reg_begin(), and llvm::MachineRegisterInfo::reg_end().

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

Variable Documentation

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