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/MC/MCAsmInfo.h"
12 #include "llvm/MC/MCCodeEmitter.h"
13 #include "llvm/MC/MCContext.h"
14 #include "llvm/MC/MCExpr.h"
15 #include "llvm/MC/MCInst.h"
16 #include "llvm/MC/MCInstPrinter.h"
17 #include "llvm/MC/MCSectionMachO.h"
18 #include "llvm/MC/MCSymbol.h"
19 #include "llvm/ADT/OwningPtr.h"
20 #include "llvm/ADT/SmallString.h"
21 #include "llvm/ADT/Twine.h"
22 #include "llvm/Support/ErrorHandling.h"
23 #include "llvm/Support/MathExtras.h"
24 #include "llvm/Support/Format.h"
25 #include "llvm/Support/FormattedStream.h"
30 class MCAsmStreamer : public MCStreamer {
31 formatted_raw_ostream &OS;
33 OwningPtr<MCInstPrinter> InstPrinter;
34 OwningPtr<MCCodeEmitter> Emitter;
36 SmallString<128> CommentToEmit;
37 raw_svector_ostream CommentStream;
39 unsigned IsLittleEndian : 1;
40 unsigned IsVerboseAsm : 1;
41 unsigned ShowInst : 1;
44 MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os,
45 bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *printer,
46 MCCodeEmitter *emitter, bool showInst)
47 : MCStreamer(Context), OS(os), MAI(Context.getAsmInfo()),
48 InstPrinter(printer), Emitter(emitter), CommentStream(CommentToEmit),
49 IsLittleEndian(isLittleEndian), IsVerboseAsm(isVerboseAsm),
51 if (InstPrinter && IsVerboseAsm)
52 InstPrinter->setCommentStream(CommentStream);
56 bool isLittleEndian() const { return IsLittleEndian; }
58 inline void EmitEOL() {
59 // If we don't have any comments, just emit a \n.
66 void EmitCommentsAndEOL();
68 /// isVerboseAsm - Return true if this streamer supports verbose assembly at
70 virtual bool isVerboseAsm() const { return IsVerboseAsm; }
72 /// hasRawTextSupport - We support EmitRawText.
73 virtual bool hasRawTextSupport() const { return true; }
75 /// AddComment - Add a comment that can be emitted to the generated .s
76 /// file if applicable as a QoI issue to make the output of the compiler
77 /// more readable. This only affects the MCAsmStreamer, and only when
78 /// verbose assembly output is enabled.
79 virtual void AddComment(const Twine &T);
81 /// AddEncodingComment - Add a comment showing the encoding of an instruction.
82 virtual void AddEncodingComment(const MCInst &Inst);
84 /// GetCommentOS - Return a raw_ostream that comments can be written to.
85 /// Unlike AddComment, you are required to terminate comments with \n if you
87 virtual raw_ostream &GetCommentOS() {
89 return nulls(); // Discard comments unless in verbose asm mode.
93 /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
94 virtual void AddBlankLine() {
98 /// @name MCStreamer Interface
101 virtual void SwitchSection(const MCSection *Section);
103 virtual void InitSections() {
104 // FIXME, this is MachO specific, but the testsuite
106 SwitchSection(getContext().getMachOSection("__TEXT", "__text",
107 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
108 0, SectionKind::getText()));
111 virtual void EmitLabel(MCSymbol *Symbol);
113 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
115 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
117 virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
119 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
120 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol);
121 virtual void EmitCOFFSymbolStorageClass(int StorageClass);
122 virtual void EmitCOFFSymbolType(int Type);
123 virtual void EndCOFFSymbolDef();
124 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
125 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
126 unsigned ByteAlignment);
128 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
130 /// @param Symbol - The common symbol to emit.
131 /// @param Size - The size of the common symbol.
132 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size);
134 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
135 unsigned Size = 0, unsigned ByteAlignment = 0);
137 virtual void EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol,
138 uint64_t Size, unsigned ByteAlignment = 0);
140 virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
142 virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace);
143 virtual void EmitIntValue(uint64_t Value, unsigned Size, unsigned AddrSpace);
144 virtual void EmitGPRel32Value(const MCExpr *Value);
147 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
150 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
151 unsigned ValueSize = 1,
152 unsigned MaxBytesToEmit = 0);
154 virtual void EmitCodeAlignment(unsigned ByteAlignment,
155 unsigned MaxBytesToEmit = 0);
157 virtual void EmitValueToOffset(const MCExpr *Offset,
158 unsigned char Value = 0);
160 virtual void EmitFileDirective(StringRef Filename);
161 virtual void EmitDwarfFileDirective(unsigned FileNo, StringRef Filename);
163 virtual void EmitInstruction(const MCInst &Inst);
165 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
166 /// the specified string in the output .s file. This capability is
167 /// indicated by the hasRawTextSupport() predicate.
168 virtual void EmitRawText(StringRef String);
170 virtual void Finish();
175 } // end anonymous namespace.
177 /// AddComment - Add a comment that can be emitted to the generated .s
178 /// file if applicable as a QoI issue to make the output of the compiler
179 /// more readable. This only affects the MCAsmStreamer, and only when
180 /// verbose assembly output is enabled.
181 void MCAsmStreamer::AddComment(const Twine &T) {
182 if (!IsVerboseAsm) return;
184 // Make sure that CommentStream is flushed.
185 CommentStream.flush();
187 T.toVector(CommentToEmit);
188 // Each comment goes on its own line.
189 CommentToEmit.push_back('\n');
191 // Tell the comment stream that the vector changed underneath it.
192 CommentStream.resync();
195 void MCAsmStreamer::EmitCommentsAndEOL() {
196 if (CommentToEmit.empty() && CommentStream.GetNumBytesInBuffer() == 0) {
201 CommentStream.flush();
202 StringRef Comments = CommentToEmit.str();
204 assert(Comments.back() == '\n' &&
205 "Comment array not newline terminated");
207 // Emit a line of comments.
208 OS.PadToColumn(MAI.getCommentColumn());
209 size_t Position = Comments.find('\n');
210 OS << MAI.getCommentString() << ' ' << Comments.substr(0, Position) << '\n';
212 Comments = Comments.substr(Position+1);
213 } while (!Comments.empty());
215 CommentToEmit.clear();
216 // Tell the comment stream that the vector changed underneath it.
217 CommentStream.resync();
220 static inline int64_t truncateToSize(int64_t Value, unsigned Bytes) {
221 assert(Bytes && "Invalid size!");
222 return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8));
225 void MCAsmStreamer::SwitchSection(const MCSection *Section) {
226 assert(Section && "Cannot switch to a null section!");
227 if (Section != CurSection) {
228 PrevSection = CurSection;
229 CurSection = Section;
230 Section->PrintSwitchToSection(MAI, OS);
234 void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
235 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
236 assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
237 assert(CurSection && "Cannot emit before setting section!");
239 OS << *Symbol << ":";
241 Symbol->setSection(*CurSection);
244 void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
246 default: assert(0 && "Invalid flag!");
247 case MCAF_SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break;
252 void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
253 OS << *Symbol << " = " << *Value;
256 // FIXME: Lift context changes into super class.
257 Symbol->setVariableValue(Value);
260 void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
261 MCSymbolAttr Attribute) {
263 case MCSA_Invalid: assert(0 && "Invalid symbol attribute");
264 case MCSA_ELF_TypeFunction: /// .type _foo, STT_FUNC # aka @function
265 case MCSA_ELF_TypeIndFunction: /// .type _foo, STT_GNU_IFUNC
266 case MCSA_ELF_TypeObject: /// .type _foo, STT_OBJECT # aka @object
267 case MCSA_ELF_TypeTLS: /// .type _foo, STT_TLS # aka @tls_object
268 case MCSA_ELF_TypeCommon: /// .type _foo, STT_COMMON # aka @common
269 case MCSA_ELF_TypeNoType: /// .type _foo, STT_NOTYPE # aka @notype
270 assert(MAI.hasDotTypeDotSizeDirective() && "Symbol Attr not supported");
271 OS << "\t.type\t" << *Symbol << ','
272 << ((MAI.getCommentString()[0] != '@') ? '@' : '%');
274 default: assert(0 && "Unknown ELF .type");
275 case MCSA_ELF_TypeFunction: OS << "function"; break;
276 case MCSA_ELF_TypeIndFunction: OS << "gnu_indirect_function"; break;
277 case MCSA_ELF_TypeObject: OS << "object"; break;
278 case MCSA_ELF_TypeTLS: OS << "tls_object"; break;
279 case MCSA_ELF_TypeCommon: OS << "common"; break;
280 case MCSA_ELF_TypeNoType: OS << "no_type"; break;
284 case MCSA_Global: // .globl/.global
285 OS << MAI.getGlobalDirective();
287 case MCSA_Hidden: OS << "\t.hidden\t"; break;
288 case MCSA_IndirectSymbol: OS << "\t.indirect_symbol\t"; break;
289 case MCSA_Internal: OS << "\t.internal\t"; break;
290 case MCSA_LazyReference: OS << "\t.lazy_reference\t"; break;
291 case MCSA_Local: OS << "\t.local\t"; break;
292 case MCSA_NoDeadStrip: OS << "\t.no_dead_strip\t"; break;
293 case MCSA_PrivateExtern: OS << "\t.private_extern\t"; break;
294 case MCSA_Protected: OS << "\t.protected\t"; break;
295 case MCSA_Reference: OS << "\t.reference\t"; break;
296 case MCSA_Weak: OS << "\t.weak\t"; break;
297 case MCSA_WeakDefinition: OS << "\t.weak_definition\t"; break;
299 case MCSA_WeakReference: OS << MAI.getWeakRefDirective(); break;
300 case MCSA_WeakDefAutoPrivate: OS << "\t.weak_def_can_be_hidden\t"; break;
307 void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
308 OS << ".desc" << ' ' << *Symbol << ',' << DescValue;
312 void MCAsmStreamer::BeginCOFFSymbolDef(const MCSymbol *Symbol) {
313 OS << "\t.def\t " << *Symbol << ';';
317 void MCAsmStreamer::EmitCOFFSymbolStorageClass (int StorageClass) {
318 OS << "\t.scl\t" << StorageClass << ';';
322 void MCAsmStreamer::EmitCOFFSymbolType (int Type) {
323 OS << "\t.type\t" << Type << ';';
327 void MCAsmStreamer::EndCOFFSymbolDef() {
332 void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
333 assert(MAI.hasDotTypeDotSizeDirective());
334 OS << "\t.size\t" << *Symbol << ", " << *Value << '\n';
337 void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
338 unsigned ByteAlignment) {
339 OS << "\t.comm\t" << *Symbol << ',' << Size;
340 if (ByteAlignment != 0) {
341 if (MAI.getCOMMDirectiveAlignmentIsInBytes())
342 OS << ',' << ByteAlignment;
344 OS << ',' << Log2_32(ByteAlignment);
349 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
351 /// @param Symbol - The common symbol to emit.
352 /// @param Size - The size of the common symbol.
353 void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {
354 assert(MAI.hasLCOMMDirective() && "Doesn't have .lcomm, can't emit it!");
355 OS << "\t.lcomm\t" << *Symbol << ',' << Size;
359 void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
360 unsigned Size, unsigned ByteAlignment) {
361 // Note: a .zerofill directive does not switch sections.
364 // This is a mach-o specific directive.
365 const MCSectionMachO *MOSection = ((const MCSectionMachO*)Section);
366 OS << MOSection->getSegmentName() << "," << MOSection->getSectionName();
368 if (Symbol != NULL) {
369 OS << ',' << *Symbol << ',' << Size;
370 if (ByteAlignment != 0)
371 OS << ',' << Log2_32(ByteAlignment);
376 // .tbss sym, size, align
377 // This depends that the symbol has already been mangled from the original,
379 void MCAsmStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
380 uint64_t Size, unsigned ByteAlignment) {
381 assert(Symbol != NULL && "Symbol shouldn't be NULL!");
382 // Instead of using the Section we'll just use the shortcut.
383 // This is a mach-o specific directive and section.
384 OS << ".tbss " << *Symbol << ", " << Size;
386 // Output align if we have it. We default to 1 so don't bother printing
388 if (ByteAlignment > 1) OS << ", " << Log2_32(ByteAlignment);
393 static inline char toOctal(int X) { return (X&7)+'0'; }
395 static void PrintQuotedString(StringRef Data, raw_ostream &OS) {
398 for (unsigned i = 0, e = Data.size(); i != e; ++i) {
399 unsigned char C = Data[i];
400 if (C == '"' || C == '\\') {
401 OS << '\\' << (char)C;
405 if (isprint((unsigned char)C)) {
411 case '\b': OS << "\\b"; break;
412 case '\f': OS << "\\f"; break;
413 case '\n': OS << "\\n"; break;
414 case '\r': OS << "\\r"; break;
415 case '\t': OS << "\\t"; break;
418 OS << toOctal(C >> 6);
419 OS << toOctal(C >> 3);
420 OS << toOctal(C >> 0);
429 void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
430 assert(CurSection && "Cannot emit contents before setting section!");
431 if (Data.empty()) return;
433 if (Data.size() == 1) {
434 OS << MAI.getData8bitsDirective(AddrSpace);
435 OS << (unsigned)(unsigned char)Data[0];
440 // If the data ends with 0 and the target supports .asciz, use it, otherwise
442 if (MAI.getAscizDirective() && Data.back() == 0) {
443 OS << MAI.getAscizDirective();
444 Data = Data.substr(0, Data.size()-1);
446 OS << MAI.getAsciiDirective();
450 PrintQuotedString(Data, OS);
454 /// EmitIntValue - Special case of EmitValue that avoids the client having
455 /// to pass in a MCExpr for constant integers.
456 void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size,
457 unsigned AddrSpace) {
458 assert(CurSection && "Cannot emit contents before setting section!");
459 const char *Directive = 0;
462 case 1: Directive = MAI.getData8bitsDirective(AddrSpace); break;
463 case 2: Directive = MAI.getData16bitsDirective(AddrSpace); break;
464 case 4: Directive = MAI.getData32bitsDirective(AddrSpace); break;
466 Directive = MAI.getData64bitsDirective(AddrSpace);
467 // If the target doesn't support 64-bit data, emit as two 32-bit halves.
468 if (Directive) break;
469 if (isLittleEndian()) {
470 EmitIntValue((uint32_t)(Value >> 0 ), 4, AddrSpace);
471 EmitIntValue((uint32_t)(Value >> 32), 4, AddrSpace);
473 EmitIntValue((uint32_t)(Value >> 32), 4, AddrSpace);
474 EmitIntValue((uint32_t)(Value >> 0 ), 4, AddrSpace);
479 assert(Directive && "Invalid size for machine code value!");
480 OS << Directive << truncateToSize(Value, Size);
484 void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size,
485 unsigned AddrSpace) {
486 assert(CurSection && "Cannot emit contents before setting section!");
487 const char *Directive = 0;
490 case 1: Directive = MAI.getData8bitsDirective(AddrSpace); break;
491 case 2: Directive = MAI.getData16bitsDirective(AddrSpace); break;
492 case 4: Directive = MAI.getData32bitsDirective(AddrSpace); break;
493 case 8: Directive = MAI.getData64bitsDirective(AddrSpace); break;
496 assert(Directive && "Invalid size for machine code value!");
497 OS << Directive << *Value;
501 void MCAsmStreamer::EmitGPRel32Value(const MCExpr *Value) {
502 assert(MAI.getGPRel32Directive() != 0);
503 OS << MAI.getGPRel32Directive() << *Value;
508 /// EmitFill - Emit NumBytes bytes worth of the value specified by
509 /// FillValue. This implements directives such as '.space'.
510 void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue,
511 unsigned AddrSpace) {
512 if (NumBytes == 0) return;
515 if (const char *ZeroDirective = MAI.getZeroDirective()) {
516 OS << ZeroDirective << NumBytes;
518 OS << ',' << (int)FillValue;
523 // Emit a byte at a time.
524 MCStreamer::EmitFill(NumBytes, FillValue, AddrSpace);
527 void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
529 unsigned MaxBytesToEmit) {
530 // Some assemblers don't support non-power of two alignments, so we always
531 // emit alignments as a power of two if possible.
532 if (isPowerOf2_32(ByteAlignment)) {
534 default: llvm_unreachable("Invalid size for machine code value!");
535 case 1: OS << MAI.getAlignDirective(); break;
536 // FIXME: use MAI for this!
537 case 2: OS << ".p2alignw "; break;
538 case 4: OS << ".p2alignl "; break;
539 case 8: llvm_unreachable("Unsupported alignment size!");
542 if (MAI.getAlignmentIsInBytes())
545 OS << Log2_32(ByteAlignment);
547 if (Value || MaxBytesToEmit) {
549 OS.write_hex(truncateToSize(Value, ValueSize));
552 OS << ", " << MaxBytesToEmit;
558 // Non-power of two alignment. This is not widely supported by assemblers.
559 // FIXME: Parameterize this based on MAI.
561 default: llvm_unreachable("Invalid size for machine code value!");
562 case 1: OS << ".balign"; break;
563 case 2: OS << ".balignw"; break;
564 case 4: OS << ".balignl"; break;
565 case 8: llvm_unreachable("Unsupported alignment size!");
568 OS << ' ' << ByteAlignment;
569 OS << ", " << truncateToSize(Value, ValueSize);
571 OS << ", " << MaxBytesToEmit;
575 void MCAsmStreamer::EmitCodeAlignment(unsigned ByteAlignment,
576 unsigned MaxBytesToEmit) {
577 // Emit with a text fill value.
578 EmitValueToAlignment(ByteAlignment, MAI.getTextAlignFillValue(),
582 void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset,
583 unsigned char Value) {
584 // FIXME: Verify that Offset is associated with the current section.
585 OS << ".org " << *Offset << ", " << (unsigned) Value;
590 void MCAsmStreamer::EmitFileDirective(StringRef Filename) {
591 assert(MAI.hasSingleParameterDotFile());
593 PrintQuotedString(Filename, OS);
597 void MCAsmStreamer::EmitDwarfFileDirective(unsigned FileNo, StringRef Filename){
598 OS << "\t.file\t" << FileNo << ' ';
599 PrintQuotedString(Filename, OS);
603 void MCAsmStreamer::AddEncodingComment(const MCInst &Inst) {
604 raw_ostream &OS = GetCommentOS();
605 SmallString<256> Code;
606 SmallVector<MCFixup, 4> Fixups;
607 raw_svector_ostream VecOS(Code);
608 Emitter->EncodeInstruction(Inst, VecOS, Fixups);
611 // If we are showing fixups, create symbolic markers in the encoded
612 // representation. We do this by making a per-bit map to the fixup item index,
613 // then trying to display it as nicely as possible.
614 SmallVector<uint8_t, 64> FixupMap;
615 FixupMap.resize(Code.size() * 8);
616 for (unsigned i = 0, e = Code.size() * 8; i != e; ++i)
619 for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
620 MCFixup &F = Fixups[i];
621 const MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind());
622 for (unsigned j = 0; j != Info.TargetSize; ++j) {
623 unsigned Index = F.getOffset() * 8 + Info.TargetOffset + j;
624 assert(Index < Code.size() * 8 && "Invalid offset in fixup!");
625 FixupMap[Index] = 1 + i;
630 for (unsigned i = 0, e = Code.size(); i != e; ++i) {
634 // See if all bits are the same map entry.
635 uint8_t MapEntry = FixupMap[i * 8 + 0];
636 for (unsigned j = 1; j != 8; ++j) {
637 if (FixupMap[i * 8 + j] == MapEntry)
640 MapEntry = uint8_t(~0U);
644 if (MapEntry != uint8_t(~0U)) {
646 OS << format("0x%02x", uint8_t(Code[i]));
648 assert(Code[i] == 0 && "Encoder wrote into fixed up bit!");
649 OS << char('A' + MapEntry - 1);
652 // Otherwise, write out in binary.
654 for (unsigned j = 8; j--;) {
655 unsigned Bit = (Code[i] >> j) & 1;
656 if (uint8_t MapEntry = FixupMap[i * 8 + j]) {
657 assert(Bit == 0 && "Encoder wrote into fixed up bit!");
658 OS << char('A' + MapEntry - 1);
666 for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
667 MCFixup &F = Fixups[i];
668 const MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind());
669 OS << " fixup " << char('A' + i) << " - " << "offset: " << F.getOffset()
670 << ", value: " << *F.getValue() << ", kind: " << Info.Name << "\n";
674 void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
675 assert(CurSection && "Cannot emit contents before setting section!");
677 // Show the encoding in a comment if we have a code emitter.
679 AddEncodingComment(Inst);
681 // Show the MCInst if enabled.
683 Inst.dump_pretty(GetCommentOS(), &MAI, InstPrinter.get(), "\n ");
684 GetCommentOS() << "\n";
687 // If we have an AsmPrinter, use that to print, otherwise print the MCInst.
689 InstPrinter->printInst(&Inst, OS);
691 Inst.print(OS, &MAI);
695 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
696 /// the specified string in the output .s file. This capability is
697 /// indicated by the hasRawTextSupport() predicate.
698 void MCAsmStreamer::EmitRawText(StringRef String) {
699 if (!String.empty() && String.back() == '\n')
700 String = String.substr(0, String.size()-1);
705 void MCAsmStreamer::Finish() {
708 MCStreamer *llvm::createAsmStreamer(MCContext &Context,
709 formatted_raw_ostream &OS,
711 bool isVerboseAsm, MCInstPrinter *IP,
712 MCCodeEmitter *CE, bool ShowInst) {
713 return new MCAsmStreamer(Context, OS, isLittleEndian, isVerboseAsm,