LLVM  8.0.1
Macros | Functions | Variables
AArch64FrameLowering.cpp File Reference
#include "AArch64FrameLowering.h"
#include "AArch64InstrInfo.h"
#include "AArch64MachineFunctionInfo.h"
#include "AArch64RegisterInfo.h"
#include "AArch64Subtarget.h"
#include "AArch64TargetMachine.h"
#include "MCTargetDesc/AArch64AddressingModes.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include <cassert>
#include <cstdint>
#include <iterator>
#include <vector>
Include dependency graph for AArch64FrameLowering.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "frame-info"
 

Functions

 STATISTIC (NumRedZoneFunctions, "Number of functions using red zone")
 
static unsigned estimateRSStackSizeLimit (MachineFunction &MF)
 Look at each instruction that references stack frames and return the stack size limit beyond which some of these instructions will require a scratch register during their expansion later. More...
 
static bool ShouldSignReturnAddress (MachineFunction &MF)
 
static unsigned findScratchNonCalleeSaveRegister (MachineBasicBlock *MBB)
 
static bool windowsRequiresStackProbe (MachineFunction &MF, unsigned StackSizeInBytes)
 
static MachineBasicBlock::iterator InsertSEH (MachineBasicBlock::iterator MBBI, const TargetInstrInfo &TII, MachineInstr::MIFlag Flag)
 
static void fixupSEHOpcode (MachineBasicBlock::iterator MBBI, unsigned LocalStackSize)
 
static MachineBasicBlock::iterator convertCalleeSaveRestoreToSPPrePostIncDec (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, const TargetInstrInfo *TII, int CSStackSizeInc, bool NeedsWinCFI, bool InProlog=true)
 
static void fixupCalleeSaveRestoreStackOffset (MachineInstr &MI, unsigned LocalStackSize, bool NeedsWinCFI)
 
static void adaptForLdStOpt (MachineBasicBlock &MBB, MachineBasicBlock::iterator FirstSPPopI, MachineBasicBlock::iterator LastPopI)
 
static bool ShouldSignWithAKey (MachineFunction &MF)
 
static bool needsWinCFI (const MachineFunction &MF)
 
static void InsertReturnAddressAuth (MachineFunction &MF, MachineBasicBlock &MBB)
 
static bool isFuncletReturnInstr (const MachineInstr &MI)
 
static unsigned getPrologueDeath (MachineFunction &MF, unsigned Reg)
 
static bool produceCompactUnwindFrame (MachineFunction &MF)
 
static bool invalidateWindowsRegisterPairing (unsigned Reg1, unsigned Reg2, bool NeedsWinCFI)
 
static void computeCalleeSaveRegisterPairs (MachineFunction &MF, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI, SmallVectorImpl< RegPairInfo > &RegPairs, bool &NeedShadowCallStackProlog)
 

Variables

static cl::opt< boolEnableRedZone ("aarch64-redzone", cl::desc("enable use of redzone on AArch64"), cl::init(false), cl::Hidden)
 
static cl::opt< boolReverseCSRRestoreSeq ("reverse-csr-restore-seq", cl::desc("reverse the CSR restore sequence"), cl::init(false), cl::Hidden)
 
static const unsigned DefaultSafeSPDisplacement = 255
 This is the biggest offset to the stack pointer we can encode in aarch64 instructions (without using a separate calculation and a temp register). More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "frame-info"

Definition at line 140 of file AArch64FrameLowering.cpp.

Function Documentation

◆ adaptForLdStOpt()

static void adaptForLdStOpt ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  FirstSPPopI,
MachineBasicBlock::iterator  LastPopI 
)
static

◆ computeCalleeSaveRegisterPairs()

static void computeCalleeSaveRegisterPairs ( MachineFunction MF,
const std::vector< CalleeSavedInfo > &  CSI,
const TargetRegisterInfo TRI,
SmallVectorImpl< RegPairInfo > &  RegPairs,
bool NeedShadowCallStackProlog 
)
static

