LLVM 22.0.0git
|
#include "RISCVFrameLowering.h"
#include "MCTargetDesc/RISCVBaseInfo.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVSubtarget.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/CFIInstBuilder.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/Support/LEB128.h"
#include <algorithm>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "riscv-frame" |
Variables | |
static constexpr MCPhysReg | FPReg = RISCV::X8 |
static constexpr MCPhysReg | SPReg = RISCV::X2 |
static constexpr MCPhysReg | RAReg = RISCV::X1 |
static const MCPhysReg | FixedCSRFIMap [] |
static constexpr uint64_t | QCIInterruptPushAmount = 96 |
static const std::pair< MCPhysReg, int8_t > | FixedCSRFIQCIInterruptMap [] |
#define DEBUG_TYPE "riscv-frame" |
Definition at line 31 of file RISCVFrameLowering.cpp.
|
static |
Definition at line 674 of file RISCVFrameLowering.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::encodeSLEB128(), llvm::encodeULEB128(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and TRI.
Referenced by createDefCFAExpression(), and createDefCFAOffset().
|
static |
Definition at line 701 of file RISCVFrameLowering.cpp.
References llvm::SmallString< InternalLen >::append(), appendScalableVectorExpression(), assert(), llvm::MCCFIInstruction::createEscape(), llvm::encodeULEB128(), llvm::printReg(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), Reg, llvm::SmallVectorTemplateCommon< T, typename >::size(), SPReg, llvm::SmallString< InternalLen >::str(), and TRI.
|
static |
Definition at line 731 of file RISCVFrameLowering.cpp.
References llvm::SmallString< InternalLen >::append(), appendScalableVectorExpression(), assert(), llvm::MCCFIInstruction::createEscape(), llvm::encodeULEB128(), llvm::printReg(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), Reg, llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::SmallString< InternalLen >::str(), and TRI.
|
static |
Definition at line 251 of file RISCVFrameLowering.cpp.
References llvm::MachineFrameInfo::CreateStackObject(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::RISCVMachineFunctionInfo::isSiFivePreemptibleInterrupt(), llvm::RISCVMachineFunctionInfo::pushInterruptCSRFrameIndex(), and TRI.
Referenced by llvm::RISCVFrameLowering::determineCalleeSaves().
|
static |
Definition at line 181 of file RISCVFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::CFIInstBuilder::buildRestore(), llvm::RegState::Define, DL, llvm::MachineInstr::FrameDestroy, llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::CalleeSavedInfo::getReg(), llvm::RISCVABI::getSCSPReg(), llvm::MachineFunction::getSubtarget(), llvm::Function::hasFnAttribute(), MBB, MI, needsDwarfCFI(), llvm::none_of(), RAReg, llvm::MachineInstrBuilder::setMIFlag(), and TII.
Referenced by llvm::RISCVFrameLowering::emitEpilogue().
|
static |
Definition at line 105 of file RISCVFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::CFIInstBuilder::buildEscape(), llvm::BuildMI(), llvm::RegState::Define, DL, llvm::MachineInstr::FrameSetup, llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::CalleeSavedInfo::getReg(), llvm::RISCVABI::getSCSPReg(), llvm::MachineFunction::getSubtarget(), llvm::Function::hasFnAttribute(), MBB, MI, needsDwarfCFI(), llvm::none_of(), llvm::Offset, RAReg, llvm::MachineInstrBuilder::setMIFlag(), TII, and TRI.
Referenced by llvm::RISCVFrameLowering::emitPrologue().
|
static |
Definition at line 323 of file RISCVFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::RegState::Define, DL, llvm::MachineInstr::FrameSetup, llvm::MachineFunction::getInfo(), llvm::MachineFunction::getSubtarget(), llvm::RegState::Kill, MBB, MBBI, llvm::MachineInstrBuilder::setMIFlag(), and TII.
Referenced by llvm::RISCVFrameLowering::emitEpilogue().
|
static |
Definition at line 271 of file RISCVFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::RegState::Define, DL, llvm::MachineInstr::FrameSetup, llvm::MachineFunction::getInfo(), llvm::MachineFunction::getSubtarget(), MBB, MBBI, llvm::MachineInstrBuilder::setMIFlag(), and TII.
Referenced by llvm::RISCVFrameLowering::emitPrologue().
|
static |
Definition at line 228 of file RISCVFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), llvm::RegState::Define, DL, llvm::MachineInstr::FrameSetup, llvm::MachineFunction::getInfo(), llvm::MachineFunction::getSubtarget(), llvm::RegState::Kill, MBB, MBBI, llvm::MachineInstrBuilder::setMIFlag(), SPReg, and TII.
Referenced by llvm::RISCVFrameLowering::emitEpilogue(), and llvm::RISCVFrameLowering::emitPrologue().
|
static |
Definition at line 2408 of file RISCVFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), assert(), llvm::BuildMI(), llvm::MachineFunction::CreateMachineBasicBlock(), DL, llvm::MachineBasicBlock::end(), llvm::MachineInstr::FrameSetup, llvm::fullyRecomputeLiveIns(), llvm::RISCVTargetLowering::getStackProbeSize(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::insert(), MBB, MBBI, llvm::MachineInstrBuilder::setMIFlags(), llvm::MachineBasicBlock::splice(), SPReg, TII, and llvm::MachineBasicBlock::transferSuccessorsAndUpdatePHIs().
|
static |
Definition at line 1761 of file RISCVFrameLowering.cpp.
References llvm::MachineFunction::getSubtarget(), MBB, MI, and TII.
|
static |
Definition at line 35 of file RISCVFrameLowering.cpp.
References llvm::RISCVABI::ABI_ILP32E, and llvm::RISCVABI::ABI_LP64E.
Referenced by llvm::RISCVFrameLowering::RISCVFrameLowering().
Definition at line 2188 of file RISCVFrameLowering.cpp.
|
static |
Definition at line 374 of file RISCVFrameLowering.cpp.
References FPReg, llvm::MachineFunction::getInfo(), llvm::MCRegister::id(), llvm_unreachable, and RAReg.
Referenced by llvm::RISCVFrameLowering::assignCalleeSavedSpillSlots(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitPrologue(), getRestoreLibCallName(), and getSpillLibCallName().
|
static |
Definition at line 467 of file RISCVFrameLowering.cpp.
References assert(), llvm::find_if(), FixedCSRFIMap, and P.
Referenced by llvm::RISCVFrameLowering::assignCalleeSavedSpillSlots().
|
static |
Definition at line 902 of file RISCVFrameLowering.cpp.
References llvm_unreachable, llvm::RISCVMachineFunctionInfo::StdExtZcmp, and llvm::RISCVMachineFunctionInfo::VendorXqccmp.
Referenced by llvm::RISCVFrameLowering::restoreCalleeSavedRegisters().
|
static |
Definition at line 890 of file RISCVFrameLowering.cpp.
References llvm_unreachable, llvm::RISCVMachineFunctionInfo::StdExtZcmp, and llvm::RISCVMachineFunctionInfo::VendorXqccmp.
Referenced by llvm::RISCVFrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 583 of file RISCVFrameLowering.cpp.
References FixedCSRFIMap, FixedCSRFIQCIInterruptMap, llvm::MachineFunction::getInfo(), llvm::is_contained(), and llvm::make_first_range().
Referenced by llvm::RISCVFrameLowering::emitEpilogue(), and llvm::RISCVFrameLowering::emitPrologue().
|
static |
Definition at line 610 of file RISCVFrameLowering.cpp.
References FixedCSRFIQCIInterruptMap, llvm::MachineFunction::getInfo(), llvm::is_contained(), and llvm::make_first_range().
Referenced by llvm::RISCVFrameLowering::emitPrologue().
|
static |
Definition at line 442 of file RISCVFrameLowering.cpp.
References getLibCallID().
Referenced by llvm::RISCVFrameLowering::restoreCalleeSavedRegisters().
|
static |
Definition at line 1558 of file RISCVFrameLowering.cpp.
Referenced by llvm::RISCVFrameLowering::determineCalleeSaves().
|
static |
Definition at line 568 of file RISCVFrameLowering.cpp.
References llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getStackID(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::TargetStackID::ScalableVector.
Referenced by llvm::RISCVFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), and llvm::RISCVFrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 1698 of file RISCVFrameLowering.cpp.
References llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getStackID(), llvm::MachineFunction::getSubtarget(), llvm::RISCVSubtarget::hasVInstructions(), llvm::RISCV::isRVVSpill(), MBB, MI, and llvm::TargetStackID::ScalableVector.
Referenced by llvm::RISCVFrameLowering::processFunctionBeforeFrameFinalized().
|
static |
Definition at line 415 of file RISCVFrameLowering.cpp.
References getLibCallID().
Referenced by llvm::RISCVFrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 553 of file RISCVFrameLowering.cpp.
References llvm::TargetStackID::Default, llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getStackID(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::RISCVFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::getFrameIndexReference(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), and llvm::RISCVFrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 1742 of file RISCVFrameLowering.cpp.
References llvm::MachineFunction::getSubtarget().
Referenced by llvm::RISCVFrameLowering::hasReservedCallFrame(), and llvm::RISCVFrameLowering::processFunctionBeforeFrameFinalized().
Definition at line 878 of file RISCVFrameLowering.cpp.
Referenced by llvm::RISCVFrameLowering::emitEpilogue(), getPopRetOpcode(), and INITIALIZE_PASS().
Definition at line 867 of file RISCVFrameLowering.cpp.
Referenced by llvm::RISCVFrameLowering::emitPrologue().
|
static |
Returns true if DWARF CFI instructions ("frame moves") should be emitted.
Definition at line 99 of file RISCVFrameLowering.cpp.
References llvm::MachineFunction::needsFrameMoves().
Referenced by llvm::RISCVFrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitPrologue(), emitSCSEpilogue(), and emitSCSPrologue().
Definition at line 63 of file RISCVFrameLowering.cpp.
Referenced by llvm::RISCVFrameLowering::assignCalleeSavedSpillSlots(), getNumPushPopRegs(), getPushOrLibCallsSavedInfo(), llvm::RISCVFrameLowering::restoreCalleeSavedRegisters(), and llvm::RISCVFrameLowering::spillCalleeSavedRegisters().
Definition at line 74 of file RISCVFrameLowering.cpp.
Referenced by llvm::RISCVFrameLowering::assignCalleeSavedSpillSlots(), getPushOrLibCallsSavedInfo(), getQCISavedInfo(), and llvm::RISCVFrameLowering::spillCalleeSavedRegisters().
|
staticconstexpr |
Definition at line 51 of file RISCVFrameLowering.cpp.
Referenced by llvm::M68kFrameLowering::assignCalleeSavedSpillSlots(), llvm::X86FrameLowering::assignCalleeSavedSpillSlots(), llvm::RISCVFrameLowering::determineCalleeSaves(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), llvm::CSKYFrameLowering::emitEpilogue(), llvm::PPCFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::CSKYFrameLowering::emitPrologue(), llvm::LoongArchFrameLowering::emitPrologue(), llvm::PPCFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::getFrameIndexReference(), getLibCallID(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::PPCFrameLowering::processFunctionBeforeFrameFinalized(), llvm::PPCFrameLowering::replaceFPWithRealFP(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), and llvm::Thumb1FrameLowering::spillCalleeSavedRegisters().
|
staticconstexpr |
Definition at line 72 of file RISCVFrameLowering.cpp.
Referenced by llvm::RISCVFrameLowering::assignCalleeSavedSpillSlots(), and llvm::RISCVFrameLowering::emitPrologue().
|
staticconstexpr |
Definition at line 57 of file RISCVFrameLowering.cpp.
Referenced by llvm::RISCVFrameLowering::determineCalleeSaves(), emitSCSEpilogue(), emitSCSPrologue(), and getLibCallID().
|
staticconstexpr |
Definition at line 54 of file RISCVFrameLowering.cpp.
Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::RISCVFrameLowering::allocateStack(), llvm::AMDGPURegisterBankInfo::applyMappingDynStackAlloc(), createDefCFAExpression(), llvm::CSKYFrameLowering::eliminateCallFramePseudoInstr(), llvm::LoongArchFrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVFrameLowering::eliminateCallFramePseudoInstr(), llvm::SIFrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVTargetLowering::emitDynamicProbedAlloc(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), llvm::CSKYFrameLowering::emitEpilogue(), llvm::LoongArchFrameLowering::emitEpilogue(), llvm::PPCFrameLowering::emitEpilogue(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::SystemZXPLINKFrameLowering::emitEpilogue(), llvm::WebAssemblyFrameLowering::emitEpilogue(), llvm::PPCTargetLowering::emitProbedAlloca(), llvm::CSKYFrameLowering::emitPrologue(), llvm::LoongArchFrameLowering::emitPrologue(), llvm::PPCFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::WebAssemblyFrameLowering::emitPrologue(), emitSiFiveCLICStackSwap(), emitStackProbeInline(), llvm::LegalizerHelper::getDynStackAllocTargetPtr(), llvm::RISCVFrameLowering::getFrameIndexReference(), M68kOutgoingArgHandler::getStackAddress(), llvm::PPCFrameLowering::inlineStackProbe(), llvm::PPCInstrInfo::isTOCSaveMI(), llvm::LanaiTargetLowering::LowerDYNAMIC_STACKALLOC(), llvm::SITargetLowering::LowerDYNAMIC_STACKALLOC(), LowerDYNAMIC_STACKALLOC(), and llvm::LegalizerHelper::lowerDynStackAlloc().