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.
65 const StreamerKind Kind;
68 MCStreamer(const MCStreamer&) LLVM_DELETED_FUNCTION;
69 MCStreamer &operator=(const MCStreamer&) LLVM_DELETED_FUNCTION;
74 std::vector<MCDwarfFrameInfo> FrameInfos;
75 MCDwarfFrameInfo *getCurrentFrameInfo();
76 MCSymbol *EmitCFICommon();
77 void EnsureValidFrame();
79 std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos;
80 MCWin64EHUnwindInfo *CurrentW64UnwindInfo;
81 void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
82 void EnsureValidW64UnwindInfo();
86 /// SectionStack - This is stack of current and previous section
87 /// values saved by PushSection.
88 SmallVector<std::pair<const MCSection *,
89 const MCSection *>, 4> SectionStack;
91 bool AutoInitSections;
94 MCStreamer(StreamerKind Kind, MCContext &Ctx);
96 const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A,
99 const MCExpr *ForceExpAbs(const MCExpr* Expr);
101 void RecordProcStart(MCDwarfFrameInfo &Frame);
102 virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
103 void RecordProcEnd(MCDwarfFrameInfo &Frame);
104 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
105 void EmitFrames(bool usingCFI);
107 MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;}
108 void EmitW64Tables();
111 virtual ~MCStreamer();
113 StreamerKind getKind() const { return Kind; }
117 virtual void reset();
119 MCContext &getContext() const { return Context; }
121 unsigned getNumFrameInfos() {
122 return FrameInfos.size();
125 const MCDwarfFrameInfo &getFrameInfo(unsigned i) {
126 return FrameInfos[i];
129 ArrayRef<MCDwarfFrameInfo> getFrameInfos() {
133 unsigned getNumW64UnwindInfos() {
134 return W64UnwindInfos.size();
137 MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
138 return *W64UnwindInfos[i];
141 /// @name Assembly File Formatting.
144 /// isVerboseAsm - Return true if this streamer supports verbose assembly
145 /// and if it is enabled.
146 virtual bool isVerboseAsm() const { return false; }
148 /// hasRawTextSupport - Return true if this asm streamer supports emitting
149 /// unformatted text to the .s file with EmitRawText.
150 virtual bool hasRawTextSupport() const { return false; }
152 /// AddComment - Add a comment that can be emitted to the generated .s
153 /// file if applicable as a QoI issue to make the output of the compiler
154 /// more readable. This only affects the MCAsmStreamer, and only when
155 /// verbose assembly output is enabled.
157 /// If the comment includes embedded \n's, they will each get the comment
158 /// prefix as appropriate. The added comment should not end with a \n.
159 virtual void AddComment(const Twine &T) {}
161 /// GetCommentOS - Return a raw_ostream that comments can be written to.
162 /// Unlike AddComment, you are required to terminate comments with \n if you
164 virtual raw_ostream &GetCommentOS();
166 /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
167 virtual void AddBlankLine() {}
171 /// @name Symbol & Section Management
174 /// getCurrentSection - Return the current section that the streamer is
175 /// emitting code to.
176 const MCSection *getCurrentSection() const {
177 if (!SectionStack.empty())
178 return SectionStack.back().first;
182 /// getPreviousSection - Return the previous section that the streamer is
183 /// emitting code to.
184 const MCSection *getPreviousSection() const {
185 if (!SectionStack.empty())
186 return SectionStack.back().second;
190 /// ChangeSection - Update streamer for a new active section.
192 /// This is called by PopSection and SwitchSection, if the current
194 virtual void ChangeSection(const MCSection *) = 0;
196 /// pushSection - Save the current and previous section on the
199 SectionStack.push_back(std::make_pair(getCurrentSection(),
200 getPreviousSection()));
203 /// popSection - Restore the current and previous section from
204 /// the section stack. Calls ChangeSection as needed.
206 /// Returns false if the stack was empty.
208 if (SectionStack.size() <= 1)
210 const MCSection *oldSection = SectionStack.pop_back_val().first;
211 const MCSection *curSection = SectionStack.back().first;
213 if (oldSection != curSection)
214 ChangeSection(curSection);
218 /// SwitchSection - Set the current section where code is being emitted to
219 /// @p Section. This is required to update CurSection.
221 /// This corresponds to assembler directives like .section, .text, etc.
222 void SwitchSection(const MCSection *Section) {
223 assert(Section && "Cannot switch to a null section!");
224 const MCSection *curSection = SectionStack.back().first;
225 SectionStack.back().second = curSection;
226 if (Section != curSection) {
227 SectionStack.back().first = Section;
228 ChangeSection(Section);
232 /// SwitchSectionNoChange - Set the current section where code is being
233 /// emitted to @p Section. This is required to update CurSection. This
234 /// version does not call ChangeSection.
235 void SwitchSectionNoChange(const MCSection *Section) {
236 assert(Section && "Cannot switch to a null section!");
237 const MCSection *curSection = SectionStack.back().first;
238 SectionStack.back().second = curSection;
239 if (Section != curSection)
240 SectionStack.back().first = Section;
243 /// Initialize the streamer.
244 void InitStreamer() {
245 if (AutoInitSections)
249 /// Tell this MCStreamer to call InitSections upon initialization.
250 void setAutoInitSections(bool AutoInitSections) {
251 this->AutoInitSections = AutoInitSections;
254 /// InitSections - Create the default sections and set the initial one.
255 virtual void InitSections() = 0;
257 /// InitToTextSection - Create a text section and switch the streamer to it.
258 virtual void InitToTextSection() = 0;
260 /// EmitLabel - Emit a label for @p Symbol into the current section.
262 /// This corresponds to an assembler statement such as:
265 /// @param Symbol - The symbol to emit. A given symbol should only be
266 /// emitted as a label once, and symbols emitted as a label should never be
267 /// used in an assignment.
268 virtual void EmitLabel(MCSymbol *Symbol);
270 virtual void EmitDebugLabel(MCSymbol *Symbol);
272 virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
275 /// EmitAssemblerFlag - Note in the output the specified @p Flag.
276 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
278 /// EmitLinkerOptions - Emit the given list @p Options of strings as linker
279 /// options into the output.
280 virtual void EmitLinkerOptions(ArrayRef<std::string> Kind) {}
282 /// EmitDataRegion - Note in the output the specified region @p Kind.
283 virtual void EmitDataRegion(MCDataRegionType Kind) {}
285 /// EmitThumbFunc - Note in the output that the specified @p Func is
286 /// a Thumb mode function (ARM target only).
287 virtual void EmitThumbFunc(MCSymbol *Func) = 0;
289 /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
291 /// This corresponds to an assembler statement such as:
294 /// The assignment generates no code, but has the side effect of binding the
295 /// value in the current context. For the assembly streamer, this prints the
296 /// binding into the .s file.
298 /// @param Symbol - The symbol being assigned to.
299 /// @param Value - The value for the symbol.
300 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0;
302 /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol.
304 /// This corresponds to an assembler statement such as:
305 /// .weakref alias, symbol
307 /// @param Alias - The alias that is being created.
308 /// @param Symbol - The symbol being aliased.
309 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0;
311 /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
312 virtual void EmitSymbolAttribute(MCSymbol *Symbol,
313 MCSymbolAttr Attribute) = 0;
315 /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
317 /// @param Symbol - The symbol to have its n_desc field set.
318 /// @param DescValue - The value to set into the n_desc field.
319 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
321 /// BeginCOFFSymbolDef - Start emitting COFF symbol definition
323 /// @param Symbol - The symbol to have its External & Type fields set.
324 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0;
326 /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
328 /// @param StorageClass - The storage class the symbol should have.
329 virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0;
331 /// EmitCOFFSymbolType - Emit the type of the symbol.
333 /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
334 virtual void EmitCOFFSymbolType(int Type) = 0;
336 /// EndCOFFSymbolDef - Marks the end of the symbol definition.
337 virtual void EndCOFFSymbolDef() = 0;
339 /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
341 /// @param Symbol - Symbol the section relative realocation should point to.
342 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
344 /// EmitELFSize - Emit an ELF .size directive.
346 /// This corresponds to an assembler statement such as:
347 /// .size symbol, expression
349 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0;
351 /// EmitCommonSymbol - Emit a common symbol.
353 /// @param Symbol - The common symbol to emit.
354 /// @param Size - The size of the common symbol.
355 /// @param ByteAlignment - The alignment of the symbol if
356 /// non-zero. This must be a power of 2.
357 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
358 unsigned ByteAlignment) = 0;
360 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
362 /// @param Symbol - The common symbol to emit.
363 /// @param Size - The size of the common symbol.
364 /// @param ByteAlignment - The alignment of the common symbol in bytes.
365 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
366 unsigned ByteAlignment) = 0;
368 /// EmitZerofill - Emit the zerofill section and an optional symbol.
370 /// @param Section - The zerofill section to create and or to put the symbol
371 /// @param Symbol - The zerofill symbol to emit, if non-NULL.
372 /// @param Size - The size of the zerofill symbol.
373 /// @param ByteAlignment - The alignment of the zerofill symbol if
374 /// non-zero. This must be a power of 2 on some targets.
375 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
376 uint64_t Size = 0,unsigned ByteAlignment = 0) = 0;
378 /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
380 /// @param Section - The thread local common section.
381 /// @param Symbol - The thread local common symbol to emit.
382 /// @param Size - The size of the symbol.
383 /// @param ByteAlignment - The alignment of the thread local common symbol
384 /// if non-zero. This must be a power of 2 on some targets.
385 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
386 uint64_t Size, unsigned ByteAlignment = 0) = 0;
389 /// @name Generating Data
392 /// EmitBytes - Emit the bytes in \p Data into the output.
394 /// This is used to implement assembler directives such as .byte, .ascii,
396 virtual void EmitBytes(StringRef Data, unsigned AddrSpace = 0) = 0;
398 /// EmitValue - Emit the expression @p Value into the output as a native
399 /// integer of the given @p Size bytes.
401 /// This is used to implement assembler directives such as .word, .quad,
404 /// @param Value - The value to emit.
405 /// @param Size - The size of the integer (in bytes) to emit. This must
406 /// match a native machine width.
407 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
408 unsigned AddrSpace) = 0;
410 void EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace = 0);
412 /// EmitIntValue - Special case of EmitValue that avoids the client having
413 /// to pass in a MCExpr for constant integers.
414 virtual void EmitIntValue(uint64_t Value, unsigned Size,
415 unsigned AddrSpace = 0);
417 /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
418 /// this is done by producing
421 void EmitAbsValue(const MCExpr *Value, unsigned Size,
422 unsigned AddrSpace = 0);
424 virtual void EmitULEB128Value(const MCExpr *Value) = 0;
426 virtual void EmitSLEB128Value(const MCExpr *Value) = 0;
428 /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the
429 /// client having to pass in a MCExpr for constant integers.
430 void EmitULEB128IntValue(uint64_t Value, unsigned Padding = 0,
431 unsigned AddrSpace = 0);
433 /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
434 /// client having to pass in a MCExpr for constant integers.
435 void EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace = 0);
437 /// EmitSymbolValue - Special case of EmitValue that avoids the client
438 /// having to pass in a MCExpr for MCSymbols.
439 void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
440 unsigned AddrSpace = 0);
442 /// EmitGPRel64Value - Emit the expression @p Value into the output as a
443 /// gprel64 (64-bit GP relative) value.
445 /// This is used to implement assembler directives such as .gpdword on
446 /// targets that support them.
447 virtual void EmitGPRel64Value(const MCExpr *Value);
449 /// EmitGPRel32Value - Emit the expression @p Value into the output as a
450 /// gprel32 (32-bit GP relative) value.
452 /// This is used to implement assembler directives such as .gprel32 on
453 /// targets that support them.
454 virtual void EmitGPRel32Value(const MCExpr *Value);
456 /// EmitFill - Emit NumBytes bytes worth of the value specified by
457 /// FillValue. This implements directives such as '.space'.
458 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
459 unsigned AddrSpace = 0);
461 /// EmitZeros - Emit NumBytes worth of zeros. This is a convenience
462 /// function that just wraps EmitFill.
463 void EmitZeros(uint64_t NumBytes, unsigned AddrSpace = 0) {
464 EmitFill(NumBytes, 0, AddrSpace);
467 /// EmitValueToAlignment - Emit some number of copies of @p Value until
468 /// the byte alignment @p ByteAlignment is reached.
470 /// If the number of bytes need to emit for the alignment is not a multiple
471 /// of @p ValueSize, then the contents of the emitted fill bytes is
474 /// This used to implement the .align assembler directive.
476 /// @param ByteAlignment - The alignment to reach. This must be a power of
477 /// two on some targets.
478 /// @param Value - The value to use when filling bytes.
479 /// @param ValueSize - The size of the integer (in bytes) to emit for
480 /// @p Value. This must match a native machine width.
481 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
482 /// the alignment cannot be reached in this many bytes, no bytes are
484 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
485 unsigned ValueSize = 1,
486 unsigned MaxBytesToEmit = 0) = 0;
488 /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
491 /// This used to align code where the alignment bytes may be executed. This
492 /// can emit different bytes for different sizes to optimize execution.
494 /// @param ByteAlignment - The alignment to reach. This must be a power of
495 /// two on some targets.
496 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
497 /// the alignment cannot be reached in this many bytes, no bytes are
499 virtual void EmitCodeAlignment(unsigned ByteAlignment,
500 unsigned MaxBytesToEmit = 0) = 0;
502 /// EmitValueToOffset - Emit some number of copies of @p Value until the
503 /// byte offset @p Offset is reached.
505 /// This is used to implement assembler directives such as .org.
507 /// @param Offset - The offset to reach. This may be an expression, but the
508 /// expression must be associated with the current section.
509 /// @param Value - The value to use when filling bytes.
510 /// @return false on success, true if the offset was invalid.
511 virtual bool EmitValueToOffset(const MCExpr *Offset,
512 unsigned char Value = 0) = 0;
516 /// EmitFileDirective - Switch to a new logical file. This is used to
517 /// implement the '.file "foo.c"' assembler directive.
518 virtual void EmitFileDirective(StringRef Filename) = 0;
520 /// EmitDwarfFileDirective - Associate a filename with a specified logical
521 /// file number. This implements the DWARF2 '.file 4 "foo.c"' assembler
523 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
526 /// EmitDwarfLocDirective - This implements the DWARF2
527 // '.loc fileno lineno ...' assembler directive.
528 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
529 unsigned Column, unsigned Flags,
531 unsigned Discriminator,
534 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
535 const MCSymbol *LastLabel,
536 const MCSymbol *Label,
537 unsigned PointerSize) = 0;
539 virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
540 const MCSymbol *Label) {
543 void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
546 virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding);
547 virtual void EmitCFISections(bool EH, bool Debug);
548 void EmitCFIStartProc();
549 void EmitCFIEndProc();
550 virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
551 virtual void EmitCFIDefCfaOffset(int64_t Offset);
552 virtual void EmitCFIDefCfaRegister(int64_t Register);
553 virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
554 virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
555 virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
556 virtual void EmitCFIRememberState();
557 virtual void EmitCFIRestoreState();
558 virtual void EmitCFISameValue(int64_t Register);
559 virtual void EmitCFIRestore(int64_t Register);
560 virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
561 virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
562 virtual void EmitCFIEscape(StringRef Values);
563 virtual void EmitCFISignalFrame();
564 virtual void EmitCFIUndefined(int64_t Register);
565 virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
567 virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
568 virtual void EmitWin64EHEndProc();
569 virtual void EmitWin64EHStartChained();
570 virtual void EmitWin64EHEndChained();
571 virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
573 virtual void EmitWin64EHHandlerData();
574 virtual void EmitWin64EHPushReg(unsigned Register);
575 virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
576 virtual void EmitWin64EHAllocStack(unsigned Size);
577 virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
578 virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
579 virtual void EmitWin64EHPushFrame(bool Code);
580 virtual void EmitWin64EHEndProlog();
582 /// EmitInstruction - Emit the given @p Instruction into the current
584 virtual void EmitInstruction(const MCInst &Inst) = 0;
586 /// \brief Set the bundle alignment mode from now on in the section.
587 /// The argument is the power of 2 to which the alignment is set. The
588 /// value 0 means turn the bundle alignment off.
589 virtual void EmitBundleAlignMode(unsigned AlignPow2) = 0;
591 /// \brief The following instructions are a bundle-locked group.
593 /// \param AlignToEnd - If true, the bundle-locked group will be aligned to
594 /// the end of a bundle.
595 virtual void EmitBundleLock(bool AlignToEnd) = 0;
597 /// \brief Ends a bundle-locked group.
598 virtual void EmitBundleUnlock() = 0;
600 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
601 /// the specified string in the output .s file. This capability is
602 /// indicated by the hasRawTextSupport() predicate. By default this aborts.
603 virtual void EmitRawText(StringRef String);
604 void EmitRawText(const Twine &String);
606 /// ARM-related methods.
607 /// FIXME: Eventually we should have some "target MC streamer" and move
608 /// these methods there.
609 virtual void EmitFnStart();
610 virtual void EmitFnEnd();
611 virtual void EmitCantUnwind();
612 virtual void EmitPersonality(const MCSymbol *Personality);
613 virtual void EmitHandlerData();
614 virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0);
615 virtual void EmitPad(int64_t Offset);
616 virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
619 /// PPC-related methods.
620 /// FIXME: Eventually replace it with some "target MC streamer" and move
621 /// these methods there.
622 virtual void EmitTCEntry(const MCSymbol &S);
624 /// FinishImpl - Streamer specific finalization.
625 virtual void FinishImpl() = 0;
626 /// Finish - Finish emission of machine code.
630 /// createNullStreamer - Create a dummy machine code streamer, which does
631 /// nothing. This is useful for timing the assembler front end.
632 MCStreamer *createNullStreamer(MCContext &Ctx);
634 /// createAsmStreamer - Create a machine code streamer which will print out
635 /// assembly for the native target, suitable for compiling with a native
638 /// \param InstPrint - If given, the instruction printer to use. If not given
639 /// the MCInst representation will be printed. This method takes ownership of
642 /// \param CE - If given, a code emitter to use to show the instruction
643 /// encoding inline with the assembly. This method takes ownership of \p CE.
645 /// \param TAB - If given, a target asm backend to use to show the fixup
646 /// information in conjunction with encoding information. This method takes
647 /// ownership of \p TAB.
649 /// \param ShowInst - Whether to show the MCInst representation inline with
651 MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
655 bool useDwarfDirectory,
656 MCInstPrinter *InstPrint = 0,
657 MCCodeEmitter *CE = 0,
658 MCAsmBackend *TAB = 0,
659 bool ShowInst = false);
661 /// createMachOStreamer - Create a machine code streamer which will generate
662 /// Mach-O format object files.
664 /// Takes ownership of \p TAB and \p CE.
665 MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
666 raw_ostream &OS, MCCodeEmitter *CE,
667 bool RelaxAll = false);
669 /// createWinCOFFStreamer - Create a machine code streamer which will
670 /// generate Microsoft COFF format object files.
672 /// Takes ownership of \p TAB and \p CE.
673 MCStreamer *createWinCOFFStreamer(MCContext &Ctx,
675 MCCodeEmitter &CE, raw_ostream &OS,
676 bool RelaxAll = false);
678 /// createELFStreamer - Create a machine code streamer which will generate
679 /// ELF format object files.
680 MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
681 raw_ostream &OS, MCCodeEmitter *CE,
682 bool RelaxAll, bool NoExecStack);
684 /// createPureStreamer - Create a machine code streamer which will generate
685 /// "pure" MC object files, for use with MC-JIT and testing tools.
687 /// Takes ownership of \p TAB and \p CE.
688 MCStreamer *createPureStreamer(MCContext &Ctx, MCAsmBackend &TAB,
689 raw_ostream &OS, MCCodeEmitter *CE);
691 } // end namespace llvm