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 namespace llvm {
14 class MCAsmBackend;
15 class MCFixup;
16 class MCObjectWriter;
17 class MCValue;
18 class raw_ostream;
19 class raw_pwrite_stream;
20 
21   class MCWinCOFFObjectTargetWriter {
22     virtual void anchor();
23     const unsigned Machine;
24 
25   protected:
26     MCWinCOFFObjectTargetWriter(unsigned Machine_);
27 
28   public:
~MCWinCOFFObjectTargetWriter()29     virtual ~MCWinCOFFObjectTargetWriter() {}
30 
getMachine()31     unsigned getMachine() const { return Machine; }
32     virtual unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup,
33                                   bool IsCrossSection,
34                                   const MCAsmBackend &MAB) const = 0;
recordRelocation(const MCFixup &)35     virtual bool recordRelocation(const MCFixup &) const { return true; }
36   };
37 
38   /// \brief Construct a new Win COFF writer instance.
39   ///
40   /// \param MOTW - The target specific WinCOFF writer subclass.
41   /// \param OS - The stream to write to.
42   /// \returns The constructed object writer.
43   MCObjectWriter *createWinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW,
44                                             raw_pwrite_stream &OS);
45 } // End llvm namespace
46 
47 #endif
48