1 //===- MCStreamer.h - High-level Streaming Machine Code Output --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the MCStreamer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_MC_MCSTREAMER_H
15 #define LLVM_MC_MCSTREAMER_H
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/MC/MCDirectives.h"
20 #include "llvm/MC/MCDwarf.h"
21 #include "llvm/MC/MCWin64EH.h"
22 #include "llvm/Support/DataTypes.h"
37 class formatted_raw_ostream;
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.
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.
55 // MCObjectStreamer subclasses.
64 const StreamerKind Kind;
67 MCStreamer(const MCStreamer&) LLVM_DELETED_FUNCTION;
68 MCStreamer &operator=(const MCStreamer&) LLVM_DELETED_FUNCTION;
73 std::vector<MCDwarfFrameInfo> FrameInfos;
74 MCDwarfFrameInfo *getCurrentFrameInfo();
75 MCSymbol *EmitCFICommon();
76 void EnsureValidFrame();
78 std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos;
79 MCWin64EHUnwindInfo *CurrentW64UnwindInfo;
80 void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
81 void EnsureValidW64UnwindInfo();
85 /// SectionStack - This is stack of current and previous section
86 /// values saved by PushSection.
87 SmallVector<std::pair<const MCSection *,
88 const MCSection *>, 4> SectionStack;
90 bool AutoInitSections;
93 MCStreamer(StreamerKind Kind, MCContext &Ctx);
95 const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A,
98 const MCExpr *ForceExpAbs(const MCExpr* Expr);
100 void RecordProcStart(MCDwarfFrameInfo &Frame);
101 virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
102 void RecordProcEnd(MCDwarfFrameInfo &Frame);
103 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
104 void EmitFrames(bool usingCFI);
106 MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;}
107 void EmitW64Tables();
110 virtual ~MCStreamer();
112 StreamerKind getKind() const { return Kind; }
116 virtual void reset();
118 MCContext &getContext() const { return Context; }
120 unsigned getNumFrameInfos() {
121 return FrameInfos.size();
124 const MCDwarfFrameInfo &getFrameInfo(unsigned i) {
125 return FrameInfos[i];
128 ArrayRef<MCDwarfFrameInfo> getFrameInfos() {
132 unsigned getNumW64UnwindInfos() {
133 return W64UnwindInfos.size();
136 MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
137 return *W64UnwindInfos[i];
140 /// @name Assembly File Formatting.
143 /// isVerboseAsm - Return true if this streamer supports verbose assembly
144 /// and if it is enabled.
145 virtual bool isVerboseAsm() const { return false; }
147 /// hasRawTextSupport - Return true if this asm streamer supports emitting
148 /// unformatted text to the .s file with EmitRawText.
149 virtual bool hasRawTextSupport() const { return false; }
151 /// AddComment - Add a comment that can be emitted to the generated .s
152 /// file if applicable as a QoI issue to make the output of the compiler
153 /// more readable. This only affects the MCAsmStreamer, and only when
154 /// verbose assembly output is enabled.
156 /// If the comment includes embedded \n's, they will each get the comment
157 /// prefix as appropriate. The added comment should not end with a \n.
158 virtual void AddComment(const Twine &T) {}
160 /// GetCommentOS - Return a raw_ostream that comments can be written to.
161 /// Unlike AddComment, you are required to terminate comments with \n if you
163 virtual raw_ostream &GetCommentOS();
165 /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
166 virtual void AddBlankLine() {}
170 /// @name Symbol & Section Management
173 /// getCurrentSection - Return the current section that the streamer is
174 /// emitting code to.
175 const MCSection *getCurrentSection() const {
176 if (!SectionStack.empty())
177 return SectionStack.back().first;
181 /// getPreviousSection - Return the previous section that the streamer is
182 /// emitting code to.
183 const MCSection *getPreviousSection() const {
184 if (!SectionStack.empty())
185 return SectionStack.back().second;
189 /// ChangeSection - Update streamer for a new active section.
191 /// This is called by PopSection and SwitchSection, if the current
193 virtual void ChangeSection(const MCSection *) = 0;
195 /// pushSection - Save the current and previous section on the
198 SectionStack.push_back(std::make_pair(getCurrentSection(),
199 getPreviousSection()));
202 /// popSection - Restore the current and previous section from
203 /// the section stack. Calls ChangeSection as needed.
205 /// Returns false if the stack was empty.
207 if (SectionStack.size() <= 1)
209 const MCSection *oldSection = SectionStack.pop_back_val().first;
210 const MCSection *curSection = SectionStack.back().first;
212 if (oldSection != curSection)
213 ChangeSection(curSection);
217 /// SwitchSection - Set the current section where code is being emitted to
218 /// @p Section. This is required to update CurSection.
220 /// This corresponds to assembler directives like .section, .text, etc.
221 void SwitchSection(const MCSection *Section) {
222 assert(Section && "Cannot switch to a null section!");
223 const MCSection *curSection = SectionStack.back().first;
224 SectionStack.back().second = curSection;
225 if (Section != curSection) {
226 SectionStack.back().first = Section;
227 ChangeSection(Section);
231 /// SwitchSectionNoChange - Set the current section where code is being
232 /// emitted to @p Section. This is required to update CurSection. This
233 /// version does not call ChangeSection.
234 void SwitchSectionNoChange(const MCSection *Section) {
235 assert(Section && "Cannot switch to a null section!");
236 const MCSection *curSection = SectionStack.back().first;
237 SectionStack.back().second = curSection;
238 if (Section != curSection)
239 SectionStack.back().first = Section;
242 /// Initialize the streamer.
243 void InitStreamer() {
244 if (AutoInitSections)
248 /// Tell this MCStreamer to call InitSections upon initialization.
249 void setAutoInitSections(bool AutoInitSections) {
250 this->AutoInitSections = AutoInitSections;
253 /// InitSections - Create the default sections and set the initial one.
254 virtual void InitSections() = 0;
256 /// InitToTextSection - Create a text section and switch the streamer to it.
257 virtual void InitToTextSection() = 0;
259 /// EmitLabel - Emit a label for @p Symbol into the current section.
261 /// This corresponds to an assembler statement such as:
264 /// @param Symbol - The symbol to emit. A given symbol should only be
265 /// emitted as a label once, and symbols emitted as a label should never be
266 /// used in an assignment.
267 virtual void EmitLabel(MCSymbol *Symbol);
269 virtual void EmitDebugLabel(MCSymbol *Symbol);
271 virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
274 /// EmitAssemblerFlag - Note in the output the specified @p Flag.
275 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
277 /// EmitLinkerOptions - Emit the given list @p Options of strings as linker
278 /// options into the output.
279 virtual void EmitLinkerOptions(ArrayRef<std::string> Kind) {}
281 /// EmitDataRegion - Note in the output the specified region @p Kind.
282 virtual void EmitDataRegion(MCDataRegionType Kind) {}
284 /// EmitThumbFunc - Note in the output that the specified @p Func is
285 /// a Thumb mode function (ARM target only).
286 virtual void EmitThumbFunc(MCSymbol *Func) = 0;
288 /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
290 /// This corresponds to an assembler statement such as:
293 /// The assignment generates no code, but has the side effect of binding the
294 /// value in the current context. For the assembly streamer, this prints the
295 /// binding into the .s file.
297 /// @param Symbol - The symbol being assigned to.
298 /// @param Value - The value for the symbol.
299 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0;
301 /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol.
303 /// This corresponds to an assembler statement such as:
304 /// .weakref alias, symbol
306 /// @param Alias - The alias that is being created.
307 /// @param Symbol - The symbol being aliased.
308 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0;
310 /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
311 virtual void EmitSymbolAttribute(MCSymbol *Symbol,
312 MCSymbolAttr Attribute) = 0;
314 /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
316 /// @param Symbol - The symbol to have its n_desc field set.
317 /// @param DescValue - The value to set into the n_desc field.
318 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
320 /// BeginCOFFSymbolDef - Start emitting COFF symbol definition
322 /// @param Symbol - The symbol to have its External & Type fields set.
323 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0;
325 /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
327 /// @param StorageClass - The storage class the symbol should have.
328 virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0;
330 /// EmitCOFFSymbolType - Emit the type of the symbol.
332 /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
333 virtual void EmitCOFFSymbolType(int Type) = 0;
335 /// EndCOFFSymbolDef - Marks the end of the symbol definition.
336 virtual void EndCOFFSymbolDef() = 0;
338 /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
340 /// @param Symbol - Symbol the section relative realocation should point to.
341 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
343 /// EmitELFSize - Emit an ELF .size directive.
345 /// This corresponds to an assembler statement such as:
346 /// .size symbol, expression
348 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0;
350 /// EmitCommonSymbol - Emit a common symbol.
352 /// @param Symbol - The common symbol to emit.
353 /// @param Size - The size of the common symbol.
354 /// @param ByteAlignment - The alignment of the symbol if
355 /// non-zero. This must be a power of 2.
356 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
357 unsigned ByteAlignment) = 0;
359 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
361 /// @param Symbol - The common symbol to emit.
362 /// @param Size - The size of the common symbol.
363 /// @param ByteAlignment - The alignment of the common symbol in bytes.
364 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
365 unsigned ByteAlignment) = 0;
367 /// EmitZerofill - Emit the zerofill section and an optional symbol.
369 /// @param Section - The zerofill section to create and or to put the symbol
370 /// @param Symbol - The zerofill symbol to emit, if non-NULL.
371 /// @param Size - The size of the zerofill symbol.
372 /// @param ByteAlignment - The alignment of the zerofill symbol if
373 /// non-zero. This must be a power of 2 on some targets.
374 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
375 uint64_t Size = 0,unsigned ByteAlignment = 0) = 0;
377 /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
379 /// @param Section - The thread local common section.
380 /// @param Symbol - The thread local common symbol to emit.
381 /// @param Size - The size of the symbol.
382 /// @param ByteAlignment - The alignment of the thread local common symbol
383 /// if non-zero. This must be a power of 2 on some targets.
384 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
385 uint64_t Size, unsigned ByteAlignment = 0) = 0;
388 /// @name Generating Data
391 /// EmitBytes - Emit the bytes in \p Data into the output.
393 /// This is used to implement assembler directives such as .byte, .ascii,
395 virtual void EmitBytes(StringRef Data, unsigned AddrSpace = 0) = 0;
397 /// EmitValue - Emit the expression @p Value into the output as a native
398 /// integer of the given @p Size bytes.
400 /// This is used to implement assembler directives such as .word, .quad,
403 /// @param Value - The value to emit.
404 /// @param Size - The size of the integer (in bytes) to emit. This must
405 /// match a native machine width.
406 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
407 unsigned AddrSpace) = 0;
409 void EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace = 0);
411 /// EmitIntValue - Special case of EmitValue that avoids the client having
412 /// to pass in a MCExpr for constant integers.
413 virtual void EmitIntValue(uint64_t Value, unsigned Size,
414 unsigned AddrSpace = 0);
416 /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
417 /// this is done by producing
420 void EmitAbsValue(const MCExpr *Value, unsigned Size,
421 unsigned AddrSpace = 0);
423 virtual void EmitULEB128Value(const MCExpr *Value) = 0;
425 virtual void EmitSLEB128Value(const MCExpr *Value) = 0;
427 /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the
428 /// client having to pass in a MCExpr for constant integers.
429 void EmitULEB128IntValue(uint64_t Value, unsigned Padding = 0,
430 unsigned AddrSpace = 0);
432 /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
433 /// client having to pass in a MCExpr for constant integers.
434 void EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace = 0);
436 /// EmitSymbolValue - Special case of EmitValue that avoids the client
437 /// having to pass in a MCExpr for MCSymbols.
438 void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
439 unsigned AddrSpace = 0);
441 /// EmitGPRel64Value - Emit the expression @p Value into the output as a
442 /// gprel64 (64-bit GP relative) value.
444 /// This is used to implement assembler directives such as .gpdword on
445 /// targets that support them.
446 virtual void EmitGPRel64Value(const MCExpr *Value);
448 /// EmitGPRel32Value - Emit the expression @p Value into the output as a
449 /// gprel32 (32-bit GP relative) value.
451 /// This is used to implement assembler directives such as .gprel32 on
452 /// targets that support them.
453 virtual void EmitGPRel32Value(const MCExpr *Value);
455 /// EmitFill - Emit NumBytes bytes worth of the value specified by
456 /// FillValue. This implements directives such as '.space'.
457 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
458 unsigned AddrSpace = 0);
460 /// EmitZeros - Emit NumBytes worth of zeros. This is a convenience
461 /// function that just wraps EmitFill.
462 void EmitZeros(uint64_t NumBytes, unsigned AddrSpace = 0) {
463 EmitFill(NumBytes, 0, AddrSpace);
466 /// EmitValueToAlignment - Emit some number of copies of @p Value until
467 /// the byte alignment @p ByteAlignment is reached.
469 /// If the number of bytes need to emit for the alignment is not a multiple
470 /// of @p ValueSize, then the contents of the emitted fill bytes is
473 /// This used to implement the .align assembler directive.
475 /// @param ByteAlignment - The alignment to reach. This must be a power of
476 /// two on some targets.
477 /// @param Value - The value to use when filling bytes.
478 /// @param ValueSize - The size of the integer (in bytes) to emit for
479 /// @p Value. This must match a native machine width.
480 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
481 /// the alignment cannot be reached in this many bytes, no bytes are
483 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
484 unsigned ValueSize = 1,
485 unsigned MaxBytesToEmit = 0) = 0;
487 /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
490 /// This used to align code where the alignment bytes may be executed. This
491 /// can emit different bytes for different sizes to optimize execution.
493 /// @param ByteAlignment - The alignment to reach. This must be a power of
494 /// two on some targets.
495 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
496 /// the alignment cannot be reached in this many bytes, no bytes are
498 virtual void EmitCodeAlignment(unsigned ByteAlignment,
499 unsigned MaxBytesToEmit = 0) = 0;
501 /// EmitValueToOffset - Emit some number of copies of @p Value until the
502 /// byte offset @p Offset is reached.
504 /// This is used to implement assembler directives such as .org.
506 /// @param Offset - The offset to reach. This may be an expression, but the
507 /// expression must be associated with the current section.
508 /// @param Value - The value to use when filling bytes.
509 /// @return false on success, true if the offset was invalid.
510 virtual bool EmitValueToOffset(const MCExpr *Offset,
511 unsigned char Value = 0) = 0;
515 /// EmitFileDirective - Switch to a new logical file. This is used to
516 /// implement the '.file "foo.c"' assembler directive.
517 virtual void EmitFileDirective(StringRef Filename) = 0;
519 /// EmitDwarfFileDirective - Associate a filename with a specified logical
520 /// file number. This implements the DWARF2 '.file 4 "foo.c"' assembler
522 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
525 /// EmitDwarfLocDirective - This implements the DWARF2
526 // '.loc fileno lineno ...' assembler directive.
527 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
528 unsigned Column, unsigned Flags,
530 unsigned Discriminator,
533 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
534 const MCSymbol *LastLabel,
535 const MCSymbol *Label,
536 unsigned PointerSize) = 0;
538 virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
539 const MCSymbol *Label) {
542 void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
545 virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding);
546 virtual void EmitCFISections(bool EH, bool Debug);
547 void EmitCFIStartProc();
548 void EmitCFIEndProc();
549 virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
550 virtual void EmitCFIDefCfaOffset(int64_t Offset);
551 virtual void EmitCFIDefCfaRegister(int64_t Register);
552 virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
553 virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
554 virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
555 virtual void EmitCFIRememberState();
556 virtual void EmitCFIRestoreState();
557 virtual void EmitCFISameValue(int64_t Register);
558 virtual void EmitCFIRestore(int64_t Register);
559 virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
560 virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
561 virtual void EmitCFIEscape(StringRef Values);
562 virtual void EmitCFISignalFrame();
563 virtual void EmitCFIUndefined(int64_t Register);
564 virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
566 virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
567 virtual void EmitWin64EHEndProc();
568 virtual void EmitWin64EHStartChained();
569 virtual void EmitWin64EHEndChained();
570 virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
572 virtual void EmitWin64EHHandlerData();
573 virtual void EmitWin64EHPushReg(unsigned Register);
574 virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
575 virtual void EmitWin64EHAllocStack(unsigned Size);
576 virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
577 virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
578 virtual void EmitWin64EHPushFrame(bool Code);
579 virtual void EmitWin64EHEndProlog();
581 /// EmitInstruction - Emit the given @p Instruction into the current
583 virtual void EmitInstruction(const MCInst &Inst) = 0;
585 /// \brief Set the bundle alignment mode from now on in the section.
586 /// The argument is the power of 2 to which the alignment is set. The
587 /// value 0 means turn the bundle alignment off.
588 virtual void EmitBundleAlignMode(unsigned AlignPow2) = 0;
590 /// \brief The following instructions are a bundle-locked group.
592 /// \param AlignToEnd - If true, the bundle-locked group will be aligned to
593 /// the end of a bundle.
594 virtual void EmitBundleLock(bool AlignToEnd) = 0;
596 /// \brief Ends a bundle-locked group.
597 virtual void EmitBundleUnlock() = 0;
599 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
600 /// the specified string in the output .s file. This capability is
601 /// indicated by the hasRawTextSupport() predicate. By default this aborts.
602 virtual void EmitRawText(StringRef String);
603 void EmitRawText(const Twine &String);
605 /// ARM-related methods.
606 /// FIXME: Eventually we should have some "target MC streamer" and move
607 /// these methods there.
608 virtual void EmitFnStart();
609 virtual void EmitFnEnd();
610 virtual void EmitCantUnwind();
611 virtual void EmitPersonality(const MCSymbol *Personality);
612 virtual void EmitHandlerData();
613 virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0);
614 virtual void EmitPad(int64_t Offset);
615 virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
618 /// PPC-related methods.
619 /// FIXME: Eventually replace it with some "target MC streamer" and move
620 /// these methods there.
621 virtual void EmitTCEntry(const MCSymbol &S);
623 /// FinishImpl - Streamer specific finalization.
624 virtual void FinishImpl() = 0;
625 /// Finish - Finish emission of machine code.
629 /// createNullStreamer - Create a dummy machine code streamer, which does
630 /// nothing. This is useful for timing the assembler front end.
631 MCStreamer *createNullStreamer(MCContext &Ctx);
633 /// createAsmStreamer - Create a machine code streamer which will print out
634 /// assembly for the native target, suitable for compiling with a native
637 /// \param InstPrint - If given, the instruction printer to use. If not given
638 /// the MCInst representation will be printed. This method takes ownership of
641 /// \param CE - If given, a code emitter to use to show the instruction
642 /// encoding inline with the assembly. This method takes ownership of \p CE.
644 /// \param TAB - If given, a target asm backend to use to show the fixup
645 /// information in conjunction with encoding information. This method takes
646 /// ownership of \p TAB.
648 /// \param ShowInst - Whether to show the MCInst representation inline with
650 MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
654 bool useDwarfDirectory,
655 MCInstPrinter *InstPrint = 0,
656 MCCodeEmitter *CE = 0,
657 MCAsmBackend *TAB = 0,
658 bool ShowInst = false);
660 /// createMachOStreamer - Create a machine code streamer which will generate
661 /// Mach-O format object files.
663 /// Takes ownership of \p TAB and \p CE.
664 MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
665 raw_ostream &OS, MCCodeEmitter *CE,
666 bool RelaxAll = false);
668 /// createWinCOFFStreamer - Create a machine code streamer which will
669 /// generate Microsoft COFF format object files.
671 /// Takes ownership of \p TAB and \p CE.
672 MCStreamer *createWinCOFFStreamer(MCContext &Ctx,
674 MCCodeEmitter &CE, raw_ostream &OS,
675 bool RelaxAll = false);
677 /// createELFStreamer - Create a machine code streamer which will generate
678 /// ELF format object files.
679 MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
680 raw_ostream &OS, MCCodeEmitter *CE,
681 bool RelaxAll, bool NoExecStack);
683 /// createPureStreamer - Create a machine code streamer which will generate
684 /// "pure" MC object files, for use with MC-JIT and testing tools.
686 /// Takes ownership of \p TAB and \p CE.
687 MCStreamer *createPureStreamer(MCContext &Ctx, MCAsmBackend &TAB,
688 raw_ostream &OS, MCCodeEmitter *CE);
690 } // end namespace llvm