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(MCAsmBackend *MAB, 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 void generateCompactUnwindEncodings(MCAsmBackend *MAB);
139 /// @name Assembly File Formatting.
142 /// isVerboseAsm - Return true if this streamer supports verbose assembly
143 /// and if it is enabled.
144 virtual bool isVerboseAsm() const { return false; }
146 /// hasRawTextSupport - Return true if this asm streamer supports emitting
147 /// unformatted text to the .s file with EmitRawText.
148 virtual bool hasRawTextSupport() const { return false; }
150 /// AddComment - Add a comment that can be emitted to the generated .s
151 /// file if applicable as a QoI issue to make the output of the compiler
152 /// more readable. This only affects the MCAsmStreamer, and only when
153 /// verbose assembly output is enabled.
155 /// If the comment includes embedded \n's, they will each get the comment
156 /// prefix as appropriate. The added comment should not end with a \n.
157 virtual void AddComment(const Twine &T) {}
159 /// GetCommentOS - Return a raw_ostream that comments can be written to.
160 /// Unlike AddComment, you are required to terminate comments with \n if you
162 virtual raw_ostream &GetCommentOS();
164 /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
165 virtual void AddBlankLine() {}
169 /// @name Symbol & Section Management
172 /// getCurrentSection - Return the current section that the streamer is
173 /// emitting code to.
174 MCSectionSubPair getCurrentSection() const {
175 if (!SectionStack.empty())
176 return SectionStack.back().first;
177 return MCSectionSubPair();
180 /// getPreviousSection - Return the previous section that the streamer is
181 /// emitting code to.
182 MCSectionSubPair getPreviousSection() const {
183 if (!SectionStack.empty())
184 return SectionStack.back().second;
185 return MCSectionSubPair();
188 /// ChangeSection - Update streamer for a new active section.
190 /// This is called by PopSection and SwitchSection, if the current
192 virtual void ChangeSection(const MCSection *, const MCExpr *) = 0;
194 /// pushSection - Save the current and previous section on the
197 SectionStack.push_back(
198 std::make_pair(getCurrentSection(), getPreviousSection()));
201 /// popSection - Restore the current and previous section from
202 /// the section stack. Calls ChangeSection as needed.
204 /// Returns false if the stack was empty.
206 if (SectionStack.size() <= 1)
208 MCSectionSubPair oldSection = SectionStack.pop_back_val().first;
209 MCSectionSubPair curSection = SectionStack.back().first;
211 if (oldSection != curSection)
212 ChangeSection(curSection.first, curSection.second);
216 bool SubSection(const MCExpr *Subsection) {
217 if (SectionStack.empty())
220 SwitchSection(SectionStack.back().first.first, Subsection);
224 /// SwitchSection - Set the current section where code is being emitted to
225 /// @p Section. This is required to update CurSection.
227 /// This corresponds to assembler directives like .section, .text, etc.
228 void SwitchSection(const MCSection *Section, const MCExpr *Subsection = 0) {
229 assert(Section && "Cannot switch to a null section!");
230 MCSectionSubPair curSection = SectionStack.back().first;
231 SectionStack.back().second = curSection;
232 if (MCSectionSubPair(Section, Subsection) != curSection) {
233 SectionStack.back().first = MCSectionSubPair(Section, Subsection);
234 ChangeSection(Section, Subsection);
238 /// SwitchSectionNoChange - Set the current section where code is being
239 /// emitted to @p Section. This is required to update CurSection. This
240 /// version does not call ChangeSection.
241 void SwitchSectionNoChange(const MCSection *Section,
242 const MCExpr *Subsection = 0) {
243 assert(Section && "Cannot switch to a null section!");
244 MCSectionSubPair curSection = SectionStack.back().first;
245 SectionStack.back().second = curSection;
246 if (MCSectionSubPair(Section, Subsection) != curSection)
247 SectionStack.back().first = MCSectionSubPair(Section, Subsection);
250 /// Initialize the streamer.
251 void InitStreamer() {
252 if (AutoInitSections)
256 /// Tell this MCStreamer to call InitSections upon initialization.
257 void setAutoInitSections(bool AutoInitSections) {
258 this->AutoInitSections = AutoInitSections;
261 /// InitSections - Create the default sections and set the initial one.
262 virtual void InitSections() = 0;
264 /// InitToTextSection - Create a text section and switch the streamer to it.
265 virtual void InitToTextSection() = 0;
267 /// EmitLabel - Emit a label for @p Symbol into the current section.
269 /// This corresponds to an assembler statement such as:
272 /// @param Symbol - The symbol to emit. A given symbol should only be
273 /// emitted as a label once, and symbols emitted as a label should never be
274 /// used in an assignment.
275 virtual void EmitLabel(MCSymbol *Symbol);
277 virtual void EmitDebugLabel(MCSymbol *Symbol);
279 virtual void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol);
281 /// EmitAssemblerFlag - Note in the output the specified @p Flag.
282 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
284 /// EmitLinkerOptions - Emit the given list @p Options of strings as linker
285 /// options into the output.
286 virtual void EmitLinkerOptions(ArrayRef<std::string> Kind) {}
288 /// EmitDataRegion - Note in the output the specified region @p Kind.
289 virtual void EmitDataRegion(MCDataRegionType Kind) {}
291 /// EmitThumbFunc - Note in the output that the specified @p Func is
292 /// a Thumb mode function (ARM target only).
293 virtual void EmitThumbFunc(MCSymbol *Func) = 0;
295 /// getOrCreateSymbolData - Get symbol data for given symbol.
296 virtual MCSymbolData &getOrCreateSymbolData(MCSymbol *Symbol);
298 /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
300 /// This corresponds to an assembler statement such as:
303 /// The assignment generates no code, but has the side effect of binding the
304 /// value in the current context. For the assembly streamer, this prints the
305 /// binding into the .s file.
307 /// @param Symbol - The symbol being assigned to.
308 /// @param Value - The value for the symbol.
309 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0;
311 /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol.
313 /// This corresponds to an assembler statement such as:
314 /// .weakref alias, symbol
316 /// @param Alias - The alias that is being created.
317 /// @param Symbol - The symbol being aliased.
318 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0;
320 /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
321 virtual bool EmitSymbolAttribute(MCSymbol *Symbol,
322 MCSymbolAttr Attribute) = 0;
324 /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
326 /// @param Symbol - The symbol to have its n_desc field set.
327 /// @param DescValue - The value to set into the n_desc field.
328 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
330 /// BeginCOFFSymbolDef - Start emitting COFF symbol definition
332 /// @param Symbol - The symbol to have its External & Type fields set.
333 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0;
335 /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
337 /// @param StorageClass - The storage class the symbol should have.
338 virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0;
340 /// EmitCOFFSymbolType - Emit the type of the symbol.
342 /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
343 virtual void EmitCOFFSymbolType(int Type) = 0;
345 /// EndCOFFSymbolDef - Marks the end of the symbol definition.
346 virtual void EndCOFFSymbolDef() = 0;
348 /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
350 /// @param Symbol - Symbol the section relative realocation should point to.
351 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
353 /// EmitELFSize - Emit an ELF .size directive.
355 /// This corresponds to an assembler statement such as:
356 /// .size symbol, expression
358 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0;
360 /// EmitCommonSymbol - Emit a common 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 symbol if
365 /// non-zero. This must be a power of 2.
366 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
367 unsigned ByteAlignment) = 0;
369 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
371 /// @param Symbol - The common symbol to emit.
372 /// @param Size - The size of the common symbol.
373 /// @param ByteAlignment - The alignment of the common symbol in bytes.
374 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
375 unsigned ByteAlignment) = 0;
377 /// EmitZerofill - Emit the zerofill section and an optional symbol.
379 /// @param Section - The zerofill section to create and or to put the symbol
380 /// @param Symbol - The zerofill symbol to emit, if non-NULL.
381 /// @param Size - The size of the zerofill symbol.
382 /// @param ByteAlignment - The alignment of the zerofill symbol if
383 /// non-zero. This must be a power of 2 on some targets.
384 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
385 uint64_t Size = 0, unsigned ByteAlignment = 0) = 0;
387 /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
389 /// @param Section - The thread local common section.
390 /// @param Symbol - The thread local common symbol to emit.
391 /// @param Size - The size of the symbol.
392 /// @param ByteAlignment - The alignment of the thread local common symbol
393 /// if non-zero. This must be a power of 2 on some targets.
394 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
395 uint64_t Size, unsigned ByteAlignment = 0) = 0;
398 /// @name Generating Data
401 /// EmitBytes - Emit the bytes in \p Data into the output.
403 /// This is used to implement assembler directives such as .byte, .ascii,
405 virtual void EmitBytes(StringRef Data) = 0;
407 /// EmitValue - Emit the expression @p Value into the output as a native
408 /// integer of the given @p Size bytes.
410 /// This is used to implement assembler directives such as .word, .quad,
413 /// @param Value - The value to emit.
414 /// @param Size - The size of the integer (in bytes) to emit. This must
415 /// match a native machine width.
416 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size) = 0;
418 void EmitValue(const MCExpr *Value, unsigned Size);
420 /// EmitIntValue - Special case of EmitValue that avoids the client having
421 /// to pass in a MCExpr for constant integers.
422 virtual void EmitIntValue(uint64_t Value, unsigned Size);
424 /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
425 /// this is done by producing
428 void EmitAbsValue(const MCExpr *Value, unsigned Size);
430 virtual void EmitULEB128Value(const MCExpr *Value) = 0;
432 virtual void EmitSLEB128Value(const MCExpr *Value) = 0;
434 /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the
435 /// client having to pass in a MCExpr for constant integers.
436 void EmitULEB128IntValue(uint64_t Value, unsigned Padding = 0);
438 /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
439 /// client having to pass in a MCExpr for constant integers.
440 void EmitSLEB128IntValue(int64_t Value);
442 /// EmitSymbolValue - Special case of EmitValue that avoids the client
443 /// having to pass in a MCExpr for MCSymbols.
444 void EmitSymbolValue(const MCSymbol *Sym, unsigned Size);
446 /// EmitGPRel64Value - Emit the expression @p Value into the output as a
447 /// gprel64 (64-bit GP relative) value.
449 /// This is used to implement assembler directives such as .gpdword on
450 /// targets that support them.
451 virtual void EmitGPRel64Value(const MCExpr *Value);
453 /// EmitGPRel32Value - Emit the expression @p Value into the output as a
454 /// gprel32 (32-bit GP relative) value.
456 /// This is used to implement assembler directives such as .gprel32 on
457 /// targets that support them.
458 virtual void EmitGPRel32Value(const MCExpr *Value);
460 /// EmitFill - Emit NumBytes bytes worth of the value specified by
461 /// FillValue. This implements directives such as '.space'.
462 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue);
464 /// \brief Emit NumBytes worth of zeros.
465 /// This function properly handles data in virtual sections.
466 virtual void EmitZeros(uint64_t NumBytes);
468 /// EmitValueToAlignment - Emit some number of copies of @p Value until
469 /// the byte alignment @p ByteAlignment is reached.
471 /// If the number of bytes need to emit for the alignment is not a multiple
472 /// of @p ValueSize, then the contents of the emitted fill bytes is
475 /// This used to implement the .align assembler directive.
477 /// @param ByteAlignment - The alignment to reach. This must be a power of
478 /// two on some targets.
479 /// @param Value - The value to use when filling bytes.
480 /// @param ValueSize - The size of the integer (in bytes) to emit for
481 /// @p Value. This must match a native machine width.
482 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
483 /// the alignment cannot be reached in this many bytes, no bytes are
485 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
486 unsigned ValueSize = 1,
487 unsigned MaxBytesToEmit = 0) = 0;
489 /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
492 /// This used to align code where the alignment bytes may be executed. This
493 /// can emit different bytes for different sizes to optimize execution.
495 /// @param ByteAlignment - The alignment to reach. This must be a power of
496 /// two on some targets.
497 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
498 /// the alignment cannot be reached in this many bytes, no bytes are
500 virtual void EmitCodeAlignment(unsigned ByteAlignment,
501 unsigned MaxBytesToEmit = 0) = 0;
503 /// EmitValueToOffset - Emit some number of copies of @p Value until the
504 /// byte offset @p Offset is reached.
506 /// This is used to implement assembler directives such as .org.
508 /// @param Offset - The offset to reach. This may be an expression, but the
509 /// expression must be associated with the current section.
510 /// @param Value - The value to use when filling bytes.
511 /// @return false on success, true if the offset was invalid.
512 virtual bool EmitValueToOffset(const MCExpr *Offset,
513 unsigned char Value = 0) = 0;
517 /// EmitFileDirective - Switch to a new logical file. This is used to
518 /// implement the '.file "foo.c"' assembler directive.
519 virtual void EmitFileDirective(StringRef Filename) = 0;
521 /// EmitDwarfFileDirective - Associate a filename with a specified logical
522 /// file number. This implements the DWARF2 '.file 4 "foo.c"' assembler
524 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
525 StringRef Filename, unsigned CUID = 0);
527 /// EmitDwarfLocDirective - This implements the DWARF2
528 // '.loc fileno lineno ...' assembler directive.
529 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
530 unsigned Column, unsigned Flags,
531 unsigned Isa, 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) {}
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,
651 bool isVerboseAsm, bool useLoc, bool useCFI,
652 bool useDwarfDirectory,
653 MCInstPrinter *InstPrint = 0,
654 MCCodeEmitter *CE = 0, MCAsmBackend *TAB = 0,
655 bool ShowInst = false);
657 /// createMachOStreamer - Create a machine code streamer which will generate
658 /// Mach-O format object files.
660 /// Takes ownership of \p TAB and \p CE.
661 MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
662 raw_ostream &OS, MCCodeEmitter *CE,
663 bool RelaxAll = false);
665 /// createWinCOFFStreamer - Create a machine code streamer which will
666 /// generate Microsoft COFF format object files.
668 /// Takes ownership of \p TAB and \p CE.
669 MCStreamer *createWinCOFFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
670 MCCodeEmitter &CE, raw_ostream &OS,
671 bool RelaxAll = false);
673 /// createELFStreamer - Create a machine code streamer which will generate
674 /// ELF format object files.
675 MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
676 raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll,
679 /// createPureStreamer - Create a machine code streamer which will generate
680 /// "pure" MC object files, for use with MC-JIT and testing tools.
682 /// Takes ownership of \p TAB and \p CE.
683 MCStreamer *createPureStreamer(MCContext &Ctx, MCAsmBackend &TAB,
684 raw_ostream &OS, MCCodeEmitter *CE);
686 } // end namespace llvm