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/MCAssembler.h"
20 #include "llvm/MC/MCDirectives.h"
21 #include "llvm/MC/MCDwarf.h"
22 #include "llvm/MC/MCWin64EH.h"
23 #include "llvm/Support/DataTypes.h"
38 class formatted_raw_ostream;
40 typedef std::pair<const MCSection *, const MCExpr *> MCSectionSubPair;
42 /// MCStreamer - Streaming machine code generation interface. This interface
43 /// is intended to provide a programatic interface that is very similar to the
44 /// level that an assembler .s file provides. It has callbacks to emit bytes,
45 /// handle directives, etc. The implementation of this interface retains
46 /// state to know what the current section is etc.
48 /// There are multiple implementations of this interface: one for writing out
49 /// a .s file, and implementations that write out .o files of various formats.
58 // MCObjectStreamer subclasses.
68 const StreamerKind Kind;
71 MCStreamer(const MCStreamer &) LLVM_DELETED_FUNCTION;
72 MCStreamer &operator=(const MCStreamer &) LLVM_DELETED_FUNCTION;
77 std::vector<MCDwarfFrameInfo> FrameInfos;
78 MCDwarfFrameInfo *getCurrentFrameInfo();
79 MCSymbol *EmitCFICommon();
80 void EnsureValidFrame();
82 std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos;
83 MCWin64EHUnwindInfo *CurrentW64UnwindInfo;
84 void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
85 void EnsureValidW64UnwindInfo();
89 /// SectionStack - This is stack of current and previous section
90 /// values saved by PushSection.
91 SmallVector<std::pair<MCSectionSubPair, MCSectionSubPair>, 4> SectionStack;
93 bool AutoInitSections;
96 MCStreamer(StreamerKind Kind, MCContext &Ctx);
98 const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A,
101 const MCExpr *ForceExpAbs(const MCExpr *Expr);
103 void RecordProcStart(MCDwarfFrameInfo &Frame);
104 virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
105 void RecordProcEnd(MCDwarfFrameInfo &Frame);
106 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
107 void EmitFrames(bool usingCFI);
109 MCWin64EHUnwindInfo *getCurrentW64UnwindInfo() {
110 return CurrentW64UnwindInfo;
112 void EmitW64Tables();
115 virtual ~MCStreamer();
117 StreamerKind getKind() const { return Kind; }
121 virtual void reset();
123 MCContext &getContext() const { return Context; }
125 unsigned getNumFrameInfos() { return FrameInfos.size(); }
127 const MCDwarfFrameInfo &getFrameInfo(unsigned i) { return FrameInfos[i]; }
129 ArrayRef<MCDwarfFrameInfo> getFrameInfos() const { return FrameInfos; }
131 unsigned getNumW64UnwindInfos() { return W64UnwindInfos.size(); }
133 MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
134 return *W64UnwindInfos[i];
137 /// @name Assembly File Formatting.
140 /// isVerboseAsm - Return true if this streamer supports verbose assembly
141 /// and if it is enabled.
142 virtual bool isVerboseAsm() const { return false; }
144 /// hasRawTextSupport - Return true if this asm streamer supports emitting
145 /// unformatted text to the .s file with EmitRawText.
146 virtual bool hasRawTextSupport() const { return false; }
148 /// AddComment - Add a comment that can be emitted to the generated .s
149 /// file if applicable as a QoI issue to make the output of the compiler
150 /// more readable. This only affects the MCAsmStreamer, and only when
151 /// verbose assembly output is enabled.
153 /// If the comment includes embedded \n's, they will each get the comment
154 /// prefix as appropriate. The added comment should not end with a \n.
155 virtual void AddComment(const Twine &T) {}
157 /// GetCommentOS - Return a raw_ostream that comments can be written to.
158 /// Unlike AddComment, you are required to terminate comments with \n if you
160 virtual raw_ostream &GetCommentOS();
162 /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
163 virtual void AddBlankLine() {}
167 /// @name Symbol & Section Management
170 /// getCurrentSection - Return the current section that the streamer is
171 /// emitting code to.
172 MCSectionSubPair getCurrentSection() const {
173 if (!SectionStack.empty())
174 return SectionStack.back().first;
175 return MCSectionSubPair();
178 /// getPreviousSection - Return the previous section that the streamer is
179 /// emitting code to.
180 MCSectionSubPair getPreviousSection() const {
181 if (!SectionStack.empty())
182 return SectionStack.back().second;
183 return MCSectionSubPair();
186 /// ChangeSection - Update streamer for a new active section.
188 /// This is called by PopSection and SwitchSection, if the current
190 virtual void ChangeSection(const MCSection *, const MCExpr *) = 0;
192 /// pushSection - Save the current and previous section on the
195 SectionStack.push_back(
196 std::make_pair(getCurrentSection(), getPreviousSection()));
199 /// popSection - Restore the current and previous section from
200 /// the section stack. Calls ChangeSection as needed.
202 /// Returns false if the stack was empty.
204 if (SectionStack.size() <= 1)
206 MCSectionSubPair oldSection = SectionStack.pop_back_val().first;
207 MCSectionSubPair curSection = SectionStack.back().first;
209 if (oldSection != curSection)
210 ChangeSection(curSection.first, curSection.second);
214 bool SubSection(const MCExpr *Subsection) {
215 if (SectionStack.empty())
218 SwitchSection(SectionStack.back().first.first, Subsection);
222 /// SwitchSection - Set the current section where code is being emitted to
223 /// @p Section. This is required to update CurSection.
225 /// This corresponds to assembler directives like .section, .text, etc.
226 void SwitchSection(const MCSection *Section, const MCExpr *Subsection = 0) {
227 assert(Section && "Cannot switch to a null section!");
228 MCSectionSubPair curSection = SectionStack.back().first;
229 SectionStack.back().second = curSection;
230 if (MCSectionSubPair(Section, Subsection) != curSection) {
231 SectionStack.back().first = MCSectionSubPair(Section, Subsection);
232 ChangeSection(Section, Subsection);
236 /// SwitchSectionNoChange - Set the current section where code is being
237 /// emitted to @p Section. This is required to update CurSection. This
238 /// version does not call ChangeSection.
239 void SwitchSectionNoChange(const MCSection *Section,
240 const MCExpr *Subsection = 0) {
241 assert(Section && "Cannot switch to a null section!");
242 MCSectionSubPair curSection = SectionStack.back().first;
243 SectionStack.back().second = curSection;
244 if (MCSectionSubPair(Section, Subsection) != curSection)
245 SectionStack.back().first = MCSectionSubPair(Section, Subsection);
248 /// Initialize the streamer.
249 void InitStreamer() {
250 if (AutoInitSections)
254 /// Tell this MCStreamer to call InitSections upon initialization.
255 void setAutoInitSections(bool AutoInitSections) {
256 this->AutoInitSections = AutoInitSections;
259 /// InitSections - Create the default sections and set the initial one.
260 virtual void InitSections() = 0;
262 /// InitToTextSection - Create a text section and switch the streamer to it.
263 virtual void InitToTextSection() = 0;
265 /// EmitLabel - Emit a label for @p Symbol into the current section.
267 /// This corresponds to an assembler statement such as:
270 /// @param Symbol - The symbol to emit. A given symbol should only be
271 /// emitted as a label once, and symbols emitted as a label should never be
272 /// used in an assignment.
273 virtual void EmitLabel(MCSymbol *Symbol);
275 virtual void EmitDebugLabel(MCSymbol *Symbol);
277 virtual void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol);
279 /// EmitAssemblerFlag - Note in the output the specified @p Flag.
280 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
282 /// EmitLinkerOptions - Emit the given list @p Options of strings as linker
283 /// options into the output.
284 virtual void EmitLinkerOptions(ArrayRef<std::string> Kind) {}
286 /// EmitDataRegion - Note in the output the specified region @p Kind.
287 virtual void EmitDataRegion(MCDataRegionType Kind) {}
289 /// EmitThumbFunc - Note in the output that the specified @p Func is
290 /// a Thumb mode function (ARM target only).
291 virtual void EmitThumbFunc(MCSymbol *Func) = 0;
293 /// getOrCreateSymbolData - Get symbol data for given symbol.
294 virtual MCSymbolData &getOrCreateSymbolData(MCSymbol *Symbol);
296 /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
298 /// This corresponds to an assembler statement such as:
301 /// The assignment generates no code, but has the side effect of binding the
302 /// value in the current context. For the assembly streamer, this prints the
303 /// binding into the .s file.
305 /// @param Symbol - The symbol being assigned to.
306 /// @param Value - The value for the symbol.
307 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0;
309 /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol.
311 /// This corresponds to an assembler statement such as:
312 /// .weakref alias, symbol
314 /// @param Alias - The alias that is being created.
315 /// @param Symbol - The symbol being aliased.
316 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0;
318 /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
319 virtual bool EmitSymbolAttribute(MCSymbol *Symbol,
320 MCSymbolAttr Attribute) = 0;
322 /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
324 /// @param Symbol - The symbol to have its n_desc field set.
325 /// @param DescValue - The value to set into the n_desc field.
326 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
328 /// BeginCOFFSymbolDef - Start emitting COFF symbol definition
330 /// @param Symbol - The symbol to have its External & Type fields set.
331 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0;
333 /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
335 /// @param StorageClass - The storage class the symbol should have.
336 virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0;
338 /// EmitCOFFSymbolType - Emit the type of the symbol.
340 /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
341 virtual void EmitCOFFSymbolType(int Type) = 0;
343 /// EndCOFFSymbolDef - Marks the end of the symbol definition.
344 virtual void EndCOFFSymbolDef() = 0;
346 /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
348 /// @param Symbol - Symbol the section relative realocation should point to.
349 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
351 /// EmitELFSize - Emit an ELF .size directive.
353 /// This corresponds to an assembler statement such as:
354 /// .size symbol, expression
356 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0;
358 /// EmitCommonSymbol - Emit a common symbol.
360 /// @param Symbol - The common symbol to emit.
361 /// @param Size - The size of the common symbol.
362 /// @param ByteAlignment - The alignment of the symbol if
363 /// non-zero. This must be a power of 2.
364 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
365 unsigned ByteAlignment) = 0;
367 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
369 /// @param Symbol - The common symbol to emit.
370 /// @param Size - The size of the common symbol.
371 /// @param ByteAlignment - The alignment of the common symbol in bytes.
372 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
373 unsigned ByteAlignment) = 0;
375 /// EmitZerofill - Emit the zerofill section and an optional symbol.
377 /// @param Section - The zerofill section to create and or to put the symbol
378 /// @param Symbol - The zerofill symbol to emit, if non-NULL.
379 /// @param Size - The size of the zerofill symbol.
380 /// @param ByteAlignment - The alignment of the zerofill symbol if
381 /// non-zero. This must be a power of 2 on some targets.
382 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
383 uint64_t Size = 0, unsigned ByteAlignment = 0) = 0;
385 /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
387 /// @param Section - The thread local common section.
388 /// @param Symbol - The thread local common symbol to emit.
389 /// @param Size - The size of the symbol.
390 /// @param ByteAlignment - The alignment of the thread local common symbol
391 /// if non-zero. This must be a power of 2 on some targets.
392 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
393 uint64_t Size, unsigned ByteAlignment = 0) = 0;
396 /// @name Generating Data
399 /// EmitBytes - Emit the bytes in \p Data into the output.
401 /// This is used to implement assembler directives such as .byte, .ascii,
403 virtual void EmitBytes(StringRef Data) = 0;
405 /// EmitValue - Emit the expression @p Value into the output as a native
406 /// integer of the given @p Size bytes.
408 /// This is used to implement assembler directives such as .word, .quad,
411 /// @param Value - The value to emit.
412 /// @param Size - The size of the integer (in bytes) to emit. This must
413 /// match a native machine width.
414 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size) = 0;
416 void EmitValue(const MCExpr *Value, unsigned Size);
418 /// EmitIntValue - Special case of EmitValue that avoids the client having
419 /// to pass in a MCExpr for constant integers.
420 virtual void EmitIntValue(uint64_t Value, unsigned Size);
422 /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
423 /// this is done by producing
426 void EmitAbsValue(const MCExpr *Value, unsigned Size);
428 virtual void EmitULEB128Value(const MCExpr *Value) = 0;
430 virtual void EmitSLEB128Value(const MCExpr *Value) = 0;
432 /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the
433 /// client having to pass in a MCExpr for constant integers.
434 void EmitULEB128IntValue(uint64_t Value, unsigned Padding = 0);
436 /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
437 /// client having to pass in a MCExpr for constant integers.
438 void EmitSLEB128IntValue(int64_t Value);
440 /// EmitSymbolValue - Special case of EmitValue that avoids the client
441 /// having to pass in a MCExpr for MCSymbols.
442 void EmitSymbolValue(const MCSymbol *Sym, unsigned Size);
444 /// EmitGPRel64Value - Emit the expression @p Value into the output as a
445 /// gprel64 (64-bit GP relative) value.
447 /// This is used to implement assembler directives such as .gpdword on
448 /// targets that support them.
449 virtual void EmitGPRel64Value(const MCExpr *Value);
451 /// EmitGPRel32Value - Emit the expression @p Value into the output as a
452 /// gprel32 (32-bit GP relative) value.
454 /// This is used to implement assembler directives such as .gprel32 on
455 /// targets that support them.
456 virtual void EmitGPRel32Value(const MCExpr *Value);
458 /// EmitFill - Emit NumBytes bytes worth of the value specified by
459 /// FillValue. This implements directives such as '.space'.
460 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue);
462 /// \brief Emit NumBytes worth of zeros.
463 /// This function properly handles data in virtual sections.
464 virtual void EmitZeros(uint64_t NumBytes);
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,
523 StringRef Filename, unsigned CUID = 0);
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,
529 unsigned Isa, unsigned Discriminator,
532 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
533 const MCSymbol *LastLabel,
534 const MCSymbol *Label,
535 unsigned PointerSize) = 0;
537 virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
538 const MCSymbol *Label) {}
540 void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
543 virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding);
544 virtual void EmitCFISections(bool EH, bool Debug);
545 void EmitCFIStartProc();
546 void EmitCFIEndProc();
547 virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
548 virtual void EmitCFIDefCfaOffset(int64_t Offset);
549 virtual void EmitCFIDefCfaRegister(int64_t Register);
550 virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
551 virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
552 virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
553 virtual void EmitCFIRememberState();
554 virtual void EmitCFIRestoreState();
555 virtual void EmitCFISameValue(int64_t Register);
556 virtual void EmitCFIRestore(int64_t Register);
557 virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
558 virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
559 virtual void EmitCFIEscape(StringRef Values);
560 virtual void EmitCFISignalFrame();
561 virtual void EmitCFIUndefined(int64_t Register);
562 virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
564 virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
565 virtual void EmitWin64EHEndProc();
566 virtual void EmitWin64EHStartChained();
567 virtual void EmitWin64EHEndChained();
568 virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
570 virtual void EmitWin64EHHandlerData();
571 virtual void EmitWin64EHPushReg(unsigned Register);
572 virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
573 virtual void EmitWin64EHAllocStack(unsigned Size);
574 virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
575 virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
576 virtual void EmitWin64EHPushFrame(bool Code);
577 virtual void EmitWin64EHEndProlog();
579 /// EmitInstruction - Emit the given @p Instruction into the current
581 virtual void EmitInstruction(const MCInst &Inst) = 0;
583 /// \brief Set the bundle alignment mode from now on in the section.
584 /// The argument is the power of 2 to which the alignment is set. The
585 /// value 0 means turn the bundle alignment off.
586 virtual void EmitBundleAlignMode(unsigned AlignPow2) = 0;
588 /// \brief The following instructions are a bundle-locked group.
590 /// \param AlignToEnd - If true, the bundle-locked group will be aligned to
591 /// the end of a bundle.
592 virtual void EmitBundleLock(bool AlignToEnd) = 0;
594 /// \brief Ends a bundle-locked group.
595 virtual void EmitBundleUnlock() = 0;
597 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
598 /// the specified string in the output .s file. This capability is
599 /// indicated by the hasRawTextSupport() predicate. By default this aborts.
600 virtual void EmitRawText(StringRef String);
601 void EmitRawText(const Twine &String);
603 /// ARM-related methods.
604 /// FIXME: Eventually we should have some "target MC streamer" and move
605 /// these methods there.
606 virtual void EmitFnStart();
607 virtual void EmitFnEnd();
608 virtual void EmitCantUnwind();
609 virtual void EmitPersonality(const MCSymbol *Personality);
610 virtual void EmitHandlerData();
611 virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0);
612 virtual void EmitPad(int64_t Offset);
613 virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
616 /// PPC-related methods.
617 /// FIXME: Eventually replace it with some "target MC streamer" and move
618 /// these methods there.
619 virtual void EmitTCEntry(const MCSymbol &S);
621 /// FinishImpl - Streamer specific finalization.
622 virtual void FinishImpl() = 0;
623 /// Finish - Finish emission of machine code.
627 /// createNullStreamer - Create a dummy machine code streamer, which does
628 /// nothing. This is useful for timing the assembler front end.
629 MCStreamer *createNullStreamer(MCContext &Ctx);
631 /// createAsmStreamer - Create a machine code streamer which will print out
632 /// assembly for the native target, suitable for compiling with a native
635 /// \param InstPrint - If given, the instruction printer to use. If not given
636 /// the MCInst representation will be printed. This method takes ownership of
639 /// \param CE - If given, a code emitter to use to show the instruction
640 /// encoding inline with the assembly. This method takes ownership of \p CE.
642 /// \param TAB - If given, a target asm backend to use to show the fixup
643 /// information in conjunction with encoding information. This method takes
644 /// ownership of \p TAB.
646 /// \param ShowInst - Whether to show the MCInst representation inline with
648 MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
649 bool isVerboseAsm, bool useLoc, bool useCFI,
650 bool useDwarfDirectory,
651 MCInstPrinter *InstPrint = 0,
652 MCCodeEmitter *CE = 0, MCAsmBackend *TAB = 0,
653 bool ShowInst = false);
655 /// createMachOStreamer - Create a machine code streamer which will generate
656 /// Mach-O format object files.
658 /// Takes ownership of \p TAB and \p CE.
659 MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
660 raw_ostream &OS, MCCodeEmitter *CE,
661 bool RelaxAll = false);
663 /// createWinCOFFStreamer - Create a machine code streamer which will
664 /// generate Microsoft COFF format object files.
666 /// Takes ownership of \p TAB and \p CE.
667 MCStreamer *createWinCOFFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
668 MCCodeEmitter &CE, raw_ostream &OS,
669 bool RelaxAll = false);
671 /// createELFStreamer - Create a machine code streamer which will generate
672 /// ELF format object files.
673 MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
674 raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll,
677 /// createPureStreamer - Create a machine code streamer which will generate
678 /// "pure" MC object files, for use with MC-JIT and testing tools.
680 /// Takes ownership of \p TAB and \p CE.
681 MCStreamer *createPureStreamer(MCContext &Ctx, MCAsmBackend &TAB,
682 raw_ostream &OS, MCCodeEmitter *CE);
684 } // end namespace llvm