MCStreamer.h revision f4f14f68f6078ea6681ee27b5bf42719d7db3441
1//===- MCStreamer.h - High-level Streaming Machine Code Output --*- C++ -*-===// 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// This file declares the MCStreamer class. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef LLVM_MC_MCSTREAMER_H 15#define LLVM_MC_MCSTREAMER_H 16 17#include "llvm/Support/DataTypes.h" 18#include "llvm/MC/MCDirectives.h" 19#include "llvm/MC/MCDwarf.h" 20#include "llvm/MC/MCWin64EH.h" 21#include "llvm/ADT/ArrayRef.h" 22#include "llvm/ADT/SmallVector.h" 23 24namespace llvm { 25 class MCAsmBackend; 26 class MCCodeEmitter; 27 class MCContext; 28 class MCExpr; 29 class MCInst; 30 class MCInstPrinter; 31 class MCSection; 32 class MCSymbol; 33 class StringRef; 34 class Twine; 35 class raw_ostream; 36 class formatted_raw_ostream; 37 38 /// MCStreamer - Streaming machine code generation interface. This interface 39 /// is intended to provide a programatic interface that is very similar to the 40 /// level that an assembler .s file provides. It has callbacks to emit bytes, 41 /// handle directives, etc. The implementation of this interface retains 42 /// state to know what the current section is etc. 43 /// 44 /// There are multiple implementations of this interface: one for writing out 45 /// a .s file, and implementations that write out .o files of various formats. 46 /// 47 class MCStreamer { 48 MCContext &Context; 49 50 MCStreamer(const MCStreamer&) LLVM_DELETED_FUNCTION; 51 MCStreamer &operator=(const MCStreamer&) LLVM_DELETED_FUNCTION; 52 53 bool EmitEHFrame; 54 bool EmitDebugFrame; 55 56 std::vector<MCDwarfFrameInfo> FrameInfos; 57 MCDwarfFrameInfo *getCurrentFrameInfo(); 58 MCSymbol *EmitCFICommon(); 59 void EnsureValidFrame(); 60 61 std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos; 62 MCWin64EHUnwindInfo *CurrentW64UnwindInfo; 63 void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame); 64 void EnsureValidW64UnwindInfo(); 65 66 MCSymbol* LastSymbol; 67 68 /// SectionStack - This is stack of current and previous section 69 /// values saved by PushSection. 70 SmallVector<std::pair<const MCSection *, 71 const MCSection *>, 4> SectionStack; 72 73 protected: 74 MCStreamer(MCContext &Ctx); 75 76 const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A, 77 const MCSymbol *B); 78 79 const MCExpr *ForceExpAbs(const MCExpr* Expr); 80 81 void RecordProcStart(MCDwarfFrameInfo &Frame); 82 virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame); 83 void RecordProcEnd(MCDwarfFrameInfo &Frame); 84 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame); 85 void EmitFrames(bool usingCFI); 86 87 MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;} 88 void EmitW64Tables(); 89 90 public: 91 virtual ~MCStreamer(); 92 93 MCContext &getContext() const { return Context; } 94 95 unsigned getNumFrameInfos() { 96 return FrameInfos.size(); 97 } 98 99 const MCDwarfFrameInfo &getFrameInfo(unsigned i) { 100 return FrameInfos[i]; 101 } 102 103 ArrayRef<MCDwarfFrameInfo> getFrameInfos() { 104 return FrameInfos; 105 } 106 107 unsigned getNumW64UnwindInfos() { 108 return W64UnwindInfos.size(); 109 } 110 111 MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) { 112 return *W64UnwindInfos[i]; 113 } 114 115 /// @name Assembly File Formatting. 116 /// @{ 117 118 /// isVerboseAsm - Return true if this streamer supports verbose assembly 119 /// and if it is enabled. 120 virtual bool isVerboseAsm() const { return false; } 121 122 /// hasRawTextSupport - Return true if this asm streamer supports emitting 123 /// unformatted text to the .s file with EmitRawText. 124 virtual bool hasRawTextSupport() const { return false; } 125 126 /// AddComment - Add a comment that can be emitted to the generated .s 127 /// file if applicable as a QoI issue to make the output of the compiler 128 /// more readable. This only affects the MCAsmStreamer, and only when 129 /// verbose assembly output is enabled. 130 /// 131 /// If the comment includes embedded \n's, they will each get the comment 132 /// prefix as appropriate. The added comment should not end with a \n. 133 virtual void AddComment(const Twine &T) {} 134 135 /// GetCommentOS - Return a raw_ostream that comments can be written to. 136 /// Unlike AddComment, you are required to terminate comments with \n if you 137 /// use this method. 138 virtual raw_ostream &GetCommentOS(); 139 140 /// AddBlankLine - Emit a blank line to a .s file to pretty it up. 141 virtual void AddBlankLine() {} 142 143 /// @} 144 145 /// @name Symbol & Section Management 146 /// @{ 147 148 /// getCurrentSection - Return the current section that the streamer is 149 /// emitting code to. 150 const MCSection *getCurrentSection() const { 151 if (!SectionStack.empty()) 152 return SectionStack.back().first; 153 return NULL; 154 } 155 156 /// getPreviousSection - Return the previous section that the streamer is 157 /// emitting code to. 158 const MCSection *getPreviousSection() const { 159 if (!SectionStack.empty()) 160 return SectionStack.back().second; 161 return NULL; 162 } 163 164 /// ChangeSection - Update streamer for a new active section. 165 /// 166 /// This is called by PopSection and SwitchSection, if the current 167 /// section changes. 168 virtual void ChangeSection(const MCSection *) = 0; 169 170 /// pushSection - Save the current and previous section on the 171 /// section stack. 172 void PushSection() { 173 SectionStack.push_back(std::make_pair(getCurrentSection(), 174 getPreviousSection())); 175 } 176 177 /// popSection - Restore the current and previous section from 178 /// the section stack. Calls ChangeSection as needed. 179 /// 180 /// Returns false if the stack was empty. 181 bool PopSection() { 182 if (SectionStack.size() <= 1) 183 return false; 184 const MCSection *oldSection = SectionStack.pop_back_val().first; 185 const MCSection *curSection = SectionStack.back().first; 186 187 if (oldSection != curSection) 188 ChangeSection(curSection); 189 return true; 190 } 191 192 /// SwitchSection - Set the current section where code is being emitted to 193 /// @p Section. This is required to update CurSection. 194 /// 195 /// This corresponds to assembler directives like .section, .text, etc. 196 void SwitchSection(const MCSection *Section) { 197 assert(Section && "Cannot switch to a null section!"); 198 const MCSection *curSection = SectionStack.back().first; 199 SectionStack.back().second = curSection; 200 if (Section != curSection) { 201 SectionStack.back().first = Section; 202 ChangeSection(Section); 203 } 204 } 205 206 /// SwitchSectionNoChange - Set the current section where code is being 207 /// emitted to @p Section. This is required to update CurSection. This 208 /// version does not call ChangeSection. 209 void SwitchSectionNoChange(const MCSection *Section) { 210 assert(Section && "Cannot switch to a null section!"); 211 const MCSection *curSection = SectionStack.back().first; 212 SectionStack.back().second = curSection; 213 if (Section != curSection) 214 SectionStack.back().first = Section; 215 } 216 217 /// InitSections - Create the default sections and set the initial one. 218 virtual void InitSections() = 0; 219 220 /// EmitLabel - Emit a label for @p Symbol into the current section. 221 /// 222 /// This corresponds to an assembler statement such as: 223 /// foo: 224 /// 225 /// @param Symbol - The symbol to emit. A given symbol should only be 226 /// emitted as a label once, and symbols emitted as a label should never be 227 /// used in an assignment. 228 virtual void EmitLabel(MCSymbol *Symbol); 229 230 virtual void EmitEHSymAttributes(const MCSymbol *Symbol, 231 MCSymbol *EHSymbol); 232 233 /// EmitAssemblerFlag - Note in the output the specified @p Flag. 234 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0; 235 236 /// EmitDataRegion - Note in the output the specified region @p Kind. 237 virtual void EmitDataRegion(MCDataRegionType Kind) {} 238 239 /// EmitThumbFunc - Note in the output that the specified @p Func is 240 /// a Thumb mode function (ARM target only). 241 virtual void EmitThumbFunc(MCSymbol *Func) = 0; 242 243 /// EmitAssignment - Emit an assignment of @p Value to @p Symbol. 244 /// 245 /// This corresponds to an assembler statement such as: 246 /// symbol = value 247 /// 248 /// The assignment generates no code, but has the side effect of binding the 249 /// value in the current context. For the assembly streamer, this prints the 250 /// binding into the .s file. 251 /// 252 /// @param Symbol - The symbol being assigned to. 253 /// @param Value - The value for the symbol. 254 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0; 255 256 /// EmitWeakReference - Emit an weak reference from @p Alias to @p Symbol. 257 /// 258 /// This corresponds to an assembler statement such as: 259 /// .weakref alias, symbol 260 /// 261 /// @param Alias - The alias that is being created. 262 /// @param Symbol - The symbol being aliased. 263 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) = 0; 264 265 /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol. 266 virtual void EmitSymbolAttribute(MCSymbol *Symbol, 267 MCSymbolAttr Attribute) = 0; 268 269 /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol. 270 /// 271 /// @param Symbol - The symbol to have its n_desc field set. 272 /// @param DescValue - The value to set into the n_desc field. 273 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0; 274 275 /// BeginCOFFSymbolDef - Start emitting COFF symbol definition 276 /// 277 /// @param Symbol - The symbol to have its External & Type fields set. 278 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) = 0; 279 280 /// EmitCOFFSymbolStorageClass - Emit the storage class of the symbol. 281 /// 282 /// @param StorageClass - The storage class the symbol should have. 283 virtual void EmitCOFFSymbolStorageClass(int StorageClass) = 0; 284 285 /// EmitCOFFSymbolType - Emit the type of the symbol. 286 /// 287 /// @param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h) 288 virtual void EmitCOFFSymbolType(int Type) = 0; 289 290 /// EndCOFFSymbolDef - Marks the end of the symbol definition. 291 virtual void EndCOFFSymbolDef() = 0; 292 293 /// EmitCOFFSecRel32 - Emits a COFF section relative relocation. 294 /// 295 /// @param Symbol - Symbol the section relative realocation should point to. 296 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); 297 298 /// EmitELFSize - Emit an ELF .size directive. 299 /// 300 /// This corresponds to an assembler statement such as: 301 /// .size symbol, expression 302 /// 303 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) = 0; 304 305 /// EmitCommonSymbol - Emit a common symbol. 306 /// 307 /// @param Symbol - The common symbol to emit. 308 /// @param Size - The size of the common symbol. 309 /// @param ByteAlignment - The alignment of the symbol if 310 /// non-zero. This must be a power of 2. 311 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, 312 unsigned ByteAlignment) = 0; 313 314 /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol. 315 /// 316 /// @param Symbol - The common symbol to emit. 317 /// @param Size - The size of the common symbol. 318 /// @param ByteAlignment - The alignment of the common symbol in bytes. 319 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, 320 unsigned ByteAlignment) = 0; 321 322 /// EmitZerofill - Emit the zerofill section and an optional symbol. 323 /// 324 /// @param Section - The zerofill section to create and or to put the symbol 325 /// @param Symbol - The zerofill symbol to emit, if non-NULL. 326 /// @param Size - The size of the zerofill symbol. 327 /// @param ByteAlignment - The alignment of the zerofill symbol if 328 /// non-zero. This must be a power of 2 on some targets. 329 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, 330 uint64_t Size = 0,unsigned ByteAlignment = 0) = 0; 331 332 /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol. 333 /// 334 /// @param Section - The thread local common section. 335 /// @param Symbol - The thread local common symbol to emit. 336 /// @param Size - The size of the symbol. 337 /// @param ByteAlignment - The alignment of the thread local common symbol 338 /// if non-zero. This must be a power of 2 on some targets. 339 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, 340 uint64_t Size, unsigned ByteAlignment = 0) = 0; 341 342 /// @} 343 /// @name Generating Data 344 /// @{ 345 346 /// EmitBytes - Emit the bytes in \p Data into the output. 347 /// 348 /// This is used to implement assembler directives such as .byte, .ascii, 349 /// etc. 350 virtual void EmitBytes(StringRef Data, unsigned AddrSpace) = 0; 351 352 /// EmitValue - Emit the expression @p Value into the output as a native 353 /// integer of the given @p Size bytes. 354 /// 355 /// This is used to implement assembler directives such as .word, .quad, 356 /// etc. 357 /// 358 /// @param Value - The value to emit. 359 /// @param Size - The size of the integer (in bytes) to emit. This must 360 /// match a native machine width. 361 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size, 362 unsigned AddrSpace) = 0; 363 364 void EmitValue(const MCExpr *Value, unsigned Size, unsigned AddrSpace = 0); 365 366 /// EmitIntValue - Special case of EmitValue that avoids the client having 367 /// to pass in a MCExpr for constant integers. 368 virtual void EmitIntValue(uint64_t Value, unsigned Size, 369 unsigned AddrSpace = 0); 370 371 /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO 372 /// this is done by producing 373 /// foo = value 374 /// .long foo 375 void EmitAbsValue(const MCExpr *Value, unsigned Size, 376 unsigned AddrSpace = 0); 377 378 virtual void EmitULEB128Value(const MCExpr *Value) = 0; 379 380 virtual void EmitSLEB128Value(const MCExpr *Value) = 0; 381 382 /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the 383 /// client having to pass in a MCExpr for constant integers. 384 void EmitULEB128IntValue(uint64_t Value, unsigned AddrSpace = 0, 385 unsigned Padding = 0); 386 387 /// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the 388 /// client having to pass in a MCExpr for constant integers. 389 void EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace = 0); 390 391 /// EmitSymbolValue - Special case of EmitValue that avoids the client 392 /// having to pass in a MCExpr for MCSymbols. 393 void EmitSymbolValue(const MCSymbol *Sym, unsigned Size, 394 unsigned AddrSpace = 0); 395 396 /// EmitGPRel64Value - Emit the expression @p Value into the output as a 397 /// gprel64 (64-bit GP relative) value. 398 /// 399 /// This is used to implement assembler directives such as .gpdword on 400 /// targets that support them. 401 virtual void EmitGPRel64Value(const MCExpr *Value); 402 403 /// EmitGPRel32Value - Emit the expression @p Value into the output as a 404 /// gprel32 (32-bit GP relative) value. 405 /// 406 /// This is used to implement assembler directives such as .gprel32 on 407 /// targets that support them. 408 virtual void EmitGPRel32Value(const MCExpr *Value); 409 410 /// EmitFill - Emit NumBytes bytes worth of the value specified by 411 /// FillValue. This implements directives such as '.space'. 412 virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue, 413 unsigned AddrSpace); 414 415 /// EmitZeros - Emit NumBytes worth of zeros. This is a convenience 416 /// function that just wraps EmitFill. 417 void EmitZeros(uint64_t NumBytes, unsigned AddrSpace) { 418 EmitFill(NumBytes, 0, AddrSpace); 419 } 420 421 422 /// EmitValueToAlignment - Emit some number of copies of @p Value until 423 /// the byte alignment @p ByteAlignment is reached. 424 /// 425 /// If the number of bytes need to emit for the alignment is not a multiple 426 /// of @p ValueSize, then the contents of the emitted fill bytes is 427 /// undefined. 428 /// 429 /// This used to implement the .align assembler directive. 430 /// 431 /// @param ByteAlignment - The alignment to reach. This must be a power of 432 /// two on some targets. 433 /// @param Value - The value to use when filling bytes. 434 /// @param ValueSize - The size of the integer (in bytes) to emit for 435 /// @p Value. This must match a native machine width. 436 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If 437 /// the alignment cannot be reached in this many bytes, no bytes are 438 /// emitted. 439 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, 440 unsigned ValueSize = 1, 441 unsigned MaxBytesToEmit = 0) = 0; 442 443 /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment 444 /// is reached. 445 /// 446 /// This used to align code where the alignment bytes may be executed. This 447 /// can emit different bytes for different sizes to optimize execution. 448 /// 449 /// @param ByteAlignment - The alignment to reach. This must be a power of 450 /// two on some targets. 451 /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If 452 /// the alignment cannot be reached in this many bytes, no bytes are 453 /// emitted. 454 virtual void EmitCodeAlignment(unsigned ByteAlignment, 455 unsigned MaxBytesToEmit = 0) = 0; 456 457 /// EmitValueToOffset - Emit some number of copies of @p Value until the 458 /// byte offset @p Offset is reached. 459 /// 460 /// This is used to implement assembler directives such as .org. 461 /// 462 /// @param Offset - The offset to reach. This may be an expression, but the 463 /// expression must be associated with the current section. 464 /// @param Value - The value to use when filling bytes. 465 /// @return false on success, true if the offset was invalid. 466 virtual bool EmitValueToOffset(const MCExpr *Offset, 467 unsigned char Value = 0) = 0; 468 469 /// @} 470 471 /// EmitFileDirective - Switch to a new logical file. This is used to 472 /// implement the '.file "foo.c"' assembler directive. 473 virtual void EmitFileDirective(StringRef Filename) = 0; 474 475 /// EmitDwarfFileDirective - Associate a filename with a specified logical 476 /// file number. This implements the DWARF2 '.file 4 "foo.c"' assembler 477 /// directive. 478 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory, 479 StringRef Filename); 480 481 /// EmitDwarfLocDirective - This implements the DWARF2 482 // '.loc fileno lineno ...' assembler directive. 483 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line, 484 unsigned Column, unsigned Flags, 485 unsigned Isa, 486 unsigned Discriminator, 487 StringRef FileName); 488 489 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta, 490 const MCSymbol *LastLabel, 491 const MCSymbol *Label, 492 unsigned PointerSize) = 0; 493 494 virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel, 495 const MCSymbol *Label) { 496 } 497 498 void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label, 499 int PointerSize); 500 501 virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding); 502 virtual void EmitCFISections(bool EH, bool Debug); 503 void EmitCFIStartProc(); 504 void EmitCFIEndProc(); 505 virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset); 506 virtual void EmitCFIDefCfaOffset(int64_t Offset); 507 virtual void EmitCFIDefCfaRegister(int64_t Register); 508 virtual void EmitCFIOffset(int64_t Register, int64_t Offset); 509 virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding); 510 virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding); 511 virtual void EmitCFIRememberState(); 512 virtual void EmitCFIRestoreState(); 513 virtual void EmitCFISameValue(int64_t Register); 514 virtual void EmitCFIRestore(int64_t Register); 515 virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset); 516 virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment); 517 virtual void EmitCFIEscape(StringRef Values); 518 virtual void EmitCFISignalFrame(); 519 virtual void EmitCFIUndefined(int64_t Register); 520 virtual void EmitCFIRegister(int64_t Register1, int64_t Register2); 521 522 virtual void EmitWin64EHStartProc(const MCSymbol *Symbol); 523 virtual void EmitWin64EHEndProc(); 524 virtual void EmitWin64EHStartChained(); 525 virtual void EmitWin64EHEndChained(); 526 virtual void EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind, 527 bool Except); 528 virtual void EmitWin64EHHandlerData(); 529 virtual void EmitWin64EHPushReg(unsigned Register); 530 virtual void EmitWin64EHSetFrame(unsigned Register, unsigned Offset); 531 virtual void EmitWin64EHAllocStack(unsigned Size); 532 virtual void EmitWin64EHSaveReg(unsigned Register, unsigned Offset); 533 virtual void EmitWin64EHSaveXMM(unsigned Register, unsigned Offset); 534 virtual void EmitWin64EHPushFrame(bool Code); 535 virtual void EmitWin64EHEndProlog(); 536 537 /// EmitInstruction - Emit the given @p Instruction into the current 538 /// section. 539 virtual void EmitInstruction(const MCInst &Inst) = 0; 540 541 /// EmitRawText - If this file is backed by a assembly streamer, this dumps 542 /// the specified string in the output .s file. This capability is 543 /// indicated by the hasRawTextSupport() predicate. By default this aborts. 544 virtual void EmitRawText(StringRef String); 545 void EmitRawText(const Twine &String); 546 547 /// ARM-related methods. 548 /// FIXME: Eventually we should have some "target MC streamer" and move 549 /// these methods there. 550 virtual void EmitFnStart(); 551 virtual void EmitFnEnd(); 552 virtual void EmitCantUnwind(); 553 virtual void EmitPersonality(const MCSymbol *Personality); 554 virtual void EmitHandlerData(); 555 virtual void EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset = 0); 556 virtual void EmitPad(int64_t Offset); 557 virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList, 558 bool isVector); 559 560 /// PPC-related methods. 561 /// FIXME: Eventually replace it with some "target MC streamer" and move 562 /// these methods there. 563 virtual void EmitTCEntry(const MCSymbol &S); 564 565 /// FinishImpl - Streamer specific finalization. 566 virtual void FinishImpl() = 0; 567 /// Finish - Finish emission of machine code. 568 void Finish(); 569 }; 570 571 /// createNullStreamer - Create a dummy machine code streamer, which does 572 /// nothing. This is useful for timing the assembler front end. 573 MCStreamer *createNullStreamer(MCContext &Ctx); 574 575 /// createAsmStreamer - Create a machine code streamer which will print out 576 /// assembly for the native target, suitable for compiling with a native 577 /// assembler. 578 /// 579 /// \param InstPrint - If given, the instruction printer to use. If not given 580 /// the MCInst representation will be printed. This method takes ownership of 581 /// InstPrint. 582 /// 583 /// \param CE - If given, a code emitter to use to show the instruction 584 /// encoding inline with the assembly. This method takes ownership of \p CE. 585 /// 586 /// \param TAB - If given, a target asm backend to use to show the fixup 587 /// information in conjunction with encoding information. This method takes 588 /// ownership of \p TAB. 589 /// 590 /// \param ShowInst - Whether to show the MCInst representation inline with 591 /// the assembly. 592 MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS, 593 bool isVerboseAsm, 594 bool useLoc, 595 bool useCFI, 596 bool useDwarfDirectory, 597 MCInstPrinter *InstPrint = 0, 598 MCCodeEmitter *CE = 0, 599 MCAsmBackend *TAB = 0, 600 bool ShowInst = false); 601 602 /// createMachOStreamer - Create a machine code streamer which will generate 603 /// Mach-O format object files. 604 /// 605 /// Takes ownership of \p TAB and \p CE. 606 MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB, 607 raw_ostream &OS, MCCodeEmitter *CE, 608 bool RelaxAll = false); 609 610 /// createWinCOFFStreamer - Create a machine code streamer which will 611 /// generate Microsoft COFF format object files. 612 /// 613 /// Takes ownership of \p TAB and \p CE. 614 MCStreamer *createWinCOFFStreamer(MCContext &Ctx, 615 MCAsmBackend &TAB, 616 MCCodeEmitter &CE, raw_ostream &OS, 617 bool RelaxAll = false); 618 619 /// createELFStreamer - Create a machine code streamer which will generate 620 /// ELF format object files. 621 MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB, 622 raw_ostream &OS, MCCodeEmitter *CE, 623 bool RelaxAll, bool NoExecStack); 624 625 /// createPureStreamer - Create a machine code streamer which will generate 626 /// "pure" MC object files, for use with MC-JIT and testing tools. 627 /// 628 /// Takes ownership of \p TAB and \p CE. 629 MCStreamer *createPureStreamer(MCContext &Ctx, MCAsmBackend &TAB, 630 raw_ostream &OS, MCCodeEmitter *CE); 631 632} // end namespace llvm 633 634#endif 635