1 //===-- X86WinCOFFStreamer.cpp - X86 Target WinCOFF Streamer ----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "X86MCTargetDesc.h"
11 #include "llvm/MC/MCWinCOFFStreamer.h"
12
13 using namespace llvm;
14
15 namespace {
16 class X86WinCOFFStreamer : public MCWinCOFFStreamer {
17 public:
X86WinCOFFStreamer(MCContext & C,MCAsmBackend & AB,MCCodeEmitter * CE,raw_ostream & OS)18 X86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter *CE,
19 raw_ostream &OS)
20 : MCWinCOFFStreamer(C, AB, *CE, OS) { }
21
22 void EmitWinEHHandlerData() override;
23 void FinishImpl() override;
24 };
25
EmitWinEHHandlerData()26 void X86WinCOFFStreamer::EmitWinEHHandlerData() {
27 MCStreamer::EmitWinEHHandlerData();
28
29 // We have to emit the unwind info now, because this directive
30 // actually switches to the .xdata section!
31 MCWin64EHUnwindEmitter::EmitUnwindInfo(*this, getCurrentW64UnwindInfo());
32 }
33
FinishImpl()34 void X86WinCOFFStreamer::FinishImpl() {
35 EmitFrames(nullptr);
36 EmitW64Tables();
37
38 MCWinCOFFStreamer::FinishImpl();
39 }
40 }
41
42 namespace llvm {
createX86WinCOFFStreamer(MCContext & C,MCAsmBackend & AB,MCCodeEmitter * CE,raw_ostream & OS,bool RelaxAll)43 MCStreamer *createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
44 MCCodeEmitter *CE, raw_ostream &OS,
45 bool RelaxAll) {
46 X86WinCOFFStreamer *S = new X86WinCOFFStreamer(C, AB, CE, OS);
47 S->getAssembler().setRelaxAll(RelaxAll);
48 return S;
49 }
50 }
51
52