LLVM 20.0.0git
|
#include "XCoreFrameLowering.h"
#include "XCoreInstrInfo.h"
#include "XCoreMachineFunctionInfo.h"
#include "XCoreSubtarget.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetOptions.h"
#include <algorithm>
Go to the source code of this file.
Functions | |
static bool | isImmU6 (unsigned val) |
static bool | isImmU16 (unsigned val) |
static bool | CompareSSIOffset (const StackSlotInfo &a, const StackSlotInfo &b) |
static void | EmitDefCfaRegister (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &dl, const TargetInstrInfo &TII, MachineFunction &MF, unsigned DRegNum) |
static void | EmitDefCfaOffset (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &dl, const TargetInstrInfo &TII, int Offset) |
static void | EmitCfiOffset (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &dl, const TargetInstrInfo &TII, unsigned DRegNum, int Offset) |
static void | IfNeededExtSP (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &dl, const TargetInstrInfo &TII, int OffsetFromTop, int &Adjusted, int FrameSize, bool emitFrameMoves) |
The SP register is moved in steps of 'MaxImmU16' towards the bottom of the frame. | |
static void | IfNeededLDAWSP (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &dl, const TargetInstrInfo &TII, int OffsetFromTop, int &RemainingAdj) |
The SP register is moved in steps of 'MaxImmU16' towards the top of the frame. | |
static void | GetSpillList (SmallVectorImpl< StackSlotInfo > &SpillList, MachineFrameInfo &MFI, XCoreFunctionInfo *XFI, bool fetchLR, bool fetchFP) |
Creates an ordered list of registers that are spilled during the emitPrologue/emitEpilogue. | |
static void | GetEHSpillList (SmallVectorImpl< StackSlotInfo > &SpillList, MachineFrameInfo &MFI, XCoreFunctionInfo *XFI, const Constant *PersonalityFn, const TargetLowering *TL) |
Creates an ordered list of EH info register 'spills'. | |
static MachineMemOperand * | getFrameIndexMMO (MachineBasicBlock &MBB, int FrameIndex, MachineMemOperand::Flags flags) |
static void | RestoreSpillList (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &dl, const TargetInstrInfo &TII, int &RemainingAdj, SmallVectorImpl< StackSlotInfo > &SpillList) |
Restore clobbered registers with their spill slot value. | |
Variables | |
static const unsigned | FramePtr = XCore::R10 |
static const int | MaxImmU16 = (1<<16) - 1 |
Definition at line 54 of file XCoreFrameLowering.cpp.
Referenced by GetEHSpillList(), and GetSpillList().
|
static |
Definition at line 79 of file XCoreFrameLowering.cpp.
References llvm::MachineInstrBuilder::addCFIIndex(), llvm::MachineFunction::addFrameInst(), llvm::BuildMI(), llvm::MCCFIInstruction::createOffset(), llvm::MachineBasicBlock::getParent(), MBB, MBBI, llvm::Offset, and TII.
Referenced by llvm::XCoreFrameLowering::emitPrologue().
|
static |
Definition at line 68 of file XCoreFrameLowering.cpp.
References llvm::MachineInstrBuilder::addCFIIndex(), llvm::MachineFunction::addFrameInst(), llvm::BuildMI(), llvm::MCCFIInstruction::cfiDefCfaOffset(), llvm::MachineBasicBlock::getParent(), MBB, MBBI, llvm::Offset, and TII.
Referenced by llvm::XCoreFrameLowering::emitPrologue(), and IfNeededExtSP().
|
static |
Definition at line 58 of file XCoreFrameLowering.cpp.
References llvm::MachineInstrBuilder::addCFIIndex(), llvm::MachineFunction::addFrameInst(), llvm::BuildMI(), llvm::MCCFIInstruction::createDefCfaRegister(), MBB, MBBI, and TII.
Referenced by llvm::XCoreFrameLowering::emitPrologue().
|
static |
Creates an ordered list of EH info register 'spills'.
These slots are only used by the unwinder and calls to llvm.eh.return(). Registers are ordered according to their frame offset. As offsets are negative, the largest offsets will be first.
Definition at line 158 of file XCoreFrameLowering.cpp.
References assert(), CompareSSIOffset(), llvm::XCoreFunctionInfo::getEHSpillSlot(), llvm::TargetLoweringBase::getExceptionPointerRegister(), llvm::TargetLoweringBase::getExceptionSelectorRegister(), llvm::MachineFrameInfo::getObjectOffset(), llvm::XCoreFunctionInfo::hasEHSpillSlot(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::sort().
Referenced by llvm::XCoreFrameLowering::emitEpilogue(), and llvm::XCoreFrameLowering::emitPrologue().
|
static |
Definition at line 173 of file XCoreFrameLowering.cpp.
References llvm::MachinePointerInfo::getFixedStack(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getMachineMemOperand(), llvm::MachineFrameInfo::getObjectAlign(), llvm::MachineFrameInfo::getObjectSize(), llvm::MachineBasicBlock::getParent(), and MBB.
Referenced by llvm::XCoreFrameLowering::emitPrologue(), and RestoreSpillList().
|
static |
Creates an ordered list of registers that are spilled during the emitPrologue/emitEpilogue.
Registers are ordered according to their frame offset. As offsets are negative, the largest offsets will be first.
Definition at line 136 of file XCoreFrameLowering.cpp.
References CompareSSIOffset(), FramePtr, llvm::XCoreFunctionInfo::getFPSpillSlot(), llvm::XCoreFunctionInfo::getLRSpillSlot(), llvm::MachineFrameInfo::getObjectOffset(), llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::sort().
Referenced by llvm::XCoreFrameLowering::emitEpilogue(), and llvm::XCoreFrameLowering::emitPrologue().
|
static |
The SP register is moved in steps of 'MaxImmU16' towards the bottom of the frame.
During these steps, it may be necessary to spill registers. IfNeededExtSP emits the necessary EXTSP instructions to move the SP only as far as to make 'OffsetFromBottom' reachable using an STWSP_lru6.
OffsetFromTop | the spill offset from the top of the frame. | |
[in,out] | Adjusted | the current SP offset from the top of the frame. |
Definition at line 96 of file XCoreFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), assert(), llvm::BuildMI(), EmitDefCfaOffset(), isImmU6(), MaxImmU16, MBB, MBBI, and TII.
Referenced by llvm::XCoreFrameLowering::emitPrologue().
|
static |
The SP register is moved in steps of 'MaxImmU16' towards the top of the frame.
During these steps, it may be necessary to re-load registers. IfNeededLDAWSP emits the necessary LDAWSP instructions to move the SP only as far as to make 'OffsetFromTop' reachable using an LDAWSP_lru6.
OffsetFromTop | the spill offset from the top of the frame. | |
[in,out] | RemainingAdj | the current SP offset from the top of the frame. |
Definition at line 119 of file XCoreFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), assert(), llvm::BuildMI(), isImmU6(), MaxImmU16, MBB, MBBI, and TII.
Referenced by llvm::XCoreFrameLowering::emitEpilogue(), and RestoreSpillList().
Definition at line 40 of file XCoreFrameLowering.cpp.
Referenced by llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreRegisterInfo::eliminateFrameIndex(), and llvm::XCoreInstrInfo::loadImmediate().
Definition at line 36 of file XCoreFrameLowering.cpp.
Referenced by llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::emitEpilogue(), llvm::XCoreFrameLowering::emitPrologue(), IfNeededExtSP(), IfNeededLDAWSP(), InsertSPImmInst(), llvm::XCoreInstrInfo::loadImmediate(), and RestoreSpillList().
|
static |
Restore clobbered registers with their spill slot value.
The SP will be adjusted at the same time, thus the SpillList must be ordered with the largest (negative) offsets first.
Definition at line 188 of file XCoreFrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMemOperand(), assert(), llvm::BuildMI(), getFrameIndexMMO(), IfNeededLDAWSP(), isImmU6(), MBB, MBBI, llvm::MachineMemOperand::MOLoad, llvm::Offset, llvm::SmallVectorBase< Size_T >::size(), and TII.
Referenced by llvm::XCoreFrameLowering::emitEpilogue().
Definition at line 32 of file XCoreFrameLowering.cpp.
Referenced by llvm::ARMFrameLowering::determineCalleeSaves(), llvm::X86FrameLowering::emitCalleeSavedFrameMoves(), llvm::X86FrameLowering::emitCalleeSavedFrameMovesFullCFA(), emitDefineCFAWithFP(), llvm::ARMFrameLowering::emitEpilogue(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::M68kFrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::XCoreFrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitPrologue(), llvm::Thumb1FrameLowering::emitPrologue(), llvm::M68kFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), GetSpillList(), insertSpills(), lowerAwaitSuspend(), lowerSubFn(), markCoroutineAsDone(), maybeFreeRetconStorage(), processCall(), replaceCoroEnd(), replaceFallthroughCoroEnd(), replaceFI(), replaceUnwindCoroEnd(), llvm::X86FrameLowering::restoreWin32EHStackPointers(), and llvm::coro::AsyncABI::splitCoroutine().
|
static |
Definition at line 33 of file XCoreFrameLowering.cpp.
Referenced by llvm::XCoreFrameLowering::emitPrologue(), IfNeededExtSP(), and IfNeededLDAWSP().