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