LLVM  3.7.0
X86WinCOFFStreamer.cpp
Go to the documentation of this file.
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/MCWin64EH.h"
13 
14 using namespace llvm;
15 
16 namespace {
17 class X86WinCOFFStreamer : public MCWinCOFFStreamer {
19 public:
20  X86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter *CE,
22  : MCWinCOFFStreamer(C, AB, *CE, OS) {}
23 
24  void EmitWinEHHandlerData() override;
25  void EmitWindowsUnwindTables() override;
26  void FinishImpl() override;
27 };
28 
29 void X86WinCOFFStreamer::EmitWinEHHandlerData() {
31 
32  // We have to emit the unwind info now, because this directive
33  // actually switches to the .xdata section!
34  EHStreamer.EmitUnwindInfo(*this, getCurrentWinFrameInfo());
35 }
36 
37 void X86WinCOFFStreamer::EmitWindowsUnwindTables() {
38  if (!getNumWinFrameInfos())
39  return;
40  EHStreamer.Emit(*this);
41 }
42 
43 void X86WinCOFFStreamer::FinishImpl() {
44  EmitFrames(nullptr);
45  EmitWindowsUnwindTables();
46 
48 }
49 }
50 
53  MCCodeEmitter *CE, bool RelaxAll) {
54  X86WinCOFFStreamer *S = new X86WinCOFFStreamer(C, AB, CE, OS);
55  S->getAssembler().setRelaxAll(RelaxAll);
56  return S;
57 }
58 
virtual void EmitWinEHHandlerData()
Definition: MCStreamer.cpp:464
Emits exception handling directives.
Definition: EHStreamer.h:33
Context object for machine code objects.
Definition: MCContext.h:48
Streaming machine code generation interface.
Definition: MCStreamer.h:157
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:23
MCStreamer * createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, raw_pwrite_stream &OS, MCCodeEmitter *CE, bool RelaxAll)
Construct an X86 Windows COFF machine code streamer which will generate PE/COFF format object files...
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:321
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:34
void FinishImpl() override
Streamer specific finalization.