Avoid some Mach-O specific alignment being done on ELF.
[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 MCExpr;
20 class MCFragment;
21 class MCDataFragment;
22 class TargetAsmBackend;
23 class raw_ostream;
24
25 /// \brief Streaming object file generation interface.
26 ///
27 /// This class provides an implementation of the MCStreamer interface which is
28 /// suitable for use with the assembler backend. Specific object file formats
29 /// are expected to subclass this interface to implement directives specific
30 /// to that file format or custom semantics expected by the object writer
31 /// implementation.
32 class MCObjectStreamer : public MCStreamer {
33   MCAssembler *Assembler;
34   MCSectionData *CurSectionData;
35
36 protected:
37   MCObjectStreamer(MCContext &Context, TargetAsmBackend &TAB,
38                    raw_ostream &_OS, MCCodeEmitter *_Emitter,
39                    bool _PadSectionToAlignment);
40   ~MCObjectStreamer();
41
42   MCSectionData *getCurrentSectionData() const {
43     return CurSectionData;
44   }
45
46   MCFragment *getCurrentFragment() const;
47
48   /// Get a data fragment to write into, creating a new one if the current
49   /// fragment is not a data fragment.
50   MCDataFragment *getOrCreateDataFragment() const;
51
52   const MCExpr *AddValueSymbols(const MCExpr *Value);
53
54 public:
55   MCAssembler &getAssembler() { return *Assembler; }
56
57   /// @name MCStreamer Interface
58   /// @{
59
60   virtual void SwitchSection(const MCSection *Section);
61   virtual void Finish();
62
63   /// @}
64 };
65
66 } // end namespace llvm
67
68 #endif