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 EmitLabel(MCSymbol *Symbol);
105 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
107 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
109 virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
111 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
112 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol);
113 virtual void EmitCOFFSymbolStorageClass(int StorageClass);
114 virtual void EmitCOFFSymbolType(int Type);
115 virtual void EndCOFFSymbolDef();
116 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
117 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
118 unsigned ByteAlignment);
120 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
122 /// @param Symbol - The common symbol to emit.
123 /// @param Size - The size of the common symbol.
124 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size);
126 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
127 unsigned Size = 0, unsigned ByteAlignment = 0);
129 virtual void EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol,
130 uint64_t Size, unsigned ByteAlignment = 0);
132 virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
134 virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace);
135 virtual void EmitIntValue(uint64_t Value, unsigned Size, unsigned AddrSpace);
136 virtual void EmitGPRel32Value(const MCExpr *Value);
139 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
142 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
143 unsigned ValueSize = 1,
144 unsigned MaxBytesToEmit = 0);
146 virtual void EmitCodeAlignment(unsigned ByteAlignment,
147 unsigned MaxBytesToEmit = 0);
149 virtual void EmitValueToOffset(const MCExpr *Offset,
150 unsigned char Value = 0);
152 virtual void EmitFileDirective(StringRef Filename);
153 virtual void EmitDwarfFileDirective(unsigned FileNo, StringRef Filename);
155 virtual void EmitInstruction(const MCInst &Inst);
157 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
158 /// the specified string in the output .s file. This capability is
159 /// indicated by the hasRawTextSupport() predicate.
160 virtual void EmitRawText(StringRef String);
162 virtual void Finish();
167 } // end anonymous namespace.
169 /// AddComment - Add a comment that can be emitted to the generated .s
170 /// file if applicable as a QoI issue to make the output of the compiler
171 /// more readable. This only affects the MCAsmStreamer, and only when
172 /// verbose assembly output is enabled.
173 void MCAsmStreamer::AddComment(const Twine &T) {
174 if (!IsVerboseAsm) return;
176 // Make sure that CommentStream is flushed.
177 CommentStream.flush();
179 T.toVector(CommentToEmit);
180 // Each comment goes on its own line.
181 CommentToEmit.push_back('\n');
183 // Tell the comment stream that the vector changed underneath it.
184 CommentStream.resync();
187 void MCAsmStreamer::EmitCommentsAndEOL() {
188 if (CommentToEmit.empty() && CommentStream.GetNumBytesInBuffer() == 0) {
193 CommentStream.flush();
194 StringRef Comments = CommentToEmit.str();
196 assert(Comments.back() == '\n' &&
197 "Comment array not newline terminated");
199 // Emit a line of comments.
200 OS.PadToColumn(MAI.getCommentColumn());
201 size_t Position = Comments.find('\n');
202 OS << MAI.getCommentString() << ' ' << Comments.substr(0, Position) << '\n';
204 Comments = Comments.substr(Position+1);
205 } while (!Comments.empty());
207 CommentToEmit.clear();
208 // Tell the comment stream that the vector changed underneath it.
209 CommentStream.resync();
212 static inline int64_t truncateToSize(int64_t Value, unsigned Bytes) {
213 assert(Bytes && "Invalid size!");
214 return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8));
217 void MCAsmStreamer::SwitchSection(const MCSection *Section) {
218 assert(Section && "Cannot switch to a null section!");
219 if (Section != CurSection) {
220 PrevSection = CurSection;
221 CurSection = Section;
222 Section->PrintSwitchToSection(MAI, OS);
226 void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
227 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
228 assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
229 assert(CurSection && "Cannot emit before setting section!");
231 OS << *Symbol << ":";
233 Symbol->setSection(*CurSection);
236 void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
238 default: assert(0 && "Invalid flag!");
239 case MCAF_SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break;
244 void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
245 OS << *Symbol << " = " << *Value;
248 // FIXME: Lift context changes into super class.
249 Symbol->setVariableValue(Value);
252 void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
253 MCSymbolAttr Attribute) {
255 case MCSA_Invalid: assert(0 && "Invalid symbol attribute");
256 case MCSA_ELF_TypeFunction: /// .type _foo, STT_FUNC # aka @function
257 case MCSA_ELF_TypeIndFunction: /// .type _foo, STT_GNU_IFUNC
258 case MCSA_ELF_TypeObject: /// .type _foo, STT_OBJECT # aka @object
259 case MCSA_ELF_TypeTLS: /// .type _foo, STT_TLS # aka @tls_object
260 case MCSA_ELF_TypeCommon: /// .type _foo, STT_COMMON # aka @common
261 case MCSA_ELF_TypeNoType: /// .type _foo, STT_NOTYPE # aka @notype
262 assert(MAI.hasDotTypeDotSizeDirective() && "Symbol Attr not supported");
263 OS << "\t.type\t" << *Symbol << ','
264 << ((MAI.getCommentString()[0] != '@') ? '@' : '%');
266 default: assert(0 && "Unknown ELF .type");
267 case MCSA_ELF_TypeFunction: OS << "function"; break;
268 case MCSA_ELF_TypeIndFunction: OS << "gnu_indirect_function"; break;
269 case MCSA_ELF_TypeObject: OS << "object"; break;
270 case MCSA_ELF_TypeTLS: OS << "tls_object"; break;
271 case MCSA_ELF_TypeCommon: OS << "common"; break;
272 case MCSA_ELF_TypeNoType: OS << "no_type"; break;
276 case MCSA_Global: // .globl/.global
277 OS << MAI.getGlobalDirective();
279 case MCSA_Hidden: OS << "\t.hidden\t"; break;
280 case MCSA_IndirectSymbol: OS << "\t.indirect_symbol\t"; break;
281 case MCSA_Internal: OS << "\t.internal\t"; break;
282 case MCSA_LazyReference: OS << "\t.lazy_reference\t"; break;
283 case MCSA_Local: OS << "\t.local\t"; break;
284 case MCSA_NoDeadStrip: OS << "\t.no_dead_strip\t"; break;
285 case MCSA_PrivateExtern: OS << "\t.private_extern\t"; break;
286 case MCSA_Protected: OS << "\t.protected\t"; break;
287 case MCSA_Reference: OS << "\t.reference\t"; break;
288 case MCSA_Weak: OS << "\t.weak\t"; break;
289 case MCSA_WeakDefinition: OS << "\t.weak_definition\t"; break;
291 case MCSA_WeakReference: OS << MAI.getWeakRefDirective(); break;
292 case MCSA_WeakDefAutoPrivate: OS << "\t.weak_def_can_be_hidden\t"; break;
299 void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
300 OS << ".desc" << ' ' << *Symbol << ',' << DescValue;
304 void MCAsmStreamer::BeginCOFFSymbolDef(const MCSymbol *Symbol) {
305 OS << "\t.def\t " << *Symbol << ';';
309 void MCAsmStreamer::EmitCOFFSymbolStorageClass (int StorageClass) {
310 OS << "\t.scl\t" << StorageClass << ';';
314 void MCAsmStreamer::EmitCOFFSymbolType (int Type) {
315 OS << "\t.type\t" << Type << ';';
319 void MCAsmStreamer::EndCOFFSymbolDef() {
324 void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
325 assert(MAI.hasDotTypeDotSizeDirective());
326 OS << "\t.size\t" << *Symbol << ", " << *Value << '\n';
329 void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
330 unsigned ByteAlignment) {
331 OS << "\t.comm\t" << *Symbol << ',' << Size;
332 if (ByteAlignment != 0) {
333 if (MAI.getCOMMDirectiveAlignmentIsInBytes())
334 OS << ',' << ByteAlignment;
336 OS << ',' << Log2_32(ByteAlignment);
341 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
343 /// @param Symbol - The common symbol to emit.
344 /// @param Size - The size of the common symbol.
345 void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {
346 assert(MAI.hasLCOMMDirective() && "Doesn't have .lcomm, can't emit it!");
347 OS << "\t.lcomm\t" << *Symbol << ',' << Size;
351 void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
352 unsigned Size, unsigned ByteAlignment) {
353 // Note: a .zerofill directive does not switch sections.
356 // This is a mach-o specific directive.
357 const MCSectionMachO *MOSection = ((const MCSectionMachO*)Section);
358 OS << MOSection->getSegmentName() << "," << MOSection->getSectionName();
360 if (Symbol != NULL) {
361 OS << ',' << *Symbol << ',' << Size;
362 if (ByteAlignment != 0)
363 OS << ',' << Log2_32(ByteAlignment);
368 // .tbss sym, size, align
369 // This depends that the symbol has already been mangled from the original,
371 void MCAsmStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
372 uint64_t Size, unsigned ByteAlignment) {
373 assert(Symbol != NULL && "Symbol shouldn't be NULL!");
374 // Instead of using the Section we'll just use the shortcut.
375 // This is a mach-o specific directive and section.
376 OS << ".tbss " << *Symbol << ", " << Size;
378 // Output align if we have it. We default to 1 so don't bother printing
380 if (ByteAlignment > 1) OS << ", " << Log2_32(ByteAlignment);
385 static inline char toOctal(int X) { return (X&7)+'0'; }
387 static void PrintQuotedString(StringRef Data, raw_ostream &OS) {
390 for (unsigned i = 0, e = Data.size(); i != e; ++i) {
391 unsigned char C = Data[i];
392 if (C == '"' || C == '\\') {
393 OS << '\\' << (char)C;
397 if (isprint((unsigned char)C)) {
403 case '\b': OS << "\\b"; break;
404 case '\f': OS << "\\f"; break;
405 case '\n': OS << "\\n"; break;
406 case '\r': OS << "\\r"; break;
407 case '\t': OS << "\\t"; break;
410 OS << toOctal(C >> 6);
411 OS << toOctal(C >> 3);
412 OS << toOctal(C >> 0);
421 void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
422 assert(CurSection && "Cannot emit contents before setting section!");
423 if (Data.empty()) return;
425 if (Data.size() == 1) {
426 OS << MAI.getData8bitsDirective(AddrSpace);
427 OS << (unsigned)(unsigned char)Data[0];
432 // If the data ends with 0 and the target supports .asciz, use it, otherwise
434 if (MAI.getAscizDirective() && Data.back() == 0) {
435 OS << MAI.getAscizDirective();
436 Data = Data.substr(0, Data.size()-1);
438 OS << MAI.getAsciiDirective();
442 PrintQuotedString(Data, OS);
446 /// EmitIntValue - Special case of EmitValue that avoids the client having
447 /// to pass in a MCExpr for constant integers.
448 void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size,
449 unsigned AddrSpace) {
450 assert(CurSection && "Cannot emit contents before setting section!");
451 const char *Directive = 0;
454 case 1: Directive = MAI.getData8bitsDirective(AddrSpace); break;
455 case 2: Directive = MAI.getData16bitsDirective(AddrSpace); break;
456 case 4: Directive = MAI.getData32bitsDirective(AddrSpace); break;
458 Directive = MAI.getData64bitsDirective(AddrSpace);
459 // If the target doesn't support 64-bit data, emit as two 32-bit halves.
460 if (Directive) break;
461 if (isLittleEndian()) {
462 EmitIntValue((uint32_t)(Value >> 0 ), 4, AddrSpace);
463 EmitIntValue((uint32_t)(Value >> 32), 4, AddrSpace);
465 EmitIntValue((uint32_t)(Value >> 32), 4, AddrSpace);
466 EmitIntValue((uint32_t)(Value >> 0 ), 4, AddrSpace);
471 assert(Directive && "Invalid size for machine code value!");
472 OS << Directive << truncateToSize(Value, Size);
476 void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size,
477 unsigned AddrSpace) {
478 assert(CurSection && "Cannot emit contents before setting section!");
479 const char *Directive = 0;
482 case 1: Directive = MAI.getData8bitsDirective(AddrSpace); break;
483 case 2: Directive = MAI.getData16bitsDirective(AddrSpace); break;
484 case 4: Directive = MAI.getData32bitsDirective(AddrSpace); break;
485 case 8: Directive = MAI.getData64bitsDirective(AddrSpace); break;
488 assert(Directive && "Invalid size for machine code value!");
489 OS << Directive << *Value;
493 void MCAsmStreamer::EmitGPRel32Value(const MCExpr *Value) {
494 assert(MAI.getGPRel32Directive() != 0);
495 OS << MAI.getGPRel32Directive() << *Value;
500 /// EmitFill - Emit NumBytes bytes worth of the value specified by
501 /// FillValue. This implements directives such as '.space'.
502 void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue,
503 unsigned AddrSpace) {
504 if (NumBytes == 0) return;
507 if (const char *ZeroDirective = MAI.getZeroDirective()) {
508 OS << ZeroDirective << NumBytes;
510 OS << ',' << (int)FillValue;
515 // Emit a byte at a time.
516 MCStreamer::EmitFill(NumBytes, FillValue, AddrSpace);
519 void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
521 unsigned MaxBytesToEmit) {
522 // Some assemblers don't support non-power of two alignments, so we always
523 // emit alignments as a power of two if possible.
524 if (isPowerOf2_32(ByteAlignment)) {
526 default: llvm_unreachable("Invalid size for machine code value!");
527 case 1: OS << MAI.getAlignDirective(); break;
528 // FIXME: use MAI for this!
529 case 2: OS << ".p2alignw "; break;
530 case 4: OS << ".p2alignl "; break;
531 case 8: llvm_unreachable("Unsupported alignment size!");
534 if (MAI.getAlignmentIsInBytes())
537 OS << Log2_32(ByteAlignment);
539 if (Value || MaxBytesToEmit) {
541 OS.write_hex(truncateToSize(Value, ValueSize));
544 OS << ", " << MaxBytesToEmit;
550 // Non-power of two alignment. This is not widely supported by assemblers.
551 // FIXME: Parameterize this based on MAI.
553 default: llvm_unreachable("Invalid size for machine code value!");
554 case 1: OS << ".balign"; break;
555 case 2: OS << ".balignw"; break;
556 case 4: OS << ".balignl"; break;
557 case 8: llvm_unreachable("Unsupported alignment size!");
560 OS << ' ' << ByteAlignment;
561 OS << ", " << truncateToSize(Value, ValueSize);
563 OS << ", " << MaxBytesToEmit;
567 void MCAsmStreamer::EmitCodeAlignment(unsigned ByteAlignment,
568 unsigned MaxBytesToEmit) {
569 // Emit with a text fill value.
570 EmitValueToAlignment(ByteAlignment, MAI.getTextAlignFillValue(),
574 void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset,
575 unsigned char Value) {
576 // FIXME: Verify that Offset is associated with the current section.
577 OS << ".org " << *Offset << ", " << (unsigned) Value;
582 void MCAsmStreamer::EmitFileDirective(StringRef Filename) {
583 assert(MAI.hasSingleParameterDotFile());
585 PrintQuotedString(Filename, OS);
589 void MCAsmStreamer::EmitDwarfFileDirective(unsigned FileNo, StringRef Filename){
590 OS << "\t.file\t" << FileNo << ' ';
591 PrintQuotedString(Filename, OS);
595 void MCAsmStreamer::AddEncodingComment(const MCInst &Inst) {
596 raw_ostream &OS = GetCommentOS();
597 SmallString<256> Code;
598 SmallVector<MCFixup, 4> Fixups;
599 raw_svector_ostream VecOS(Code);
600 Emitter->EncodeInstruction(Inst, VecOS, Fixups);
603 // If we are showing fixups, create symbolic markers in the encoded
604 // representation. We do this by making a per-bit map to the fixup item index,
605 // then trying to display it as nicely as possible.
606 SmallVector<uint8_t, 64> FixupMap;
607 FixupMap.resize(Code.size() * 8);
608 for (unsigned i = 0, e = Code.size() * 8; i != e; ++i)
611 for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
612 MCFixup &F = Fixups[i];
613 const MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind());
614 for (unsigned j = 0; j != Info.TargetSize; ++j) {
615 unsigned Index = F.getOffset() * 8 + Info.TargetOffset + j;
616 assert(Index < Code.size() * 8 && "Invalid offset in fixup!");
617 FixupMap[Index] = 1 + i;
622 for (unsigned i = 0, e = Code.size(); i != e; ++i) {
626 // See if all bits are the same map entry.
627 uint8_t MapEntry = FixupMap[i * 8 + 0];
628 for (unsigned j = 1; j != 8; ++j) {
629 if (FixupMap[i * 8 + j] == MapEntry)
632 MapEntry = uint8_t(~0U);
636 if (MapEntry != uint8_t(~0U)) {
638 OS << format("0x%02x", uint8_t(Code[i]));
640 assert(Code[i] == 0 && "Encoder wrote into fixed up bit!");
641 OS << char('A' + MapEntry - 1);
644 // Otherwise, write out in binary.
646 for (unsigned j = 8; j--;) {
647 unsigned Bit = (Code[i] >> j) & 1;
648 if (uint8_t MapEntry = FixupMap[i * 8 + j]) {
649 assert(Bit == 0 && "Encoder wrote into fixed up bit!");
650 OS << char('A' + MapEntry - 1);
658 for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
659 MCFixup &F = Fixups[i];
660 const MCFixupKindInfo &Info = Emitter->getFixupKindInfo(F.getKind());
661 OS << " fixup " << char('A' + i) << " - " << "offset: " << F.getOffset()
662 << ", value: " << *F.getValue() << ", kind: " << Info.Name << "\n";
666 void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
667 assert(CurSection && "Cannot emit contents before setting section!");
669 // Show the encoding in a comment if we have a code emitter.
671 AddEncodingComment(Inst);
673 // Show the MCInst if enabled.
675 Inst.dump_pretty(GetCommentOS(), &MAI, InstPrinter.get(), "\n ");
676 GetCommentOS() << "\n";
679 // If we have an AsmPrinter, use that to print, otherwise print the MCInst.
681 InstPrinter->printInst(&Inst, OS);
683 Inst.print(OS, &MAI);
687 /// EmitRawText - If this file is backed by a assembly streamer, this dumps
688 /// the specified string in the output .s file. This capability is
689 /// indicated by the hasRawTextSupport() predicate.
690 void MCAsmStreamer::EmitRawText(StringRef String) {
691 if (!String.empty() && String.back() == '\n')
692 String = String.substr(0, String.size()-1);
697 void MCAsmStreamer::Finish() {
700 MCStreamer *llvm::createAsmStreamer(MCContext &Context,
701 formatted_raw_ostream &OS,
703 bool isVerboseAsm, MCInstPrinter *IP,
704 MCCodeEmitter *CE, bool ShowInst) {
705 return new MCAsmStreamer(Context, OS, isLittleEndian, isVerboseAsm,