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 /// MCStreamer - Streaming machine code generation interface. This interface
41 /// is intended to provide a programatic interface that is very similar to the
42 /// level that an assembler .s file provides. It has callbacks to emit bytes,
43 /// handle directives, etc. The implementation of this interface retains
44 /// state to know what the current section is etc.
46 /// There are multiple implementations of this interface: one for writing out
47 /// a .s file, and implementations that write out .o files of various formats.
56 // MCObjectStreamer subclasses.
66 const StreamerKind Kind;
69 MCStreamer(const MCStreamer&) LLVM_DELETED_FUNCTION;
70 MCStreamer &operator=(const MCStreamer&) LLVM_DELETED_FUNCTION;
75 std::vector<MCDwarfFrameInfo> FrameInfos;
76 MCDwarfFrameInfo *getCurrentFrameInfo();
77 MCSymbol *EmitCFICommon();
78 void EnsureValidFrame();
80 std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos;
81 MCWin64EHUnwindInfo *CurrentW64UnwindInfo;
82 void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
83 void EnsureValidW64UnwindInfo();
87 /// SectionStack - This is stack of current and previous section
88 /// values saved by PushSection.
89 SmallVector<std::pair<const MCSection *,
90 const MCSection *>, 4> SectionStack;
92 bool AutoInitSections;
95 MCStreamer(StreamerKind Kind, MCContext &Ctx);
97 const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A,
100 const MCExpr *ForceExpAbs(const MCExpr* Expr);
102 void RecordProcStart(MCDwarfFrameInfo &Frame);
103 virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
104 void RecordProcEnd(MCDwarfFrameInfo &Frame);
105 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
106 void EmitFrames(bool usingCFI);
108 MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;}
109 void EmitW64Tables();
112 virtual ~MCStreamer();
114 StreamerKind getKind() const { return Kind; }
118 virtual void reset();
120 MCContext &getContext() const { return Context; }
122 unsigned getNumFrameInfos() {
123 return FrameInfos.size();
126 const MCDwarfFrameInfo &getFrameInfo(unsigned i) {
127 return FrameInfos[i];
130 ArrayRef<MCDwarfFrameInfo> getFrameInfos() {
134 unsigned getNumW64UnwindInfos() {
135 return W64UnwindInfos.size();
138 MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
139 return *W64UnwindInfos[i];
142 /// @name Assembly File Formatting.
145 /// isVerboseAsm - Return true if this streamer supports verbose assembly
146 /// and if it is enabled.
147 virtual bool isVerboseAsm() const { return false; }
149 /// hasRawTextSupport - Return true if this asm streamer supports emitting
150 /// unformatted text to the .s file with EmitRawText.
151 virtual bool hasRawTextSupport() const { return false; }
153 /// AddComment - Add a comment that can be emitted to the generated .s
154 /// file if applicable as a QoI issue to make the output of the compiler
155 /// more readable. This only affects the MCAsmStreamer, and only when
156 /// verbose assembly output is enabled.
158 /// If the comment includes embedded \n's, they will each get the comment
159 /// prefix as appropriate. The added comment should not end with a \n.
160 virtual void AddComment(const Twine &T) {}
162 /// GetCommentOS - Return a raw_ostream that comments can be written to.
163 /// Unlike AddComment, you are required to terminate comments with \n if you
165 virtual raw_ostream &GetCommentOS();
167 /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
168 virtual void AddBlankLine() {}
172 /// @name Symbol & Section Management
175 /// getCurrentSection - Return the current section that the streamer is
176 /// emitting code to.
177 const MCSection *getCurrentSection() const {
178 if (!SectionStack.empty())
179 return SectionStack.back().first;
183 /// getPreviousSection - Return the previous section that the streamer is
184 /// emitting code to.
185 const MCSection *getPreviousSection() const {
186 if (!SectionStack.empty())
187 return SectionStack.back().second;
191 /// ChangeSection - Update streamer for a new active section.
193 /// This is called by PopSection and SwitchSection, if the current
195 virtual void ChangeSection(const MCSection *) = 0;
197 /// pushSection - Save the current and previous section on the
200 SectionStack.push_back(std::make_pair(getCurrentSection(),
201 getPreviousSection()));
204 /// popSection - Restore the current and previous section from
205 /// the section stack. Calls ChangeSection as needed.
207 /// Returns false if the stack was empty.
209 if (SectionStack.size() <= 1)
211 const MCSection *oldSection = SectionStack.pop_back_val().first;
212 const MCSection *curSection = SectionStack.back().first;
214 if (oldSection != curSection)
215 ChangeSection(curSection);
219 /// SwitchSection - Set the current section where code is being emitted to
220 /// @p Section. This is required to update CurSection.
222 /// This corresponds to assembler directives like .section, .text, etc.
223 void SwitchSection(const MCSection *Section) {
224 assert(Section && "Cannot switch to a null section!");
225 const MCSection *curSection = SectionStack.back().first;
226 SectionStack.back().second = curSection;
227 if (Section != curSection) {
228 SectionStack.back().first = Section;
229 ChangeSection(Section);
233 /// SwitchSectionNoChange - Set the current section where code is being
234 /// emitted to @p Section. This is required to update CurSection. This
235 /// version does not call ChangeSection.
236 void SwitchSectionNoChange(const MCSection *Section) {
237 assert(Section && "Cannot switch to a null section!");
238 const MCSection *curSection = SectionStack.back().first;
239 SectionStack.back().second = curSection;
240 if (Section != curSection)
241 SectionStack.back().first = Section;
244 /// Initialize the streamer.
245 void InitStreamer() {
246 if (AutoInitSections)
250 /// Tell this MCStreamer to call InitSections upon initialization.
251 void setAutoInitSections(bool AutoInitSections) {
252 this->AutoInitSections = AutoInitSections;
255 /// InitSections - Create the default sections and set the initial one.
256 virtual void InitSections() = 0;
258 /// InitToTextSection - Create a text section and switch the streamer to it.
259 virtual void InitToTextSection() = 0;
261 /// EmitLabel - Emit a label for @p Symbol into the current section.
263 /// This corresponds to an assembler statement such as:
266 /// @param Symbol - The symbol to emit. A given symbol should only be
267 /// emitted as a label once, and symbols emitted as a label should never be
268 /// used in an assignment.
269 virtual void EmitLabel(MCSymbol *Symbol);
271 virtual void EmitDebugLabel(MCSymbol *Symbol);
273 virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
276 /// EmitAssemblerFlag - Note in the output the specified @p Flag.
277 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
279 /// EmitLinkerOptions - Emit the given list @p Options of strings as linker
280 /// options into the output.
281 virtual void EmitLinkerOptions(ArrayRef<std::string> Kind) {}
283 /// EmitDataRegion - Note in the output the specified region @p Kind.
284 virtual void EmitDataRegion(MCDataRegionType Kind) {}
286 /// EmitThumbFunc - Note in the output that the specified @p Func is
287 /// a Thumb mode function (ARM target only).
288 virtual void EmitThumbFunc(MCSymbol *Func) = 0;
290 /// getOrCreateSymbolData - Get symbol data for given symbol.
291 virtual MCSymbolData &getOrCreateSymbolData(MCSymbol *Symbol);
293 /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
295 /// This corresponds to an assembler statement such as:
298 /// The assignment generates no code, but has the side effect of binding the
299 /// value in the current context. For the assembly streamer, this prints the
300 /// binding into the .s file.
302 /// @param Symbol - The symbol being assigned to.
303 /// @param Value - The value for the symbol.
304 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0;
306 /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol.
308 /// This corresponds to an assembler statement such as:
309 /// .weakref alias, symbol
311 /// @param Alias - The alias that is being created.
312 /// @param Symbol - The symbol being aliased.
313 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0;
315 /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
316 virtual void EmitSymbolAttribute(MCSymbol *Symbol,
317 MCSymbolAttr Attribute) = 0;
319 /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
321 /// @param Symbol - The symbol to have its n_desc field set.
322 /// @param DescValue - The value to set into the n_desc field.
323 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0;
325 /// BeginCOFFSymbolDef - Start emitting COFF symbol definition
327 /// @param Symbol - The symbol to have its External & Type fields set.
328 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0;
330 /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
332 /// @param StorageClass - The storage class the symbol should have.
333 virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0;
335 /// EmitCOFFSymbolType - Emit the type of the symbol.
337 /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
338 virtual void EmitCOFFSymbolType(int Type) = 0;
340 /// EndCOFFSymbolDef - Marks the end of the symbol definition.
341 virtual void EndCOFFSymbolDef() = 0;
343 /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
345 /// @param Symbol - Symbol the section relative realocation should point to.
346 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
348 /// EmitELFSize - Emit an ELF .size directive.
350 /// This corresponds to an assembler statement such as:
351 /// .size symbol, expression
353 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0;
355 /// EmitCommonSymbol - Emit a common symbol.
357 /// @param Symbol - The common symbol to emit.
358 /// @param Size - The size of the common symbol.
359 /// @param ByteAlignment - The alignment of the symbol if
360 /// non-zero. This must be a power of 2.
361 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
362 unsigned ByteAlignment) = 0;
364 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
366 /// @param Symbol - The common symbol to emit.
367 /// @param Size - The size of the common symbol.
368 /// @param ByteAlignment - The alignment of the common symbol in bytes.
369 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
370 unsigned ByteAlignment) = 0;
372 /// EmitZerofill - Emit the zerofill section and an optional symbol.
374 /// @param Section - The zerofill section to create and or to put the symbol
375 /// @param Symbol - The zerofill symbol to emit, if non-NULL.
376 /// @param Size - The size of the zerofill symbol.
377 /// @param ByteAlignment - The alignment of the zerofill symbol if
378 /// non-zero. This must be a power of 2 on some targets.
379 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
380 uint64_t Size = 0,unsigned ByteAlignment = 0) = 0;
382 /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
384 /// @param Section - The thread local common section.
385 /// @param Symbol - The thread local common symbol to emit.
386 /// @param Size - The size of the symbol.
387 /// @param ByteAlignment - The alignment of the thread local common symbol
388 /// if non-zero. This must be a power of 2 on some targets.
389 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
390 uint64_t Size, unsigned ByteAlignment = 0) = 0;
393 /// @name Generating Data
396 /// EmitBytes - Emit the bytes in \p Data into the output.
398 /// This is used to implement assembler directives such as .byte, .ascii,
400 virtual void EmitBytes(StringRef Data, unsigned AddrSpace = 0) = 0;
402 /// EmitValue - Emit the expression @p Value into the output as a native
403 /// integer of the given @p Size bytes.
405 /// This is used to implement assembler directives such as .word, .quad,
408 /// @param Value - The value to emit.
409 /// @param Size - The size of the integer (in bytes) to emit. This must
410 /// match a native machine width.
411 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
412 unsigned AddrSpace) = 0;
414 void EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace = 0);
416 /// EmitIntValue - Special case of EmitValue that avoids the client having
417 /// to pass in a MCExpr for constant integers.
418 virtual void EmitIntValue(uint64_t Value, unsigned Size,
419 unsigned AddrSpace = 0);
421 /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
422 /// this is done by producing
425 void EmitAbsValue(const MCExpr *Value, unsigned Size,
426 unsigned AddrSpace = 0);
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,
435 unsigned AddrSpace = 0);
437 /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the
438 /// client having to pass in a MCExpr for constant integers.
439 void EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace = 0);
441 /// EmitSymbolValue - Special case of EmitValue that avoids the client
442 /// having to pass in a MCExpr for MCSymbols.
443 void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
444 unsigned AddrSpace = 0);
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,
463 unsigned AddrSpace = 0);
465 /// EmitZeros - Emit NumBytes worth of zeros. This is a convenience
466 /// function that just wraps EmitFill.
467 void EmitZeros(uint64_t NumBytes, unsigned AddrSpace = 0) {
468 EmitFill(NumBytes, 0, AddrSpace);
471 /// EmitValueToAlignment - Emit some number of copies of @p Value until
472 /// the byte alignment @p ByteAlignment is reached.
474 /// If the number of bytes need to emit for the alignment is not a multiple
475 /// of @p ValueSize, then the contents of the emitted fill bytes is
478 /// This used to implement the .align assembler directive.
480 /// @param ByteAlignment - The alignment to reach. This must be a power of
481 /// two on some targets.
482 /// @param Value - The value to use when filling bytes.
483 /// @param ValueSize - The size of the integer (in bytes) to emit for
484 /// @p Value. This must match a native machine width.
485 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
486 /// the alignment cannot be reached in this many bytes, no bytes are
488 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
489 unsigned ValueSize = 1,
490 unsigned MaxBytesToEmit = 0) = 0;
492 /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
495 /// This used to align code where the alignment bytes may be executed. This
496 /// can emit different bytes for different sizes to optimize execution.
498 /// @param ByteAlignment - The alignment to reach. This must be a power of
499 /// two on some targets.
500 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
501 /// the alignment cannot be reached in this many bytes, no bytes are
503 virtual void EmitCodeAlignment(unsigned ByteAlignment,
504 unsigned MaxBytesToEmit = 0) = 0;
506 /// EmitValueToOffset - Emit some number of copies of @p Value until the
507 /// byte offset @p Offset is reached.
509 /// This is used to implement assembler directives such as .org.
511 /// @param Offset - The offset to reach. This may be an expression, but the
512 /// expression must be associated with the current section.
513 /// @param Value - The value to use when filling bytes.
514 /// @return false on success, true if the offset was invalid.
515 virtual bool EmitValueToOffset(const MCExpr *Offset,
516 unsigned char Value = 0) = 0;
520 /// EmitFileDirective - Switch to a new logical file. This is used to
521 /// implement the '.file "foo.c"' assembler directive.
522 virtual void EmitFileDirective(StringRef Filename) = 0;
524 /// EmitDwarfFileDirective - Associate a filename with a specified logical
525 /// file number. This implements the DWARF2 '.file 4 "foo.c"' assembler
527 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
528 StringRef Filename, unsigned CUID = 0);
530 /// EmitDwarfLocDirective - This implements the DWARF2
531 // '.loc fileno lineno ...' assembler directive.
532 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
533 unsigned Column, unsigned Flags,
535 unsigned Discriminator,
538 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
539 const MCSymbol *LastLabel,
540 const MCSymbol *Label,
541 unsigned PointerSize) = 0;
543 virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
544 const MCSymbol *Label) {
547 void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
550 virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding);
551 virtual void EmitCFISections(bool EH, bool Debug);
552 void EmitCFIStartProc();
553 void EmitCFIEndProc();
554 virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
555 virtual void EmitCFIDefCfaOffset(int64_t Offset);
556 virtual void EmitCFIDefCfaRegister(int64_t Register);
557 virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
558 virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
559 virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
560 virtual void EmitCFIRememberState();
561 virtual void EmitCFIRestoreState();
562 virtual void EmitCFISameValue(int64_t Register);
563 virtual void EmitCFIRestore(int64_t Register);
564 virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
565 virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
566 virtual void EmitCFIEscape(StringRef Values);
567 virtual void EmitCFISignalFrame();
568 virtual void EmitCFIUndefined(int64_t Register);
569 virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
571 virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
572 virtual void EmitWin64EHEndProc();
573 virtual void EmitWin64EHStartChained();
574 virtual void EmitWin64EHEndChained();
575 virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
577 virtual void EmitWin64EHHandlerData();
578 virtual void EmitWin64EHPushReg(unsigned Register);
579 virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
580 virtual void EmitWin64EHAllocStack(unsigned Size);
581 virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
582 virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
583 virtual void EmitWin64EHPushFrame(bool Code);
584 virtual void EmitWin64EHEndProlog();
586 /// EmitInstruction - Emit the given @p Instruction into the current
588 virtual void EmitInstruction(const MCInst &Inst) = 0;
590 /// \brief Set the bundle alignment mode from now on in the section.
591 /// The argument is the power of 2 to which the alignment is set. The
592 /// value 0 means turn the bundle alignment off.
593 virtual void EmitBundleAlignMode(unsigned AlignPow2) = 0;
595 /// \brief The following instructions are a bundle-locked group.
597 /// \param AlignToEnd - If true, the bundle-locked group will be aligned to
598 /// the end of a bundle.
599 virtual void EmitBundleLock(bool AlignToEnd) = 0;
601 /// \brief Ends a bundle-locked group.
602 virtual void EmitBundleUnlock() = 0;
604 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
605 /// the specified string in the output .s file. This capability is
606 /// indicated by the hasRawTextSupport() predicate. By default this aborts.
607 virtual void EmitRawText(StringRef String);
608 void EmitRawText(const Twine &String);
610 /// ARM-related methods.
611 /// FIXME: Eventually we should have some "target MC streamer" and move
612 /// these methods there.
613 virtual void EmitFnStart();
614 virtual void EmitFnEnd();
615 virtual void EmitCantUnwind();
616 virtual void EmitPersonality(const MCSymbol *Personality);
617 virtual void EmitHandlerData();
618 virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0);
619 virtual void EmitPad(int64_t Offset);
620 virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
623 /// PPC-related methods.
624 /// FIXME: Eventually replace it with some "target MC streamer" and move
625 /// these methods there.
626 virtual void EmitTCEntry(const MCSymbol &S);
628 /// FinishImpl - Streamer specific finalization.
629 virtual void FinishImpl() = 0;
630 /// Finish - Finish emission of machine code.
634 /// createNullStreamer - Create a dummy machine code streamer, which does
635 /// nothing. This is useful for timing the assembler front end.
636 MCStreamer *createNullStreamer(MCContext &Ctx);
638 /// createAsmStreamer - Create a machine code streamer which will print out
639 /// assembly for the native target, suitable for compiling with a native
642 /// \param InstPrint - If given, the instruction printer to use. If not given
643 /// the MCInst representation will be printed. This method takes ownership of
646 /// \param CE - If given, a code emitter to use to show the instruction
647 /// encoding inline with the assembly. This method takes ownership of \p CE.
649 /// \param TAB - If given, a target asm backend to use to show the fixup
650 /// information in conjunction with encoding information. This method takes
651 /// ownership of \p TAB.
653 /// \param ShowInst - Whether to show the MCInst representation inline with
655 MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
659 bool useDwarfDirectory,
660 MCInstPrinter *InstPrint = 0,
661 MCCodeEmitter *CE = 0,
662 MCAsmBackend *TAB = 0,
663 bool ShowInst = false);
665 /// createMachOStreamer - Create a machine code streamer which will generate
666 /// Mach-O format object files.
668 /// Takes ownership of \p TAB and \p CE.
669 MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
670 raw_ostream &OS, MCCodeEmitter *CE,
671 bool RelaxAll = false);
673 /// createWinCOFFStreamer - Create a machine code streamer which will
674 /// generate Microsoft COFF format object files.
676 /// Takes ownership of \p TAB and \p CE.
677 MCStreamer *createWinCOFFStreamer(MCContext &Ctx,
679 MCCodeEmitter &CE, raw_ostream &OS,
680 bool RelaxAll = false);
682 /// createELFStreamer - Create a machine code streamer which will generate
683 /// ELF format object files.
684 MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
685 raw_ostream &OS, MCCodeEmitter *CE,
686 bool RelaxAll, bool NoExecStack);
688 /// createPureStreamer - Create a machine code streamer which will generate
689 /// "pure" MC object files, for use with MC-JIT and testing tools.
691 /// Takes ownership of \p TAB and \p CE.
692 MCStreamer *createPureStreamer(MCContext &Ctx, MCAsmBackend &TAB,
693 raw_ostream &OS, MCCodeEmitter *CE);
695 } // end namespace llvm