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