]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/MC/MCWinCOFFObjectWriter.h
Merge ^/head r327150 through r327164.
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / MC / MCWinCOFFObjectWriter.h
1 //===- llvm/MC/MCWinCOFFObjectWriter.h - Win COFF Object Writer -*- 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 #ifndef LLVM_MC_MCWINCOFFOBJECTWRITER_H
11 #define LLVM_MC_MCWINCOFFOBJECTWRITER_H
12
13 #include <memory>
14
15 namespace llvm {
16
17 class MCAsmBackend;
18 class MCContext;
19 class MCFixup;
20 class MCObjectWriter;
21 class MCValue;
22 class raw_pwrite_stream;
23
24   class MCWinCOFFObjectTargetWriter {
25     virtual void anchor();
26
27     const unsigned Machine;
28
29   protected:
30     MCWinCOFFObjectTargetWriter(unsigned Machine_);
31
32   public:
33     virtual ~MCWinCOFFObjectTargetWriter() = default;
34
35     unsigned getMachine() const { return Machine; }
36     virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
37                                   const MCFixup &Fixup, bool IsCrossSection,
38                                   const MCAsmBackend &MAB) const = 0;
39     virtual bool recordRelocation(const MCFixup &) const { return true; }
40   };
41
42   /// \brief Construct a new Win COFF writer instance.
43   ///
44   /// \param MOTW - The target specific WinCOFF writer subclass.
45   /// \param OS - The stream to write to.
46   /// \returns The constructed object writer.
47   std::unique_ptr<MCObjectWriter>
48   createWinCOFFObjectWriter(std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW,
49                             raw_pwrite_stream &OS);
50 } // end namespace llvm
51
52 #endif // LLVM_MC_MCWINCOFFOBJECTWRITER_H