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(){return CurrentW64UnwindInfo;}
110 void EmitW64Tables();
113 virtual ~MCStreamer();
115 StreamerKind getKind() const { return Kind; }
119 virtual void reset();
121 MCContext &getContext() const { return Context; }
123 unsigned getNumFrameInfos() {
124 return FrameInfos.size();
127 const MCDwarfFrameInfo &getFrameInfo(unsigned i) {
128 return FrameInfos[i];
131 ArrayRef<MCDwarfFrameInfo> getFrameInfos() {
135 unsigned getNumW64UnwindInfos() {
136 return W64UnwindInfos.size();
139 MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
140 return *W64UnwindInfos[i];
143 /// @name Assembly File Formatting.
146 /// isVerboseAsm - Return true if this streamer supports verbose assembly
147 /// and if it is enabled.
148 virtual bool isVerboseAsm() const { return false; }
150 /// hasRawTextSupport - Return true if this asm streamer supports emitting
151 /// unformatted text to the .s file with EmitRawText.
152 virtual bool hasRawTextSupport() const { return false; }
154 /// AddComment - Add a comment that can be emitted to the generated .s
155 /// file if applicable as a QoI issue to make the output of the compiler
156 /// more readable. This only affects the MCAsmStreamer, and only when
157 /// verbose assembly output is enabled.
159 /// If the comment includes embedded \n's, they will each get the comment
160 /// prefix as appropriate. The added comment should not end with a \n.
161 virtual void AddComment(const Twine &T) {}
163 /// GetCommentOS - Return a raw_ostream that comments can be written to.
164 /// Unlike AddComment, you are required to terminate comments with \n if you
166 virtual raw_ostream &GetCommentOS();
168 /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
169 virtual void AddBlankLine() {}
173 /// @name Symbol & Section Management
176 /// getCurrentSection - Return the current section that the streamer is
177 /// emitting code to.
178 MCSectionSubPair getCurrentSection() const {
179 if (!SectionStack.empty())
180 return SectionStack.back().first;
181 return MCSectionSubPair();
184 /// getPreviousSection - Return the previous section that the streamer is
185 /// emitting code to.
186 MCSectionSubPair getPreviousSection() const {
187 if (!SectionStack.empty())
188 return SectionStack.back().second;
189 return MCSectionSubPair();
192 /// ChangeSection - Update streamer for a new active section.
194 /// This is called by PopSection and SwitchSection, if the current
196 virtual void ChangeSection(const MCSection *, const MCExpr *) = 0;
198 /// pushSection - Save the current and previous section on the
201 SectionStack.push_back(std::make_pair(getCurrentSection(),
202 getPreviousSection()));
205 /// popSection - Restore the current and previous section from
206 /// the section stack. Calls ChangeSection as needed.
208 /// Returns false if the stack was empty.
210 if (SectionStack.size() <= 1)
212 MCSectionSubPair oldSection = SectionStack.pop_back_val().first;
213 MCSectionSubPair curSection = SectionStack.back().first;
215 if (oldSection != curSection)
216 ChangeSection(curSection.first, curSection.second);
220 bool SubSection(const MCExpr *Subsection) {
221 if (SectionStack.empty())
224 SwitchSection(SectionStack.back().first.first, Subsection);
228 /// SwitchSection - Set the current section where code is being emitted to
229 /// @p Section. This is required to update CurSection.
231 /// This corresponds to assembler directives like .section, .text, etc.
232 void SwitchSection(const MCSection *Section, const MCExpr *Subsection = 0) {
233 assert(Section && "Cannot switch to a null section!");
234 MCSectionSubPair curSection = SectionStack.back().first;
235 SectionStack.back().second = curSection;
236 if (MCSectionSubPair(Section, Subsection) != curSection) {
237 SectionStack.back().first = MCSectionSubPair(Section, Subsection);
238 ChangeSection(Section, Subsection);
242 /// SwitchSectionNoChange - Set the current section where code is being
243 /// emitted to @p Section. This is required to update CurSection. This
244 /// version does not call ChangeSection.
245 void SwitchSectionNoChange(const MCSection *Section,
246 const MCExpr *Subsection = 0) {
247 assert(Section && "Cannot switch to a null section!");
248 MCSectionSubPair curSection = SectionStack.back().first;
249 SectionStack.back().second = curSection;
250 if (MCSectionSubPair(Section, Subsection) != curSection)
251 SectionStack.back().first = MCSectionSubPair(Section, Subsection);
254 /// Initialize the streamer.
255 void InitStreamer() {
256 if (AutoInitSections)
260 /// Tell this MCStreamer to call InitSections upon initialization.
261 void setAutoInitSections(bool AutoInitSections) {
262 this->AutoInitSections = AutoInitSections;
265 /// InitSections - Create the default sections and set the initial one.
266 virtual void InitSections() = 0;
268 /// InitToTextSection - Create a text section and switch the streamer to it.
269 virtual void InitToTextSection() = 0;
271 /// EmitLabel - Emit a label for @p Symbol into the current section.
273 /// This corresponds to an assembler statement such as:
276 /// @param Symbol - The symbol to emit. A given symbol should only be
277 /// emitted as a label once, and symbols emitted as a label should never be
278 /// used in an assignment.
279 virtual void EmitLabel(MCSymbol *Symbol);
281 virtual void EmitDebugLabel(MCSymbol *Symbol);
283 virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
286 /// EmitAssemblerFlag - Note in the output the specified @p Flag.
287 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
289 /// EmitLinkerOptions - Emit the given list @p Options of strings as linker
290 /// options into the output.
291 virtual void EmitLinkerOptions(ArrayRef<std::string> Kind) {}
293 /// EmitDataRegion - Note in the output the specified region @p Kind.
294 virtual void EmitDataRegion(MCDataRegionType Kind) {}
296 /// EmitThumbFunc - Note in the output that the specified @p Func is
297 /// a Thumb mode function (ARM target only).
298 virtual void EmitThumbFunc(MCSymbol *Func) = 0;
300 /// getOrCreateSymbolData - Get symbol data for given symbol.
301 virtual MCSymbolData &getOrCreateSymbolData(MCSymbol *Symbol);
303 /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
305 /// This corresponds to an assembler statement such as:
308 /// The assignment generates no code, but has the side effect of binding the
309 /// value in the current context. For the assembly streamer, this prints the
310 /// binding into the .s file.
312 /// @param Symbol - The symbol being assigned to.
313 /// @param Value - The value for the symbol.
314 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0;
316 /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol.
318 /// This corresponds to an assembler statement such as:
319 /// .weakref alias, symbol
321 /// @param Alias - The alias that is being created.
322 /// @param Symbol - The symbol being aliased.
323 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0;
325 /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
326 virtual void EmitSymbolAttribute(MCSymbol *Symbol,
327 MCSymbolAttr Attribute) = 0;
329 /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
331 /// @param Symbol - The symbol to have its n_desc field set.
332 /// @param DescValue - The value to set into the n_desc field.
333 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
335 /// BeginCOFFSymbolDef - Start emitting COFF symbol definition
337 /// @param Symbol - The symbol to have its External & Type fields set.
338 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0;
340 /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
342 /// @param StorageClass - The storage class the symbol should have.
343 virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0;
345 /// EmitCOFFSymbolType - Emit the type of the symbol.
347 /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
348 virtual void EmitCOFFSymbolType(int Type) = 0;
350 /// EndCOFFSymbolDef - Marks the end of the symbol definition.
351 virtual void EndCOFFSymbolDef() = 0;
353 /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
355 /// @param Symbol - Symbol the section relative realocation should point to.
356 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
358 /// EmitELFSize - Emit an ELF .size directive.
360 /// This corresponds to an assembler statement such as:
361 /// .size symbol, expression
363 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0;
365 /// EmitCommonSymbol - Emit a common symbol.
367 /// @param Symbol - The common symbol to emit.
368 /// @param Size - The size of the common symbol.
369 /// @param ByteAlignment - The alignment of the symbol if
370 /// non-zero. This must be a power of 2.
371 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
372 unsigned ByteAlignment) = 0;
374 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
376 /// @param Symbol - The common symbol to emit.
377 /// @param Size - The size of the common symbol.
378 /// @param ByteAlignment - The alignment of the common symbol in bytes.
379 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
380 unsigned ByteAlignment) = 0;
382 /// EmitZerofill - Emit the zerofill section and an optional symbol.
384 /// @param Section - The zerofill section to create and or to put the symbol
385 /// @param Symbol - The zerofill symbol to emit, if non-NULL.
386 /// @param Size - The size of the zerofill symbol.
387 /// @param ByteAlignment - The alignment of the zerofill symbol if
388 /// non-zero. This must be a power of 2 on some targets.
389 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
390 uint64_t Size = 0,unsigned ByteAlignment = 0) = 0;
392 /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
394 /// @param Section - The thread local common section.
395 /// @param Symbol - The thread local common symbol to emit.
396 /// @param Size - The size of the symbol.
397 /// @param ByteAlignment - The alignment of the thread local common symbol
398 /// if non-zero. This must be a power of 2 on some targets.
399 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
400 uint64_t Size, unsigned ByteAlignment = 0) = 0;
403 /// @name Generating Data
406 /// EmitBytes - Emit the bytes in \p Data into the output.
408 /// This is used to implement assembler directives such as .byte, .ascii,
410 virtual void EmitBytes(StringRef Data, unsigned AddrSpace = 0) = 0;
412 /// EmitValue - Emit the expression @p Value into the output as a native
413 /// integer of the given @p Size bytes.
415 /// This is used to implement assembler directives such as .word, .quad,
418 /// @param Value - The value to emit.
419 /// @param Size - The size of the integer (in bytes) to emit. This must
420 /// match a native machine width.
421 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
422 unsigned AddrSpace) = 0;
424 void EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace = 0);
426 /// EmitIntValue - Special case of EmitValue that avoids the client having
427 /// to pass in a MCExpr for constant integers.
428 virtual void EmitIntValue(uint64_t Value, unsigned Size,
429 unsigned AddrSpace = 0);
431 /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
432 /// this is done by producing
435 void EmitAbsValue(const MCExpr *Value, unsigned Size,
436 unsigned AddrSpace = 0);
438 virtual void EmitULEB128Value(const MCExpr *Value) = 0;
440 virtual void EmitSLEB128Value(const MCExpr *Value) = 0;
442 /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the
443 /// client having to pass in a MCExpr for constant integers.
444 void EmitULEB128IntValue(uint64_t Value, unsigned Padding = 0,
445 unsigned AddrSpace = 0);
447 /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
448 /// client having to pass in a MCExpr for constant integers.
449 void EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace = 0);
451 /// EmitSymbolValue - Special case of EmitValue that avoids the client
452 /// having to pass in a MCExpr for MCSymbols.
453 void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
454 unsigned AddrSpace = 0);
456 /// EmitGPRel64Value - Emit the expression @p Value into the output as a
457 /// gprel64 (64-bit GP relative) value.
459 /// This is used to implement assembler directives such as .gpdword on
460 /// targets that support them.
461 virtual void EmitGPRel64Value(const MCExpr *Value);
463 /// EmitGPRel32Value - Emit the expression @p Value into the output as a
464 /// gprel32 (32-bit GP relative) value.
466 /// This is used to implement assembler directives such as .gprel32 on
467 /// targets that support them.
468 virtual void EmitGPRel32Value(const MCExpr *Value);
470 /// EmitFill - Emit NumBytes bytes worth of the value specified by
471 /// FillValue. This implements directives such as '.space'.
472 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
473 unsigned AddrSpace = 0);
475 /// \brief EmitZeros - Emit NumBytes worth of zeros.
476 /// This function properly handles data in virtual sections.
477 virtual void EmitZeros(uint64_t NumBytes, unsigned AddrSpace = 0);
479 /// EmitValueToAlignment - Emit some number of copies of @p Value until
480 /// the byte alignment @p ByteAlignment is reached.
482 /// If the number of bytes need to emit for the alignment is not a multiple
483 /// of @p ValueSize, then the contents of the emitted fill bytes is
486 /// This used to implement the .align assembler directive.
488 /// @param ByteAlignment - The alignment to reach. This must be a power of
489 /// two on some targets.
490 /// @param Value - The value to use when filling bytes.
491 /// @param ValueSize - The size of the integer (in bytes) to emit for
492 /// @p Value. This must match a native machine width.
493 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
494 /// the alignment cannot be reached in this many bytes, no bytes are
496 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
497 unsigned ValueSize = 1,
498 unsigned MaxBytesToEmit = 0) = 0;
500 /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
503 /// This used to align code where the alignment bytes may be executed. This
504 /// can emit different bytes for different sizes to optimize execution.
506 /// @param ByteAlignment - The alignment to reach. This must be a power of
507 /// two on some targets.
508 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
509 /// the alignment cannot be reached in this many bytes, no bytes are
511 virtual void EmitCodeAlignment(unsigned ByteAlignment,
512 unsigned MaxBytesToEmit = 0) = 0;
514 /// EmitValueToOffset - Emit some number of copies of @p Value until the
515 /// byte offset @p Offset is reached.
517 /// This is used to implement assembler directives such as .org.
519 /// @param Offset - The offset to reach. This may be an expression, but the
520 /// expression must be associated with the current section.
521 /// @param Value - The value to use when filling bytes.
522 /// @return false on success, true if the offset was invalid.
523 virtual bool EmitValueToOffset(const MCExpr *Offset,
524 unsigned char Value = 0) = 0;
528 /// EmitFileDirective - Switch to a new logical file. This is used to
529 /// implement the '.file "foo.c"' assembler directive.
530 virtual void EmitFileDirective(StringRef Filename) = 0;
532 /// EmitDwarfFileDirective - Associate a filename with a specified logical
533 /// file number. This implements the DWARF2 '.file 4 "foo.c"' assembler
535 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
536 StringRef Filename, unsigned CUID = 0);
538 /// EmitDwarfLocDirective - This implements the DWARF2
539 // '.loc fileno lineno ...' assembler directive.
540 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
541 unsigned Column, unsigned Flags,
543 unsigned Discriminator,
546 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
547 const MCSymbol *LastLabel,
548 const MCSymbol *Label,
549 unsigned PointerSize) = 0;
551 virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
552 const MCSymbol *Label) {
555 void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
558 virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding);
559 virtual void EmitCFISections(bool EH, bool Debug);
560 void EmitCFIStartProc();
561 void EmitCFIEndProc();
562 virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
563 virtual void EmitCFIDefCfaOffset(int64_t Offset);
564 virtual void EmitCFIDefCfaRegister(int64_t Register);
565 virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
566 virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
567 virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
568 virtual void EmitCFIRememberState();
569 virtual void EmitCFIRestoreState();
570 virtual void EmitCFISameValue(int64_t Register);
571 virtual void EmitCFIRestore(int64_t Register);
572 virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
573 virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
574 virtual void EmitCFIEscape(StringRef Values);
575 virtual void EmitCFISignalFrame();
576 virtual void EmitCFIUndefined(int64_t Register);
577 virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
579 virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
580 virtual void EmitWin64EHEndProc();
581 virtual void EmitWin64EHStartChained();
582 virtual void EmitWin64EHEndChained();
583 virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
585 virtual void EmitWin64EHHandlerData();
586 virtual void EmitWin64EHPushReg(unsigned Register);
587 virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
588 virtual void EmitWin64EHAllocStack(unsigned Size);
589 virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
590 virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
591 virtual void EmitWin64EHPushFrame(bool Code);
592 virtual void EmitWin64EHEndProlog();
594 /// EmitInstruction - Emit the given @p Instruction into the current
596 virtual void EmitInstruction(const MCInst &Inst) = 0;
598 /// \brief Set the bundle alignment mode from now on in the section.
599 /// The argument is the power of 2 to which the alignment is set. The
600 /// value 0 means turn the bundle alignment off.
601 virtual void EmitBundleAlignMode(unsigned AlignPow2) = 0;
603 /// \brief The following instructions are a bundle-locked group.
605 /// \param AlignToEnd - If true, the bundle-locked group will be aligned to
606 /// the end of a bundle.
607 virtual void EmitBundleLock(bool AlignToEnd) = 0;
609 /// \brief Ends a bundle-locked group.
610 virtual void EmitBundleUnlock() = 0;
612 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
613 /// the specified string in the output .s file. This capability is
614 /// indicated by the hasRawTextSupport() predicate. By default this aborts.
615 virtual void EmitRawText(StringRef String);
616 void EmitRawText(const Twine &String);
618 /// ARM-related methods.
619 /// FIXME: Eventually we should have some "target MC streamer" and move
620 /// these methods there.
621 virtual void EmitFnStart();
622 virtual void EmitFnEnd();
623 virtual void EmitCantUnwind();
624 virtual void EmitPersonality(const MCSymbol *Personality);
625 virtual void EmitHandlerData();
626 virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0);
627 virtual void EmitPad(int64_t Offset);
628 virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
631 /// PPC-related methods.
632 /// FIXME: Eventually replace it with some "target MC streamer" and move
633 /// these methods there.
634 virtual void EmitTCEntry(const MCSymbol &S);
636 /// FinishImpl - Streamer specific finalization.
637 virtual void FinishImpl() = 0;
638 /// Finish - Finish emission of machine code.
642 /// createNullStreamer - Create a dummy machine code streamer, which does
643 /// nothing. This is useful for timing the assembler front end.
644 MCStreamer *createNullStreamer(MCContext &Ctx);
646 /// createAsmStreamer - Create a machine code streamer which will print out
647 /// assembly for the native target, suitable for compiling with a native
650 /// \param InstPrint - If given, the instruction printer to use. If not given
651 /// the MCInst representation will be printed. This method takes ownership of
654 /// \param CE - If given, a code emitter to use to show the instruction
655 /// encoding inline with the assembly. This method takes ownership of \p CE.
657 /// \param TAB - If given, a target asm backend to use to show the fixup
658 /// information in conjunction with encoding information. This method takes
659 /// ownership of \p TAB.
661 /// \param ShowInst - Whether to show the MCInst representation inline with
663 MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
667 bool useDwarfDirectory,
668 MCInstPrinter *InstPrint = 0,
669 MCCodeEmitter *CE = 0,
670 MCAsmBackend *TAB = 0,
671 bool ShowInst = false);
673 /// createMachOStreamer - Create a machine code streamer which will generate
674 /// Mach-O format object files.
676 /// Takes ownership of \p TAB and \p CE.
677 MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
678 raw_ostream &OS, MCCodeEmitter *CE,
679 bool RelaxAll = false);
681 /// createWinCOFFStreamer - Create a machine code streamer which will
682 /// generate Microsoft COFF format object files.
684 /// Takes ownership of \p TAB and \p CE.
685 MCStreamer *createWinCOFFStreamer(MCContext &Ctx,
687 MCCodeEmitter &CE, raw_ostream &OS,
688 bool RelaxAll = false);
690 /// createELFStreamer - Create a machine code streamer which will generate
691 /// ELF format object files.
692 MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
693 raw_ostream &OS, MCCodeEmitter *CE,
694 bool RelaxAll, bool NoExecStack);
696 /// createPureStreamer - Create a machine code streamer which will generate
697 /// "pure" MC object files, for use with MC-JIT and testing tools.
699 /// Takes ownership of \p TAB and \p CE.
700 MCStreamer *createPureStreamer(MCContext &Ctx, MCAsmBackend &TAB,
701 raw_ostream &OS, MCCodeEmitter *CE);
703 } // end namespace llvm