LLVM
8.0.1
|
#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>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "frame-info" |
Variables | |
static cl::opt< bool > | EnableRedZone ("aarch64-redzone", cl::desc("enable use of redzone on AArch64"), cl::init(false), cl::Hidden) |
static cl::opt< bool > | ReverseCSRRestoreSeq ("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... | |
#define DEBUG_TYPE "frame-info" |
Definition at line 140 of file AArch64FrameLowering.cpp.
|
static |
Definition at line 747 of file AArch64FrameLowering.cpp.
References ReverseCSRRestoreSeq, and llvm::MachineBasicBlock::splice().
Referenced by llvm::AArch64FrameLowering::emitEpilogue().
|
static |
Definition at line 1613 of file AArch64FrameLowering.cpp.
References assert(), contains(), llvm::AArch64FunctionInfo::getCalleeSavedStackSize(), llvm::Function::getCallingConv(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::MachineFunction::getSubtarget(), llvm::GPR, llvm::AArch64FunctionInfo::hasCalleeSaveStackFreeSpace(), llvm::Function::hasFnAttribute(), invalidateWindowsRegisterPairing(), llvm::AArch64Subtarget::isXRegisterReserved(), llvm_unreachable, needsWinCFI(), llvm::CallingConv::PreserveMost, produceCompactUnwindFrame(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::report_fatal_error(), llvm::NVPTX::PTXCvtMode::RPI, and llvm::Attribute::ShadowCallStack.
Referenced by llvm::AArch64FrameLowering::restoreCalleeSavedRegisters(), and llvm::AArch64FrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 592 of file AArch64FrameLowering.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), llvm::RegState::Define, llvm::MachineBasicBlock::erase(), llvm::MachineInstr::FrameDestroy, llvm::MachineInstr::FrameSetup, llvm::MCInstrInfo::get(), InsertSEH(), llvm::AArch64InstrInfo::isSEHInstruction(), llvm_unreachable, llvm::MachineInstrBuilder::setMemRefs(), and llvm::MachineInstrBuilder::setMIFlags().
Referenced by llvm::AArch64FrameLowering::emitEpilogue(), and llvm::AArch64FrameLowering::emitPrologue().
|
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().
|
static |
Definition at line 357 of file AArch64FrameLowering.cpp.
References llvm::LivePhysRegs::addLiveIns(), llvm::LivePhysRegs::addReg(), llvm::LivePhysRegs::available(), llvm::MachineFunction::front(), llvm::MachineRegisterInfo::getCalleeSavedRegs(), llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getRegInfo(), llvm::AArch64Subtarget::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), MRI, Reg, and TRI.
Referenced by llvm::AArch64FrameLowering::canUseAsPrologue().
|
static |
Definition at line 690 of file AArch64FrameLowering.cpp.
References assert(), llvm::MachineBasicBlock::end(), fixupSEHOpcode(), llvm::MachineInstr::getNumExplicitOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::AArch64InstrInfo::isSEHInstruction(), and llvm_unreachable.
Referenced by llvm::AArch64FrameLowering::emitEpilogue().
|
static |
Definition at line 570 of file AArch64FrameLowering.cpp.
References llvm::MachineOperand::getImm(), llvm_unreachable, and llvm::MachineOperand::setImm().
Referenced by fixupCalleeSaveRestoreStackOffset().
|
static |
Definition at line 1562 of file AArch64FrameLowering.cpp.
References llvm::getKillRegState(), llvm::MachineFunction::getRegInfo(), and llvm::MachineRegisterInfo::isLiveIn().
Referenced by llvm::AArch64FrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 1189 of file AArch64FrameLowering.cpp.
References llvm::BuildMI(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::erase(), llvm::MachineInstr::FrameDestroy, llvm::MDNode::get(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::AArch64Subtarget::getInstrInfo(), llvm::MachineFunction::getSubtarget(), llvm::AArch64Subtarget::hasV8_3aOps(), ShouldSignReturnAddress(), ShouldSignWithAKey(), and TII.
Referenced by llvm::AArch64FrameLowering::emitEpilogue().
|
static |
Definition at line 450 of file AArch64FrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), llvm::MCInstrInfo::get(), llvm::MachineBasicBlock::getParent(), llvm::AArch64Subtarget::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::MachineBasicBlock::insertAfter(), LLVM_FALLTHROUGH, llvm_unreachable, Reg, and llvm::MachineInstrBuilder::setMIFlag().
Referenced by convertCalleeSaveRestoreToSPPrePostIncDec(), llvm::AArch64FrameLowering::restoreCalleeSavedRegisters(), and llvm::AArch64FrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 1580 of file AArch64FrameLowering.cpp.
References llvm::GPR.
Referenced by computeCalleeSaveRegisterPairs().
|
static |
Definition at line 1219 of file AArch64FrameLowering.cpp.
References llvm::ISD::CATCHRET, llvm::ISD::CLEANUPRET, and llvm::MachineInstr::getOpcode().
Referenced by llvm::AArch64FrameLowering::emitEpilogue().
|
static |
Definition at line 790 of file AArch64FrameLowering.cpp.
References F(), llvm::MachineFunction::getFunction(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFunction::getTarget(), llvm::Function::needsUnwindTableEntry(), and llvm::MCAsmInfo::usesWindowsCFI().
Referenced by computeCalleeSaveRegisterPairs(), llvm::AArch64FrameLowering::emitEpilogue(), llvm::AArch64FrameLowering::emitPrologue(), llvm::AArch64FrameLowering::restoreCalleeSavedRegisters(), and llvm::AArch64FrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 1572 of file AArch64FrameLowering.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Key::Attrs, llvm::Function::getAttributes(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getSubtarget(), llvm::AArch64Subtarget::getTargetLowering(), llvm::AArch64Subtarget::isTargetMachO(), llvm::AArch64TargetLowering::supportSwiftError(), and llvm::Attribute::SwiftError.
Referenced by computeCalleeSaveRegisterPairs(), and llvm::AArch64FrameLowering::determineCalleeSaves().
|
static |
Definition at line 294 of file AArch64FrameLowering.cpp.
References assert(), llvm::StringRef::equals(), F(), llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::Function::getFnAttribute(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::Attribute::getValueAsString(), llvm::Function::hasFnAttribute(), and Info.
Referenced by llvm::AArch64FrameLowering::emitPrologue(), and InsertReturnAddressAuth().
|
static |
Definition at line 779 of file AArch64FrameLowering.cpp.
References assert(), llvm::StringRef::equals_lower(), F(), llvm::Function::getFnAttribute(), llvm::MachineFunction::getFunction(), llvm::Attribute::getValueAsString(), and llvm::Function::hasFnAttribute().
Referenced by llvm::AArch64FrameLowering::emitPrologue(), and InsertReturnAddressAuth().
STATISTIC | ( | NumRedZoneFunctions | , |
"Number of functions using red zone" | |||
) |
|
static |
Definition at line 401 of file AArch64FrameLowering.cpp.
References llvm::AArch64FrameLowering::canUseRedZone(), F(), llvm::StringRef::getAsInteger(), llvm::Function::getFnAttribute(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::AArch64FunctionInfo::getLocalStackSize(), llvm::AArch64Subtarget::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::Attribute::getValueAsString(), llvm::Function::hasFnAttribute(), and llvm::AArch64Subtarget::isTargetWindows().
Referenced by llvm::AArch64FrameLowering::determineCalleeSaves(), and llvm::AArch64FrameLowering::emitPrologue().
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().
|
static |
Referenced by llvm::AArch64FrameLowering::canUseRedZone().
|
static |
Referenced by adaptForLdStOpt(), and llvm::AArch64FrameLowering::restoreCalleeSavedRegisters().