LLVM  8.0.1
MCWinCOFFObjectWriter.h
Go to the documentation of this file.
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 "llvm/MC/MCObjectWriter.h"
14 #include <memory>
15 
16 namespace llvm {
17 
18 class MCAsmBackend;
19 class MCContext;
20 class MCFixup;
21 class MCValue;
22 class raw_pwrite_stream;
23 
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  virtual Triple::ObjectFormatType getFormat() const { return Triple::COFF; }
36  static bool classof(const MCObjectTargetWriter *W) {
37  return W->getFormat() == Triple::COFF;
38  }
39 
40  unsigned getMachine() const { return Machine; }
41  virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
42  const MCFixup &Fixup, bool IsCrossSection,
43  const MCAsmBackend &MAB) const = 0;
44  virtual bool recordRelocation(const MCFixup &) const { return true; }
45  };
46 
47  /// Construct a new Win COFF writer instance.
48  ///
49  /// \param MOTW - The target specific WinCOFF writer subclass.
50  /// \param OS - The stream to write to.
51  /// \returns The constructed object writer.
52  std::unique_ptr<MCObjectWriter>
53  createWinCOFFObjectWriter(std::unique_ptr<MCWinCOFFObjectTargetWriter> MOTW,
54  raw_pwrite_stream &OS);
55 } // end namespace llvm
56 
57 #endif // LLVM_MC_MCWINCOFFOBJECTWRITER_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
This represents an "assembler immediate".
Definition: MCValue.h:40
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:74
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsCrossSection, const MCAsmBackend &MAB) const =0
virtual Triple::ObjectFormatType getFormat() const =0
Context object for machine code objects.
Definition: MCContext.h:63
virtual ~MCWinCOFFObjectTargetWriter()=default
virtual bool recordRelocation(const MCFixup &) const
std::unique_ptr< MCObjectWriter > createWinCOFFObjectWriter(std::unique_ptr< MCWinCOFFObjectTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new Win COFF writer instance.
PowerPC TLS Dynamic Call Fixup
virtual Triple::ObjectFormatType getFormat() const
Target - Wrapper for Target specific information.
Base class for classes that define behaviour that is specific to both the target and the object forma...
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:341
ObjectFormatType
Definition: Triple.h:216
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:42
static bool classof(const MCObjectTargetWriter *W)