20void CFIFunctionFrameStreamer::updateReceiver(
21 const std::optional<MCInst> &NewInst) {
23 "should have an unfinished DWARF frame here");
25 "there should be an index available for the current frame");
26 assert(FrameIndices.
size() == LastInstructions.size());
27 assert(LastInstructions.size() == LastDirectiveIndices.
size());
31 unsigned LastDirectiveIndex = LastDirectiveIndices.
back();
32 unsigned CurrentDirectiveIndex =
33 Frames[FrameIndices.
back()].Instructions.size();
34 assert(CurrentDirectiveIndex >= LastDirectiveIndex);
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);
78 updateReceiver(std::nullopt);
80 assert(!FrameIndices.
empty() &&
"There should be at least one frame to pop");
82 LastInstructions.pop_back();
85 Receiver->finishFunctionFrame();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares CFIFunctionFrameStreamer class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
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.
void push_back(const T &Elt)
This is an optimization pass for GlobalISel generic memory operations.
std::vector< MCCFIInstruction > Instructions