1 //===- lib/MC/MCAsmStreamer.cpp - Text Assembly Output --------------------===//
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 #include "llvm/MC/MCStreamer.h"
11 #include "llvm/ADT/OwningPtr.h"
12 #include "llvm/ADT/SmallString.h"
13 #include "llvm/ADT/StringExtras.h"
14 #include "llvm/ADT/Twine.h"
15 #include "llvm/MC/MCAsmBackend.h"
16 #include "llvm/MC/MCAsmInfo.h"
17 #include "llvm/MC/MCCodeEmitter.h"
18 #include "llvm/MC/MCContext.h"
19 #include "llvm/MC/MCExpr.h"
20 #include "llvm/MC/MCFixupKindInfo.h"
21 #include "llvm/MC/MCInst.h"
22 #include "llvm/MC/MCInstPrinter.h"
23 #include "llvm/MC/MCObjectFileInfo.h"
24 #include "llvm/MC/MCRegisterInfo.h"
25 #include "llvm/MC/MCSectionCOFF.h"
26 #include "llvm/MC/MCSectionMachO.h"
27 #include "llvm/MC/MCSymbol.h"
28 #include "llvm/Support/CommandLine.h"
29 #include "llvm/Support/ErrorHandling.h"
30 #include "llvm/Support/Format.h"
31 #include "llvm/Support/FormattedStream.h"
32 #include "llvm/Support/MathExtras.h"
33 #include "llvm/Support/Path.h"
37 static cl::opt<bool> PrintHackDirectives("print-hack-directives",
38 cl::init(false), cl::Hidden);
42 class MCAsmStreamer : public MCStreamer {
44 formatted_raw_ostream &OS;
47 OwningPtr<MCInstPrinter> InstPrinter;
48 OwningPtr<MCCodeEmitter> Emitter;
49 OwningPtr<MCAsmBackend> AsmBackend;
51 SmallString<128> CommentToEmit;
52 raw_svector_ostream CommentStream;
54 unsigned IsVerboseAsm : 1;
55 unsigned ShowInst : 1;
58 unsigned UseDwarfDirectory : 1;
60 enum EHSymbolFlags { EHGlobal = 1,
61 EHWeakDefinition = 1 << 1,
62 EHPrivateExtern = 1 << 2 };
63 DenseMap<const MCSymbol*, unsigned> FlagMap;
65 bool needsSet(const MCExpr *Value);
67 void EmitRegisterName(int64_t Register);
68 virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
69 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame);
72 MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os,
73 bool isVerboseAsm, bool useLoc, bool useCFI,
74 bool useDwarfDirectory,
75 MCInstPrinter *printer, MCCodeEmitter *emitter,
76 MCAsmBackend *asmbackend,
78 : MCStreamer(Context), OS(os), MAI(Context.getAsmInfo()),
79 InstPrinter(printer), Emitter(emitter), AsmBackend(asmbackend),
80 CommentStream(CommentToEmit), IsVerboseAsm(isVerboseAsm),
81 ShowInst(showInst), UseLoc(useLoc), UseCFI(useCFI),
82 UseDwarfDirectory(useDwarfDirectory) {
83 if (InstPrinter && IsVerboseAsm)
84 InstPrinter->setCommentStream(CommentStream);
88 inline void EmitEOL() {
89 // If we don't have any comments, just emit a \n.
96 void EmitCommentsAndEOL();
98 /// isVerboseAsm - Return true if this streamer supports verbose assembly at
100 virtual bool isVerboseAsm() const { return IsVerboseAsm; }
102 /// hasRawTextSupport - We support EmitRawText.
103 virtual bool hasRawTextSupport() const { return true; }
105 /// AddComment - Add a comment that can be emitted to the generated .s
106 /// file if applicable as a QoI issue to make the output of the compiler
107 /// more readable. This only affects the MCAsmStreamer, and only when
108 /// verbose assembly output is enabled.
109 virtual void AddComment(const Twine &T);
111 /// AddEncodingComment - Add a comment showing the encoding of an instruction.
112 virtual void AddEncodingComment(const MCInst &Inst);
114 /// GetCommentOS - Return a raw_ostream that comments can be written to.
115 /// Unlike AddComment, you are required to terminate comments with \n if you
117 virtual raw_ostream &GetCommentOS() {
119 return nulls(); // Discard comments unless in verbose asm mode.
120 return CommentStream;
123 /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
124 virtual void AddBlankLine() {
128 /// @name MCStreamer Interface
131 virtual void ChangeSection(const MCSection *Section,
132 const MCExpr *Subsection);
134 virtual void InitSections() {
138 virtual void InitToTextSection() {
139 SwitchSection(getContext().getObjectFileInfo()->getTextSection());
142 virtual void EmitLabel(MCSymbol *Symbol);
143 virtual void EmitDebugLabel(MCSymbol *Symbol);
145 virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
147 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
148 virtual void EmitLinkerOptions(ArrayRef<std::string> Options);
149 virtual void EmitDataRegion(MCDataRegionType Kind);
150 virtual void EmitThumbFunc(MCSymbol *Func);
152 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
153 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
154 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
155 const MCSymbol *LastLabel,
156 const MCSymbol *Label,
157 unsigned PointerSize);
158 virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
159 const MCSymbol *Label);
161 virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
163 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
164 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol);
165 virtual void EmitCOFFSymbolStorageClass(int StorageClass);
166 virtual void EmitCOFFSymbolType(int Type);
167 virtual void EndCOFFSymbolDef();
168 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
169 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
170 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
171 unsigned ByteAlignment);
173 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
175 /// @param Symbol - The common symbol to emit.
176 /// @param Size - The size of the common symbol.
177 /// @param ByteAlignment - The alignment of the common symbol in bytes.
178 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
179 unsigned ByteAlignment);
181 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
182 uint64_t Size = 0, unsigned ByteAlignment = 0);
184 virtual void EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol,
185 uint64_t Size, unsigned ByteAlignment = 0);
187 virtual void EmitBytes(StringRef Data);
189 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size);
190 virtual void EmitIntValue(uint64_t Value, unsigned Size);
192 virtual void EmitULEB128Value(const MCExpr *Value);
194 virtual void EmitSLEB128Value(const MCExpr *Value);
196 virtual void EmitGPRel64Value(const MCExpr *Value);
198 virtual void EmitGPRel32Value(const MCExpr *Value);
201 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue);
203 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
204 unsigned ValueSize = 1,
205 unsigned MaxBytesToEmit = 0);
207 virtual void EmitCodeAlignment(unsigned ByteAlignment,
208 unsigned MaxBytesToEmit = 0);
210 virtual bool EmitValueToOffset(const MCExpr *Offset,
211 unsigned char Value = 0);
213 virtual void EmitFileDirective(StringRef Filename);
214 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
215 StringRef Filename, unsigned CUID = 0);
216 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
217 unsigned Column, unsigned Flags,
218 unsigned Isa, unsigned Discriminator,
221 virtual void EmitCFISections(bool EH, bool Debug);
222 virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
223 virtual void EmitCFIDefCfaOffset(int64_t Offset);
224 virtual void EmitCFIDefCfaRegister(int64_t Register);
225 virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
226 virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
227 virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
228 virtual void EmitCFIRememberState();
229 virtual void EmitCFIRestoreState();
230 virtual void EmitCFISameValue(int64_t Register);
231 virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
232 virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
233 virtual void EmitCFISignalFrame();
234 virtual void EmitCFIUndefined(int64_t Register);
235 virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
236 virtual void EmitCFIWindowSave();
238 virtual void EmitWin64EHStartProc(const MCSymbol *Symbol);
239 virtual void EmitWin64EHEndProc();
240 virtual void EmitWin64EHStartChained();
241 virtual void EmitWin64EHEndChained();
242 virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
244 virtual void EmitWin64EHHandlerData();
245 virtual void EmitWin64EHPushReg(unsigned Register);
246 virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset);
247 virtual void EmitWin64EHAllocStack(unsigned Size);
248 virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset);
249 virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset);
250 virtual void EmitWin64EHPushFrame(bool Code);
251 virtual void EmitWin64EHEndProlog();
253 virtual void EmitFnStart();
254 virtual void EmitFnEnd();
255 virtual void EmitCantUnwind();
256 virtual void EmitPersonality(const MCSymbol *Personality);
257 virtual void EmitHandlerData();
258 virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0);
259 virtual void EmitPad(int64_t Offset);
260 virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList, bool);
262 /// Mips-related methods.
263 virtual void emitMipsHackELFFlags(unsigned Flags);
264 virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val);
267 virtual void EmitTCEntry(const MCSymbol &S);
269 virtual void EmitInstruction(const MCInst &Inst);
271 virtual void EmitBundleAlignMode(unsigned AlignPow2);
272 virtual void EmitBundleLock(bool AlignToEnd);
273 virtual void EmitBundleUnlock();
275 /// EmitRawText - If this file is backed by an assembly streamer, this dumps
276 /// the specified string in the output .s file. This capability is
277 /// indicated by the hasRawTextSupport() predicate.
278 virtual void EmitRawText(StringRef String);
280 virtual void FinishImpl();
283 } // end anonymous namespace.
285 /// AddComment - Add a comment that can be emitted to the generated .s
286 /// file if applicable as a QoI issue to make the output of the compiler
287 /// more readable. This only affects the MCAsmStreamer, and only when
288 /// verbose assembly output is enabled.
289 void MCAsmStreamer::AddComment(const Twine &T) {
290 if (!IsVerboseAsm) return;
292 // Make sure that CommentStream is flushed.
293 CommentStream.flush();
295 T.toVector(CommentToEmit);
296 // Each comment goes on its own line.
297 CommentToEmit.push_back('\n');
299 // Tell the comment stream that the vector changed underneath it.
300 CommentStream.resync();
303 void MCAsmStreamer::EmitCommentsAndEOL() {
304 if (CommentToEmit.empty() && CommentStream.GetNumBytesInBuffer() == 0) {
309 CommentStream.flush();
310 StringRef Comments = CommentToEmit.str();
312 assert(Comments.back() == '\n' &&
313 "Comment array not newline terminated");
315 // Emit a line of comments.
316 OS.PadToColumn(MAI->getCommentColumn());
317 size_t Position = Comments.find('\n');
318 OS << MAI->getCommentString() << ' ' << Comments.substr(0, Position) <<'\n';
320 Comments = Comments.substr(Position+1);
321 } while (!Comments.empty());
323 CommentToEmit.clear();
324 // Tell the comment stream that the vector changed underneath it.
325 CommentStream.resync();
328 static inline int64_t truncateToSize(int64_t Value, unsigned Bytes) {
329 assert(Bytes && "Invalid size!");
330 return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8));
333 void MCAsmStreamer::ChangeSection(const MCSection *Section,
334 const MCExpr *Subsection) {
335 assert(Section && "Cannot switch to a null section!");
336 Section->PrintSwitchToSection(*MAI, OS, Subsection);
339 void MCAsmStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
340 MCSymbol *EHSymbol) {
344 unsigned Flags = FlagMap.lookup(Symbol);
346 if (Flags & EHGlobal)
347 EmitSymbolAttribute(EHSymbol, MCSA_Global);
348 if (Flags & EHWeakDefinition)
349 EmitSymbolAttribute(EHSymbol, MCSA_WeakDefinition);
350 if (Flags & EHPrivateExtern)
351 EmitSymbolAttribute(EHSymbol, MCSA_PrivateExtern);
354 void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
355 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
356 MCStreamer::EmitLabel(Symbol);
358 OS << *Symbol << MAI->getLabelSuffix();
362 void MCAsmStreamer::EmitDebugLabel(MCSymbol *Symbol) {
363 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
364 MCStreamer::EmitDebugLabel(Symbol);
366 OS << *Symbol << MAI->getDebugLabelSuffix();
370 void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
372 case MCAF_SyntaxUnified: OS << "\t.syntax unified"; break;
373 case MCAF_SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break;
374 case MCAF_Code16: OS << '\t'<< MAI->getCode16Directive();break;
375 case MCAF_Code32: OS << '\t'<< MAI->getCode32Directive();break;
376 case MCAF_Code64: OS << '\t'<< MAI->getCode64Directive();break;
381 void MCAsmStreamer::EmitLinkerOptions(ArrayRef<std::string> Options) {
382 assert(!Options.empty() && "At least one option is required!");
383 OS << "\t.linker_option \"" << Options[0] << '"';
384 for (ArrayRef<std::string>::iterator it = Options.begin() + 1,
385 ie = Options.end(); it != ie; ++it) {
386 OS << ", " << '"' << *it << '"';
391 void MCAsmStreamer::EmitDataRegion(MCDataRegionType Kind) {
392 if (!MAI->doesSupportDataRegionDirectives())
395 case MCDR_DataRegion: OS << "\t.data_region"; break;
396 case MCDR_DataRegionJT8: OS << "\t.data_region jt8"; break;
397 case MCDR_DataRegionJT16: OS << "\t.data_region jt16"; break;
398 case MCDR_DataRegionJT32: OS << "\t.data_region jt32"; break;
399 case MCDR_DataRegionEnd: OS << "\t.end_data_region"; break;
404 void MCAsmStreamer::EmitThumbFunc(MCSymbol *Func) {
405 // This needs to emit to a temporary string to get properly quoted
406 // MCSymbols when they have spaces in them.
407 OS << "\t.thumb_func";
408 // Only Mach-O hasSubsectionsViaSymbols()
409 if (MAI->hasSubsectionsViaSymbols())
414 void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
415 OS << *Symbol << " = " << *Value;
418 // FIXME: Lift context changes into super class.
419 Symbol->setVariableValue(Value);
422 void MCAsmStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
423 OS << ".weakref " << *Alias << ", " << *Symbol;
427 void MCAsmStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
428 const MCSymbol *LastLabel,
429 const MCSymbol *Label,
430 unsigned PointerSize) {
431 EmitDwarfSetLineAddr(LineDelta, Label, PointerSize);
434 void MCAsmStreamer::EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
435 const MCSymbol *Label) {
436 EmitIntValue(dwarf::DW_CFA_advance_loc4, 1);
437 const MCExpr *AddrDelta = BuildSymbolDiff(getContext(), Label, LastLabel);
438 AddrDelta = ForceExpAbs(AddrDelta);
439 EmitValue(AddrDelta, 4);
443 bool MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
444 MCSymbolAttr Attribute) {
446 case MCSA_Invalid: llvm_unreachable("Invalid symbol attribute");
447 case MCSA_ELF_TypeFunction: /// .type _foo, STT_FUNC # aka @function
448 case MCSA_ELF_TypeIndFunction: /// .type _foo, STT_GNU_IFUNC
449 case MCSA_ELF_TypeObject: /// .type _foo, STT_OBJECT # aka @object
450 case MCSA_ELF_TypeTLS: /// .type _foo, STT_TLS # aka @tls_object
451 case MCSA_ELF_TypeCommon: /// .type _foo, STT_COMMON # aka @common
452 case MCSA_ELF_TypeNoType: /// .type _foo, STT_NOTYPE # aka @notype
453 case MCSA_ELF_TypeGnuUniqueObject: /// .type _foo, @gnu_unique_object
454 if (!MAI->hasDotTypeDotSizeDirective())
455 return false; // Symbol attribute not supported
456 OS << "\t.type\t" << *Symbol << ','
457 << ((MAI->getCommentString()[0] != '@') ? '@' : '%');
459 default: return false;
460 case MCSA_ELF_TypeFunction: OS << "function"; break;
461 case MCSA_ELF_TypeIndFunction: OS << "gnu_indirect_function"; break;
462 case MCSA_ELF_TypeObject: OS << "object"; break;
463 case MCSA_ELF_TypeTLS: OS << "tls_object"; break;
464 case MCSA_ELF_TypeCommon: OS << "common"; break;
465 case MCSA_ELF_TypeNoType: OS << "no_type"; break;
466 case MCSA_ELF_TypeGnuUniqueObject: OS << "gnu_unique_object"; break;
470 case MCSA_Global: // .globl/.global
471 OS << MAI->getGlobalDirective();
472 FlagMap[Symbol] |= EHGlobal;
474 case MCSA_Hidden: OS << "\t.hidden\t"; break;
475 case MCSA_IndirectSymbol: OS << "\t.indirect_symbol\t"; break;
476 case MCSA_Internal: OS << "\t.internal\t"; break;
477 case MCSA_LazyReference: OS << "\t.lazy_reference\t"; break;
478 case MCSA_Local: OS << "\t.local\t"; break;
479 case MCSA_NoDeadStrip: OS << "\t.no_dead_strip\t"; break;
480 case MCSA_SymbolResolver: OS << "\t.symbol_resolver\t"; break;
481 case MCSA_PrivateExtern:
482 OS << "\t.private_extern\t";
483 FlagMap[Symbol] |= EHPrivateExtern;
485 case MCSA_Protected: OS << "\t.protected\t"; break;
486 case MCSA_Reference: OS << "\t.reference\t"; break;
487 case MCSA_Weak: OS << "\t.weak\t"; break;
488 case MCSA_WeakDefinition:
489 OS << "\t.weak_definition\t";
490 FlagMap[Symbol] |= EHWeakDefinition;
493 case MCSA_WeakReference: OS << MAI->getWeakRefDirective(); break;
494 case MCSA_WeakDefAutoPrivate: OS << "\t.weak_def_can_be_hidden\t"; break;
503 void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
504 OS << ".desc" << ' ' << *Symbol << ',' << DescValue;
508 void MCAsmStreamer::BeginCOFFSymbolDef(const MCSymbol *Symbol) {
509 OS << "\t.def\t " << *Symbol << ';';
513 void MCAsmStreamer::EmitCOFFSymbolStorageClass (int StorageClass) {
514 OS << "\t.scl\t" << StorageClass << ';';
518 void MCAsmStreamer::EmitCOFFSymbolType (int Type) {
519 OS << "\t.type\t" << Type << ';';
523 void MCAsmStreamer::EndCOFFSymbolDef() {
528 void MCAsmStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
529 OS << "\t.secrel32\t" << *Symbol << '\n';
533 void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
534 assert(MAI->hasDotTypeDotSizeDirective());
535 OS << "\t.size\t" << *Symbol << ", " << *Value << '\n';
538 void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
539 unsigned ByteAlignment) {
540 // Common symbols do not belong to any actual section.
541 AssignSection(Symbol, NULL);
543 OS << "\t.comm\t" << *Symbol << ',' << Size;
544 if (ByteAlignment != 0) {
545 if (MAI->getCOMMDirectiveAlignmentIsInBytes())
546 OS << ',' << ByteAlignment;
548 OS << ',' << Log2_32(ByteAlignment);
553 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
555 /// @param Symbol - The common symbol to emit.
556 /// @param Size - The size of the common symbol.
557 void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
558 unsigned ByteAlign) {
559 // Common symbols do not belong to any actual section.
560 AssignSection(Symbol, NULL);
562 OS << "\t.lcomm\t" << *Symbol << ',' << Size;
564 switch (MAI->getLCOMMDirectiveAlignmentType()) {
565 case LCOMM::NoAlignment:
566 llvm_unreachable("alignment not supported on .lcomm!");
567 case LCOMM::ByteAlignment:
568 OS << ',' << ByteAlign;
570 case LCOMM::Log2Alignment:
571 assert(isPowerOf2_32(ByteAlign) && "alignment must be a power of 2");
572 OS << ',' << Log2_32(ByteAlign);
579 void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
580 uint64_t Size, unsigned ByteAlignment) {
582 AssignSection(Symbol, Section);
584 // Note: a .zerofill directive does not switch sections.
587 // This is a mach-o specific directive.
588 const MCSectionMachO *MOSection = ((const MCSectionMachO*)Section);
589 OS << MOSection->getSegmentName() << "," << MOSection->getSectionName();
591 if (Symbol != NULL) {
592 OS << ',' << *Symbol << ',' << Size;
593 if (ByteAlignment != 0)
594 OS << ',' << Log2_32(ByteAlignment);
599 // .tbss sym, size, align
600 // This depends that the symbol has already been mangled from the original,
602 void MCAsmStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
603 uint64_t Size, unsigned ByteAlignment) {
604 AssignSection(Symbol, Section);
606 assert(Symbol != NULL && "Symbol shouldn't be NULL!");
607 // Instead of using the Section we'll just use the shortcut.
608 // This is a mach-o specific directive and section.
609 OS << ".tbss " << *Symbol << ", " << Size;
611 // Output align if we have it. We default to 1 so don't bother printing
613 if (ByteAlignment > 1) OS << ", " << Log2_32(ByteAlignment);
618 static inline char toOctal(int X) { return (X&7)+'0'; }
620 static void PrintQuotedString(StringRef Data, raw_ostream &OS) {
623 for (unsigned i = 0, e = Data.size(); i != e; ++i) {
624 unsigned char C = Data[i];
625 if (C == '"' || C == '\\') {
626 OS << '\\' << (char)C;
630 if (isprint((unsigned char)C)) {
636 case '\b': OS << "\\b"; break;
637 case '\f': OS << "\\f"; break;
638 case '\n': OS << "\\n"; break;
639 case '\r': OS << "\\r"; break;
640 case '\t': OS << "\\t"; break;
643 OS << toOctal(C >> 6);
644 OS << toOctal(C >> 3);
645 OS << toOctal(C >> 0);
654 void MCAsmStreamer::EmitBytes(StringRef Data) {
655 assert(getCurrentSection().first &&
656 "Cannot emit contents before setting section!");
657 if (Data.empty()) return;
659 if (Data.size() == 1) {
660 OS << MAI->getData8bitsDirective();
661 OS << (unsigned)(unsigned char)Data[0];
666 // If the data ends with 0 and the target supports .asciz, use it, otherwise
668 if (MAI->getAscizDirective() && Data.back() == 0) {
669 OS << MAI->getAscizDirective();
670 Data = Data.substr(0, Data.size()-1);
672 OS << MAI->getAsciiDirective();
675 PrintQuotedString(Data, OS);
679 void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
680 EmitValue(MCConstantExpr::Create(Value, getContext()), Size);
683 void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size) {
684 assert(getCurrentSection().first &&
685 "Cannot emit contents before setting section!");
686 const char *Directive = 0;
689 case 1: Directive = MAI->getData8bitsDirective(); break;
690 case 2: Directive = MAI->getData16bitsDirective(); break;
691 case 4: Directive = MAI->getData32bitsDirective(); break;
693 Directive = MAI->getData64bitsDirective();
694 // If the target doesn't support 64-bit data, emit as two 32-bit halves.
695 if (Directive) break;
697 if (!Value->EvaluateAsAbsolute(IntValue))
698 report_fatal_error("Don't know how to emit this value.");
699 if (MAI->isLittleEndian()) {
700 EmitIntValue((uint32_t)(IntValue >> 0 ), 4);
701 EmitIntValue((uint32_t)(IntValue >> 32), 4);
703 EmitIntValue((uint32_t)(IntValue >> 32), 4);
704 EmitIntValue((uint32_t)(IntValue >> 0 ), 4);
709 assert(Directive && "Invalid size for machine code value!");
710 OS << Directive << *Value;
714 void MCAsmStreamer::EmitULEB128Value(const MCExpr *Value) {
716 if (Value->EvaluateAsAbsolute(IntValue)) {
717 EmitULEB128IntValue(IntValue);
720 assert(MAI->hasLEB128() && "Cannot print a .uleb");
721 OS << ".uleb128 " << *Value;
725 void MCAsmStreamer::EmitSLEB128Value(const MCExpr *Value) {
727 if (Value->EvaluateAsAbsolute(IntValue)) {
728 EmitSLEB128IntValue(IntValue);
731 assert(MAI->hasLEB128() && "Cannot print a .sleb");
732 OS << ".sleb128 " << *Value;
736 void MCAsmStreamer::EmitGPRel64Value(const MCExpr *Value) {
737 assert(MAI->getGPRel64Directive() != 0);
738 OS << MAI->getGPRel64Directive() << *Value;
742 void MCAsmStreamer::EmitGPRel32Value(const MCExpr *Value) {
743 assert(MAI->getGPRel32Directive() != 0);
744 OS << MAI->getGPRel32Directive() << *Value;
749 /// EmitFill - Emit NumBytes bytes worth of the value specified by
750 /// FillValue. This implements directives such as '.space'.
751 void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) {
752 if (NumBytes == 0) return;
754 if (const char *ZeroDirective = MAI->getZeroDirective()) {
755 OS << ZeroDirective << NumBytes;
757 OS << ',' << (int)FillValue;
762 // Emit a byte at a time.
763 MCStreamer::EmitFill(NumBytes, FillValue);
766 void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
768 unsigned MaxBytesToEmit) {
769 // Some assemblers don't support non-power of two alignments, so we always
770 // emit alignments as a power of two if possible.
771 if (isPowerOf2_32(ByteAlignment)) {
773 default: llvm_unreachable("Invalid size for machine code value!");
774 case 1: OS << MAI->getAlignDirective(); break;
775 // FIXME: use MAI for this!
776 case 2: OS << ".p2alignw "; break;
777 case 4: OS << ".p2alignl "; break;
778 case 8: llvm_unreachable("Unsupported alignment size!");
781 if (MAI->getAlignmentIsInBytes())
784 OS << Log2_32(ByteAlignment);
786 if (Value || MaxBytesToEmit) {
788 OS.write_hex(truncateToSize(Value, ValueSize));
791 OS << ", " << MaxBytesToEmit;
797 // Non-power of two alignment. This is not widely supported by assemblers.
798 // FIXME: Parameterize this based on MAI.
800 default: llvm_unreachable("Invalid size for machine code value!");
801 case 1: OS << ".balign"; break;
802 case 2: OS << ".balignw"; break;
803 case 4: OS << ".balignl"; break;
804 case 8: llvm_unreachable("Unsupported alignment size!");
807 OS << ' ' << ByteAlignment;
808 OS << ", " << truncateToSize(Value, ValueSize);
810 OS << ", " << MaxBytesToEmit;
814 void MCAsmStreamer::EmitCodeAlignment(unsigned ByteAlignment,
815 unsigned MaxBytesToEmit) {
816 // Emit with a text fill value.
817 EmitValueToAlignment(ByteAlignment, MAI->getTextAlignFillValue(),
821 bool MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset,
822 unsigned char Value) {
823 // FIXME: Verify that Offset is associated with the current section.
824 OS << ".org " << *Offset << ", " << (unsigned) Value;
830 void MCAsmStreamer::EmitFileDirective(StringRef Filename) {
831 assert(MAI->hasSingleParameterDotFile());
833 PrintQuotedString(Filename, OS);
837 bool MCAsmStreamer::EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
838 StringRef Filename, unsigned CUID) {
839 if (!UseDwarfDirectory && !Directory.empty()) {
840 if (sys::path::is_absolute(Filename))
841 return EmitDwarfFileDirective(FileNo, "", Filename, CUID);
843 SmallString<128> FullPathName = Directory;
844 sys::path::append(FullPathName, Filename);
845 return EmitDwarfFileDirective(FileNo, "", FullPathName, CUID);
849 OS << "\t.file\t" << FileNo << ' ';
850 if (!Directory.empty()) {
851 PrintQuotedString(Directory, OS);
854 PrintQuotedString(Filename, OS);
856 // All .file will belong to a single CUID.
859 return this->MCStreamer::EmitDwarfFileDirective(FileNo, Directory, Filename,
863 void MCAsmStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
864 unsigned Column, unsigned Flags,
866 unsigned Discriminator,
867 StringRef FileName) {
868 this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
869 Isa, Discriminator, FileName);
873 OS << "\t.loc\t" << FileNo << " " << Line << " " << Column;
874 if (Flags & DWARF2_FLAG_BASIC_BLOCK)
875 OS << " basic_block";
876 if (Flags & DWARF2_FLAG_PROLOGUE_END)
877 OS << " prologue_end";
878 if (Flags & DWARF2_FLAG_EPILOGUE_BEGIN)
879 OS << " epilogue_begin";
881 unsigned OldFlags = getContext().getCurrentDwarfLoc().getFlags();
882 if ((Flags & DWARF2_FLAG_IS_STMT) != (OldFlags & DWARF2_FLAG_IS_STMT)) {
885 if (Flags & DWARF2_FLAG_IS_STMT)
894 OS << "discriminator " << Discriminator;
897 OS.PadToColumn(MAI->getCommentColumn());
898 OS << MAI->getCommentString() << ' ' << FileName << ':'
899 << Line << ':' << Column;
904 void MCAsmStreamer::EmitCFISections(bool EH, bool Debug) {
905 MCStreamer::EmitCFISections(EH, Debug);
910 OS << "\t.cfi_sections ";
914 OS << ", .debug_frame";
916 OS << ".debug_frame";
922 void MCAsmStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
924 RecordProcStart(Frame);
928 OS << "\t.cfi_startproc";
932 void MCAsmStreamer::EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
934 RecordProcEnd(Frame);
938 // Put a dummy non-null value in Frame.End to mark that this frame has been
940 Frame.End = (MCSymbol *) 1;
942 OS << "\t.cfi_endproc";
946 void MCAsmStreamer::EmitRegisterName(int64_t Register) {
947 if (InstPrinter && !MAI->useDwarfRegNumForCFI()) {
948 const MCRegisterInfo *MRI = getContext().getRegisterInfo();
949 unsigned LLVMRegister = MRI->getLLVMRegNum(Register, true);
950 InstPrinter->printRegName(OS, LLVMRegister);
956 void MCAsmStreamer::EmitCFIDefCfa(int64_t Register, int64_t Offset) {
957 MCStreamer::EmitCFIDefCfa(Register, Offset);
962 OS << "\t.cfi_def_cfa ";
963 EmitRegisterName(Register);
964 OS << ", " << Offset;
968 void MCAsmStreamer::EmitCFIDefCfaOffset(int64_t Offset) {
969 MCStreamer::EmitCFIDefCfaOffset(Offset);
974 OS << "\t.cfi_def_cfa_offset " << Offset;
978 void MCAsmStreamer::EmitCFIDefCfaRegister(int64_t Register) {
979 MCStreamer::EmitCFIDefCfaRegister(Register);
984 OS << "\t.cfi_def_cfa_register ";
985 EmitRegisterName(Register);
989 void MCAsmStreamer::EmitCFIOffset(int64_t Register, int64_t Offset) {
990 this->MCStreamer::EmitCFIOffset(Register, Offset);
995 OS << "\t.cfi_offset ";
996 EmitRegisterName(Register);
997 OS << ", " << Offset;
1001 void MCAsmStreamer::EmitCFIPersonality(const MCSymbol *Sym,
1002 unsigned Encoding) {
1003 MCStreamer::EmitCFIPersonality(Sym, Encoding);
1008 OS << "\t.cfi_personality " << Encoding << ", " << *Sym;
1012 void MCAsmStreamer::EmitCFILsda(const MCSymbol *Sym, unsigned Encoding) {
1013 MCStreamer::EmitCFILsda(Sym, Encoding);
1018 OS << "\t.cfi_lsda " << Encoding << ", " << *Sym;
1022 void MCAsmStreamer::EmitCFIRememberState() {
1023 MCStreamer::EmitCFIRememberState();
1028 OS << "\t.cfi_remember_state";
1032 void MCAsmStreamer::EmitCFIRestoreState() {
1033 MCStreamer::EmitCFIRestoreState();
1038 OS << "\t.cfi_restore_state";
1042 void MCAsmStreamer::EmitCFISameValue(int64_t Register) {
1043 MCStreamer::EmitCFISameValue(Register);
1048 OS << "\t.cfi_same_value ";
1049 EmitRegisterName(Register);
1053 void MCAsmStreamer::EmitCFIRelOffset(int64_t Register, int64_t Offset) {
1054 MCStreamer::EmitCFIRelOffset(Register, Offset);
1059 OS << "\t.cfi_rel_offset ";
1060 EmitRegisterName(Register);
1061 OS << ", " << Offset;
1065 void MCAsmStreamer::EmitCFIAdjustCfaOffset(int64_t Adjustment) {
1066 MCStreamer::EmitCFIAdjustCfaOffset(Adjustment);
1071 OS << "\t.cfi_adjust_cfa_offset " << Adjustment;
1075 void MCAsmStreamer::EmitCFISignalFrame() {
1076 MCStreamer::EmitCFISignalFrame();
1081 OS << "\t.cfi_signal_frame";
1085 void MCAsmStreamer::EmitCFIUndefined(int64_t Register) {
1086 MCStreamer::EmitCFIUndefined(Register);
1091 OS << "\t.cfi_undefined " << Register;
1095 void MCAsmStreamer::EmitCFIRegister(int64_t Register1, int64_t Register2) {
1096 MCStreamer::EmitCFIRegister(Register1, Register2);
1101 OS << "\t.cfi_register " << Register1 << ", " << Register2;
1105 void MCAsmStreamer::EmitCFIWindowSave() {
1106 MCStreamer::EmitCFIWindowSave();
1111 OS << "\t.cfi_window_save";
1115 void MCAsmStreamer::EmitWin64EHStartProc(const MCSymbol *Symbol) {
1116 MCStreamer::EmitWin64EHStartProc(Symbol);
1118 OS << ".seh_proc " << *Symbol;
1122 void MCAsmStreamer::EmitWin64EHEndProc() {
1123 MCStreamer::EmitWin64EHEndProc();
1125 OS << "\t.seh_endproc";
1129 void MCAsmStreamer::EmitWin64EHStartChained() {
1130 MCStreamer::EmitWin64EHStartChained();
1132 OS << "\t.seh_startchained";
1136 void MCAsmStreamer::EmitWin64EHEndChained() {
1137 MCStreamer::EmitWin64EHEndChained();
1139 OS << "\t.seh_endchained";
1143 void MCAsmStreamer::EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
1145 MCStreamer::EmitWin64EHHandler(Sym, Unwind, Except);
1147 OS << "\t.seh_handler " << *Sym;
1155 static const MCSection *getWin64EHTableSection(StringRef suffix,
1156 MCContext &context) {
1157 // FIXME: This doesn't belong in MCObjectFileInfo. However,
1158 /// this duplicate code in MCWin64EH.cpp.
1160 return context.getObjectFileInfo()->getXDataSection();
1161 return context.getCOFFSection((".xdata"+suffix).str(),
1162 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
1163 COFF::IMAGE_SCN_MEM_READ |
1164 COFF::IMAGE_SCN_MEM_WRITE,
1165 SectionKind::getDataRel());
1168 void MCAsmStreamer::EmitWin64EHHandlerData() {
1169 MCStreamer::EmitWin64EHHandlerData();
1171 // Switch sections. Don't call SwitchSection directly, because that will
1172 // cause the section switch to be visible in the emitted assembly.
1173 // We only do this so the section switch that terminates the handler
1174 // data block is visible.
1175 MCWin64EHUnwindInfo *CurFrame = getCurrentW64UnwindInfo();
1176 StringRef suffix=MCWin64EHUnwindEmitter::GetSectionSuffix(CurFrame->Function);
1177 const MCSection *xdataSect = getWin64EHTableSection(suffix, getContext());
1179 SwitchSectionNoChange(xdataSect);
1181 OS << "\t.seh_handlerdata";
1185 void MCAsmStreamer::EmitWin64EHPushReg(unsigned Register) {
1186 MCStreamer::EmitWin64EHPushReg(Register);
1188 OS << "\t.seh_pushreg " << Register;
1192 void MCAsmStreamer::EmitWin64EHSetFrame(unsigned Register, unsigned Offset) {
1193 MCStreamer::EmitWin64EHSetFrame(Register, Offset);
1195 OS << "\t.seh_setframe " << Register << ", " << Offset;
1199 void MCAsmStreamer::EmitWin64EHAllocStack(unsigned Size) {
1200 MCStreamer::EmitWin64EHAllocStack(Size);
1202 OS << "\t.seh_stackalloc " << Size;
1206 void MCAsmStreamer::EmitWin64EHSaveReg(unsigned Register, unsigned Offset) {
1207 MCStreamer::EmitWin64EHSaveReg(Register, Offset);
1209 OS << "\t.seh_savereg " << Register << ", " << Offset;
1213 void MCAsmStreamer::EmitWin64EHSaveXMM(unsigned Register, unsigned Offset) {
1214 MCStreamer::EmitWin64EHSaveXMM(Register, Offset);
1216 OS << "\t.seh_savexmm " << Register << ", " << Offset;
1220 void MCAsmStreamer::EmitWin64EHPushFrame(bool Code) {
1221 MCStreamer::EmitWin64EHPushFrame(Code);
1223 OS << "\t.seh_pushframe";
1229 void MCAsmStreamer::EmitWin64EHEndProlog(void) {
1230 MCStreamer::EmitWin64EHEndProlog();
1232 OS << "\t.seh_endprologue";
1236 void MCAsmStreamer::AddEncodingComment(const MCInst &Inst) {
1237 raw_ostream &OS = GetCommentOS();
1238 SmallString<256> Code;
1239 SmallVector<MCFixup, 4> Fixups;
1240 raw_svector_ostream VecOS(Code);
1241 Emitter->EncodeInstruction(Inst, VecOS, Fixups);
1244 // If we are showing fixups, create symbolic markers in the encoded
1245 // representation. We do this by making a per-bit map to the fixup item index,
1246 // then trying to display it as nicely as possible.
1247 SmallVector<uint8_t, 64> FixupMap;
1248 FixupMap.resize(Code.size() * 8);
1249 for (unsigned i = 0, e = Code.size() * 8; i != e; ++i)
1252 for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
1253 MCFixup &F = Fixups[i];
1254 const MCFixupKindInfo &Info = AsmBackend->getFixupKindInfo(F.getKind());
1255 for (unsigned j = 0; j != Info.TargetSize; ++j) {
1256 unsigned Index = F.getOffset() * 8 + Info.TargetOffset + j;
1257 assert(Index < Code.size() * 8 && "Invalid offset in fixup!");
1258 FixupMap[Index] = 1 + i;
1262 // FIXME: Note the fixup comments for Thumb2 are completely bogus since the
1263 // high order halfword of a 32-bit Thumb2 instruction is emitted first.
1264 OS << "encoding: [";
1265 for (unsigned i = 0, e = Code.size(); i != e; ++i) {
1269 // See if all bits are the same map entry.
1270 uint8_t MapEntry = FixupMap[i * 8 + 0];
1271 for (unsigned j = 1; j != 8; ++j) {
1272 if (FixupMap[i * 8 + j] == MapEntry)
1275 MapEntry = uint8_t(~0U);
1279 if (MapEntry != uint8_t(~0U)) {
1280 if (MapEntry == 0) {
1281 OS << format("0x%02x", uint8_t(Code[i]));
1284 // FIXME: Some of the 8 bits require fix up.
1285 OS << format("0x%02x", uint8_t(Code[i])) << '\''
1286 << char('A' + MapEntry - 1) << '\'';
1288 OS << char('A' + MapEntry - 1);
1291 // Otherwise, write out in binary.
1293 for (unsigned j = 8; j--;) {
1294 unsigned Bit = (Code[i] >> j) & 1;
1297 if (MAI->isLittleEndian())
1298 FixupBit = i * 8 + j;
1300 FixupBit = i * 8 + (7-j);
1302 if (uint8_t MapEntry = FixupMap[FixupBit]) {
1303 assert(Bit == 0 && "Encoder wrote into fixed up bit!");
1304 OS << char('A' + MapEntry - 1);
1312 for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
1313 MCFixup &F = Fixups[i];
1314 const MCFixupKindInfo &Info = AsmBackend->getFixupKindInfo(F.getKind());
1315 OS << " fixup " << char('A' + i) << " - " << "offset: " << F.getOffset()
1316 << ", value: " << *F.getValue() << ", kind: " << Info.Name << "\n";
1320 void MCAsmStreamer::EmitFnStart() {
1325 void MCAsmStreamer::EmitFnEnd() {
1330 void MCAsmStreamer::EmitCantUnwind() {
1331 OS << "\t.cantunwind";
1335 void MCAsmStreamer::EmitHandlerData() {
1336 OS << "\t.handlerdata";
1340 void MCAsmStreamer::EmitPersonality(const MCSymbol *Personality) {
1341 OS << "\t.personality " << Personality->getName();
1345 void MCAsmStreamer::EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset) {
1347 InstPrinter->printRegName(OS, FpReg);
1349 InstPrinter->printRegName(OS, SpReg);
1351 OS << ", #" << Offset;
1355 void MCAsmStreamer::EmitPad(int64_t Offset) {
1356 OS << "\t.pad\t#" << Offset;
1360 void MCAsmStreamer::EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
1362 assert(RegList.size() && "RegList should not be empty");
1364 OS << "\t.vsave\t{";
1368 InstPrinter->printRegName(OS, RegList[0]);
1370 for (unsigned i = 1, e = RegList.size(); i != e; ++i) {
1372 InstPrinter->printRegName(OS, RegList[i]);
1379 void MCAsmStreamer::emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) {
1380 if (!PrintHackDirectives)
1383 OS << "\t.mips_hack_stocg ";
1384 OS << Sym->getName();
1390 void MCAsmStreamer::emitMipsHackELFFlags(unsigned Flags) {
1391 if (!PrintHackDirectives)
1394 OS << "\t.mips_hack_elf_flags 0x";
1395 OS.write_hex(Flags);
1399 void MCAsmStreamer::EmitTCEntry(const MCSymbol &S) {
1407 void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
1408 assert(getCurrentSection().first &&
1409 "Cannot emit contents before setting section!");
1411 // Show the encoding in a comment if we have a code emitter.
1413 AddEncodingComment(Inst);
1415 // Show the MCInst if enabled.
1417 Inst.dump_pretty(GetCommentOS(), MAI, InstPrinter.get(), "\n ");
1418 GetCommentOS() << "\n";
1421 // If we have an AsmPrinter, use that to print, otherwise print the MCInst.
1423 InstPrinter->printInst(&Inst, OS, "");
1425 Inst.print(OS, MAI);
1429 void MCAsmStreamer::EmitBundleAlignMode(unsigned AlignPow2) {
1430 OS << "\t.bundle_align_mode " << AlignPow2;
1434 void MCAsmStreamer::EmitBundleLock(bool AlignToEnd) {
1435 OS << "\t.bundle_lock";
1437 OS << " align_to_end";
1441 void MCAsmStreamer::EmitBundleUnlock() {
1442 OS << "\t.bundle_unlock";
1446 /// EmitRawText - If this file is backed by an assembly streamer, this dumps
1447 /// the specified string in the output .s file. This capability is
1448 /// indicated by the hasRawTextSupport() predicate.
1449 void MCAsmStreamer::EmitRawText(StringRef String) {
1450 if (!String.empty() && String.back() == '\n')
1451 String = String.substr(0, String.size()-1);
1456 void MCAsmStreamer::FinishImpl() {
1457 // FIXME: This header is duplicated with MCObjectStreamer
1458 // Dump out the dwarf file & directory tables and line tables.
1459 const MCSymbol *LineSectionSymbol = NULL;
1460 if (getContext().hasDwarfFiles() && !UseLoc)
1461 LineSectionSymbol = MCDwarfFileTable::Emit(this);
1463 // If we are generating dwarf for assembly source files dump out the sections.
1464 if (getContext().getGenDwarfForAssembly())
1465 MCGenDwarfInfo::Emit(this, LineSectionSymbol);
1468 EmitFrames(AsmBackend.get(), false);
1471 MCStreamer *llvm::createAsmStreamer(MCContext &Context,
1472 formatted_raw_ostream &OS,
1473 bool isVerboseAsm, bool useLoc,
1474 bool useCFI, bool useDwarfDirectory,
1475 MCInstPrinter *IP, MCCodeEmitter *CE,
1476 MCAsmBackend *MAB, bool ShowInst) {
1477 return new MCAsmStreamer(Context, OS, isVerboseAsm, useLoc, useCFI,
1478 useDwarfDirectory, IP, CE, MAB, ShowInst);