Unfortunately several files in MC are badly violating layering rule by using
[oota-llvm.git] / include / llvm / MC / MCStreamer.h
1 //===- MCStreamer.h - High-level Streaming Machine Code Output --*- 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 // This file declares the MCStreamer class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_MC_MCSTREAMER_H
15 #define LLVM_MC_MCSTREAMER_H
16
17 #include "llvm/ADT/SmallVector.h"
18 #include "llvm/Support/DataTypes.h"
19 #include "llvm/MC/MCDirectives.h"
20 #include "llvm/MC/MCDwarf.h"
21 #include "llvm/MC/MCWin64EH.h"
22
23 namespace llvm {
24   class MCAsmInfo;
25   class MCCodeEmitter;
26   class MCContext;
27   class MCExpr;
28   class MCInst;
29   class MCInstPrinter;
30   class MCSection;
31   class MCSymbol;
32   class StringRef;
33   class TargetAsmBackend;
34   class TargetLoweringObjectFile;
35   class Twine;
36   class raw_ostream;
37   class formatted_raw_ostream;
38
39   /// MCStreamer - Streaming machine code generation interface.  This interface
40   /// is intended to provide a programatic interface that is very similar to the
41   /// level that an assembler .s file provides.  It has callbacks to emit bytes,
42   /// handle directives, etc.  The implementation of this interface retains
43   /// state to know what the current section is etc.
44   ///
45   /// There are multiple implementations of this interface: one for writing out
46   /// a .s file, and implementations that write out .o files of various formats.
47   ///
48   class MCStreamer {
49     MCContext &Context;
50
51     MCStreamer(const MCStreamer&); // DO NOT IMPLEMENT
52     MCStreamer &operator=(const MCStreamer&); // DO NOT IMPLEMENT
53
54     bool EmitEHFrame;
55     bool EmitDebugFrame;
56
57     std::vector<MCDwarfFrameInfo> FrameInfos;
58     MCDwarfFrameInfo *getCurrentFrameInfo();
59     void EnsureValidFrame();
60
61     std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos;
62     MCWin64EHUnwindInfo *CurrentW64UnwindInfo;
63     void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
64     void EnsureValidW64UnwindInfo();
65
66     const MCSymbol* LastNonPrivate;
67
68     /// SectionStack - This is stack of current and previous section
69     /// values saved by PushSection.
70     SmallVector<std::pair<const MCSection *,
71                 const MCSection *>, 4> SectionStack;
72
73   protected:
74     MCStreamer(MCContext &Ctx);
75
76     const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A,
77                                   const MCSymbol *B);
78
79     const MCExpr *ForceExpAbs(const MCExpr* Expr);
80
81     void EmitFrames(bool usingCFI);
82
83     MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;}
84     void EmitW64Tables();
85
86   public:
87     virtual ~MCStreamer();
88
89     MCContext &getContext() const { return Context; }
90
91     unsigned getNumFrameInfos() {
92       return FrameInfos.size();
93     }
94
95     const MCDwarfFrameInfo &getFrameInfo(unsigned i) {
96       return FrameInfos[i];
97     }
98
99     unsigned getNumW64UnwindInfos() {
100       return W64UnwindInfos.size();
101     }
102
103     MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
104       return *W64UnwindInfos[i];
105     }
106
107     /// @name Assembly File Formatting.
108     /// @{
109
110     /// isVerboseAsm - Return true if this streamer supports verbose assembly
111     /// and if it is enabled.
112     virtual bool isVerboseAsm() const { return false; }
113
114     /// hasRawTextSupport - Return true if this asm streamer supports emitting
115     /// unformatted text to the .s file with EmitRawText.
116     virtual bool hasRawTextSupport() const { return false; }
117
118     /// AddComment - Add a comment that can be emitted to the generated .s
119     /// file if applicable as a QoI issue to make the output of the compiler
120     /// more readable.  This only affects the MCAsmStreamer, and only when
121     /// verbose assembly output is enabled.
122     ///
123     /// If the comment includes embedded \n's, they will each get the comment
124     /// prefix as appropriate.  The added comment should not end with a \n.
125     virtual void AddComment(const Twine &T) {}
126
127     /// GetCommentOS - Return a raw_ostream that comments can be written to.
128     /// Unlike AddComment, you are required to terminate comments with \n if you
129     /// use this method.
130     virtual raw_ostream &GetCommentOS();
131
132     /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
133     virtual void AddBlankLine() {}
134
135     /// @}
136
137     /// @name Symbol & Section Management
138     /// @{
139
140     /// getCurrentSection - Return the current section that the streamer is
141     /// emitting code to.
142     const MCSection *getCurrentSection() const {
143       if (!SectionStack.empty())
144         return SectionStack.back().first;
145       return NULL;
146     }
147
148     /// getPreviousSection - Return the previous section that the streamer is
149     /// emitting code to.
150     const MCSection *getPreviousSection() const {
151       if (!SectionStack.empty())
152         return SectionStack.back().second;
153       return NULL;
154     }
155
156     /// ChangeSection - Update streamer for a new active section.
157     ///
158     /// This is called by PopSection and SwitchSection, if the current
159     /// section changes.
160     virtual void ChangeSection(const MCSection *) = 0;
161
162     /// pushSection - Save the current and previous section on the
163     /// section stack.
164     void PushSection() {
165       SectionStack.push_back(std::make_pair(getCurrentSection(),
166                                             getPreviousSection()));
167     }
168
169     /// popSection - Restore the current and previous section from
170     /// the section stack.  Calls ChangeSection as needed.
171     ///
172     /// Returns false if the stack was empty.
173     bool PopSection() {
174       if (SectionStack.size() <= 1)
175         return false;
176       const MCSection *oldSection = SectionStack.pop_back_val().first;
177       const MCSection *curSection = SectionStack.back().first;
178
179       if (oldSection != curSection)
180         ChangeSection(curSection);
181       return true;
182     }
183
184     /// SwitchSection - Set the current section where code is being emitted to
185     /// @p Section.  This is required to update CurSection.
186     ///
187     /// This corresponds to assembler directives like .section, .text, etc.
188     void SwitchSection(const MCSection *Section) {
189       assert(Section && "Cannot switch to a null section!");
190       const MCSection *curSection = SectionStack.back().first;
191       SectionStack.back().second = curSection;
192       if (Section != curSection) {
193         SectionStack.back().first = Section;
194         ChangeSection(Section);
195       }
196     }
197
198     /// SwitchSectionNoChange - Set the current section where code is being
199     /// emitted to @p Section.  This is required to update CurSection. This
200     /// version does not call ChangeSection.
201     void SwitchSectionNoChange(const MCSection *Section) {
202       assert(Section && "Cannot switch to a null section!");
203       const MCSection *curSection = SectionStack.back().first;
204       SectionStack.back().second = curSection;
205       if (Section != curSection)
206         SectionStack.back().first = Section;
207     }
208
209     /// InitSections - Create the default sections and set the initial one.
210     virtual void InitSections() = 0;
211
212     /// EmitLabel - Emit a label for @p Symbol into the current section.
213     ///
214     /// This corresponds to an assembler statement such as:
215     ///   foo:
216     ///
217     /// @param Symbol - The symbol to emit. A given symbol should only be
218     /// emitted as a label once, and symbols emitted as a label should never be
219     /// used in an assignment.
220     virtual void EmitLabel(MCSymbol *Symbol);
221
222     virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
223                                      MCSymbol *EHSymbol);
224
225     /// EmitAssemblerFlag - Note in the output the specified @p Flag
226     virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
227
228     /// EmitThumbFunc - Note in the output that the specified @p Func is
229     /// a Thumb mode function (ARM target only).
230     virtual void EmitThumbFunc(MCSymbol *Func) = 0;
231
232     /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
233     ///
234     /// This corresponds to an assembler statement such as:
235     ///  symbol = value
236     ///
237     /// The assignment generates no code, but has the side effect of binding the
238     /// value in the current context. For the assembly streamer, this prints the
239     /// binding into the .s file.
240     ///
241     /// @param Symbol - The symbol being assigned to.
242     /// @param Value - The value for the symbol.
243     virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0;
244
245     /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol.
246     ///
247     /// This corresponds to an assembler statement such as:
248     ///  .weakref alias, symbol
249     ///
250     /// @param Alias - The alias that is being created.
251     /// @param Symbol - The symbol being aliased.
252     virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0;
253
254     /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
255     virtual void EmitSymbolAttribute(MCSymbol *Symbol,
256                                      MCSymbolAttr Attribute) = 0;
257
258     /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
259     ///
260     /// @param Symbol - The symbol to have its n_desc field set.
261     /// @param DescValue - The value to set into the n_desc field.
262     virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
263
264     /// BeginCOFFSymbolDef - Start emitting COFF symbol definition
265     ///
266     /// @param Symbol - The symbol to have its External & Type fields set.
267     virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0;
268
269     /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
270     ///
271     /// @param StorageClass - The storage class the symbol should have.
272     virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0;
273
274     /// EmitCOFFSymbolType - Emit the type of the symbol.
275     ///
276     /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
277     virtual void EmitCOFFSymbolType(int Type) = 0;
278
279     /// EndCOFFSymbolDef - Marks the end of the symbol definition.
280     virtual void EndCOFFSymbolDef() = 0;
281
282     /// EmitELFSize - Emit an ELF .size directive.
283     ///
284     /// This corresponds to an assembler statement such as:
285     ///  .size symbol, expression
286     ///
287     virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0;
288
289     /// EmitCommonSymbol - Emit a common symbol.
290     ///
291     /// @param Symbol - The common symbol to emit.
292     /// @param Size - The size of the common symbol.
293     /// @param ByteAlignment - The alignment of the symbol if
294     /// non-zero. This must be a power of 2.
295     virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
296                                   unsigned ByteAlignment) = 0;
297
298     /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
299     ///
300     /// @param Symbol - The common symbol to emit.
301     /// @param Size - The size of the common symbol.
302     virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) = 0;
303
304     /// EmitZerofill - Emit the zerofill section and an optional symbol.
305     ///
306     /// @param Section - The zerofill section to create and or to put the symbol
307     /// @param Symbol - The zerofill symbol to emit, if non-NULL.
308     /// @param Size - The size of the zerofill symbol.
309     /// @param ByteAlignment - The alignment of the zerofill symbol if
310     /// non-zero. This must be a power of 2 on some targets.
311     virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
312                               unsigned Size = 0,unsigned ByteAlignment = 0) = 0;
313
314     /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
315     ///
316     /// @param Section - The thread local common section.
317     /// @param Symbol - The thread local common symbol to emit.
318     /// @param Size - The size of the symbol.
319     /// @param ByteAlignment - The alignment of the thread local common symbol
320     /// if non-zero.  This must be a power of 2 on some targets.
321     virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
322                                 uint64_t Size, unsigned ByteAlignment = 0) = 0;
323
324     /// @}
325     /// @name Generating Data
326     /// @{
327
328     /// EmitBytes - Emit the bytes in \arg Data into the output.
329     ///
330     /// This is used to implement assembler directives such as .byte, .ascii,
331     /// etc.
332     virtual void EmitBytes(StringRef Data, unsigned AddrSpace) = 0;
333
334     /// EmitValue - Emit the expression @p Value into the output as a native
335     /// integer of the given @p Size bytes.
336     ///
337     /// This is used to implement assembler directives such as .word, .quad,
338     /// etc.
339     ///
340     /// @param Value - The value to emit.
341     /// @param Size - The size of the integer (in bytes) to emit. This must
342     /// match a native machine width.
343     virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
344                                unsigned AddrSpace) = 0;
345
346     void EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace = 0);
347
348     /// EmitIntValue - Special case of EmitValue that avoids the client having
349     /// to pass in a MCExpr for constant integers.
350     virtual void EmitIntValue(uint64_t Value, unsigned Size,
351                               unsigned AddrSpace = 0);
352
353     /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
354     /// this is done by producing
355     /// foo = value
356     /// .long foo
357     void EmitAbsValue(const MCExpr *Value, unsigned Size,
358                       unsigned AddrSpace = 0);
359
360     virtual void EmitULEB128Value(const MCExpr *Value) = 0;
361
362     virtual void EmitSLEB128Value(const MCExpr *Value) = 0;
363
364     /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the
365     /// client having to pass in a MCExpr for constant integers.
366     void EmitULEB128IntValue(uint64_t Value, unsigned AddrSpace = 0);
367
368     /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
369     /// client having to pass in a MCExpr for constant integers.
370     void EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace = 0);
371
372     /// EmitSymbolValue - Special case of EmitValue that avoids the client
373     /// having to pass in a MCExpr for MCSymbols.
374     void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
375                          unsigned AddrSpace = 0);
376
377     /// EmitGPRel32Value - Emit the expression @p Value into the output as a
378     /// gprel32 (32-bit GP relative) value.
379     ///
380     /// This is used to implement assembler directives such as .gprel32 on
381     /// targets that support them.
382     virtual void EmitGPRel32Value(const MCExpr *Value);
383
384     /// EmitFill - Emit NumBytes bytes worth of the value specified by
385     /// FillValue.  This implements directives such as '.space'.
386     virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
387                           unsigned AddrSpace);
388
389     /// EmitZeros - Emit NumBytes worth of zeros.  This is a convenience
390     /// function that just wraps EmitFill.
391     void EmitZeros(uint64_t NumBytes, unsigned AddrSpace) {
392       EmitFill(NumBytes, 0, AddrSpace);
393     }
394
395
396     /// EmitValueToAlignment - Emit some number of copies of @p Value until
397     /// the byte alignment @p ByteAlignment is reached.
398     ///
399     /// If the number of bytes need to emit for the alignment is not a multiple
400     /// of @p ValueSize, then the contents of the emitted fill bytes is
401     /// undefined.
402     ///
403     /// This used to implement the .align assembler directive.
404     ///
405     /// @param ByteAlignment - The alignment to reach. This must be a power of
406     /// two on some targets.
407     /// @param Value - The value to use when filling bytes.
408     /// @param ValueSize - The size of the integer (in bytes) to emit for
409     /// @p Value. This must match a native machine width.
410     /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
411     /// the alignment cannot be reached in this many bytes, no bytes are
412     /// emitted.
413     virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
414                                       unsigned ValueSize = 1,
415                                       unsigned MaxBytesToEmit = 0) = 0;
416
417     /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
418     /// is reached.
419     ///
420     /// This used to align code where the alignment bytes may be executed.  This
421     /// can emit different bytes for different sizes to optimize execution.
422     ///
423     /// @param ByteAlignment - The alignment to reach. This must be a power of
424     /// two on some targets.
425     /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
426     /// the alignment cannot be reached in this many bytes, no bytes are
427     /// emitted.
428     virtual void EmitCodeAlignment(unsigned ByteAlignment,
429                                    unsigned MaxBytesToEmit = 0) = 0;
430
431     /// EmitValueToOffset - Emit some number of copies of @p Value until the
432     /// byte offset @p Offset is reached.
433     ///
434     /// This is used to implement assembler directives such as .org.
435     ///
436     /// @param Offset - The offset to reach. This may be an expression, but the
437     /// expression must be associated with the current section.
438     /// @param Value - The value to use when filling bytes.
439     virtual void EmitValueToOffset(const MCExpr *Offset,
440                                    unsigned char Value = 0) = 0;
441
442     /// @}
443
444     /// EmitFileDirective - Switch to a new logical file.  This is used to
445     /// implement the '.file "foo.c"' assembler directive.
446     virtual void EmitFileDirective(StringRef Filename) = 0;
447
448     /// EmitDwarfFileDirective - Associate a filename with a specified logical
449     /// file number.  This implements the DWARF2 '.file 4 "foo.c"' assembler
450     /// directive.
451     virtual bool EmitDwarfFileDirective(unsigned FileNo,StringRef Filename);
452
453     /// EmitDwarfLocDirective - This implements the DWARF2
454     // '.loc fileno lineno ...' assembler directive.
455     virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
456                                        unsigned Column, unsigned Flags,
457                                        unsigned Isa,
458                                        unsigned Discriminator,
459                                        StringRef FileName);
460
461     virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
462                                           const MCSymbol *LastLabel,
463                                           const MCSymbol *Label,
464                                           unsigned PointerSize) = 0;
465
466     virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
467                                            const MCSymbol *Label) {
468     }
469
470     void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
471                               int PointerSize);
472
473     virtual void EmitCFISections(bool EH, bool Debug);
474     virtual void EmitCFIStartProc();
475     virtual void EmitCFIEndProc();
476     virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
477     virtual void EmitCFIDefCfaOffset(int64_t Offset);
478     virtual void EmitCFIDefCfaRegister(int64_t Register);
479     virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
480     virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
481     virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
482     virtual void EmitCFIRememberState();
483     virtual void EmitCFIRestoreState();
484     virtual void EmitCFISameValue(int64_t Register);
485     virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
486     virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
487
488     virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
489     virtual void EmitWin64EHEndProc();
490     virtual void EmitWin64EHStartChained();
491     virtual void EmitWin64EHEndChained();
492     virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
493                                     bool Except);
494     virtual void EmitWin64EHHandlerData();
495     virtual void EmitWin64EHPushReg(unsigned Register);
496     virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
497     virtual void EmitWin64EHAllocStack(unsigned Size);
498     virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
499     virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
500     virtual void EmitWin64EHPushFrame(bool Code);
501     virtual void EmitWin64EHEndProlog();
502
503     /// EmitInstruction - Emit the given @p Instruction into the current
504     /// section.
505     virtual void EmitInstruction(const MCInst &Inst) = 0;
506
507     /// EmitRawText - If this file is backed by a assembly streamer, this dumps
508     /// the specified string in the output .s file.  This capability is
509     /// indicated by the hasRawTextSupport() predicate.  By default this aborts.
510     virtual void EmitRawText(StringRef String);
511     void EmitRawText(const Twine &String);
512
513     /// ARM-related methods.
514     /// FIXME: Eventually we should have some "target MC streamer" and move
515     /// these methods there.
516     virtual void EmitFnStart();
517     virtual void EmitFnEnd();
518     virtual void EmitCantUnwind();
519     virtual void EmitPersonality(const MCSymbol *Personality);
520     virtual void EmitHandlerData();
521     virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0);
522     virtual void EmitPad(int64_t Offset);
523     virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
524                              bool isVector);
525
526     /// Finish - Finish emission of machine code.
527     virtual void Finish() = 0;
528   };
529
530   /// createNullStreamer - Create a dummy machine code streamer, which does
531   /// nothing. This is useful for timing the assembler front end.
532   MCStreamer *createNullStreamer(MCContext &Ctx);
533
534   /// createAsmStreamer - Create a machine code streamer which will print out
535   /// assembly for the native target, suitable for compiling with a native
536   /// assembler.
537   ///
538   /// \param InstPrint - If given, the instruction printer to use. If not given
539   /// the MCInst representation will be printed.  This method takes ownership of
540   /// InstPrint.
541   ///
542   /// \param CE - If given, a code emitter to use to show the instruction
543   /// encoding inline with the assembly. This method takes ownership of \arg CE.
544   ///
545   /// \param TAB - If given, a target asm backend to use to show the fixup
546   /// information in conjunction with encoding information. This method takes
547   /// ownership of \arg TAB.
548   ///
549   /// \param ShowInst - Whether to show the MCInst representation inline with
550   /// the assembly.
551   ///
552   /// \param DecodeLSDA - If true, emit comments that translates the LSDA into a
553   /// human readable format. Only usable with CFI.
554   MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
555                                 bool isVerboseAsm,
556                                 bool useLoc,
557                                 bool useCFI,
558                                 MCInstPrinter *InstPrint = 0,
559                                 MCCodeEmitter *CE = 0,
560                                 TargetAsmBackend *TAB = 0,
561                                 bool ShowInst = false);
562
563   /// createMachOStreamer - Create a machine code streamer which will generate
564   /// Mach-O format object files.
565   ///
566   /// Takes ownership of \arg TAB and \arg CE.
567   MCStreamer *createMachOStreamer(MCContext &Ctx, TargetAsmBackend &TAB,
568                                   raw_ostream &OS, MCCodeEmitter *CE,
569                                   bool RelaxAll = false);
570
571   /// createWinCOFFStreamer - Create a machine code streamer which will
572   /// generate Microsoft COFF format object files.
573   ///
574   /// Takes ownership of \arg TAB and \arg CE.
575   MCStreamer *createWinCOFFStreamer(MCContext &Ctx,
576                                     TargetAsmBackend &TAB,
577                                     MCCodeEmitter &CE, raw_ostream &OS,
578                                     bool RelaxAll = false);
579
580   /// createELFStreamer - Create a machine code streamer which will generate
581   /// ELF format object files.
582   MCStreamer *createELFStreamer(MCContext &Ctx, TargetAsmBackend &TAB,
583                                 raw_ostream &OS, MCCodeEmitter *CE,
584                                 bool RelaxAll, bool NoExecStack);
585
586   /// createLoggingStreamer - Create a machine code streamer which just logs the
587   /// API calls and then dispatches to another streamer.
588   ///
589   /// The new streamer takes ownership of the \arg Child.
590   MCStreamer *createLoggingStreamer(MCStreamer *Child, raw_ostream &OS);
591
592   /// createPureStreamer - Create a machine code streamer which will generate
593   /// "pure" MC object files, for use with MC-JIT and testing tools.
594   ///
595   /// Takes ownership of \arg TAB and \arg CE.
596   MCStreamer *createPureStreamer(MCContext &Ctx, TargetAsmBackend &TAB,
597                                  raw_ostream &OS, MCCodeEmitter *CE);
598
599 } // end namespace llvm
600
601 #endif