mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-27 21:50:40 +00:00
Move EH/Debug frame handling to the object streamer.
Now that the asm streamer doesn't use it, the MCStreamer doesn't need to know about it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208562 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6ec481443b
commit
23f2d7ae23
@ -35,6 +35,8 @@ class MCObjectStreamer : public MCStreamer {
|
|||||||
MCAssembler *Assembler;
|
MCAssembler *Assembler;
|
||||||
MCSectionData *CurSectionData;
|
MCSectionData *CurSectionData;
|
||||||
MCSectionData::iterator CurInsertionPoint;
|
MCSectionData::iterator CurInsertionPoint;
|
||||||
|
bool EmitEHFrame;
|
||||||
|
bool EmitDebugFrame;
|
||||||
|
|
||||||
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo&) = 0;
|
virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo&) = 0;
|
||||||
void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
|
void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
|
||||||
@ -57,6 +59,8 @@ public:
|
|||||||
MCSymbolData &getOrCreateSymbolData(const MCSymbol *Symbol) {
|
MCSymbolData &getOrCreateSymbolData(const MCSymbol *Symbol) {
|
||||||
return getAssembler().getOrCreateSymbolData(*Symbol);
|
return getAssembler().getOrCreateSymbolData(*Symbol);
|
||||||
}
|
}
|
||||||
|
void EmitFrames(MCAsmBackend *MAB);
|
||||||
|
void EmitCFISections(bool EH, bool Debug) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MCSectionData *getCurrentSectionData() const {
|
MCSectionData *getCurrentSectionData() const {
|
||||||
|
@ -154,9 +154,6 @@ class MCStreamer {
|
|||||||
MCStreamer(const MCStreamer &) LLVM_DELETED_FUNCTION;
|
MCStreamer(const MCStreamer &) LLVM_DELETED_FUNCTION;
|
||||||
MCStreamer &operator=(const MCStreamer &) LLVM_DELETED_FUNCTION;
|
MCStreamer &operator=(const MCStreamer &) LLVM_DELETED_FUNCTION;
|
||||||
|
|
||||||
bool EmitEHFrame;
|
|
||||||
bool EmitDebugFrame;
|
|
||||||
|
|
||||||
std::vector<MCDwarfFrameInfo> FrameInfos;
|
std::vector<MCDwarfFrameInfo> FrameInfos;
|
||||||
MCDwarfFrameInfo *getCurrentFrameInfo();
|
MCDwarfFrameInfo *getCurrentFrameInfo();
|
||||||
MCSymbol *EmitCFICommon();
|
MCSymbol *EmitCFICommon();
|
||||||
@ -189,7 +186,6 @@ protected:
|
|||||||
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
|
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
|
||||||
void RecordProcEnd(MCDwarfFrameInfo &Frame);
|
void RecordProcEnd(MCDwarfFrameInfo &Frame);
|
||||||
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
|
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
|
||||||
void EmitFrames(MCAsmBackend *MAB);
|
|
||||||
|
|
||||||
MCWin64EHUnwindInfo *getCurrentW64UnwindInfo() {
|
MCWin64EHUnwindInfo *getCurrentW64UnwindInfo() {
|
||||||
return CurrentW64UnwindInfo;
|
return CurrentW64UnwindInfo;
|
||||||
|
@ -27,12 +27,13 @@ MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
|
|||||||
: MCStreamer(Context),
|
: MCStreamer(Context),
|
||||||
Assembler(new MCAssembler(Context, TAB, *Emitter_,
|
Assembler(new MCAssembler(Context, TAB, *Emitter_,
|
||||||
*TAB.createObjectWriter(OS), OS)),
|
*TAB.createObjectWriter(OS), OS)),
|
||||||
CurSectionData(nullptr) {}
|
CurSectionData(nullptr), EmitEHFrame(true), EmitDebugFrame(false) {}
|
||||||
|
|
||||||
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
|
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter_,
|
raw_ostream &OS, MCCodeEmitter *Emitter_,
|
||||||
MCAssembler *_Assembler)
|
MCAssembler *_Assembler)
|
||||||
: MCStreamer(Context), Assembler(_Assembler), CurSectionData(nullptr) {}
|
: MCStreamer(Context), Assembler(_Assembler), CurSectionData(nullptr),
|
||||||
|
EmitEHFrame(true), EmitDebugFrame(false) {}
|
||||||
|
|
||||||
MCObjectStreamer::~MCObjectStreamer() {
|
MCObjectStreamer::~MCObjectStreamer() {
|
||||||
delete &Assembler->getBackend();
|
delete &Assembler->getBackend();
|
||||||
@ -46,9 +47,22 @@ void MCObjectStreamer::reset() {
|
|||||||
Assembler->reset();
|
Assembler->reset();
|
||||||
CurSectionData = nullptr;
|
CurSectionData = nullptr;
|
||||||
CurInsertionPoint = MCSectionData::iterator();
|
CurInsertionPoint = MCSectionData::iterator();
|
||||||
|
EmitEHFrame = true;
|
||||||
|
EmitDebugFrame = false;
|
||||||
MCStreamer::reset();
|
MCStreamer::reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCObjectStreamer::EmitFrames(MCAsmBackend *MAB) {
|
||||||
|
if (!getNumFrameInfos())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (EmitEHFrame)
|
||||||
|
MCDwarfFrameEmitter::Emit(*this, MAB, true);
|
||||||
|
|
||||||
|
if (EmitDebugFrame)
|
||||||
|
MCDwarfFrameEmitter::Emit(*this, MAB, false);
|
||||||
|
}
|
||||||
|
|
||||||
MCFragment *MCObjectStreamer::getCurrentFragment() const {
|
MCFragment *MCObjectStreamer::getCurrentFragment() const {
|
||||||
assert(getCurrentSectionData() && "No current section!");
|
assert(getCurrentSectionData() && "No current section!");
|
||||||
|
|
||||||
@ -97,6 +111,12 @@ const MCExpr *MCObjectStreamer::AddValueSymbols(const MCExpr *Value) {
|
|||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCObjectStreamer::EmitCFISections(bool EH, bool Debug) {
|
||||||
|
MCStreamer::EmitCFISections(EH, Debug);
|
||||||
|
EmitEHFrame = EH;
|
||||||
|
EmitDebugFrame = Debug;
|
||||||
|
}
|
||||||
|
|
||||||
void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
const SMLoc &Loc) {
|
const SMLoc &Loc) {
|
||||||
MCDataFragment *DF = getOrCreateDataFragment();
|
MCDataFragment *DF = getOrCreateDataFragment();
|
||||||
|
@ -37,8 +37,7 @@ void MCTargetStreamer::finish() {}
|
|||||||
void MCTargetStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
|
void MCTargetStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
|
||||||
|
|
||||||
MCStreamer::MCStreamer(MCContext &Ctx)
|
MCStreamer::MCStreamer(MCContext &Ctx)
|
||||||
: Context(Ctx), EmitEHFrame(true), EmitDebugFrame(false),
|
: Context(Ctx), CurrentW64UnwindInfo(nullptr), LastSymbol(nullptr) {
|
||||||
CurrentW64UnwindInfo(nullptr), LastSymbol(nullptr) {
|
|
||||||
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
|
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +50,6 @@ void MCStreamer::reset() {
|
|||||||
for (unsigned i = 0; i < getNumW64UnwindInfos(); ++i)
|
for (unsigned i = 0; i < getNumW64UnwindInfos(); ++i)
|
||||||
delete W64UnwindInfos[i];
|
delete W64UnwindInfos[i];
|
||||||
W64UnwindInfos.clear();
|
W64UnwindInfos.clear();
|
||||||
EmitEHFrame = true;
|
|
||||||
EmitDebugFrame = false;
|
|
||||||
CurrentW64UnwindInfo = nullptr;
|
CurrentW64UnwindInfo = nullptr;
|
||||||
LastSymbol = nullptr;
|
LastSymbol = nullptr;
|
||||||
SectionStack.clear();
|
SectionStack.clear();
|
||||||
@ -259,8 +256,6 @@ void MCStreamer::EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding) {
|
|||||||
|
|
||||||
void MCStreamer::EmitCFISections(bool EH, bool Debug) {
|
void MCStreamer::EmitCFISections(bool EH, bool Debug) {
|
||||||
assert(EH || Debug);
|
assert(EH || Debug);
|
||||||
EmitEHFrame = EH;
|
|
||||||
EmitDebugFrame = Debug;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCStreamer::EmitCFIStartProc(bool IsSimple) {
|
void MCStreamer::EmitCFIStartProc(bool IsSimple) {
|
||||||
@ -615,17 +610,6 @@ void MCStreamer::EmitRawText(const Twine &T) {
|
|||||||
EmitRawTextImpl(T.toStringRef(Str));
|
EmitRawTextImpl(T.toStringRef(Str));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCStreamer::EmitFrames(MCAsmBackend *MAB) {
|
|
||||||
if (!getNumFrameInfos())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (EmitEHFrame)
|
|
||||||
MCDwarfFrameEmitter::Emit(*this, MAB, true);
|
|
||||||
|
|
||||||
if (EmitDebugFrame)
|
|
||||||
MCDwarfFrameEmitter::Emit(*this, MAB, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MCStreamer::EmitW64Tables() {
|
void MCStreamer::EmitW64Tables() {
|
||||||
if (!getNumW64UnwindInfos())
|
if (!getNumW64UnwindInfos())
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user