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