7b9ff00fc078fe4550e1f27d19de2e9e86835b36
[oota-llvm.git] / include / llvm / MC / MCObjectStreamer.h
1 //===- MCObjectStreamer.h - MCStreamer Object File Interface ----*- 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_MCOBJECTSTREAMER_H
11 #define LLVM_MC_MCOBJECTSTREAMER_H
12
13 #include "llvm/MC/MCStreamer.h"
14
15 namespace llvm {
16 class MCAssembler;
17 class MCCodeEmitter;
18 class MCSectionData;
19 class TargetAsmBackend;
20 class raw_ostream;
21
22 /// \brief Streaming object file generation interface.
23 ///
24 /// This class provides an implementation of the MCStreamer interface which is
25 /// suitable for use with the assembler backend. Specific object file formats
26 /// are expected to subclass this interface to implement directives specific
27 /// to that file format or custom semantics expected by the object writer
28 /// implementation.
29 class MCObjectStreamer : public MCStreamer {
30   MCAssembler *Assembler;
31   MCSectionData *CurSectionData;
32
33 protected:
34   MCObjectStreamer(MCContext &Context, TargetAsmBackend &TAB,
35                    raw_ostream &_OS, MCCodeEmitter *_Emitter);
36   ~MCObjectStreamer();
37
38   MCSectionData *getCurrentSectionData() const {
39     return CurSectionData;
40   }
41
42 public:
43   MCAssembler &getAssembler() { return *Assembler; }
44
45   /// @name MCStreamer Interface
46   /// @{
47
48   virtual void SwitchSection(const MCSection *Section);
49   virtual void Finish();
50
51   /// @}
52 };
53
54 } // end namespace llvm
55
56 #endif