#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ErrorHandling.h"
#include <cstdlib>
using namespace llvm;
+// Pin the vtables to this file.
MCTargetStreamer::~MCTargetStreamer() {}
-MCStreamer::MCStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer)
- : Context(Ctx), TargetStreamer(TargetStreamer), EmitEHFrame(true),
- EmitDebugFrame(false), CurrentW64UnwindInfo(0), LastSymbol(0),
- AutoInitSections(false) {
+MCTargetStreamer::MCTargetStreamer(MCStreamer &S) : Streamer(S) {
+ S.setTargetStreamer(this);
+}
+
+void MCTargetStreamer::emitLabel(MCSymbol *Symbol) {}
+
+void MCTargetStreamer::finish() {}
+
+MCStreamer::MCStreamer(MCContext &Ctx)
+ : Context(Ctx), EmitEHFrame(true), EmitDebugFrame(false),
+ CurrentW64UnwindInfo(0), LastSymbol(0) {
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
- if (TargetStreamer)
- TargetStreamer->setStreamer(this);
}
MCStreamer::~MCStreamer() {
return nulls();
}
+void MCStreamer::emitRawComment(const Twine &T, bool TabPrefix) {}
+
void MCStreamer::generateCompactUnwindEncodings(MCAsmBackend *MAB) {
for (std::vector<MCDwarfFrameInfo>::iterator I = FrameInfos.begin(),
E = FrameInfos.end(); I != E; ++I)
MCSymbol *EHSymbol) {
}
+void MCStreamer::InitSections(bool Force) {
+ SwitchSection(getContext().getObjectFileInfo()->getTextSection());
+}
+
void MCStreamer::AssignSection(MCSymbol *Symbol, const MCSection *Section) {
if (Section)
Symbol->setSection(*Section);
assert(getCurrentSection().first && "Cannot emit before setting section!");
AssignSection(Symbol, getCurrentSection().first);
LastSymbol = Symbol;
+
+ MCTargetStreamer *TS = getTargetStreamer();
+ if (TS)
+ TS->emitLabel(Symbol);
}
void MCStreamer::EmitDebugLabel(MCSymbol *Symbol) {
EmitDebugFrame = Debug;
}
-void MCStreamer::EmitCFIStartProc() {
+void MCStreamer::EmitCFIStartProc(bool IsSimple) {
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
if (CurFrame && !CurFrame->End)
report_fatal_error("Starting a frame before finishing the previous one!");
MCDwarfFrameInfo Frame;
+ Frame.IsSimple = IsSimple;
EmitCFIStartProcImpl(Frame);
FrameInfos.push_back(Frame);
void MCStreamer::RecordProcStart(MCDwarfFrameInfo &Frame) {
Frame.Function = LastSymbol;
- // If the function is externally visible, we need to create a local
- // symbol to avoid relocations.
- StringRef Prefix = getContext().getAsmInfo()->getPrivateGlobalPrefix();
- if (LastSymbol && LastSymbol->getName().startswith(Prefix)) {
- Frame.Begin = LastSymbol;
- } else {
- Frame.Begin = getContext().CreateTempSymbol();
- EmitLabel(Frame.Begin);
- }
+ // We need to create a local symbol to avoid relocations.
+ Frame.Begin = getContext().CreateTempSymbol();
+ EmitLabel(Frame.Begin);
}
void MCStreamer::EmitCFIEndProc() {
EmitLabel(CurFrame->PrologEnd);
}
+void MCStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) {
+ llvm_unreachable("This file format doesn't support this directive");
+}
+
void MCStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
llvm_unreachable("This file format doesn't support this directive");
}
if (!FrameInfos.empty() && !FrameInfos.back().End)
report_fatal_error("Unfinished frame!");
+ MCTargetStreamer *TS = getTargetStreamer();
+ if (TS)
+ TS->finish();
+
FinishImpl();
}