There are more than one paths to where the frame information is emitted. Place
the call to generateCompactUnwindEncodings() into the method which outputs the
frame information, thus ensuring that the encoding is there for every path. This
involved threading the MCAsmBackend object through to this method.
<rdar://problem/
13623355>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190335
91177308-0d34-0410-b5e6-
96231b3b80d8
#include <vector>
namespace llvm {
#include <vector>
namespace llvm {
class MCContext;
class MCSection;
class MCStreamer;
class MCContext;
class MCSection;
class MCStreamer;
//
// This emits the frame info section.
//
//
// This emits the frame info section.
//
- static void Emit(MCStreamer &streamer, bool usingCFI, bool isEH);
+ static void Emit(MCStreamer &streamer, MCAsmBackend *MAB,
+ bool usingCFI, bool isEH);
static void EmitAdvanceLoc(MCStreamer &Streamer, uint64_t AddrDelta);
static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
raw_ostream &OS);
static void EmitAdvanceLoc(MCStreamer &Streamer, uint64_t AddrDelta);
static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
raw_ostream &OS);
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
void RecordProcEnd(MCDwarfFrameInfo &Frame);
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
void RecordProcEnd(MCDwarfFrameInfo &Frame);
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
- void EmitFrames(bool usingCFI);
+ void EmitFrames(MCAsmBackend *MAB, bool usingCFI);
MCWin64EHUnwindInfo *getCurrentW64UnwindInfo() {
return CurrentW64UnwindInfo;
MCWin64EHUnwindInfo *getCurrentW64UnwindInfo() {
return CurrentW64UnwindInfo;
return *W64UnwindInfos[i];
}
return *W64UnwindInfos[i];
}
- void generateCompactUnwindEncodings(MCAsmBackend &MAB);
+ void generateCompactUnwindEncodings(MCAsmBackend *MAB);
/// @name Assembly File Formatting.
/// @{
/// @name Assembly File Formatting.
/// @{
// Create a code emitter if asked to show the encoding.
MCCodeEmitter *MCE = 0;
// Create a code emitter if asked to show the encoding.
MCCodeEmitter *MCE = 0;
- MCAsmBackend *MAB = 0;
- if (ShowMCEncoding) {
MCE = getTarget().createMCCodeEmitter(MII, MRI, STI, *Context);
MCE = getTarget().createMCCodeEmitter(MII, MRI, STI, *Context);
- MAB = getTarget().createMCAsmBackend(MRI, getTargetTriple(), TargetCPU);
- }
+ MCAsmBackend *MAB = getTarget().createMCAsmBackend(MRI, getTargetTriple(),
+ TargetCPU);
MCStreamer *S = getTarget().createAsmStreamer(*Context, Out,
getVerboseAsm(),
hasMCUseLoc(),
MCStreamer *S = getTarget().createAsmStreamer(*Context, Out,
getVerboseAsm(),
hasMCUseLoc(),
MCGenDwarfInfo::Emit(this, LineSectionSymbol);
if (!UseCFI)
MCGenDwarfInfo::Emit(this, LineSectionSymbol);
if (!UseCFI)
+ EmitFrames(AsmBackend.get(), false);
MCStreamer *llvm::createAsmStreamer(MCContext &Context,
formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc,
MCStreamer *llvm::createAsmStreamer(MCContext &Context,
formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc,
-void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer,
- bool UsingCFI,
- bool IsEH) {
+void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer, MCAsmBackend *MAB,
+ bool UsingCFI, bool IsEH) {
+ Streamer.generateCompactUnwindEncodings(MAB);
+
MCContext &Context = Streamer.getContext();
const MCObjectFileInfo *MOFI = Context.getObjectFileInfo();
FrameEmitterImpl Emitter(UsingCFI, IsEH);
MCContext &Context = Streamer.getContext();
const MCObjectFileInfo *MOFI = Context.getObjectFileInfo();
FrameEmitterImpl Emitter(UsingCFI, IsEH);
}
void MCELFStreamer::FinishImpl() {
}
void MCELFStreamer::FinishImpl() {
+ EmitFrames(NULL, true);
for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(),
e = LocalCommons.end();
for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(),
e = LocalCommons.end();
}
void MCMachOStreamer::FinishImpl() {
}
void MCMachOStreamer::FinishImpl() {
- generateCompactUnwindEncodings(getAssembler().getBackend());
- EmitFrames(true);
+ EmitFrames(&getAssembler().getBackend(), true);
// We have to set the fragment atom associations so we can relax properly for
// Mach-O.
// We have to set the fragment atom associations so we can relax properly for
// Mach-O.
-void MCStreamer::generateCompactUnwindEncodings(MCAsmBackend &MAB) {
+void MCStreamer::generateCompactUnwindEncodings(MCAsmBackend *MAB) {
+ if (!MAB) return;
for (std::vector<MCDwarfFrameInfo>::iterator I = FrameInfos.begin(),
E = FrameInfos.end(); I != E; ++I)
for (std::vector<MCDwarfFrameInfo>::iterator I = FrameInfos.begin(),
E = FrameInfos.end(); I != E; ++I)
- if (!I->CompactUnwindEncoding)
- I->CompactUnwindEncoding =
- MAB.generateCompactUnwindEncoding(I->Instructions);
+ I->CompactUnwindEncoding =
+ MAB->generateCompactUnwindEncoding(I->Instructions);
}
void MCStreamer::EmitDwarfSetLineAddr(int64_t LineDelta,
}
void MCStreamer::EmitDwarfSetLineAddr(int64_t LineDelta,
EmitRawText(Str.str());
}
EmitRawText(Str.str());
}
-void MCStreamer::EmitFrames(bool usingCFI) {
+void MCStreamer::EmitFrames(MCAsmBackend *MAB, bool usingCFI) {
if (!getNumFrameInfos())
return;
if (EmitEHFrame)
if (!getNumFrameInfos())
return;
if (EmitEHFrame)
- MCDwarfFrameEmitter::Emit(*this, usingCFI, true);
+ MCDwarfFrameEmitter::Emit(*this, MAB, usingCFI, true);
- MCDwarfFrameEmitter::Emit(*this, usingCFI, false);
+ MCDwarfFrameEmitter::Emit(*this, MAB, usingCFI, false);
}
void MCStreamer::EmitW64Tables() {
}
void MCStreamer::EmitW64Tables() {