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
13namespace llvm {
14class MCAsmBackend;
15class MCFixup;
16class MCObjectWriter;
17class MCValue;
18class raw_ostream;
19class 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:
29    virtual ~MCWinCOFFObjectTargetWriter() {}
30
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;
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