20void CFIFunctionFrameStreamer::updateReceiver(
21 const std::optional<MCInst> &NewInst) {
23 "should have an unfinished DWARF frame here");
24 assert(!FrameIndices.empty() &&
25 "there should be an index available for the current frame");
26 assert(FrameIndices.size() == LastInstructions.size());
27 assert(LastInstructions.size() == LastDirectiveIndices.size());
30 assert(FrameIndices.back() < Frames.size());
31 unsigned LastDirectiveIndex = LastDirectiveIndices.back();
32 unsigned CurrentDirectiveIndex =
33 Frames[FrameIndices.back()].Instructions.size();
34 assert(CurrentDirectiveIndex >= LastDirectiveIndex);
36 const MCDwarfFrameInfo *LastFrame = &Frames[FrameIndices.back()];
38 if (LastDirectiveIndex < CurrentDirectiveIndex) {
42 .drop_back(LastFrame->
Instructions.size() - CurrentDirectiveIndex);
45 auto MaybeLastInstruction = LastInstructions.back();
46 if (MaybeLastInstruction)
48 Receiver->emitInstructionAndDirectives(*MaybeLastInstruction, Directives);
51 Receiver->startFunctionFrame(
false ,
55 LastInstructions.back() = NewInst;
56 LastDirectiveIndices.back() = CurrentDirectiveIndex;
68 LastInstructions.push_back(std::nullopt);
69 LastDirectiveIndices.push_back(0);
78 updateReceiver(std::nullopt);
80 assert(!FrameIndices.empty() &&
"There should be at least one frame to pop");
81 LastDirectiveIndices.pop_back();
82 LastInstructions.pop_back();
83 FrameIndices.pop_back();
85 Receiver->finishFunctionFrame();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares CFIFunctionFrameStreamer class.
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
void emitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
void emitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame) override
Instances of this class represent a single low-level machine instruction.
bool hasUnfinishedDwarfFrameInfo()
virtual void emitCFIStartProcImpl(MCDwarfFrameInfo &Frame)
unsigned getNumFrameInfos()
virtual void emitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame)
ArrayRef< MCDwarfFrameInfo > getDwarfFrameInfos() const
Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
ArrayRef(const T &OneElt) -> ArrayRef< T >
std::vector< MCCFIInstruction > Instructions