summaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-05-12 14:02:44 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-05-12 14:02:44 +0000
commit23f2d7ae231823601458bd67cc5893e32d0c354d (patch)
tree8dce3c56dda4ee38b3446633b85baf04641b1bec /lib/MC
parent6ec481443b6b26230877f292fa3a53c0118e8faa (diff)
downloadllvm-23f2d7ae231823601458bd67cc5893e32d0c354d.tar.gz
llvm-23f2d7ae231823601458bd67cc5893e32d0c354d.tar.bz2
llvm-23f2d7ae231823601458bd67cc5893e32d0c354d.tar.xz
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
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCObjectStreamer.cpp24
-rw-r--r--lib/MC/MCStreamer.cpp18
2 files changed, 23 insertions, 19 deletions
diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp
index ea3f42574d..a1aa60283c 100644
--- a/lib/MC/MCObjectStreamer.cpp
+++ b/lib/MC/MCObjectStreamer.cpp
@@ -27,12 +27,13 @@ MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
: MCStreamer(Context),
Assembler(new MCAssembler(Context, TAB, *Emitter_,
*TAB.createObjectWriter(OS), OS)),
- CurSectionData(nullptr) {}
+ CurSectionData(nullptr), EmitEHFrame(true), EmitDebugFrame(false) {}
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
raw_ostream &OS, MCCodeEmitter *Emitter_,
MCAssembler *_Assembler)
- : MCStreamer(Context), Assembler(_Assembler), CurSectionData(nullptr) {}
+ : MCStreamer(Context), Assembler(_Assembler), CurSectionData(nullptr),
+ EmitEHFrame(true), EmitDebugFrame(false) {}
MCObjectStreamer::~MCObjectStreamer() {
delete &Assembler->getBackend();
@@ -46,9 +47,22 @@ void MCObjectStreamer::reset() {
Assembler->reset();
CurSectionData = nullptr;
CurInsertionPoint = MCSectionData::iterator();
+ EmitEHFrame = true;
+ EmitDebugFrame = false;
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 {
assert(getCurrentSectionData() && "No current section!");
@@ -97,6 +111,12 @@ const MCExpr *MCObjectStreamer::AddValueSymbols(const MCExpr *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,
const SMLoc &Loc) {
MCDataFragment *DF = getOrCreateDataFragment();
diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp
index a5c20340c4..7dccf0d751 100644
--- a/lib/MC/MCStreamer.cpp
+++ b/lib/MC/MCStreamer.cpp
@@ -37,8 +37,7 @@ void MCTargetStreamer::finish() {}
void MCTargetStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
MCStreamer::MCStreamer(MCContext &Ctx)
- : Context(Ctx), EmitEHFrame(true), EmitDebugFrame(false),
- CurrentW64UnwindInfo(nullptr), LastSymbol(nullptr) {
+ : Context(Ctx), CurrentW64UnwindInfo(nullptr), LastSymbol(nullptr) {
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
}
@@ -51,8 +50,6 @@ void MCStreamer::reset() {
for (unsigned i = 0; i < getNumW64UnwindInfos(); ++i)
delete W64UnwindInfos[i];
W64UnwindInfos.clear();
- EmitEHFrame = true;
- EmitDebugFrame = false;
CurrentW64UnwindInfo = nullptr;
LastSymbol = nullptr;
SectionStack.clear();
@@ -259,8 +256,6 @@ void MCStreamer::EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding) {
void MCStreamer::EmitCFISections(bool EH, bool Debug) {
assert(EH || Debug);
- EmitEHFrame = EH;
- EmitDebugFrame = Debug;
}
void MCStreamer::EmitCFIStartProc(bool IsSimple) {
@@ -615,17 +610,6 @@ void MCStreamer::EmitRawText(const Twine &T) {
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() {
if (!getNumW64UnwindInfos())
return;