OSDN Git Service

These functions have default arguments of 0 for the last arg. Use
[android-x86/external-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 MCAsmBackend;
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   virtual void EmitInstToData(const MCInst &Inst) = 0;
37   virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
38   virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame);
39
40 protected:
41   MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
42                    raw_ostream &_OS, MCCodeEmitter *_Emitter);
43   MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
44                    raw_ostream &_OS, MCCodeEmitter *_Emitter,
45                    MCAssembler *_Assembler);
46   ~MCObjectStreamer();
47
48 public:
49   /// state management
50   virtual void reset();
51
52 protected:
53   MCSectionData *getCurrentSectionData() const {
54     return CurSectionData;
55   }
56
57   MCFragment *getCurrentFragment() const;
58
59   /// Get a data fragment to write into, creating a new one if the current
60   /// fragment is not a data fragment.
61   MCDataFragment *getOrCreateDataFragment() const;
62
63   const MCExpr *AddValueSymbols(const MCExpr *Value);
64
65 public:
66   MCAssembler &getAssembler() { return *Assembler; }
67
68   /// @name MCStreamer Interface
69   /// @{
70
71   virtual void EmitLabel(MCSymbol *Symbol);
72   virtual void EmitDebugLabel(MCSymbol *Symbol);
73   virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
74   virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
75                              unsigned AddrSpace);
76   virtual void EmitULEB128Value(const MCExpr *Value);
77   virtual void EmitSLEB128Value(const MCExpr *Value);
78   virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
79   virtual void ChangeSection(const MCSection *Section);
80   virtual void EmitInstruction(const MCInst &Inst);
81
82   /// \brief Emit an instruction to a special fragment, because this instruction
83   /// can change its size during relaxation.
84   virtual void EmitInstToFragment(const MCInst &Inst);
85
86   virtual void EmitBundleAlignMode(unsigned AlignPow2);
87   virtual void EmitBundleLock(bool AlignToEnd);
88   virtual void EmitBundleUnlock();
89   virtual void EmitBytes(StringRef Data, unsigned AddrSpace = 0);
90   virtual void EmitValueToAlignment(unsigned ByteAlignment,
91                                     int64_t Value = 0,
92                                     unsigned ValueSize = 1,
93                                     unsigned MaxBytesToEmit = 0);
94   virtual void EmitCodeAlignment(unsigned ByteAlignment,
95                                  unsigned MaxBytesToEmit = 0);
96   virtual bool EmitValueToOffset(const MCExpr *Offset, unsigned char Value);
97   virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
98                                         const MCSymbol *LastLabel,
99                                         const MCSymbol *Label,
100                                         unsigned PointerSize);
101   virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
102                                          const MCSymbol *Label);
103   virtual void EmitGPRel32Value(const MCExpr *Value);
104   virtual void EmitGPRel64Value(const MCExpr *Value);
105   virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
106                         unsigned AddrSpace = 0);
107   virtual void FinishImpl();
108
109   /// @}
110 };
111
112 } // end namespace llvm
113
114 #endif