blob: a126b52786315cf4b96a4f5694fad9ac9cb4c922 [file] [log] [blame]
Daniel Dunbara11af532009-06-24 01:03:06 +00001//===- lib/MC/MCAsmStreamer.cpp - Text Assembly Output --------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/MC/MCStreamer.h"
Daniel Dunbar4a0abd82009-08-27 00:51:57 +000011#include "llvm/ADT/SmallString.h"
Daniel Dunbar8c2eebe2009-08-31 08:08:38 +000012#include "llvm/MC/MCAsmInfo.h"
Daniel Dunbar4a0abd82009-08-27 00:51:57 +000013#include "llvm/MC/MCCodeEmitter.h"
Daniel Dunbara11af532009-06-24 01:03:06 +000014#include "llvm/MC/MCContext.h"
Daniel Dunbar8c2eebe2009-08-31 08:08:38 +000015#include "llvm/MC/MCExpr.h"
Daniel Dunbarabde2982009-07-01 06:35:03 +000016#include "llvm/MC/MCInst.h"
Chris Lattner90edac02009-09-14 03:02:37 +000017#include "llvm/MC/MCInstPrinter.h"
Chris Lattnerf9bdedd2009-08-10 18:15:01 +000018#include "llvm/MC/MCSectionMachO.h"
Daniel Dunbara11af532009-06-24 01:03:06 +000019#include "llvm/MC/MCSymbol.h"
Torok Edwinc25e7582009-07-11 20:10:48 +000020#include "llvm/Support/ErrorHandling.h"
Chris Lattner663c2d22009-08-19 06:12:02 +000021#include "llvm/Support/MathExtras.h"
Daniel Dunbar4a0abd82009-08-27 00:51:57 +000022#include "llvm/Support/Format.h"
Daniel Dunbara11af532009-06-24 01:03:06 +000023#include "llvm/Support/raw_ostream.h"
24using namespace llvm;
25
26namespace {
27
Chris Lattner46a947d2009-08-17 04:17:34 +000028class MCAsmStreamer : public MCStreamer {
29 raw_ostream &OS;
Chris Lattner33adcfb2009-08-22 21:43:10 +000030 const MCAsmInfo &MAI;
Chris Lattner90edac02009-09-14 03:02:37 +000031 MCInstPrinter *InstPrinter;
Daniel Dunbar4a0abd82009-08-27 00:51:57 +000032 MCCodeEmitter *Emitter;
Chris Lattner46a947d2009-08-17 04:17:34 +000033public:
Chris Lattneraf76e592009-08-22 20:48:53 +000034 MCAsmStreamer(MCContext &Context, raw_ostream &_OS, const MCAsmInfo &tai,
Chris Lattner90edac02009-09-14 03:02:37 +000035 MCInstPrinter *_Printer, MCCodeEmitter *_Emitter)
36 : MCStreamer(Context), OS(_OS), MAI(tai), InstPrinter(_Printer),
Daniel Dunbar4a0abd82009-08-27 00:51:57 +000037 Emitter(_Emitter) {}
Chris Lattner46a947d2009-08-17 04:17:34 +000038 ~MCAsmStreamer() {}
Daniel Dunbara11af532009-06-24 01:03:06 +000039
Chris Lattner46a947d2009-08-17 04:17:34 +000040 /// @name MCStreamer Interface
41 /// @{
Daniel Dunbara11af532009-06-24 01:03:06 +000042
Chris Lattner975780b2009-08-17 05:49:08 +000043 virtual void SwitchSection(const MCSection *Section);
Daniel Dunbara11af532009-06-24 01:03:06 +000044
Chris Lattner46a947d2009-08-17 04:17:34 +000045 virtual void EmitLabel(MCSymbol *Symbol);
Daniel Dunbara11af532009-06-24 01:03:06 +000046
Chris Lattner46a947d2009-08-17 04:17:34 +000047 virtual void EmitAssemblerFlag(AssemblerFlag Flag);
Daniel Dunbara11af532009-06-24 01:03:06 +000048
Daniel Dunbar821e3332009-08-31 08:09:28 +000049 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
Daniel Dunbara11af532009-06-24 01:03:06 +000050
Chris Lattner46a947d2009-08-17 04:17:34 +000051 virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute);
Kevin Enderbya5c78322009-07-13 21:03:15 +000052
Chris Lattner46a947d2009-08-17 04:17:34 +000053 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
Daniel Dunbara11af532009-06-24 01:03:06 +000054
Chris Lattner46a947d2009-08-17 04:17:34 +000055 virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
Daniel Dunbar7092c7e2009-08-30 06:17:16 +000056 unsigned ByteAlignment);
Kevin Enderby95cf30c2009-07-14 18:17:10 +000057
Daniel Dunbar8751b942009-08-28 05:48:22 +000058 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
Daniel Dunbar7092c7e2009-08-30 06:17:16 +000059 unsigned Size = 0, unsigned ByteAlignment = 0);
Kevin Enderby71148242009-07-14 21:35:03 +000060
Chris Lattneraaec2052010-01-19 19:46:13 +000061 virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
Chris Lattner4e4db7a2009-07-07 20:30:46 +000062
Chris Lattneraaec2052010-01-19 19:46:13 +000063 virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace);
Chris Lattner32ae3fe2010-01-19 22:03:38 +000064 virtual void EmitIntValue(uint64_t Value, unsigned Size, unsigned AddrSpace);
65
Chris Lattneraaec2052010-01-19 19:46:13 +000066 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
67 unsigned AddrSpace);
Chris Lattner9be3fee2009-07-10 22:20:30 +000068
Chris Lattner46a947d2009-08-17 04:17:34 +000069 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
70 unsigned ValueSize = 1,
71 unsigned MaxBytesToEmit = 0);
Daniel Dunbara11af532009-06-24 01:03:06 +000072
Daniel Dunbar821e3332009-08-31 08:09:28 +000073 virtual void EmitValueToOffset(const MCExpr *Offset,
Chris Lattner46a947d2009-08-17 04:17:34 +000074 unsigned char Value = 0);
75
76 virtual void EmitInstruction(const MCInst &Inst);
Daniel Dunbara11af532009-06-24 01:03:06 +000077
Chris Lattner46a947d2009-08-17 04:17:34 +000078 virtual void Finish();
79
80 /// @}
81};
Daniel Dunbar84a29262009-06-24 19:25:34 +000082
Chris Lattner46a947d2009-08-17 04:17:34 +000083} // end anonymous namespace.
Daniel Dunbara11af532009-06-24 01:03:06 +000084
Daniel Dunbar304f6a42009-06-25 21:03:18 +000085static inline int64_t truncateToSize(int64_t Value, unsigned Bytes) {
86 assert(Bytes && "Invalid size!");
87 return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8));
88}
89
Daniel Dunbar821e3332009-08-31 08:09:28 +000090static inline const MCExpr *truncateToSize(const MCExpr *Value,
91 unsigned Bytes) {
92 // FIXME: Do we really need this routine?
93 return Value;
Daniel Dunbar304f6a42009-06-25 21:03:18 +000094}
95
Chris Lattner975780b2009-08-17 05:49:08 +000096void MCAsmStreamer::SwitchSection(const MCSection *Section) {
Chris Lattner6c2f9e12009-08-19 05:49:37 +000097 assert(Section && "Cannot switch to a null section!");
Daniel Dunbara11af532009-06-24 01:03:06 +000098 if (Section != CurSection) {
99 CurSection = Section;
Chris Lattner33adcfb2009-08-22 21:43:10 +0000100 Section->PrintSwitchToSection(MAI, OS);
Daniel Dunbara11af532009-06-24 01:03:06 +0000101 }
102}
103
104void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
Daniel Dunbar8906ff12009-08-22 07:22:36 +0000105 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
Daniel Dunbar71d259b2009-06-24 17:00:42 +0000106 assert(CurSection && "Cannot emit before setting section!");
Daniel Dunbar71d259b2009-06-24 17:00:42 +0000107
Chris Lattner10b318b2010-01-17 21:43:43 +0000108 OS << *Symbol << ":\n";
Daniel Dunbar8906ff12009-08-22 07:22:36 +0000109 Symbol->setSection(*CurSection);
Daniel Dunbara11af532009-06-24 01:03:06 +0000110}
111
Kevin Enderbyf96db462009-07-16 17:56:39 +0000112void MCAsmStreamer::EmitAssemblerFlag(AssemblerFlag Flag) {
113 switch (Flag) {
Daniel Dunbar011e4db2009-08-13 23:36:34 +0000114 default: assert(0 && "Invalid flag!");
Kevin Enderbyf96db462009-07-16 17:56:39 +0000115 case SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break;
116 }
117 OS << '\n';
Kevin Enderbya5c78322009-07-13 21:03:15 +0000118}
119
Daniel Dunbar821e3332009-08-31 08:09:28 +0000120void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
Daniel Dunbar8906ff12009-08-22 07:22:36 +0000121 // Only absolute symbols can be redefined.
122 assert((Symbol->isUndefined() || Symbol->isAbsolute()) &&
123 "Cannot define a symbol twice!");
Daniel Dunbar71d259b2009-06-24 17:00:42 +0000124
Chris Lattner8cb9a3b2010-01-18 00:37:40 +0000125 OS << *Symbol << " = " << *Value << '\n';
Daniel Dunbarfffff912009-10-16 01:34:54 +0000126
127 // FIXME: Lift context changes into super class.
Daniel Dunbar75773ff2009-10-16 01:57:39 +0000128 // FIXME: Set associated section.
Daniel Dunbarfffff912009-10-16 01:34:54 +0000129 Symbol->setValue(Value);
Daniel Dunbara11af532009-06-24 01:03:06 +0000130}
131
Daniel Dunbarfffff912009-10-16 01:34:54 +0000132void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
Daniel Dunbara11af532009-06-24 01:03:06 +0000133 SymbolAttr Attribute) {
134 switch (Attribute) {
Daniel Dunbar7eb85192009-10-16 01:58:15 +0000135 case Global: OS << ".globl"; break;
136 case Hidden: OS << ".hidden"; break;
Daniel Dunbard814b212009-06-24 16:36:52 +0000137 case IndirectSymbol: OS << ".indirect_symbol"; break;
Daniel Dunbar7eb85192009-10-16 01:58:15 +0000138 case Internal: OS << ".internal"; break;
139 case LazyReference: OS << ".lazy_reference"; break;
140 case NoDeadStrip: OS << ".no_dead_strip"; break;
141 case PrivateExtern: OS << ".private_extern"; break;
142 case Protected: OS << ".protected"; break;
143 case Reference: OS << ".reference"; break;
144 case Weak: OS << ".weak"; break;
Daniel Dunbard814b212009-06-24 16:36:52 +0000145 case WeakDefinition: OS << ".weak_definition"; break;
Daniel Dunbar7eb85192009-10-16 01:58:15 +0000146 case WeakReference: OS << ".weak_reference"; break;
Daniel Dunbara11af532009-06-24 01:03:06 +0000147 }
148
Chris Lattner10b318b2010-01-17 21:43:43 +0000149 OS << ' ' << *Symbol << '\n';
Daniel Dunbara11af532009-06-24 01:03:06 +0000150}
151
Kevin Enderby95cf30c2009-07-14 18:17:10 +0000152void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
Chris Lattner10b318b2010-01-17 21:43:43 +0000153 OS << ".desc" << ' ' << *Symbol << ',' << DescValue << '\n';
Kevin Enderby95cf30c2009-07-14 18:17:10 +0000154}
155
Chris Lattner4e4db7a2009-07-07 20:30:46 +0000156void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
Daniel Dunbar7092c7e2009-08-30 06:17:16 +0000157 unsigned ByteAlignment) {
Chris Lattner4ed54382010-01-19 06:01:04 +0000158 OS << MAI.getCOMMDirective() << *Symbol << ',' << Size;
159 if (ByteAlignment != 0 && MAI.getCOMMDirectiveTakesAlignment()) {
160 if (MAI.getAlignmentIsInBytes())
161 OS << ',' << ByteAlignment;
162 else
163 OS << ',' << Log2_32(ByteAlignment);
164 }
Chris Lattner4e4db7a2009-07-07 20:30:46 +0000165 OS << '\n';
166}
167
Daniel Dunbar8751b942009-08-28 05:48:22 +0000168void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
Daniel Dunbar7092c7e2009-08-30 06:17:16 +0000169 unsigned Size, unsigned ByteAlignment) {
Daniel Dunbar011e4db2009-08-13 23:36:34 +0000170 // Note: a .zerofill directive does not switch sections.
Chris Lattner93b6db32009-08-08 23:39:42 +0000171 OS << ".zerofill ";
172
173 // This is a mach-o specific directive.
Chris Lattnerff4bc462009-08-10 01:39:42 +0000174 const MCSectionMachO *MOSection = ((const MCSectionMachO*)Section);
Daniel Dunbar12de0df2009-08-14 18:51:45 +0000175 OS << MOSection->getSegmentName() << "," << MOSection->getSectionName();
Chris Lattner93b6db32009-08-08 23:39:42 +0000176
Chris Lattner9be3fee2009-07-10 22:20:30 +0000177 if (Symbol != NULL) {
Chris Lattner10b318b2010-01-17 21:43:43 +0000178 OS << ',' << *Symbol << ',' << Size;
Daniel Dunbar7092c7e2009-08-30 06:17:16 +0000179 if (ByteAlignment != 0)
180 OS << ',' << Log2_32(ByteAlignment);
Chris Lattner9be3fee2009-07-10 22:20:30 +0000181 }
182 OS << '\n';
183}
184
Chris Lattneraaec2052010-01-19 19:46:13 +0000185void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
Daniel Dunbar71d259b2009-06-24 17:00:42 +0000186 assert(CurSection && "Cannot emit contents before setting section!");
Chris Lattneraaec2052010-01-19 19:46:13 +0000187 const char *Directive = MAI.getData8bitsDirective(AddrSpace);
Daniel Dunbar9a7e2cc2009-07-27 21:49:56 +0000188 for (unsigned i = 0, e = Data.size(); i != e; ++i)
Chris Lattneraaec2052010-01-19 19:46:13 +0000189 OS << Directive << (unsigned)(unsigned char)Data[i] << '\n';
Daniel Dunbara11af532009-06-24 01:03:06 +0000190}
191
Chris Lattner32ae3fe2010-01-19 22:03:38 +0000192/// EmitIntValue - Special case of EmitValue that avoids the client having
193/// to pass in a MCExpr for constant integers.
194void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size,
195 unsigned AddrSpace) {
196 assert(CurSection && "Cannot emit contents before setting section!");
197 // Need target hooks to know how to print this.
198 const char *Directive = 0;
199 switch (Size) {
200 default: break;
201 case 1: Directive = MAI.getData8bitsDirective(AddrSpace); break;
202 case 2: Directive = MAI.getData16bitsDirective(AddrSpace); break;
203 case 4: Directive = MAI.getData32bitsDirective(AddrSpace); break;
204 case 8: Directive = MAI.getData64bitsDirective(AddrSpace); break;
205 }
206
207 assert(Directive && "Invalid size for machine code value!");
208 OS << Directive << truncateToSize(Value, Size) << '\n';
209}
210
Chris Lattneraaec2052010-01-19 19:46:13 +0000211void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size,
212 unsigned AddrSpace) {
Daniel Dunbar71d259b2009-06-24 17:00:42 +0000213 assert(CurSection && "Cannot emit contents before setting section!");
Daniel Dunbara11af532009-06-24 01:03:06 +0000214 // Need target hooks to know how to print this.
Chris Lattner32ae3fe2010-01-19 22:03:38 +0000215 const char *Directive = 0;
Daniel Dunbara11af532009-06-24 01:03:06 +0000216 switch (Size) {
Chris Lattner32ae3fe2010-01-19 22:03:38 +0000217 default: break;
218 case 1: Directive = MAI.getData8bitsDirective(AddrSpace); break;
219 case 2: Directive = MAI.getData16bitsDirective(AddrSpace); break;
220 case 4: Directive = MAI.getData32bitsDirective(AddrSpace); break;
221 case 8: Directive = MAI.getData64bitsDirective(AddrSpace); break;
Daniel Dunbara11af532009-06-24 01:03:06 +0000222 }
Chris Lattneraaec2052010-01-19 19:46:13 +0000223
Chris Lattner32ae3fe2010-01-19 22:03:38 +0000224 assert(Directive && "Invalid size for machine code value!");
225 OS << Directive << *truncateToSize(Value, Size) << '\n';
Daniel Dunbara11af532009-06-24 01:03:06 +0000226}
227
Chris Lattner6113b3d2010-01-19 18:52:28 +0000228/// EmitFill - Emit NumBytes bytes worth of the value specified by
229/// FillValue. This implements directives such as '.space'.
Chris Lattneraaec2052010-01-19 19:46:13 +0000230void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue,
231 unsigned AddrSpace) {
Chris Lattner8a6d7ac2010-01-19 18:58:52 +0000232 if (NumBytes == 0) return;
233
Chris Lattneraaec2052010-01-19 19:46:13 +0000234 if (AddrSpace == 0)
235 if (const char *ZeroDirective = MAI.getZeroDirective()) {
236 OS << ZeroDirective << NumBytes;
237 if (FillValue != 0)
238 OS << ',' << (int)FillValue;
239 OS << '\n';
240 return;
241 }
242
243 // Emit a byte at a time.
244 MCStreamer::EmitFill(NumBytes, FillValue, AddrSpace);
Chris Lattner6113b3d2010-01-19 18:52:28 +0000245}
246
Daniel Dunbar84a29262009-06-24 19:25:34 +0000247void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
248 unsigned ValueSize,
249 unsigned MaxBytesToEmit) {
Chris Lattner663c2d22009-08-19 06:12:02 +0000250 // Some assemblers don't support non-power of two alignments, so we always
251 // emit alignments as a power of two if possible.
252 if (isPowerOf2_32(ByteAlignment)) {
Chris Lattner6e579c62009-08-19 06:35:36 +0000253 switch (ValueSize) {
254 default: llvm_unreachable("Invalid size for machine code value!");
Chris Lattner33adcfb2009-08-22 21:43:10 +0000255 case 1: OS << MAI.getAlignDirective(); break;
256 // FIXME: use MAI for this!
Chris Lattner6e579c62009-08-19 06:35:36 +0000257 case 2: OS << ".p2alignw "; break;
258 case 4: OS << ".p2alignl "; break;
259 case 8: llvm_unreachable("Unsupported alignment size!");
260 }
Chris Lattner663c2d22009-08-19 06:12:02 +0000261
Chris Lattner33adcfb2009-08-22 21:43:10 +0000262 if (MAI.getAlignmentIsInBytes())
Chris Lattner663c2d22009-08-19 06:12:02 +0000263 OS << ByteAlignment;
264 else
265 OS << Log2_32(ByteAlignment);
Daniel Dunbar84a29262009-06-24 19:25:34 +0000266
Chris Lattner663c2d22009-08-19 06:12:02 +0000267 if (Value || MaxBytesToEmit) {
Chris Lattner579531c2009-09-03 04:01:10 +0000268 OS << ", 0x";
269 OS.write_hex(truncateToSize(Value, ValueSize));
Chris Lattner663c2d22009-08-19 06:12:02 +0000270
271 if (MaxBytesToEmit)
272 OS << ", " << MaxBytesToEmit;
273 }
274 OS << '\n';
275 return;
276 }
277
278 // Non-power of two alignment. This is not widely supported by assemblers.
Chris Lattner33adcfb2009-08-22 21:43:10 +0000279 // FIXME: Parameterize this based on MAI.
Daniel Dunbar84a29262009-06-24 19:25:34 +0000280 switch (ValueSize) {
Chris Lattner663c2d22009-08-19 06:12:02 +0000281 default: llvm_unreachable("Invalid size for machine code value!");
282 case 1: OS << ".balign"; break;
283 case 2: OS << ".balignw"; break;
284 case 4: OS << ".balignl"; break;
285 case 8: llvm_unreachable("Unsupported alignment size!");
Daniel Dunbar84a29262009-06-24 19:25:34 +0000286 }
287
Chris Lattner663c2d22009-08-19 06:12:02 +0000288 OS << ' ' << ByteAlignment;
Daniel Dunbar304f6a42009-06-25 21:03:18 +0000289 OS << ", " << truncateToSize(Value, ValueSize);
Daniel Dunbar84a29262009-06-24 19:25:34 +0000290 if (MaxBytesToEmit)
291 OS << ", " << MaxBytesToEmit;
292 OS << '\n';
293}
294
Daniel Dunbar821e3332009-08-31 08:09:28 +0000295void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset,
Daniel Dunbar84a29262009-06-24 19:25:34 +0000296 unsigned char Value) {
297 // FIXME: Verify that Offset is associated with the current section.
Chris Lattner8cb9a3b2010-01-18 00:37:40 +0000298 OS << ".org " << *Offset << ", " << (unsigned) Value << '\n';
Daniel Dunbar84a29262009-06-24 19:25:34 +0000299}
300
Daniel Dunbara11af532009-06-24 01:03:06 +0000301void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
Daniel Dunbar71d259b2009-06-24 17:00:42 +0000302 assert(CurSection && "Cannot emit contents before setting section!");
Daniel Dunbarc22e0b22009-08-14 03:48:55 +0000303
304 // If we have an AsmPrinter, use that to print.
Chris Lattner90edac02009-09-14 03:02:37 +0000305 if (InstPrinter) {
306 InstPrinter->printInst(&Inst);
Chris Lattner1b6570e2009-09-13 22:24:34 +0000307 OS << '\n';
Daniel Dunbara356aea2009-08-27 07:58:57 +0000308
309 // Show the encoding if we have a code emitter.
310 if (Emitter) {
311 SmallString<256> Code;
312 raw_svector_ostream VecOS(Code);
313 Emitter->EncodeInstruction(Inst, VecOS);
314 VecOS.flush();
315
316 OS.indent(20);
317 OS << " # encoding: [";
318 for (unsigned i = 0, e = Code.size(); i != e; ++i) {
319 if (i)
320 OS << ',';
321 OS << format("%#04x", uint8_t(Code[i]));
322 }
323 OS << "]\n";
324 }
325
Daniel Dunbarc22e0b22009-08-14 03:48:55 +0000326 return;
327 }
328
329 // Otherwise fall back to a structural printing for now. Eventually we should
330 // always have access to the target specific printer.
Chris Lattner684c593d2009-09-03 05:46:51 +0000331 Inst.print(OS, &MAI);
Daniel Dunbar8c2eebe2009-08-31 08:08:38 +0000332 OS << '\n';
Daniel Dunbara11af532009-06-24 01:03:06 +0000333}
334
335void MCAsmStreamer::Finish() {
336 OS.flush();
337}
338
Daniel Dunbarc22e0b22009-08-14 03:48:55 +0000339MCStreamer *llvm::createAsmStreamer(MCContext &Context, raw_ostream &OS,
Chris Lattner90edac02009-09-14 03:02:37 +0000340 const MCAsmInfo &MAI, MCInstPrinter *IP,
Daniel Dunbar4a0abd82009-08-27 00:51:57 +0000341 MCCodeEmitter *CE) {
Chris Lattner90edac02009-09-14 03:02:37 +0000342 return new MCAsmStreamer(Context, OS, MAI, IP, CE);
Daniel Dunbara11af532009-06-24 01:03:06 +0000343}