Assume .cfi_startproc is the first thing in a function. If the function is
[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     virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) = 0;
308
309     /// EmitZerofill - Emit the zerofill section and an optional symbol.
310     ///
311     /// @param Section - The zerofill section to create and or to put the symbol
312     /// @param Symbol - The zerofill symbol to emit, if non-NULL.
313     /// @param Size - The size of the zerofill symbol.
314     /// @param ByteAlignment - The alignment of the zerofill symbol if
315     /// non-zero. This must be a power of 2 on some targets.
316     virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
317                               unsigned Size = 0,unsigned ByteAlignment = 0) = 0;
318
319     /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
320     ///
321     /// @param Section - The thread local common section.
322     /// @param Symbol - The thread local common symbol to emit.
323     /// @param Size - The size of the symbol.
324     /// @param ByteAlignment - The alignment of the thread local common symbol
325     /// if non-zero.  This must be a power of 2 on some targets.
326     virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
327                                 uint64_t Size, unsigned ByteAlignment = 0) = 0;
328
329     /// @}
330     /// @name Generating Data
331     /// @{
332
333     /// EmitBytes - Emit the bytes in \arg Data into the output.
334     ///
335     /// This is used to implement assembler directives such as .byte, .ascii,
336     /// etc.
337     virtual void EmitBytes(StringRef Data, unsigned AddrSpace) = 0;
338
339     /// EmitValue - Emit the expression @p Value into the output as a native
340     /// integer of the given @p Size bytes.
341     ///
342     /// This is used to implement assembler directives such as .word, .quad,
343     /// etc.
344     ///
345     /// @param Value - The value to emit.
346     /// @param Size - The size of the integer (in bytes) to emit. This must
347     /// match a native machine width.
348     virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
349                                unsigned AddrSpace) = 0;
350
351     void EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace = 0);
352
353     /// EmitIntValue - Special case of EmitValue that avoids the client having
354     /// to pass in a MCExpr for constant integers.
355     virtual void EmitIntValue(uint64_t Value, unsigned Size,
356                               unsigned AddrSpace = 0);
357
358     /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
359     /// this is done by producing
360     /// foo = value
361     /// .long foo
362     void EmitAbsValue(const MCExpr *Value, unsigned Size,
363                       unsigned AddrSpace = 0);
364
365     virtual void EmitULEB128Value(const MCExpr *Value) = 0;
366
367     virtual void EmitSLEB128Value(const MCExpr *Value) = 0;
368
369     /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the
370     /// client having to pass in a MCExpr for constant integers.
371     void EmitULEB128IntValue(uint64_t Value, unsigned AddrSpace = 0);
372
373     /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
374     /// client having to pass in a MCExpr for constant integers.
375     void EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace = 0);
376
377     /// EmitSymbolValue - Special case of EmitValue that avoids the client
378     /// having to pass in a MCExpr for MCSymbols.
379     void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
380                          unsigned AddrSpace = 0);
381
382     /// EmitGPRel32Value - Emit the expression @p Value into the output as a
383     /// gprel32 (32-bit GP relative) value.
384     ///
385     /// This is used to implement assembler directives such as .gprel32 on
386     /// targets that support them.
387     virtual void EmitGPRel32Value(const MCExpr *Value);
388
389     /// EmitFill - Emit NumBytes bytes worth of the value specified by
390     /// FillValue.  This implements directives such as '.space'.
391     virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
392                           unsigned AddrSpace);
393
394     /// EmitZeros - Emit NumBytes worth of zeros.  This is a convenience
395     /// function that just wraps EmitFill.
396     void EmitZeros(uint64_t NumBytes, unsigned AddrSpace) {
397       EmitFill(NumBytes, 0, AddrSpace);
398     }
399
400
401     /// EmitValueToAlignment - Emit some number of copies of @p Value until
402     /// the byte alignment @p ByteAlignment is reached.
403     ///
404     /// If the number of bytes need to emit for the alignment is not a multiple
405     /// of @p ValueSize, then the contents of the emitted fill bytes is
406     /// undefined.
407     ///
408     /// This used to implement the .align assembler directive.
409     ///
410     /// @param ByteAlignment - The alignment to reach. This must be a power of
411     /// two on some targets.
412     /// @param Value - The value to use when filling bytes.
413     /// @param ValueSize - The size of the integer (in bytes) to emit for
414     /// @p Value. This must match a native machine width.
415     /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
416     /// the alignment cannot be reached in this many bytes, no bytes are
417     /// emitted.
418     virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
419                                       unsigned ValueSize = 1,
420                                       unsigned MaxBytesToEmit = 0) = 0;
421
422     /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
423     /// is reached.
424     ///
425     /// This used to align code where the alignment bytes may be executed.  This
426     /// can emit different bytes for different sizes to optimize execution.
427     ///
428     /// @param ByteAlignment - The alignment to reach. This must be a power of
429     /// two on some targets.
430     /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
431     /// the alignment cannot be reached in this many bytes, no bytes are
432     /// emitted.
433     virtual void EmitCodeAlignment(unsigned ByteAlignment,
434                                    unsigned MaxBytesToEmit = 0) = 0;
435
436     /// EmitValueToOffset - Emit some number of copies of @p Value until the
437     /// byte offset @p Offset is reached.
438     ///
439     /// This is used to implement assembler directives such as .org.
440     ///
441     /// @param Offset - The offset to reach. This may be an expression, but the
442     /// expression must be associated with the current section.
443     /// @param Value - The value to use when filling bytes.
444     virtual void EmitValueToOffset(const MCExpr *Offset,
445                                    unsigned char Value = 0) = 0;
446
447     /// @}
448
449     /// EmitFileDirective - Switch to a new logical file.  This is used to
450     /// implement the '.file "foo.c"' assembler directive.
451     virtual void EmitFileDirective(StringRef Filename) = 0;
452
453     /// EmitDwarfFileDirective - Associate a filename with a specified logical
454     /// file number.  This implements the DWARF2 '.file 4 "foo.c"' assembler
455     /// directive.
456     virtual bool EmitDwarfFileDirective(unsigned FileNo,StringRef Filename);
457
458     /// EmitDwarfLocDirective - This implements the DWARF2
459     // '.loc fileno lineno ...' assembler directive.
460     virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
461                                        unsigned Column, unsigned Flags,
462                                        unsigned Isa,
463                                        unsigned Discriminator,
464                                        StringRef FileName);
465
466     virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
467                                           const MCSymbol *LastLabel,
468                                           const MCSymbol *Label,
469                                           unsigned PointerSize) = 0;
470
471     virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
472                                            const MCSymbol *Label) {
473     }
474
475     void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
476                               int PointerSize);
477
478     virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding);
479     virtual void EmitCFISections(bool EH, bool Debug);
480     virtual void EmitCFIStartProc();
481     virtual void EmitCFIEndProc();
482     virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
483     virtual void EmitCFIDefCfaOffset(int64_t Offset);
484     virtual void EmitCFIDefCfaRegister(int64_t Register);
485     virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
486     virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
487     virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
488     virtual void EmitCFIRememberState();
489     virtual void EmitCFIRestoreState();
490     virtual void EmitCFISameValue(int64_t Register);
491     virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
492     virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
493
494     virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
495     virtual void EmitWin64EHEndProc();
496     virtual void EmitWin64EHStartChained();
497     virtual void EmitWin64EHEndChained();
498     virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
499                                     bool Except);
500     virtual void EmitWin64EHHandlerData();
501     virtual void EmitWin64EHPushReg(unsigned Register);
502     virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
503     virtual void EmitWin64EHAllocStack(unsigned Size);
504     virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
505     virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
506     virtual void EmitWin64EHPushFrame(bool Code);
507     virtual void EmitWin64EHEndProlog();
508
509     /// EmitInstruction - Emit the given @p Instruction into the current
510     /// section.
511     virtual void EmitInstruction(const MCInst &Inst) = 0;
512
513     /// EmitRawText - If this file is backed by a assembly streamer, this dumps
514     /// the specified string in the output .s file.  This capability is
515     /// indicated by the hasRawTextSupport() predicate.  By default this aborts.
516     virtual void EmitRawText(StringRef String);
517     void EmitRawText(const Twine &String);
518
519     /// ARM-related methods.
520     /// FIXME: Eventually we should have some "target MC streamer" and move
521     /// these methods there.
522     virtual void EmitFnStart();
523     virtual void EmitFnEnd();
524     virtual void EmitCantUnwind();
525     virtual void EmitPersonality(const MCSymbol *Personality);
526     virtual void EmitHandlerData();
527     virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0);
528     virtual void EmitPad(int64_t Offset);
529     virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
530                              bool isVector);
531
532     /// Finish - Finish emission of machine code.
533     virtual void Finish() = 0;
534   };
535
536   /// createNullStreamer - Create a dummy machine code streamer, which does
537   /// nothing. This is useful for timing the assembler front end.
538   MCStreamer *createNullStreamer(MCContext &Ctx);
539
540   /// createAsmStreamer - Create a machine code streamer which will print out
541   /// assembly for the native target, suitable for compiling with a native
542   /// assembler.
543   ///
544   /// \param InstPrint - If given, the instruction printer to use. If not given
545   /// the MCInst representation will be printed.  This method takes ownership of
546   /// InstPrint.
547   ///
548   /// \param CE - If given, a code emitter to use to show the instruction
549   /// encoding inline with the assembly. This method takes ownership of \arg CE.
550   ///
551   /// \param TAB - If given, a target asm backend to use to show the fixup
552   /// information in conjunction with encoding information. This method takes
553   /// ownership of \arg TAB.
554   ///
555   /// \param ShowInst - Whether to show the MCInst representation inline with
556   /// the assembly.
557   ///
558   /// \param DecodeLSDA - If true, emit comments that translates the LSDA into a
559   /// human readable format. Only usable with CFI.
560   MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
561                                 bool isVerboseAsm,
562                                 bool useLoc,
563                                 bool useCFI,
564                                 MCInstPrinter *InstPrint = 0,
565                                 MCCodeEmitter *CE = 0,
566                                 MCAsmBackend *TAB = 0,
567                                 bool ShowInst = false);
568
569   /// createMachOStreamer - Create a machine code streamer which will generate
570   /// Mach-O format object files.
571   ///
572   /// Takes ownership of \arg TAB and \arg CE.
573   MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
574                                   raw_ostream &OS, MCCodeEmitter *CE,
575                                   bool RelaxAll = false);
576
577   /// createWinCOFFStreamer - Create a machine code streamer which will
578   /// generate Microsoft COFF format object files.
579   ///
580   /// Takes ownership of \arg TAB and \arg CE.
581   MCStreamer *createWinCOFFStreamer(MCContext &Ctx,
582                                     MCAsmBackend &TAB,
583                                     MCCodeEmitter &CE, raw_ostream &OS,
584                                     bool RelaxAll = false);
585
586   /// createELFStreamer - Create a machine code streamer which will generate
587   /// ELF format object files.
588   MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
589                                 raw_ostream &OS, MCCodeEmitter *CE,
590                                 bool RelaxAll, bool NoExecStack);
591
592   /// createLoggingStreamer - Create a machine code streamer which just logs the
593   /// API calls and then dispatches to another streamer.
594   ///
595   /// The new streamer takes ownership of the \arg Child.
596   MCStreamer *createLoggingStreamer(MCStreamer *Child, raw_ostream &OS);
597
598   /// createPureStreamer - Create a machine code streamer which will generate
599   /// "pure" MC object files, for use with MC-JIT and testing tools.
600   ///
601   /// Takes ownership of \arg TAB and \arg CE.
602   MCStreamer *createPureStreamer(MCContext &Ctx, MCAsmBackend &TAB,
603                                  raw_ostream &OS, MCCodeEmitter *CE);
604
605 } // end namespace llvm
606
607 #endif