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 663 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 690 of file RISCVFrameLowering.cpp.
References llvm::SmallString< InternalLen >::append(), appendScalableVectorExpression(), assert(), llvm::MCCFIInstruction::createEscape(), llvm::encodeULEB128(), llvm::printReg(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), SPReg, llvm::SmallString< InternalLen >::str(), and TRI.
|
static |
Definition at line 720 of file RISCVFrameLowering.cpp.
References llvm::SmallString< InternalLen >::append(), appendScalableVectorExpression(), assert(), llvm::MCCFIInstruction::createEscape(), llvm::encodeULEB128(), llvm::printReg(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), llvm::SmallString< InternalLen >::str(), and TRI.
|
static |
Definition at line 240 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 170 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 312 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, llvm::HexagonInstrInfo::loadRegFromStackSlot(), MBB, MBBI, llvm::MachineInstrBuilder::setMIFlag(), and TII.
Referenced by llvm::RISCVFrameLowering::emitEpilogue().
|
static |
Definition at line 260 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(), llvm::HexagonInstrInfo::storeRegToStackSlot(), and TII.
Referenced by llvm::RISCVFrameLowering::emitPrologue().
|
static |
Definition at line 217 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 2397 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::MachineBasicBlock::getBasicBlock(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineBasicBlock::getParent(), 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 1750 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.
Definition at line 2177 of file RISCVFrameLowering.cpp.
|
static |
Definition at line 363 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 456 of file RISCVFrameLowering.cpp.
References assert(), llvm::find_if(), FixedCSRFIMap, and P.
Referenced by llvm::RISCVFrameLowering::assignCalleeSavedSpillSlots().
|
static |
Definition at line 891 of file RISCVFrameLowering.cpp.
References llvm_unreachable, llvm::RISCVMachineFunctionInfo::StdExtZcmp, and llvm::RISCVMachineFunctionInfo::VendorXqccmp.
Referenced by llvm::RISCVFrameLowering::restoreCalleeSavedRegisters().
|
static |
Definition at line 879 of file RISCVFrameLowering.cpp.
References llvm_unreachable, llvm::RISCVMachineFunctionInfo::StdExtZcmp, and llvm::RISCVMachineFunctionInfo::VendorXqccmp.
Referenced by llvm::RISCVFrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 572 of file RISCVFrameLowering.cpp.
References FixedCSRFIMap, FixedCSRFIQCIInterruptMap, llvm::MachineFunction::getInfo(), llvm::is_contained(), llvm::make_first_range(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::RISCVFrameLowering::emitEpilogue(), and llvm::RISCVFrameLowering::emitPrologue().
|
static |
Definition at line 599 of file RISCVFrameLowering.cpp.
References FixedCSRFIQCIInterruptMap, llvm::MachineFunction::getInfo(), llvm::is_contained(), llvm::make_first_range(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::RISCVFrameLowering::emitPrologue().
|
static |
Definition at line 431 of file RISCVFrameLowering.cpp.
References getLibCallID().
Referenced by llvm::RISCVFrameLowering::restoreCalleeSavedRegisters().
|
static |
Definition at line 1547 of file RISCVFrameLowering.cpp.
References TRI.
Referenced by llvm::RISCVFrameLowering::determineCalleeSaves().
|
static |
Definition at line 557 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 1687 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 404 of file RISCVFrameLowering.cpp.
References getLibCallID().
Referenced by llvm::RISCVFrameLowering::spillCalleeSavedRegisters().
|
static |
Definition at line 542 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 1731 of file RISCVFrameLowering.cpp.
References llvm::MachineFunction::getSubtarget().
Referenced by llvm::RISCVFrameLowering::hasReservedCallFrame(), and llvm::RISCVFrameLowering::processFunctionBeforeFrameFinalized().
Definition at line 867 of file RISCVFrameLowering.cpp.
Referenced by llvm::RISCVFrameLowering::emitEpilogue(), and getPopRetOpcode().
Definition at line 856 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(), getLibCallID(), llvm::MCRegisterInfo::getRARegister(), and llvm::MCRegisterInfo::InitMCRegisterInfo().
|
staticconstexpr |
Definition at line 54 of file RISCVFrameLowering.cpp.
Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::RISCVFrameLowering::allocateStack(), llvm::AMDGPURegisterBankInfo::applyMappingDynStackAlloc(), createDefCFAExpression(), llvm::SIFrameLowering::eliminateCallFramePseudoInstr(), llvm::CSKYFrameLowering::eliminateCallFramePseudoInstr(), llvm::LoongArchFrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVFrameLowering::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::SITargetLowering::LowerDYNAMIC_STACKALLOC(), llvm::LanaiTargetLowering::LowerDYNAMIC_STACKALLOC(), LowerDYNAMIC_STACKALLOC(), and llvm::LegalizerHelper::lowerDynStackAlloc().