◆ convertCalleeSaveRestoreToSPPrePostIncDec()

static MachineBasicBlock::iterator convertCalleeSaveRestoreToSPPrePostIncDec ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MBBI,
const DebugLoc DL,
const TargetInstrInfo TII,
int  CSStackSizeInc,
bool  NeedsWinCFI,
bool  InProlog = true 
)
static

◆ estimateRSStackSizeLimit()

static unsigned estimateRSStackSizeLimit ( MachineFunction MF)
static

Look at each instruction that references stack frames and return the stack size limit beyond which some of these instructions will require a scratch register during their expansion later.

Definition at line 162 of file AArch64FrameLowering.cpp.

References llvm::AArch64FrameOffsetCannotUpdate, DefaultSafeSPDisplacement, llvm::isAArch64FrameOffsetLegal(), and MI.

Referenced by llvm::AArch64FrameLowering::determineCalleeSaves().

◆ findScratchNonCalleeSaveRegister()

static unsigned findScratchNonCalleeSaveRegister ( MachineBasicBlock MBB)
static

◆ fixupCalleeSaveRestoreStackOffset()

static void fixupCalleeSaveRestoreStackOffset ( MachineInstr MI,
unsigned  LocalStackSize,
bool  NeedsWinCFI 
)
static

◆ fixupSEHOpcode()

static void fixupSEHOpcode ( MachineBasicBlock::iterator  MBBI,
unsigned  LocalStackSize 
)
static

◆ getPrologueDeath()

static unsigned getPrologueDeath ( MachineFunction MF,
unsigned  Reg 
)
static

◆ InsertReturnAddressAuth()

static void InsertReturnAddressAuth ( MachineFunction MF,
MachineBasicBlock MBB 
)
static

◆ InsertSEH()

◆ invalidateWindowsRegisterPairing()

static bool invalidateWindowsRegisterPairing ( unsigned  Reg1,
unsigned  Reg2,
bool  NeedsWinCFI 
)
static

Definition at line 1580 of file AArch64FrameLowering.cpp.

References llvm::GPR.

Referenced by computeCalleeSaveRegisterPairs().

◆ isFuncletReturnInstr()

static bool isFuncletReturnInstr ( const MachineInstr MI)
static

◆ needsWinCFI()

static bool needsWinCFI ( const MachineFunction MF)
static

◆ produceCompactUnwindFrame()

static bool produceCompactUnwindFrame ( MachineFunction MF)
static

◆ ShouldSignReturnAddress()

static bool ShouldSignReturnAddress ( MachineFunction MF)
static

◆ ShouldSignWithAKey()

static bool ShouldSignWithAKey ( MachineFunction MF)
static

◆ STATISTIC()

STATISTIC ( NumRedZoneFunctions  ,
"Number of functions using red zone"   
)

◆ windowsRequiresStackProbe()

static bool windowsRequiresStackProbe ( MachineFunction MF,
unsigned  StackSizeInBytes 
)
static

Variable Documentation

◆ DefaultSafeSPDisplacement

const unsigned DefaultSafeSPDisplacement = 255
static

This is the biggest offset to the stack pointer we can encode in aarch64 instructions (without using a separate calculation and a temp register).

Note that the exception here are vector stores/loads which cannot encode any displacements (see estimateRSStackSizeLimit(), isAArch64FrameOffsetLegal()).

Definition at line 157 of file AArch64FrameLowering.cpp.

Referenced by estimateRSStackSizeLimit(), and llvm::AArch64FrameLowering::hasFP().

◆ EnableRedZone

cl::opt<bool> EnableRedZone("aarch64-redzone", cl::desc("enable use of redzone on AArch64"), cl::init(false), cl::Hidden)
static

◆ ReverseCSRRestoreSeq

cl::opt<bool> ReverseCSRRestoreSeq("reverse-csr-restore-seq", cl::desc("reverse the CSR restore sequence"), cl::init(false), cl::Hidden)
static