1//===- lib/MC/MCStreamer.cpp - Streaming Machine Code 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/MCAsmInfo.h" 11#include "llvm/MC/MCContext.h" 12#include "llvm/MC/MCStreamer.h" 13#include "llvm/MC/MCExpr.h" 14#include "llvm/MC/MCObjectWriter.h" 15#include "llvm/MC/MCSymbol.h" 16#include "llvm/Support/ErrorHandling.h" 17#include "llvm/Support/raw_ostream.h" 18#include "llvm/ADT/SmallString.h" 19#include "llvm/ADT/StringExtras.h" 20#include "llvm/ADT/Twine.h" 21#include <cstdlib> 22using namespace llvm; 23 24MCStreamer::MCStreamer(MCContext &Ctx) : Context(Ctx), EmitEHFrame(true), 25 EmitDebugFrame(false), 26 CurrentW64UnwindInfo(0), 27 LastSymbol(0), 28 UniqueCodeBeginSuffix(0), 29 UniqueDataBeginSuffix(0) { 30 const MCSection *section = NULL; 31 SectionStack.push_back(std::make_pair(section, section)); 32} 33 34MCStreamer::~MCStreamer() { 35 for (unsigned i = 0; i < getNumW64UnwindInfos(); ++i) 36 delete W64UnwindInfos[i]; 37} 38 39const MCExpr *MCStreamer::BuildSymbolDiff(MCContext &Context, 40 const MCSymbol *A, 41 const MCSymbol *B) { 42 MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None; 43 const MCExpr *ARef = 44 MCSymbolRefExpr::Create(A, Variant, Context); 45 const MCExpr *BRef = 46 MCSymbolRefExpr::Create(B, Variant, Context); 47 const MCExpr *AddrDelta = 48 MCBinaryExpr::Create(MCBinaryExpr::Sub, ARef, BRef, Context); 49 return AddrDelta; 50} 51 52const MCExpr *MCStreamer::ForceExpAbs(const MCExpr* Expr) { 53 if (Context.getAsmInfo().hasAggressiveSymbolFolding() || 54 isa<MCSymbolRefExpr>(Expr)) 55 return Expr; 56 57 MCSymbol *ABS = Context.CreateTempSymbol(); 58 EmitAssignment(ABS, Expr); 59 return MCSymbolRefExpr::Create(ABS, Context); 60} 61 62raw_ostream &MCStreamer::GetCommentOS() { 63 // By default, discard comments. 64 return nulls(); 65} 66 67void MCStreamer::EmitDwarfSetLineAddr(int64_t LineDelta, 68 const MCSymbol *Label, int PointerSize) { 69 // emit the sequence to set the address 70 EmitIntValue(dwarf::DW_LNS_extended_op, 1); 71 EmitULEB128IntValue(PointerSize + 1); 72 EmitIntValue(dwarf::DW_LNE_set_address, 1); 73 EmitSymbolValue(Label, PointerSize); 74 75 // emit the sequence for the LineDelta (from 1) and a zero address delta. 76 MCDwarfLineAddr::Emit(this, LineDelta, 0); 77} 78 79/// EmitIntValue - Special case of EmitValue that avoids the client having to 80/// pass in a MCExpr for constant integers. 81void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size, 82 unsigned AddrSpace) { 83 assert(Size <= 8 && "Invalid size"); 84 assert((isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) && 85 "Invalid size"); 86 char buf[8]; 87 const bool isLittleEndian = Context.getAsmInfo().isLittleEndian(); 88 for (unsigned i = 0; i != Size; ++i) { 89 unsigned index = isLittleEndian ? i : (Size - i - 1); 90 buf[i] = uint8_t(Value >> (index * 8)); 91 } 92 EmitBytes(StringRef(buf, Size), AddrSpace); 93} 94 95/// EmitULEB128Value - Special case of EmitULEB128Value that avoids the 96/// client having to pass in a MCExpr for constant integers. 97void MCStreamer::EmitULEB128IntValue(uint64_t Value, unsigned AddrSpace) { 98 SmallString<32> Tmp; 99 raw_svector_ostream OSE(Tmp); 100 MCObjectWriter::EncodeULEB128(Value, OSE); 101 EmitBytes(OSE.str(), AddrSpace); 102} 103 104/// EmitSLEB128Value - Special case of EmitSLEB128Value that avoids the 105/// client having to pass in a MCExpr for constant integers. 106void MCStreamer::EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace) { 107 SmallString<32> Tmp; 108 raw_svector_ostream OSE(Tmp); 109 MCObjectWriter::EncodeSLEB128(Value, OSE); 110 EmitBytes(OSE.str(), AddrSpace); 111} 112 113void MCStreamer::EmitAbsValue(const MCExpr *Value, unsigned Size, 114 unsigned AddrSpace) { 115 const MCExpr *ABS = ForceExpAbs(Value); 116 EmitValue(ABS, Size, AddrSpace); 117} 118 119 120void MCStreamer::EmitValue(const MCExpr *Value, unsigned Size, 121 unsigned AddrSpace) { 122 EmitValueImpl(Value, Size, AddrSpace); 123} 124 125void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size, 126 unsigned AddrSpace) { 127 EmitValueImpl(MCSymbolRefExpr::Create(Sym, getContext()), Size, 128 AddrSpace); 129} 130 131void MCStreamer::EmitGPRel32Value(const MCExpr *Value) { 132 report_fatal_error("unsupported directive in streamer"); 133} 134 135/// EmitFill - Emit NumBytes bytes worth of the value specified by 136/// FillValue. This implements directives such as '.space'. 137void MCStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue, 138 unsigned AddrSpace) { 139 const MCExpr *E = MCConstantExpr::Create(FillValue, getContext()); 140 for (uint64_t i = 0, e = NumBytes; i != e; ++i) 141 EmitValue(E, 1, AddrSpace); 142} 143 144bool MCStreamer::EmitDwarfFileDirective(unsigned FileNo, 145 StringRef Filename) { 146 return getContext().GetDwarfFile(Filename, FileNo) == 0; 147} 148 149void MCStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line, 150 unsigned Column, unsigned Flags, 151 unsigned Isa, 152 unsigned Discriminator, 153 StringRef FileName) { 154 getContext().setCurrentDwarfLoc(FileNo, Line, Column, Flags, Isa, 155 Discriminator); 156} 157 158MCDwarfFrameInfo *MCStreamer::getCurrentFrameInfo() { 159 if (FrameInfos.empty()) 160 return NULL; 161 return &FrameInfos.back(); 162} 163 164void MCStreamer::EnsureValidFrame() { 165 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 166 if (!CurFrame || CurFrame->End) 167 report_fatal_error("No open frame"); 168} 169 170void MCStreamer::EmitEHSymAttributes(const MCSymbol *Symbol, 171 MCSymbol *EHSymbol) { 172} 173 174void MCStreamer::EmitLabel(MCSymbol *Symbol) { 175 assert(!Symbol->isVariable() && "Cannot emit a variable symbol!"); 176 assert(getCurrentSection() && "Cannot emit before setting section!"); 177 Symbol->setSection(*getCurrentSection()); 178 LastSymbol = Symbol; 179} 180 181void MCStreamer::EmitDataRegion() { 182 if (RegionIndicator == Data) return; 183 184 MCContext &Context = getContext(); 185 const MCAsmInfo &MAI = Context.getAsmInfo(); 186 if (!MAI.getSupportsDataRegions()) return; 187 188 // Generate a unique symbol name. 189 MCSymbol *NewSym = Context.GetOrCreateSymbol( 190 Twine(MAI.getDataBeginLabelName()) + 191 utostr(UniqueDataBeginSuffix++)); 192 EmitLabel(NewSym); 193 194 RegionIndicator = Data; 195} 196 197void MCStreamer::EmitCodeRegion() { 198 if (RegionIndicator == Code) return; 199 200 MCContext &Context = getContext(); 201 const MCAsmInfo &MAI = Context.getAsmInfo(); 202 if (!MAI.getSupportsDataRegions()) return; 203 204 // Generate a unique symbol name. 205 MCSymbol *NewSym = Context.GetOrCreateSymbol( 206 Twine(MAI.getCodeBeginLabelName()) + 207 utostr(UniqueCodeBeginSuffix++)); 208 EmitLabel(NewSym); 209 210 RegionIndicator = Code; 211} 212 213void MCStreamer::EmitJumpTable8Region() { 214 if (RegionIndicator == JumpTable8) return; 215 216 MCContext &Context = getContext(); 217 const MCAsmInfo &MAI = Context.getAsmInfo(); 218 if (!MAI.getSupportsDataRegions()) return; 219 220 // Generate a unique symbol name. 221 MCSymbol *NewSym = Context.GetOrCreateSymbol( 222 Twine(MAI.getJumpTable8BeginLabelName()) + 223 utostr(UniqueDataBeginSuffix++)); 224 EmitLabel(NewSym); 225 226 RegionIndicator = JumpTable8; 227} 228 229void MCStreamer::EmitJumpTable16Region() { 230 if (RegionIndicator == JumpTable16) return; 231 232 MCContext &Context = getContext(); 233 const MCAsmInfo &MAI = Context.getAsmInfo(); 234 if (!MAI.getSupportsDataRegions()) return; 235 236 // Generate a unique symbol name. 237 MCSymbol *NewSym = Context.GetOrCreateSymbol( 238 Twine(MAI.getJumpTable16BeginLabelName()) + 239 utostr(UniqueDataBeginSuffix++)); 240 EmitLabel(NewSym); 241 242 RegionIndicator = JumpTable16; 243} 244 245 246void MCStreamer::EmitJumpTable32Region() { 247 if (RegionIndicator == JumpTable32) return; 248 249 MCContext &Context = getContext(); 250 const MCAsmInfo &MAI = Context.getAsmInfo(); 251 if (!MAI.getSupportsDataRegions()) return; 252 253 // Generate a unique symbol name. 254 MCSymbol *NewSym = Context.GetOrCreateSymbol( 255 Twine(MAI.getJumpTable32BeginLabelName()) + 256 utostr(UniqueDataBeginSuffix++)); 257 EmitLabel(NewSym); 258 259 RegionIndicator = JumpTable32; 260} 261 262void MCStreamer::EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding) { 263 EnsureValidFrame(); 264 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 265 CurFrame->CompactUnwindEncoding = CompactUnwindEncoding; 266} 267 268void MCStreamer::EmitCFISections(bool EH, bool Debug) { 269 assert(EH || Debug); 270 EmitEHFrame = EH; 271 EmitDebugFrame = Debug; 272} 273 274void MCStreamer::EmitCFIStartProc() { 275 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 276 if (CurFrame && !CurFrame->End) 277 report_fatal_error("Starting a frame before finishing the previous one!"); 278 279 MCDwarfFrameInfo Frame; 280 Frame.Function = LastSymbol; 281 282 // If the function is externally visible, we need to create a local 283 // symbol to avoid relocations. 284 StringRef Prefix = getContext().getAsmInfo().getPrivateGlobalPrefix(); 285 if (LastSymbol && LastSymbol->getName().startswith(Prefix)) { 286 Frame.Begin = LastSymbol; 287 } else { 288 Frame.Begin = getContext().CreateTempSymbol(); 289 EmitLabel(Frame.Begin); 290 } 291 292 FrameInfos.push_back(Frame); 293 RegionIndicator = Code; 294} 295 296void MCStreamer::EmitCFIEndProc() { 297 EnsureValidFrame(); 298 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 299 CurFrame->End = getContext().CreateTempSymbol(); 300 EmitLabel(CurFrame->End); 301} 302 303void MCStreamer::EmitCFIDefCfa(int64_t Register, int64_t Offset) { 304 EnsureValidFrame(); 305 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 306 MCSymbol *Label = getContext().CreateTempSymbol(); 307 EmitLabel(Label); 308 MachineLocation Dest(MachineLocation::VirtualFP); 309 MachineLocation Source(Register, -Offset); 310 MCCFIInstruction Instruction(Label, Dest, Source); 311 CurFrame->Instructions.push_back(Instruction); 312} 313 314void MCStreamer::EmitCFIDefCfaOffset(int64_t Offset) { 315 EnsureValidFrame(); 316 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 317 MCSymbol *Label = getContext().CreateTempSymbol(); 318 EmitLabel(Label); 319 MachineLocation Dest(MachineLocation::VirtualFP); 320 MachineLocation Source(MachineLocation::VirtualFP, -Offset); 321 MCCFIInstruction Instruction(Label, Dest, Source); 322 CurFrame->Instructions.push_back(Instruction); 323} 324 325void MCStreamer::EmitCFIAdjustCfaOffset(int64_t Adjustment) { 326 EnsureValidFrame(); 327 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 328 MCSymbol *Label = getContext().CreateTempSymbol(); 329 EmitLabel(Label); 330 MachineLocation Dest(MachineLocation::VirtualFP); 331 MachineLocation Source(MachineLocation::VirtualFP, Adjustment); 332 MCCFIInstruction Instruction(MCCFIInstruction::RelMove, Label, Dest, Source); 333 CurFrame->Instructions.push_back(Instruction); 334} 335 336void MCStreamer::EmitCFIDefCfaRegister(int64_t Register) { 337 EnsureValidFrame(); 338 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 339 MCSymbol *Label = getContext().CreateTempSymbol(); 340 EmitLabel(Label); 341 MachineLocation Dest(Register); 342 MachineLocation Source(MachineLocation::VirtualFP); 343 MCCFIInstruction Instruction(Label, Dest, Source); 344 CurFrame->Instructions.push_back(Instruction); 345} 346 347void MCStreamer::EmitCFIOffset(int64_t Register, int64_t Offset) { 348 EnsureValidFrame(); 349 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 350 MCSymbol *Label = getContext().CreateTempSymbol(); 351 EmitLabel(Label); 352 MachineLocation Dest(Register, Offset); 353 MachineLocation Source(Register, Offset); 354 MCCFIInstruction Instruction(Label, Dest, Source); 355 CurFrame->Instructions.push_back(Instruction); 356} 357 358void MCStreamer::EmitCFIRelOffset(int64_t Register, int64_t Offset) { 359 EnsureValidFrame(); 360 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 361 MCSymbol *Label = getContext().CreateTempSymbol(); 362 EmitLabel(Label); 363 MachineLocation Dest(Register, Offset); 364 MachineLocation Source(Register, Offset); 365 MCCFIInstruction Instruction(MCCFIInstruction::RelMove, Label, Dest, Source); 366 CurFrame->Instructions.push_back(Instruction); 367} 368 369void MCStreamer::EmitCFIPersonality(const MCSymbol *Sym, 370 unsigned Encoding) { 371 EnsureValidFrame(); 372 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 373 CurFrame->Personality = Sym; 374 CurFrame->PersonalityEncoding = Encoding; 375} 376 377void MCStreamer::EmitCFILsda(const MCSymbol *Sym, unsigned Encoding) { 378 EnsureValidFrame(); 379 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 380 CurFrame->Lsda = Sym; 381 CurFrame->LsdaEncoding = Encoding; 382} 383 384void MCStreamer::EmitCFIRememberState() { 385 EnsureValidFrame(); 386 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 387 MCSymbol *Label = getContext().CreateTempSymbol(); 388 EmitLabel(Label); 389 MCCFIInstruction Instruction(MCCFIInstruction::Remember, Label); 390 CurFrame->Instructions.push_back(Instruction); 391} 392 393void MCStreamer::EmitCFIRestoreState() { 394 // FIXME: Error if there is no matching cfi_remember_state. 395 EnsureValidFrame(); 396 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 397 MCSymbol *Label = getContext().CreateTempSymbol(); 398 EmitLabel(Label); 399 MCCFIInstruction Instruction(MCCFIInstruction::Restore, Label); 400 CurFrame->Instructions.push_back(Instruction); 401} 402 403void MCStreamer::EmitCFISameValue(int64_t Register) { 404 EnsureValidFrame(); 405 MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo(); 406 MCSymbol *Label = getContext().CreateTempSymbol(); 407 EmitLabel(Label); 408 MCCFIInstruction Instruction(MCCFIInstruction::SameValue, Label, Register); 409 CurFrame->Instructions.push_back(Instruction); 410} 411 412void MCStreamer::setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame) { 413 W64UnwindInfos.push_back(Frame); 414 CurrentW64UnwindInfo = W64UnwindInfos.back(); 415} 416 417void MCStreamer::EnsureValidW64UnwindInfo() { 418 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 419 if (!CurFrame || CurFrame->End) 420 report_fatal_error("No open Win64 EH frame function!"); 421} 422 423void MCStreamer::EmitWin64EHStartProc(const MCSymbol *Symbol) { 424 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 425 if (CurFrame && !CurFrame->End) 426 report_fatal_error("Starting a function before ending the previous one!"); 427 MCWin64EHUnwindInfo *Frame = new MCWin64EHUnwindInfo; 428 Frame->Begin = getContext().CreateTempSymbol(); 429 Frame->Function = Symbol; 430 EmitLabel(Frame->Begin); 431 setCurrentW64UnwindInfo(Frame); 432} 433 434void MCStreamer::EmitWin64EHEndProc() { 435 EnsureValidW64UnwindInfo(); 436 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 437 if (CurFrame->ChainedParent) 438 report_fatal_error("Not all chained regions terminated!"); 439 CurFrame->End = getContext().CreateTempSymbol(); 440 EmitLabel(CurFrame->End); 441} 442 443void MCStreamer::EmitWin64EHStartChained() { 444 EnsureValidW64UnwindInfo(); 445 MCWin64EHUnwindInfo *Frame = new MCWin64EHUnwindInfo; 446 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 447 Frame->Begin = getContext().CreateTempSymbol(); 448 Frame->Function = CurFrame->Function; 449 Frame->ChainedParent = CurFrame; 450 EmitLabel(Frame->Begin); 451 setCurrentW64UnwindInfo(Frame); 452} 453 454void MCStreamer::EmitWin64EHEndChained() { 455 EnsureValidW64UnwindInfo(); 456 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 457 if (!CurFrame->ChainedParent) 458 report_fatal_error("End of a chained region outside a chained region!"); 459 CurFrame->End = getContext().CreateTempSymbol(); 460 EmitLabel(CurFrame->End); 461 CurrentW64UnwindInfo = CurFrame->ChainedParent; 462} 463 464void MCStreamer::EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind, 465 bool Except) { 466 EnsureValidW64UnwindInfo(); 467 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 468 if (CurFrame->ChainedParent) 469 report_fatal_error("Chained unwind areas can't have handlers!"); 470 CurFrame->ExceptionHandler = Sym; 471 if (!Except && !Unwind) 472 report_fatal_error("Don't know what kind of handler this is!"); 473 if (Unwind) 474 CurFrame->HandlesUnwind = true; 475 if (Except) 476 CurFrame->HandlesExceptions = true; 477} 478 479void MCStreamer::EmitWin64EHHandlerData() { 480 EnsureValidW64UnwindInfo(); 481 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 482 if (CurFrame->ChainedParent) 483 report_fatal_error("Chained unwind areas can't have handlers!"); 484} 485 486void MCStreamer::EmitWin64EHPushReg(unsigned Register) { 487 EnsureValidW64UnwindInfo(); 488 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 489 MCSymbol *Label = getContext().CreateTempSymbol(); 490 MCWin64EHInstruction Inst(Win64EH::UOP_PushNonVol, Label, Register); 491 EmitLabel(Label); 492 CurFrame->Instructions.push_back(Inst); 493} 494 495void MCStreamer::EmitWin64EHSetFrame(unsigned Register, unsigned Offset) { 496 EnsureValidW64UnwindInfo(); 497 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 498 if (CurFrame->LastFrameInst >= 0) 499 report_fatal_error("Frame register and offset already specified!"); 500 if (Offset & 0x0F) 501 report_fatal_error("Misaligned frame pointer offset!"); 502 MCWin64EHInstruction Inst(Win64EH::UOP_SetFPReg, NULL, Register, Offset); 503 CurFrame->LastFrameInst = CurFrame->Instructions.size(); 504 CurFrame->Instructions.push_back(Inst); 505} 506 507void MCStreamer::EmitWin64EHAllocStack(unsigned Size) { 508 EnsureValidW64UnwindInfo(); 509 if (Size & 7) 510 report_fatal_error("Misaligned stack allocation!"); 511 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 512 MCSymbol *Label = getContext().CreateTempSymbol(); 513 MCWin64EHInstruction Inst(Label, Size); 514 EmitLabel(Label); 515 CurFrame->Instructions.push_back(Inst); 516} 517 518void MCStreamer::EmitWin64EHSaveReg(unsigned Register, unsigned Offset) { 519 EnsureValidW64UnwindInfo(); 520 if (Offset & 7) 521 report_fatal_error("Misaligned saved register offset!"); 522 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 523 MCSymbol *Label = getContext().CreateTempSymbol(); 524 MCWin64EHInstruction Inst( 525 Offset > 512*1024-8 ? Win64EH::UOP_SaveNonVolBig : Win64EH::UOP_SaveNonVol, 526 Label, Register, Offset); 527 EmitLabel(Label); 528 CurFrame->Instructions.push_back(Inst); 529} 530 531void MCStreamer::EmitWin64EHSaveXMM(unsigned Register, unsigned Offset) { 532 EnsureValidW64UnwindInfo(); 533 if (Offset & 0x0F) 534 report_fatal_error("Misaligned saved vector register offset!"); 535 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 536 MCSymbol *Label = getContext().CreateTempSymbol(); 537 MCWin64EHInstruction Inst( 538 Offset > 512*1024-16 ? Win64EH::UOP_SaveXMM128Big : Win64EH::UOP_SaveXMM128, 539 Label, Register, Offset); 540 EmitLabel(Label); 541 CurFrame->Instructions.push_back(Inst); 542} 543 544void MCStreamer::EmitWin64EHPushFrame(bool Code) { 545 EnsureValidW64UnwindInfo(); 546 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 547 if (CurFrame->Instructions.size() > 0) 548 report_fatal_error("If present, PushMachFrame must be the first UOP"); 549 MCSymbol *Label = getContext().CreateTempSymbol(); 550 MCWin64EHInstruction Inst(Win64EH::UOP_PushMachFrame, Label, Code); 551 EmitLabel(Label); 552 CurFrame->Instructions.push_back(Inst); 553} 554 555void MCStreamer::EmitWin64EHEndProlog() { 556 EnsureValidW64UnwindInfo(); 557 MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; 558 CurFrame->PrologEnd = getContext().CreateTempSymbol(); 559 EmitLabel(CurFrame->PrologEnd); 560} 561 562void MCStreamer::EmitFnStart() { 563 errs() << "Not implemented yet\n"; 564 abort(); 565} 566 567void MCStreamer::EmitFnEnd() { 568 errs() << "Not implemented yet\n"; 569 abort(); 570} 571 572void MCStreamer::EmitCantUnwind() { 573 errs() << "Not implemented yet\n"; 574 abort(); 575} 576 577void MCStreamer::EmitHandlerData() { 578 errs() << "Not implemented yet\n"; 579 abort(); 580} 581 582void MCStreamer::EmitPersonality(const MCSymbol *Personality) { 583 errs() << "Not implemented yet\n"; 584 abort(); 585} 586 587void MCStreamer::EmitSetFP(unsigned FpReg, unsigned SpReg, int64_t Offset) { 588 errs() << "Not implemented yet\n"; 589 abort(); 590} 591 592void MCStreamer::EmitPad(int64_t Offset) { 593 errs() << "Not implemented yet\n"; 594 abort(); 595} 596 597void MCStreamer::EmitRegSave(const SmallVectorImpl<unsigned> &RegList, bool) { 598 errs() << "Not implemented yet\n"; 599 abort(); 600} 601 602/// EmitRawText - If this file is backed by an assembly streamer, this dumps 603/// the specified string in the output .s file. This capability is 604/// indicated by the hasRawTextSupport() predicate. 605void MCStreamer::EmitRawText(StringRef String) { 606 errs() << "EmitRawText called on an MCStreamer that doesn't support it, " 607 " something must not be fully mc'ized\n"; 608 abort(); 609} 610 611void MCStreamer::EmitRawText(const Twine &T) { 612 SmallString<128> Str; 613 T.toVector(Str); 614 EmitRawText(Str.str()); 615} 616 617void MCStreamer::EmitFrames(bool usingCFI) { 618 if (!getNumFrameInfos()) 619 return; 620 621 if (EmitEHFrame) 622 MCDwarfFrameEmitter::Emit(*this, usingCFI, true); 623 624 if (EmitDebugFrame) 625 MCDwarfFrameEmitter::Emit(*this, usingCFI, false); 626} 627 628void MCStreamer::EmitW64Tables() { 629 if (!getNumW64UnwindInfos()) 630 return; 631 632 MCWin64EHUnwindEmitter::Emit(*this); 633} 634