2014-04-27 03:48:12 +00:00
|
|
|
//===-- X86WinCOFFStreamer.cpp - X86 Target WinCOFF Streamer ----*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "X86MCTargetDesc.h"
|
|
|
|
#include "llvm/MC/MCWinCOFFStreamer.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
class X86WinCOFFStreamer : public MCWinCOFFStreamer {
|
|
|
|
public:
|
|
|
|
X86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter *CE,
|
|
|
|
raw_ostream &OS)
|
|
|
|
: MCWinCOFFStreamer(C, AB, *CE, OS) { }
|
|
|
|
|
2014-06-29 01:52:01 +00:00
|
|
|
void EmitWinEHHandlerData() override;
|
2014-08-03 18:51:26 +00:00
|
|
|
void EmitWindowsUnwindTables() override;
|
2014-04-27 03:48:12 +00:00
|
|
|
void FinishImpl() override;
|
|
|
|
};
|
|
|
|
|
2014-06-29 01:52:01 +00:00
|
|
|
void X86WinCOFFStreamer::EmitWinEHHandlerData() {
|
|
|
|
MCStreamer::EmitWinEHHandlerData();
|
2014-04-27 03:48:12 +00:00
|
|
|
|
|
|
|
// We have to emit the unwind info now, because this directive
|
|
|
|
// actually switches to the .xdata section!
|
2014-07-13 19:03:36 +00:00
|
|
|
MCWin64EHUnwindEmitter::EmitUnwindInfo(*this, getCurrentWinFrameInfo());
|
2014-04-27 03:48:12 +00:00
|
|
|
}
|
|
|
|
|
2014-08-03 18:51:26 +00:00
|
|
|
void X86WinCOFFStreamer::EmitWindowsUnwindTables() {
|
|
|
|
if (!getNumWinFrameInfos())
|
|
|
|
return;
|
|
|
|
MCWin64EHUnwindEmitter::Emit(*this);
|
|
|
|
}
|
|
|
|
|
2014-04-27 03:48:12 +00:00
|
|
|
void X86WinCOFFStreamer::FinishImpl() {
|
2014-05-12 13:30:10 +00:00
|
|
|
EmitFrames(nullptr);
|
2014-07-13 19:03:36 +00:00
|
|
|
EmitWindowsUnwindTables();
|
2014-04-27 03:48:12 +00:00
|
|
|
|
|
|
|
MCWinCOFFStreamer::FinishImpl();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
MCStreamer *createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
|
|
|
|
MCCodeEmitter *CE, raw_ostream &OS,
|
|
|
|
bool RelaxAll) {
|
|
|
|
X86WinCOFFStreamer *S = new X86WinCOFFStreamer(C, AB, CE, OS);
|
|
|
|
S->getAssembler().setRelaxAll(RelaxAll);
|
|
|
|
return S;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|