LLVM  5.0.0
Macros | Typedefs | Functions | Variables
PrologEpilogInserter.cpp File Reference
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/StackProtector.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <climits>
Include dependency graph for PrologEpilogInserter.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "prologepilog"
 

Typedefs

typedef SmallVector
< MachineBasicBlock *, 4 > 
MBBVector
 
typedef SmallSetVector< int, 8 > StackObjSet
 StackObjSet - A set of stack object indexes. More...
 

Functions

static void doSpillCalleeSavedRegs (MachineFunction &MF, RegScavenger *RS, unsigned &MinCSFrameIndex, unsigned &MaxCXFrameIndex, const MBBVector &SaveBlocks, const MBBVector &RestoreBlocks)
 
 INITIALIZE_PASS_BEGIN (PEI, DEBUG_TYPE,"Prologue/Epilogue Insertion", false, false) INITIALIZE_PASS_END(PEI
 
 STATISTIC (NumBytesStackSpace,"Number of bytes used for stack in all functions")
 
static void assignCalleeSavedSpillSlots (MachineFunction &F, const BitVector &SavedRegs, unsigned &MinCSFrameIndex, unsigned &MaxCSFrameIndex)
 
static void updateLiveness (MachineFunction &MF)
 Helper function to update the liveness information for the callee-saved registers. More...
 
static void insertCSRSpillsAndRestores (MachineFunction &Fn, const MBBVector &SaveBlocks, const MBBVector &RestoreBlocks)
 insertCSRSpillsAndRestores - Insert spill and restore code for callee saved registers used in the function. More...
 
static void AdjustStackOffset (MachineFrameInfo &MFI, int FrameIdx, bool StackGrowsDown, int64_t &Offset, unsigned &MaxAlign, unsigned Skew)
 AdjustStackOffset - Helper function used to adjust the stack frame offset. More...
 
static void computeFreeStackSlots (MachineFrameInfo &MFI, bool StackGrowsDown, unsigned MinCSFrameIndex, unsigned MaxCSFrameIndex, int64_t FixedCSEnd, BitVector &StackBytesFree)
 Compute which bytes of fixed and callee-save stack area are unused and keep track of them in StackBytesFree. More...
 
static bool scavengeStackSlot (MachineFrameInfo &MFI, int FrameIdx, bool StackGrowsDown, unsigned MaxAlign, BitVector &StackBytesFree)
 Assign frame object to an unused portion of the stack in the fixed stack object range. More...
 
static void AssignProtectedObjSet (const StackObjSet &UnassignedObjs, SmallSet< int, 16 > &ProtectedObjs, MachineFrameInfo &MFI, bool StackGrowsDown, int64_t &Offset, unsigned &MaxAlign, unsigned Skew)
 AssignProtectedObjSet - Helper function to assign large stack objects (i.e., those required to be close to the Stack Protector) to stack offsets. More...
 

Variables

static cl::opt< unsigned > WarnStackSize ("warn-stack-size", cl::Hidden, cl::init((unsigned)-1), cl::desc("Warn for stack size bigger than the given"" number"))
 
 DEBUG_TYPE
 
Prologue Epilogue Insertion &Frame Finalization
 
Prologue Epilogue Insertion &Frame false
 

Macro Definition Documentation

#define DEBUG_TYPE   "prologepilog"

Definition at line 48 of file PrologEpilogInserter.cpp.

Typedef Documentation

Definition at line 50 of file PrologEpilogInserter.cpp.

typedef SmallSetVector<int, 8> StackObjSet

StackObjSet - A set of stack object indexes.

Definition at line 156 of file PrologEpilogInserter.cpp.

Function Documentation

static void AdjustStackOffset ( MachineFrameInfo &  MFI,
int  FrameIdx,
bool  StackGrowsDown,
int64_t &  Offset,
unsigned &  MaxAlign,
unsigned  Skew 
)
inlinestatic
static void assignCalleeSavedSpillSlots ( MachineFunction &  F,
const BitVector &  SavedRegs,
unsigned &  MinCSFrameIndex,
unsigned &  MaxCSFrameIndex 
)
static
static void AssignProtectedObjSet ( const StackObjSet &  UnassignedObjs,
SmallSet< int, 16 > &  ProtectedObjs,
MachineFrameInfo &  MFI,
bool  StackGrowsDown,
int64_t &  Offset,
unsigned &  MaxAlign,
unsigned  Skew 
)
static

AssignProtectedObjSet - Helper function to assign large stack objects (i.e., those required to be close to the Stack Protector) to stack offsets.

Definition at line 691 of file PrologEpilogInserter.cpp.

References AdjustStackOffset(), llvm::SetVector< T, Vector, Set >::begin(), E, llvm::SetVector< T, Vector, Set >::end(), I, and llvm::SmallSet< T, N, C >::insert().

static void computeFreeStackSlots ( MachineFrameInfo &  MFI,
bool  StackGrowsDown,
unsigned  MinCSFrameIndex,
unsigned  MaxCSFrameIndex,
int64_t  FixedCSEnd,
BitVector &  StackBytesFree 
)
inlinestatic
static void doSpillCalleeSavedRegs ( MachineFunction &  MF,
RegScavenger *  RS,
unsigned &  MinCSFrameIndex,
unsigned &  MaxCXFrameIndex,
const MBBVector &  SaveBlocks,
const MBBVector &  RestoreBlocks 
)
static
INITIALIZE_PASS_BEGIN ( PEI  ,
DEBUG_TYPE  ,
"Prologue/Epilogue Insertion"  ,
false  ,
false   
)
static void insertCSRSpillsAndRestores ( MachineFunction &  Fn,
const MBBVector &  SaveBlocks,
const MBBVector &  RestoreBlocks 
)
static
static bool scavengeStackSlot ( MachineFrameInfo &  MFI,
int  FrameIdx,
bool  StackGrowsDown,
unsigned  MaxAlign,
BitVector &  StackBytesFree 
)
inlinestatic
STATISTIC ( NumBytesStackSpace  ,
"Number of bytes used for stack in all functions"   
)
static void updateLiveness ( MachineFunction &  MF)
static

Variable Documentation

DEBUG_TYPE

Definition at line 135 of file PrologEpilogInserter.cpp.

Prologue Epilogue Insertion& Frame false

Definition at line 135 of file PrologEpilogInserter.cpp.

Prologue Epilogue Insertion& Frame Finalization

Definition at line 135 of file PrologEpilogInserter.cpp.

cl::opt<unsigned> WarnStackSize("warn-stack-size", cl::Hidden, cl::init((unsigned)-1), cl::desc("Warn for stack size bigger than the given"" number"))
static