LLVM  10.0.0svn
MCStreamer.cpp
Go to the documentation of this file.
1 //===- lib/MC/MCStreamer.cpp - Streaming Machine Code Output --------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/MC/MCStreamer.h"
10 #include "llvm/ADT/Optional.h"
11 #include "llvm/ADT/SmallString.h"
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/ADT/Twine.h"
14 #include "llvm/BinaryFormat/COFF.h"
16 #include "llvm/MC/MCAsmBackend.h"
17 #include "llvm/MC/MCAsmInfo.h"
18 #include "llvm/MC/MCCodeView.h"
19 #include "llvm/MC/MCContext.h"
20 #include "llvm/MC/MCDwarf.h"
21 #include "llvm/MC/MCExpr.h"
22 #include "llvm/MC/MCInst.h"
23 #include "llvm/MC/MCInstPrinter.h"
25 #include "llvm/MC/MCRegister.h"
26 #include "llvm/MC/MCRegisterInfo.h"
27 #include "llvm/MC/MCSection.h"
28 #include "llvm/MC/MCSectionCOFF.h"
29 #include "llvm/MC/MCSymbol.h"
30 #include "llvm/MC/MCWin64EH.h"
31 #include "llvm/MC/MCWinEH.h"
32 #include "llvm/Support/Casting.h"
34 #include "llvm/Support/LEB128.h"
37 #include <cassert>
38 #include <cstdint>
39 #include <cstdlib>
40 #include <utility>
41 
42 using namespace llvm;
43 
45  S.setTargetStreamer(this);
46 }
47 
48 // Pin the vtables to this file.
50 
52 
54 
57  const MCExpr *Subsection,
58  raw_ostream &OS) {
59  Section->PrintSwitchToSection(
62  Subsection);
63 }
64 
66  Streamer.EmitRawText(Directive);
67 }
68 
70  SmallString<128> Str;
71  raw_svector_ostream OS(Str);
72 
73  Value->print(OS, Streamer.getContext().getAsmInfo());
74  Streamer.EmitRawText(OS.str());
75 }
76 
78  const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
79  const char *Directive = MAI->getData8bitsDirective();
80  for (const unsigned char C : Data.bytes()) {
81  SmallString<128> Str;
82  raw_svector_ostream OS(Str);
83 
84  OS << Directive << (unsigned)C;
85  Streamer.EmitRawText(OS.str());
86  }
87 }
88 
90 
92  : Context(Ctx), CurrentWinFrameInfo(nullptr),
93  UseAssemblerInfoForParsing(false) {
94  SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
95 }
96 
98 
100  DwarfFrameInfos.clear();
101  CurrentWinFrameInfo = nullptr;
102  WinFrameInfos.clear();
103  SymbolOrdering.clear();
104  SectionStack.clear();
105  SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
106 }
107 
109  // By default, discard comments.
110  return nulls();
111 }
112 
113 unsigned MCStreamer::getNumFrameInfos() { return DwarfFrameInfos.size(); }
115  return DwarfFrameInfos;
116 }
117 
118 void MCStreamer::emitRawComment(const Twine &T, bool TabPrefix) {}
119 
122 
124  for (auto &FI : DwarfFrameInfos)
125  FI.CompactUnwindEncoding =
126  (MAB ? MAB->generateCompactUnwindEncoding(FI.Instructions) : 0);
127 }
128 
129 /// EmitIntValue - Special case of EmitValue that avoids the client having to
130 /// pass in a MCExpr for constant integers.
131 void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
132  assert(1 <= Size && Size <= 8 && "Invalid size");
133  assert((isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) &&
134  "Invalid size");
135  char buf[8];
136  const bool isLittleEndian = Context.getAsmInfo()->isLittleEndian();
137  for (unsigned i = 0; i != Size; ++i) {
138  unsigned index = isLittleEndian ? i : (Size - i - 1);
139  buf[i] = uint8_t(Value >> (index * 8));
140  }
141  EmitBytes(StringRef(buf, Size));
142 }
143 
144 /// EmitULEB128IntValue - Special case of EmitULEB128Value that avoids the
145 /// client having to pass in a MCExpr for constant integers.
146 void MCStreamer::EmitULEB128IntValue(uint64_t Value, unsigned PadTo) {
147  SmallString<128> Tmp;
148  raw_svector_ostream OSE(Tmp);
149  encodeULEB128(Value, OSE, PadTo);
150  EmitBytes(OSE.str());
151 }
152 
153 /// EmitSLEB128IntValue - Special case of EmitSLEB128Value that avoids the
154 /// client having to pass in a MCExpr for constant integers.
156  SmallString<128> Tmp;
157  raw_svector_ostream OSE(Tmp);
158  encodeSLEB128(Value, OSE);
159  EmitBytes(OSE.str());
160 }
161 
162 void MCStreamer::EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc) {
163  EmitValueImpl(Value, Size, Loc);
164 }
165 
166 void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
167  bool IsSectionRelative) {
168  assert((!IsSectionRelative || Size == 4) &&
169  "SectionRelative value requires 4-bytes");
170 
171  if (!IsSectionRelative)
173  else
174  EmitCOFFSecRel32(Sym, /*Offset=*/0);
175 }
176 
178  report_fatal_error("unsupported directive in streamer");
179 }
180 
182  report_fatal_error("unsupported directive in streamer");
183 }
184 
186  report_fatal_error("unsupported directive in streamer");
187 }
188 
190  report_fatal_error("unsupported directive in streamer");
191 }
192 
194  report_fatal_error("unsupported directive in streamer");
195 }
196 
198  report_fatal_error("unsupported directive in streamer");
199 }
200 
201 /// Emit NumBytes bytes worth of the value specified by FillValue.
202 /// This implements directives such as '.space'.
203 void MCStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) {
204  emitFill(*MCConstantExpr::create(NumBytes, getContext()), FillValue);
205 }
206 
207 /// The implementation in this class just redirects to emitFill.
208 void MCStreamer::EmitZeros(uint64_t NumBytes) {
209  emitFill(NumBytes, 0);
210 }
211 
214  StringRef Filename,
215  Optional<MD5::MD5Result> Checksum,
217  unsigned CUID) {
218  return getContext().getDwarfFile(Directory, Filename, FileNo, Checksum,
219  Source, CUID);
220 }
221 
223  StringRef Filename,
224  Optional<MD5::MD5Result> Checksum,
226  unsigned CUID) {
227  getContext().setMCLineTableRootFile(CUID, Directory, Filename, Checksum,
228  Source);
229 }
230 
232  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
233  if (!CurFrame)
234  return;
235  CurFrame->IsBKeyFrame = true;
236 }
237 
238 void MCStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
239  unsigned Column, unsigned Flags,
240  unsigned Isa,
241  unsigned Discriminator,
242  StringRef FileName) {
243  getContext().setCurrentDwarfLoc(FileNo, Line, Column, Flags, Isa,
244  Discriminator);
245 }
246 
249  if (!Table.getLabel()) {
251  Table.setLabel(
252  Context.getOrCreateSymbol(Prefix + "line_table_start" + Twine(CUID)));
253  }
254  return Table.getLabel();
255 }
256 
258  return !DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End;
259 }
260 
261 MCDwarfFrameInfo *MCStreamer::getCurrentDwarfFrameInfo() {
263  getContext().reportError(SMLoc(), "this directive must appear between "
264  ".cfi_startproc and .cfi_endproc "
265  "directives");
266  return nullptr;
267  }
268  return &DwarfFrameInfos.back();
269 }
270 
271 bool MCStreamer::EmitCVFileDirective(unsigned FileNo, StringRef Filename,
272  ArrayRef<uint8_t> Checksum,
273  unsigned ChecksumKind) {
274  return getContext().getCVContext().addFile(*this, FileNo, Filename, Checksum,
275  ChecksumKind);
276 }
277 
278 bool MCStreamer::EmitCVFuncIdDirective(unsigned FunctionId) {
279  return getContext().getCVContext().recordFunctionId(FunctionId);
280 }
281 
283  unsigned IAFunc, unsigned IAFile,
284  unsigned IALine, unsigned IACol,
285  SMLoc Loc) {
286  if (getContext().getCVContext().getCVFunctionInfo(IAFunc) == nullptr) {
287  getContext().reportError(Loc, "parent function id not introduced by "
288  ".cv_func_id or .cv_inline_site_id");
289  return true;
290  }
291 
293  FunctionId, IAFunc, IAFile, IALine, IACol);
294 }
295 
296 void MCStreamer::EmitCVLocDirective(unsigned FunctionId, unsigned FileNo,
297  unsigned Line, unsigned Column,
298  bool PrologueEnd, bool IsStmt,
299  StringRef FileName, SMLoc Loc) {}
300 
301 bool MCStreamer::checkCVLocSection(unsigned FuncId, unsigned FileNo,
302  SMLoc Loc) {
304  MCCVFunctionInfo *FI = CVC.getCVFunctionInfo(FuncId);
305  if (!FI) {
307  Loc, "function id not introduced by .cv_func_id or .cv_inline_site_id");
308  return false;
309  }
310 
311  // Track the section
312  if (FI->Section == nullptr)
314  else if (FI->Section != getCurrentSectionOnly()) {
316  Loc,
317  "all .cv_loc directives for a function must be in the same section");
318  return false;
319  }
320  return true;
321 }
322 
323 void MCStreamer::EmitCVLinetableDirective(unsigned FunctionId,
324  const MCSymbol *Begin,
325  const MCSymbol *End) {}
326 
327 void MCStreamer::EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId,
328  unsigned SourceFileId,
329  unsigned SourceLineNum,
330  const MCSymbol *FnStartSym,
331  const MCSymbol *FnEndSym) {}
332 
333 /// Only call this on endian-specific types like ulittle16_t and little32_t, or
334 /// structs composed of them.
335 template <typename T>
336 static void copyBytesForDefRange(SmallString<20> &BytePrefix,
337  codeview::SymbolKind SymKind,
338  const T &DefRangeHeader) {
339  BytePrefix.resize(2 + sizeof(T));
340  codeview::ulittle16_t SymKindLE = codeview::ulittle16_t(SymKind);
341  memcpy(&BytePrefix[0], &SymKindLE, 2);
342  memcpy(&BytePrefix[2], &DefRangeHeader, sizeof(T));
343 }
344 
346  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
347  StringRef FixedSizePortion) {}
348 
350  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
352  SmallString<20> BytePrefix;
353  copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_REGISTER_REL, DRHdr);
354  EmitCVDefRangeDirective(Ranges, BytePrefix);
355 }
356 
358  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
360  SmallString<20> BytePrefix;
361  copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_SUBFIELD_REGISTER,
362  DRHdr);
363  EmitCVDefRangeDirective(Ranges, BytePrefix);
364 }
365 
367  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
369  SmallString<20> BytePrefix;
370  copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_REGISTER, DRHdr);
371  EmitCVDefRangeDirective(Ranges, BytePrefix);
372 }
373 
375  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
377  SmallString<20> BytePrefix;
378  copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_FRAMEPOINTER_REL,
379  DRHdr);
380  EmitCVDefRangeDirective(Ranges, BytePrefix);
381 }
382 
384  MCSymbol *EHSymbol) {
385 }
386 
387 void MCStreamer::InitSections(bool NoExecStack) {
388  SwitchSection(getContext().getObjectFileInfo()->getTextSection());
389 }
390 
392  assert(Fragment);
393  Symbol->setFragment(Fragment);
394 
395  // As we emit symbols into a section, track the order so that they can
396  // be sorted upon later. Zero is reserved to mean 'unemitted'.
397  SymbolOrdering[Symbol] = 1 + SymbolOrdering.size();
398 }
399 
401  Symbol->redefineIfPossible();
402 
403  if (!Symbol->isUndefined() || Symbol->isVariable())
404  return getContext().reportError(Loc, "invalid symbol redefinition");
405 
406  assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
407  assert(getCurrentSectionOnly() && "Cannot emit before setting section!");
408  assert(!Symbol->getFragment() && "Unexpected fragment on symbol data!");
409  assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
410 
411  Symbol->setFragment(&getCurrentSectionOnly()->getDummyFragment());
412 
414  if (TS)
415  TS->emitLabel(Symbol);
416 }
417 
418 void MCStreamer::EmitCFISections(bool EH, bool Debug) {
419  assert(EH || Debug);
420 }
421 
422 void MCStreamer::EmitCFIStartProc(bool IsSimple, SMLoc Loc) {
424  return getContext().reportError(
425  Loc, "starting new .cfi frame before finishing the previous one");
426 
427  MCDwarfFrameInfo Frame;
428  Frame.IsSimple = IsSimple;
429  EmitCFIStartProcImpl(Frame);
430 
431  const MCAsmInfo* MAI = Context.getAsmInfo();
432  if (MAI) {
433  for (const MCCFIInstruction& Inst : MAI->getInitialFrameState()) {
434  if (Inst.getOperation() == MCCFIInstruction::OpDefCfa ||
435  Inst.getOperation() == MCCFIInstruction::OpDefCfaRegister) {
436  Frame.CurrentCfaRegister = Inst.getRegister();
437  }
438  }
439  }
440 
441  DwarfFrameInfos.push_back(Frame);
442 }
443 
445 }
446 
448  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
449  if (!CurFrame)
450  return;
451  EmitCFIEndProcImpl(*CurFrame);
452 }
453 
455  // Put a dummy non-null value in Frame.End to mark that this frame has been
456  // closed.
457  Frame.End = (MCSymbol *)1;
458 }
459 
461  // Return a dummy non-null value so that label fields appear filled in when
462  // generating textual assembly.
463  return (MCSymbol *)1;
464 }
465 
466 void MCStreamer::EmitCFIDefCfa(int64_t Register, int64_t Offset) {
467  MCSymbol *Label = EmitCFILabel();
469  MCCFIInstruction::createDefCfa(Label, Register, Offset);
470  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
471  if (!CurFrame)
472  return;
473  CurFrame->Instructions.push_back(Instruction);
474  CurFrame->CurrentCfaRegister = static_cast<unsigned>(Register);
475 }
476 
478  MCSymbol *Label = EmitCFILabel();
481  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
482  if (!CurFrame)
483  return;
484  CurFrame->Instructions.push_back(Instruction);
485 }
486 
487 void MCStreamer::EmitCFIAdjustCfaOffset(int64_t Adjustment) {
488  MCSymbol *Label = EmitCFILabel();
490  MCCFIInstruction::createAdjustCfaOffset(Label, Adjustment);
491  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
492  if (!CurFrame)
493  return;
494  CurFrame->Instructions.push_back(Instruction);
495 }
496 
498  MCSymbol *Label = EmitCFILabel();
501  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
502  if (!CurFrame)
503  return;
504  CurFrame->Instructions.push_back(Instruction);
505  CurFrame->CurrentCfaRegister = static_cast<unsigned>(Register);
506 }
507 
508 void MCStreamer::EmitCFIOffset(int64_t Register, int64_t Offset) {
509  MCSymbol *Label = EmitCFILabel();
511  MCCFIInstruction::createOffset(Label, Register, Offset);
512  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
513  if (!CurFrame)
514  return;
515  CurFrame->Instructions.push_back(Instruction);
516 }
517 
519  MCSymbol *Label = EmitCFILabel();
521  MCCFIInstruction::createRelOffset(Label, Register, Offset);
522  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
523  if (!CurFrame)
524  return;
525  CurFrame->Instructions.push_back(Instruction);
526 }
527 
529  unsigned Encoding) {
530  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
531  if (!CurFrame)
532  return;
533  CurFrame->Personality = Sym;
534  CurFrame->PersonalityEncoding = Encoding;
535 }
536 
537 void MCStreamer::EmitCFILsda(const MCSymbol *Sym, unsigned Encoding) {
538  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
539  if (!CurFrame)
540  return;
541  CurFrame->Lsda = Sym;
542  CurFrame->LsdaEncoding = Encoding;
543 }
544 
546  MCSymbol *Label = EmitCFILabel();
548  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
549  if (!CurFrame)
550  return;
551  CurFrame->Instructions.push_back(Instruction);
552 }
553 
555  // FIXME: Error if there is no matching cfi_remember_state.
556  MCSymbol *Label = EmitCFILabel();
558  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
559  if (!CurFrame)
560  return;
561  CurFrame->Instructions.push_back(Instruction);
562 }
563 
565  MCSymbol *Label = EmitCFILabel();
567  MCCFIInstruction::createSameValue(Label, Register);
568  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
569  if (!CurFrame)
570  return;
571  CurFrame->Instructions.push_back(Instruction);
572 }
573 
575  MCSymbol *Label = EmitCFILabel();
577  MCCFIInstruction::createRestore(Label, Register);
578  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
579  if (!CurFrame)
580  return;
581  CurFrame->Instructions.push_back(Instruction);
582 }
583 
585  MCSymbol *Label = EmitCFILabel();
587  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
588  if (!CurFrame)
589  return;
590  CurFrame->Instructions.push_back(Instruction);
591 }
592 
594  MCSymbol *Label = EmitCFILabel();
597  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
598  if (!CurFrame)
599  return;
600  CurFrame->Instructions.push_back(Instruction);
601 }
602 
604  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
605  if (!CurFrame)
606  return;
607  CurFrame->IsSignalFrame = true;
608 }
609 
611  MCSymbol *Label = EmitCFILabel();
613  MCCFIInstruction::createUndefined(Label, Register);
614  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
615  if (!CurFrame)
616  return;
617  CurFrame->Instructions.push_back(Instruction);
618 }
619 
620 void MCStreamer::EmitCFIRegister(int64_t Register1, int64_t Register2) {
621  MCSymbol *Label = EmitCFILabel();
623  MCCFIInstruction::createRegister(Label, Register1, Register2);
624  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
625  if (!CurFrame)
626  return;
627  CurFrame->Instructions.push_back(Instruction);
628 }
629 
631  MCSymbol *Label = EmitCFILabel();
634  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
635  if (!CurFrame)
636  return;
637  CurFrame->Instructions.push_back(Instruction);
638 }
639 
641  MCSymbol *Label = EmitCFILabel();
643  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
644  if (!CurFrame)
645  return;
646  CurFrame->Instructions.push_back(Instruction);
647 }
648 
650  MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
651  if (!CurFrame)
652  return;
653  CurFrame->RAReg = Register;
654 }
655 
657  const MCAsmInfo *MAI = Context.getAsmInfo();
658  if (!MAI->usesWindowsCFI()) {
660  Loc, ".seh_* directives are not supported on this target");
661  return nullptr;
662  }
663  if (!CurrentWinFrameInfo || CurrentWinFrameInfo->End) {
665  Loc, ".seh_ directive must appear within an active frame");
666  return nullptr;
667  }
668  return CurrentWinFrameInfo;
669 }
670 
672  const MCAsmInfo *MAI = Context.getAsmInfo();
673  if (!MAI->usesWindowsCFI())
674  return getContext().reportError(
675  Loc, ".seh_* directives are not supported on this target");
676  if (CurrentWinFrameInfo && !CurrentWinFrameInfo->End)
678  Loc, "Starting a function before ending the previous one!");
679 
680  MCSymbol *StartProc = EmitCFILabel();
681 
682  WinFrameInfos.emplace_back(
683  std::make_unique<WinEH::FrameInfo>(Symbol, StartProc));
684  CurrentWinFrameInfo = WinFrameInfos.back().get();
685  CurrentWinFrameInfo->TextSection = getCurrentSectionOnly();
686 }
687 
689  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
690  if (!CurFrame)
691  return;
692  if (CurFrame->ChainedParent)
693  getContext().reportError(Loc, "Not all chained regions terminated!");
694 
695  MCSymbol *Label = EmitCFILabel();
696  CurFrame->End = Label;
697 }
698 
700  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
701  if (!CurFrame)
702  return;
703  if (CurFrame->ChainedParent)
704  getContext().reportError(Loc, "Not all chained regions terminated!");
705 
706  MCSymbol *Label = EmitCFILabel();
707  CurFrame->FuncletOrFuncEnd = Label;
708 }
709 
711  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
712  if (!CurFrame)
713  return;
714 
715  MCSymbol *StartProc = EmitCFILabel();
716 
717  WinFrameInfos.emplace_back(std::make_unique<WinEH::FrameInfo>(
718  CurFrame->Function, StartProc, CurFrame));
719  CurrentWinFrameInfo = WinFrameInfos.back().get();
720  CurrentWinFrameInfo->TextSection = getCurrentSectionOnly();
721 }
722 
724  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
725  if (!CurFrame)
726  return;
727  if (!CurFrame->ChainedParent)
728  return getContext().reportError(
729  Loc, "End of a chained region outside a chained region!");
730 
731  MCSymbol *Label = EmitCFILabel();
732 
733  CurFrame->End = Label;
734  CurrentWinFrameInfo = const_cast<WinEH::FrameInfo *>(CurFrame->ChainedParent);
735 }
736 
737 void MCStreamer::EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except,
738  SMLoc Loc) {
739  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
740  if (!CurFrame)
741  return;
742  if (CurFrame->ChainedParent)
743  return getContext().reportError(
744  Loc, "Chained unwind areas can't have handlers!");
745  CurFrame->ExceptionHandler = Sym;
746  if (!Except && !Unwind)
747  getContext().reportError(Loc, "Don't know what kind of handler this is!");
748  if (Unwind)
749  CurFrame->HandlesUnwind = true;
750  if (Except)
751  CurFrame->HandlesExceptions = true;
752 }
753 
755  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
756  if (!CurFrame)
757  return;
758  if (CurFrame->ChainedParent)
759  getContext().reportError(Loc, "Chained unwind areas can't have handlers!");
760 }
761 
763  const MCSymbolRefExpr *To, uint64_t Count) {
764 }
765 
766 static MCSection *getWinCFISection(MCContext &Context, unsigned *NextWinCFIID,
767  MCSection *MainCFISec,
768  const MCSection *TextSec) {
769  // If this is the main .text section, use the main unwind info section.
770  if (TextSec == Context.getObjectFileInfo()->getTextSection())
771  return MainCFISec;
772 
773  const auto *TextSecCOFF = cast<MCSectionCOFF>(TextSec);
774  auto *MainCFISecCOFF = cast<MCSectionCOFF>(MainCFISec);
775  unsigned UniqueID = TextSecCOFF->getOrAssignWinCFISectionID(NextWinCFIID);
776 
777  // If this section is COMDAT, this unwind section should be COMDAT associative
778  // with its group.
779  const MCSymbol *KeySym = nullptr;
780  if (TextSecCOFF->getCharacteristics() & COFF::IMAGE_SCN_LNK_COMDAT) {
781  KeySym = TextSecCOFF->getCOMDATSymbol();
782 
783  // In a GNU environment, we can't use associative comdats. Instead, do what
784  // GCC does, which is to make plain comdat selectany section named like
785  // ".[px]data$_Z3foov".
786  if (!Context.getAsmInfo()->hasCOFFAssociativeComdats()) {
787  std::string SectionName =
788  (MainCFISecCOFF->getSectionName() + "$" +
789  TextSecCOFF->getSectionName().split('$').second)
790  .str();
791  return Context.getCOFFSection(
792  SectionName,
793  MainCFISecCOFF->getCharacteristics() | COFF::IMAGE_SCN_LNK_COMDAT,
794  MainCFISecCOFF->getKind(), "", COFF::IMAGE_COMDAT_SELECT_ANY);
795  }
796  }
797 
798  return Context.getAssociativeCOFFSection(MainCFISecCOFF, KeySym, UniqueID);
799 }
800 
802  return getWinCFISection(getContext(), &NextWinCFIID,
803  getContext().getObjectFileInfo()->getPDataSection(),
804  TextSec);
805 }
806 
808  return getWinCFISection(getContext(), &NextWinCFIID,
809  getContext().getObjectFileInfo()->getXDataSection(),
810  TextSec);
811 }
812 
814 
815 static unsigned encodeSEHRegNum(MCContext &Ctx, MCRegister Reg) {
816  return Ctx.getRegisterInfo()->getSEHRegNum(Reg);
817 }
818 
820  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
821  if (!CurFrame)
822  return;
823 
824  MCSymbol *Label = EmitCFILabel();
825 
827  Label, encodeSEHRegNum(Context, Register));
828  CurFrame->Instructions.push_back(Inst);
829 }
830 
832  SMLoc Loc) {
833  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
834  if (!CurFrame)
835  return;
836  if (CurFrame->LastFrameInst >= 0)
837  return getContext().reportError(
838  Loc, "frame register and offset can be set at most once");
839  if (Offset & 0x0F)
840  return getContext().reportError(Loc, "offset is not a multiple of 16");
841  if (Offset > 240)
842  return getContext().reportError(
843  Loc, "frame offset must be less than or equal to 240");
844 
845  MCSymbol *Label = EmitCFILabel();
846 
848  Label, encodeSEHRegNum(getContext(), Register), Offset);
849  CurFrame->LastFrameInst = CurFrame->Instructions.size();
850  CurFrame->Instructions.push_back(Inst);
851 }
852 
854  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
855  if (!CurFrame)
856  return;
857  if (Size == 0)
858  return getContext().reportError(Loc,
859  "stack allocation size must be non-zero");
860  if (Size & 7)
861  return getContext().reportError(
862  Loc, "stack allocation size is not a multiple of 8");
863 
864  MCSymbol *Label = EmitCFILabel();
865 
867  CurFrame->Instructions.push_back(Inst);
868 }
869 
871  SMLoc Loc) {
872  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
873  if (!CurFrame)
874  return;
875 
876  if (Offset & 7)
877  return getContext().reportError(
878  Loc, "register save offset is not 8 byte aligned");
879 
880  MCSymbol *Label = EmitCFILabel();
881 
883  Label, encodeSEHRegNum(Context, Register), Offset);
884  CurFrame->Instructions.push_back(Inst);
885 }
886 
888  SMLoc Loc) {
889  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
890  if (!CurFrame)
891  return;
892  if (Offset & 0x0F)
893  return getContext().reportError(Loc, "offset is not a multiple of 16");
894 
895  MCSymbol *Label = EmitCFILabel();
896 
898  Label, encodeSEHRegNum(Context, Register), Offset);
899  CurFrame->Instructions.push_back(Inst);
900 }
901 
903  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
904  if (!CurFrame)
905  return;
906  if (!CurFrame->Instructions.empty())
907  return getContext().reportError(
908  Loc, "If present, PushMachFrame must be the first UOP");
909 
910  MCSymbol *Label = EmitCFILabel();
911 
913  CurFrame->Instructions.push_back(Inst);
914 }
915 
917  WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
918  if (!CurFrame)
919  return;
920 
921  MCSymbol *Label = EmitCFILabel();
922 
923  CurFrame->PrologEnd = Label;
924 }
925 
927 
929 
931 
933 
935 
936 /// EmitRawText - If this file is backed by an assembly streamer, this dumps
937 /// the specified string in the output .s file. This capability is
938 /// indicated by the hasRawTextSupport() predicate.
940  // This is not llvm_unreachable for the sake of out of tree backend
941  // developers who may not have assembly streamers and should serve as a
942  // reminder to not accidentally call EmitRawText in the absence of such.
943  report_fatal_error("EmitRawText called on an MCStreamer that doesn't support "
944  "it (target backend is likely missing an AsmStreamer "
945  "implementation)");
946 }
947 
949  SmallString<128> Str;
951 }
952 
954 }
955 
957  if ((!DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End) ||
958  (!WinFrameInfos.empty() && !WinFrameInfos.back()->End)) {
959  getContext().reportError(SMLoc(), "Unfinished frame!");
960  return;
961  }
962 
964  if (TS)
965  TS->finish();
966 
967  FinishImpl();
968 }
969 
971  visitUsedExpr(*Value);
972  Symbol->setVariableValue(Value);
973 
975  if (TS)
976  TS->emitAssignment(Symbol, Value);
977 }
978 
980  raw_ostream &OS, const MCInst &Inst,
981  const MCSubtargetInfo &STI) {
982  InstPrinter.printInst(&Inst, OS, "", STI);
983 }
984 
986 }
987 
989  switch (Expr.getKind()) {
990  case MCExpr::Target:
991  cast<MCTargetExpr>(Expr).visitUsedExpr(*this);
992  break;
993 
994  case MCExpr::Constant:
995  break;
996 
997  case MCExpr::Binary: {
998  const MCBinaryExpr &BE = cast<MCBinaryExpr>(Expr);
999  visitUsedExpr(*BE.getLHS());
1000  visitUsedExpr(*BE.getRHS());
1001  break;
1002  }
1003 
1004  case MCExpr::SymbolRef:
1005  visitUsedSymbol(cast<MCSymbolRefExpr>(Expr).getSymbol());
1006  break;
1007 
1008  case MCExpr::Unary:
1009  visitUsedExpr(*cast<MCUnaryExpr>(Expr).getSubExpr());
1010  break;
1011  }
1012 }
1013 
1015  // Scan for values.
1016  for (unsigned i = Inst.getNumOperands(); i--;)
1017  if (Inst.getOperand(i).isExpr())
1018  visitUsedExpr(*Inst.getOperand(i).getExpr());
1019 }
1020 
1022  unsigned Size) {
1023  // Get the Hi-Lo expression.
1024  const MCExpr *Diff =
1026  MCSymbolRefExpr::create(Lo, Context), Context);
1027 
1028  const MCAsmInfo *MAI = Context.getAsmInfo();
1029  if (!MAI->doesSetDirectiveSuppressReloc()) {
1030  EmitValue(Diff, Size);
1031  return;
1032  }
1033 
1034  // Otherwise, emit with .set (aka assignment).
1035  MCSymbol *SetLabel = Context.createTempSymbol("set", true);
1036  EmitAssignment(SetLabel, Diff);
1037  EmitSymbolValue(SetLabel, Size);
1038 }
1039 
1041  const MCSymbol *Lo) {
1042  // Get the Hi-Lo expression.
1043  const MCExpr *Diff =
1045  MCSymbolRefExpr::create(Lo, Context), Context);
1046 
1047  EmitULEB128Value(Diff);
1048 }
1049 
1052 void MCStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
1054  llvm_unreachable("this directive only supported on COFF targets");
1055 }
1057  llvm_unreachable("this directive only supported on COFF targets");
1058 }
1061  llvm_unreachable("this directive only supported on COFF targets");
1062 }
1064  llvm_unreachable("this directive only supported on COFF targets");
1065 }
1067  unsigned ByteAlign) {
1068  llvm_unreachable("this directive only supported on XCOFF targets");
1069 }
1072  const MCSymbol *Aliasee) {}
1074  unsigned ByteAlignment) {}
1076  uint64_t Size, unsigned ByteAlignment) {}
1081 void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) {
1082  visitUsedExpr(*Value);
1083 }
1086 void MCStreamer::emitFill(const MCExpr &NumBytes, uint64_t Value, SMLoc Loc) {}
1087 void MCStreamer::emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
1088  SMLoc Loc) {}
1090  unsigned ValueSize,
1091  unsigned MaxBytesToEmit) {}
1093  unsigned MaxBytesToEmit) {}
1095  SMLoc Loc) {}
1096 void MCStreamer::EmitBundleAlignMode(unsigned AlignPow2) {}
1097 void MCStreamer::EmitBundleLock(bool AlignToEnd) {}
1100 
1102  assert(Section && "Cannot switch to a null section!");
1103  MCSectionSubPair curSection = SectionStack.back().first;
1104  SectionStack.back().second = curSection;
1105  if (MCSectionSubPair(Section, Subsection) != curSection) {
1106  ChangeSection(Section, Subsection);
1107  SectionStack.back().first = MCSectionSubPair(Section, Subsection);
1108  assert(!Section->hasEnded() && "Section already ended");
1109  MCSymbol *Sym = Section->getBeginSymbol();
1110  if (Sym && !Sym->isInSection())
1111  EmitLabel(Sym);
1112  }
1113 }
1114 
1116  // TODO: keep track of the last subsection so that this symbol appears in the
1117  // correct place.
1118  MCSymbol *Sym = Section->getEndSymbol(Context);
1119  if (Sym->isInSection())
1120  return Sym;
1121 
1122  SwitchSection(Section);
1123  EmitLabel(Sym);
1124  return Sym;
1125 }
1126 
1128  const VersionTuple &SDKVersion) {
1129  if (!Target.isOSBinFormatMachO() || !Target.isOSDarwin())
1130  return;
1131  // Do we even know the version?
1132  if (Target.getOSMajorVersion() == 0)
1133  return;
1134 
1135  unsigned Major;
1136  unsigned Minor;
1137  unsigned Update;
1138  if (Target.isMacCatalystEnvironment()) {
1139  // Mac Catalyst always uses the build version load command.
1140  Target.getiOSVersion(Major, Minor, Update);
1141  assert(Major && "A non-zero major version is expected");
1142  EmitBuildVersion(MachO::PLATFORM_MACCATALYST, Major, Minor, Update,
1143  SDKVersion);
1144  return;
1145  }
1146 
1147  MCVersionMinType VersionType;
1148  if (Target.isWatchOS()) {
1149  VersionType = MCVM_WatchOSVersionMin;
1150  Target.getWatchOSVersion(Major, Minor, Update);
1151  } else if (Target.isTvOS()) {
1152  VersionType = MCVM_TvOSVersionMin;
1153  Target.getiOSVersion(Major, Minor, Update);
1154  } else if (Target.isMacOSX()) {
1155  VersionType = MCVM_OSXVersionMin;
1156  if (!Target.getMacOSXVersion(Major, Minor, Update))
1157  Major = 0;
1158  } else {
1159  VersionType = MCVM_IOSVersionMin;
1160  Target.getiOSVersion(Major, Minor, Update);
1161  }
1162  if (Major != 0)
1163  EmitVersionMin(VersionType, Major, Minor, Update, SDKVersion);
1164 }
virtual void EmitBundleUnlock()
Ends a bundle-locked group.
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag)
Note in the output the specified Flag.
const MCAsmInfo * getAsmInfo() const
Definition: MCContext.h:318
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName)
This implements the DWARF2 &#39;.loc fileno lineno ...&#39; assembler directive.
Definition: MCStreamer.cpp:238
uint64_t CallInst * C
virtual void EmitBundleAlignMode(unsigned AlignPow2)
Set the bundle alignment mode from now on in the section.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
Definition: Triple.h:481
Profile::FuncID FuncId
Definition: Profile.cpp:321
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
bool doesSetDirectiveSuppressReloc() const
Definition: MCAsmInfo.h:545
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:1114
MCStreamer(MCContext &Ctx)
Definition: MCStreamer.cpp:91
bool usesWindowsCFI() const
Definition: MCAsmInfo.h:607
virtual void EmitCFISameValue(int64_t Register)
Definition: MCStreamer.cpp:564
virtual void EmitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol *>> Ranges, StringRef FixedSizePortion)
This implements the CodeView &#39;.cv_def_range&#39; assembler directive.
Definition: MCStreamer.cpp:345
virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding)
Definition: MCStreamer.cpp:528
virtual void EmitSLEB128Value(const MCExpr *Value)
virtual void EmitCFIGnuArgsSize(int64_t Size)
Definition: MCStreamer.cpp:593
LLVMContext & Context
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:22
void EmitRawText(const Twine &String)
If this file is backed by a assembly streamer, this dumps the specified string in the output ...
Definition: MCStreamer.cpp:948
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:329
void EmitSLEB128IntValue(int64_t Value)
Special case of EmitSLEB128Value that avoids the client having to pass in a MCExpr for constant integ...
Definition: MCStreamer.cpp:155
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:139
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool isVariable() const
isVariable - Check if this is a variable symbol.
Definition: MCSymbol.h:297
void EmitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
Definition: MCStreamer.cpp:166
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
Definition: Triple.h:453
virtual void emitValueToOffset(const MCExpr *Offset, unsigned char Value, SMLoc Loc)
Emit some number of copies of Value until the byte offset Offset is reached.
virtual void emitELFSymverDirective(StringRef AliasName, const MCSymbol *Aliasee)
Emit an ELF .symver directive.
virtual void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, const MCSubtargetInfo &STI)=0
Print the specified MCInst to the specified raw_ostream.
virtual void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment=0)
Emit a thread local bss (.tbss) symbol.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
void redefineIfPossible()
Prepare this symbol to be redefined.
Definition: MCSymbol.h:231
virtual void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:671
virtual void EndCOFFSymbolDef()
Marks the end of the symbol definition.
virtual void EmitBuildVersion(unsigned Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Emit/Specify Mach-O build version command.
Definition: MCStreamer.h:466
MCSection * Section
The section of the first .cv_loc directive used for this function, or null if none has been seen yet...
Definition: MCCodeView.h:111
const MCSymbol * End
Definition: MCWinEH.h:33
.watchos_version_min
Definition: MCDirectives.h:69
virtual void EmitULEB128Value(const MCExpr *Value)
static MCCFIInstruction createRememberState(MCSymbol *L)
.cfi_remember_state Save all current rules for all registers.
Definition: MCDwarf.h:557
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol)
Emit an weak reference from Alias to Symbol.
void push_back(const T &Elt)
Definition: SmallVector.h:211
static WinEH::Instruction SaveNonVol(MCSymbol *L, unsigned Reg, unsigned Offset)
Definition: MCWin64EH.h:36
virtual void EmitBytes(StringRef Data)
Emit the bytes in Data into the output.
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
Definition: MCDwarf.h:507
Target specific streamer interface.
Definition: MCStreamer.h:91
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
Definition: Twine.h:455
unsigned Reg
.ios_version_min
Definition: MCDirectives.h:66
virtual void reset()
State management.
Definition: MCStreamer.cpp:99
unsigned CurrentCfaRegister
Definition: MCDwarf.h:614
virtual void EmitWindowsUnwindTables()
Definition: MCStreamer.cpp:953
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol)
Start emitting COFF symbol definition.
virtual Expected< unsigned > tryEmitDwarfFileDirective(unsigned FileNo, StringRef Directory, StringRef Filename, Optional< MD5::MD5Result > Checksum=None, Optional< StringRef > Source=None, unsigned CUID=0)
Associate a filename with a specified logical file number.
Definition: MCStreamer.cpp:213
virtual void EmitDTPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a dtprel (64-bit DTP relative) value.
Definition: MCStreamer.cpp:177
bool isWatchOS() const
Is this an Apple watchOS triple.
Definition: Triple.h:472
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
Definition: MCExpr.h:570
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:530
virtual void EmitCFIRegister(int64_t Register1, int64_t Register2)
Definition: MCStreamer.cpp:620
virtual void emitExplicitComments()
Emit added explicit comments.
Definition: MCStreamer.cpp:121
virtual void emitValue(const MCExpr *Value)
Definition: MCStreamer.cpp:69
.macosx_version_min
Definition: MCDirectives.h:67
virtual void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo)
Emit the absolute difference between two symbols encoded with ULEB128.
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
Definition: Endian.h:272
virtual void EmitCFIDefCfaOffset(int64_t Offset)
Definition: MCStreamer.cpp:477
virtual MCSymbol * getDwarfLineTableSymbol(unsigned CUID)
Definition: MCStreamer.cpp:247
StringRef getPrivateGlobalPrefix() const
Definition: MCAsmInfo.h:508
static MCCFIInstruction createDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA.
Definition: MCDwarf.h:494
COFF::SymbolStorageClass StorageClass
Definition: COFFYAML.cpp:356
virtual void EmitCOFFSymbolStorageClass(int StorageClass)
Emit the storage class of the symbol.
std::vector< Instruction > Instructions
Definition: MCWinEH.h:46
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Emit the expression Value into the output as a native integer of the given Size bytes.
unsigned LsdaEncoding
Definition: MCDwarf.h:616
virtual void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset)
Emits a COFF image relative relocation.
Definition: MCStreamer.cpp:934
static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int Adjustment)
.cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but Offset is a relative value that is added/subt...
Definition: MCDwarf.h:501
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)
Definition: MCCodeView.cpp:46
MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, SectionKind Kind, StringRef COMDATSymName, int Selection, unsigned UniqueID=GenericSectionID, const char *BeginSymName=nullptr)
Definition: MCContext.cpp:434
virtual void addExplicitComment(const Twine &T)
Add explicit comment T.
Definition: MCStreamer.cpp:120
virtual void EmitCFISections(bool EH, bool Debug)
Definition: MCStreamer.cpp:418
virtual void EmitGPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a gprel32 (32-bit GP relative) value.
Definition: MCStreamer.cpp:197
MCSectionCOFF * getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym, unsigned UniqueID=GenericSectionID)
Gets or creates a section equivalent to Sec that is associated with the section containing KeySym...
Definition: MCContext.cpp:474
std::vector< MCCFIInstruction > Instructions
Definition: MCDwarf.h:613
static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register)
.cfi_undefined From now on the previous value of Register can&#39;t be restored anymore.
Definition: MCDwarf.h:546
virtual void EmitCFIRememberState()
Definition: MCStreamer.cpp:545
MCContext & getContext() const
Definition: MCStreamer.h:258
unsigned getNumFrameInfos()
Definition: MCStreamer.cpp:113
virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding)
Definition: MCStreamer.cpp:537
static unsigned encodeSEHRegNum(MCContext &Ctx, MCRegister Reg)
Definition: MCStreamer.cpp:815
virtual void EmitGPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a gprel64 (64-bit GP relative) value.
Definition: MCStreamer.cpp:193
void AssignFragment(MCSymbol *Symbol, MCFragment *Fragment)
Sets the symbol&#39;s section.
Definition: MCStreamer.cpp:391
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
virtual void EmitWinCFIEndProc(SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:688
virtual void EmitCFIEscape(StringRef Values)
Definition: MCStreamer.cpp:584
bool isMacCatalystEnvironment() const
Definition: Triple.h:489
virtual void EmitCOFFSymbolType(int Type)
Emit the type of the symbol.
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
Definition: MCSymbol.h:253
virtual void EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:737
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:169
const MCSymbol * Lsda
Definition: MCDwarf.h:612
void setFragment(MCFragment *F) const
Mark the symbol as defined in the fragment F.
Definition: MCSymbol.h:274
iterator_range< const unsigned char * > bytes() const
Definition: StringRef.h:125
virtual uint32_t generateCompactUnwindEncoding(ArrayRef< MCCFIInstruction >) const
Generate the compact unwind encoding for the CFI instructions.
Definition: MCAsmBackend.h:179
Tagged union holding either a T or a Error.
Definition: yaml2obj.h:21
virtual void EmitWinCFISetFrame(MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:831
virtual void emitLabel(MCSymbol *Symbol)
Definition: MCStreamer.cpp:51
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame)
Definition: MCStreamer.cpp:444
virtual ~MCStreamer()
Definition: MCStreamer.cpp:97
MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID)
Definition: MCContext.h:558
MCSymbol * getEndSymbol(MCContext &Ctx)
Definition: MCSection.cpp:28
virtual void EmitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt, StringRef FileName, SMLoc Loc)
This implements the CodeView &#39;.cv_loc&#39; assembler directive.
Definition: MCStreamer.cpp:296
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
Definition: MCStreamer.cpp:970
virtual void EmitWinCFIStartChained(SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:710
Context object for machine code objects.
Definition: MCContext.h:65
Expected< unsigned > getDwarfFile(StringRef Directory, StringRef FileName, unsigned FileNumber, Optional< MD5::MD5Result > Checksum, Optional< StringRef > Source, unsigned CUID)
Creates an entry in the dwarf file and directory tables.
Definition: MCContext.cpp:647
virtual bool EmitCVFileDirective(unsigned FileNo, StringRef Filename, ArrayRef< uint8_t > Checksum, unsigned ChecksumKind)
Associate a filename with a specified logical file number, and also specify that file&#39;s checksum info...
Definition: MCStreamer.cpp:271
static WinEH::Instruction PushNonVol(MCSymbol *L, unsigned Reg)
Definition: MCWin64EH.h:26
bool hasEnded() const
Definition: MCSection.cpp:34
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:552
virtual void finish()
Definition: MCStreamer.cpp:53
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Definition: MCExpr.h:573
virtual void EmitWinCFISaveXMM(MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:887
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame)
Definition: MCStreamer.cpp:454
ArrayRef< MCDwarfFrameInfo > getDwarfFrameInfos() const
Definition: MCStreamer.cpp:114
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
virtual void EmitTPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a tprel (64-bit TP relative) value.
Definition: MCStreamer.cpp:185
virtual void EmitWinCFISaveReg(MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:870
virtual void emitRawComment(const Twine &T, bool TabPrefix=true)
Print T and prefix it with the comment string (normally #) and optionally a tab.
Definition: MCStreamer.cpp:118
virtual void EmitBinaryData(StringRef Data)
Functionally identical to EmitBytes.
const MCExpr * getExpr() const
Definition: MCInst.h:95
virtual void EmitCFIRestoreState()
Definition: MCStreamer.cpp:554
virtual void EmitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers...
Definition: MCStreamer.cpp:131
void EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:162
Unary expressions.
Definition: MCExpr.h:41
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false)
Definition: MCExpr.cpp:169
virtual void EmitCFIRestore(int64_t Register)
Definition: MCStreamer.cpp:574
const char * getData8bitsDirective() const
Definition: MCAsmInfo.h:425
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:131
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
virtual void EmitBundleLock(bool AlignToEnd)
The following instructions are a bundle-locked group.
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment)
Emit a local common (.lcomm) symbol.
static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register)
.cfi_same_value Current value of Register is the same as in the previous frame.
Definition: MCDwarf.h:552
virtual raw_ostream & GetCommentOS()
Return a raw_ostream that comments can be written to.
Definition: MCStreamer.cpp:108
void EmitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
Definition: MCStreamer.cpp:208
static MCCFIInstruction createNegateRAState(MCSymbol *L)
.cfi_negate_ra_state AArch64 negate RA state.
Definition: MCDwarf.h:533
Streaming machine code generation interface.
Definition: MCStreamer.h:196
virtual void EmitWinCFIFuncletOrFuncEnd(SMLoc Loc=SMLoc())
This is used on platforms, such as Windows on ARM64, that require function or funclet sizes to be emi...
Definition: MCStreamer.cpp:699
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
Definition: MCContext.cpp:225
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
Definition: MCExpr.cpp:42
const FrameInfo * ChainedParent
Definition: MCWinEH.h:45
MCTargetStreamer * getTargetStreamer()
Definition: MCStreamer.h:265
static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it...
Definition: MCDwarf.h:480
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
virtual void EmitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart, const MCSymbol *FnEnd)
This implements the CodeView &#39;.cv_linetable&#39; assembler directive.
Definition: MCStreamer.cpp:323
.tvos_version_min
Definition: MCDirectives.h:68
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA.
Definition: MCDwarf.h:487
virtual void EmitWinCFIPushReg(MCRegister Register, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:819
static MCCFIInstruction createWindowSave(MCSymbol *L)
.cfi_window_save SPARC register window is saved.
Definition: MCDwarf.h:528
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int Size)
A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE.
Definition: MCDwarf.h:573
static WinEH::Instruction PushMachFrame(MCSymbol *L, bool Code)
Definition: MCWin64EH.h:33
MCSection * getAssociatedPDataSection(const MCSection *TextSec)
Get the .pdata section used for the given section.
Definition: MCStreamer.cpp:801
virtual void EmitSyntaxDirective()
Definition: MCStreamer.cpp:813
virtual void EmitXCOFFLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment)
Emits an lcomm directive with XCOFF csect information.
virtual void EmitCFIDefCfaRegister(int64_t Register)
Definition: MCStreamer.cpp:497
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
int getSEHRegNum(MCRegister RegNum) const
Map a target register to an equivalent SEH register number.
void getWatchOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getWatchOSVersion - Parse the version number as with getOSVersion.
Definition: Triple.cpp:1140
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:322
void reportError(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:687
static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_rel_offset Previous value of Register is saved at offset Offset from the current CFA register...
Definition: MCDwarf.h:515
bool isExpr() const
Definition: MCInst.h:60
static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register)
.cfi_restore says that the rule for Register is now the same as it was at the beginning of the functi...
Definition: MCDwarf.h:540
virtual void EmitRawTextImpl(StringRef String)
EmitRawText - If this file is backed by an assembly streamer, this dumps the specified string in the ...
Definition: MCStreamer.cpp:939
virtual void EmitWinEHHandlerData(SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:754
unsigned getNumOperands() const
Definition: MCInst.h:181
unsigned size() const
Definition: DenseMap.h:99
virtual void EmitCFIUndefined(int64_t Register)
Definition: MCStreamer.cpp:610
virtual void EmitCFINegateRAState()
Definition: MCStreamer.cpp:640
unsigned PersonalityEncoding
Definition: MCDwarf.h:615
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:633
static WinEH::Instruction SetFPReg(MCSymbol *L, unsigned Reg, unsigned Off)
Definition: MCWin64EH.h:48
void Finish()
Finish emission of machine code.
Definition: MCStreamer.cpp:956
virtual void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol)
Definition: MCStreamer.cpp:383
virtual void EmitWinCFIEndChained(SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:723
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
Definition: MathExtras.h:434
static MCCFIInstruction createRestoreState(MCSymbol *L)
.cfi_restore_state Restore the previously saved state.
Definition: MCDwarf.h:562
Binary assembler expressions.
Definition: MCExpr.h:423
virtual void emitDwarfFile0Directive(StringRef Directory, StringRef Filename, Optional< MD5::MD5Result > Checksum, Optional< StringRef > Source, unsigned CUID=0)
Specify the "root" file of the compilation, using the ".file 0" extension.
Definition: MCStreamer.cpp:222
virtual void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const =0
unsigned getOSMajorVersion() const
getOSMajorVersion - Return just the major version number, this is specialized because it is a common ...
Definition: Triple.h:338
virtual void EmitCOFFSafeSEH(MCSymbol const *Symbol)
Definition: MCStreamer.cpp:926
void generateCompactUnwindEncodings(MCAsmBackend *MAB)
Definition: MCStreamer.cpp:123
MCCVFunctionInfo * getCVFunctionInfo(unsigned FuncId)
Retreive the function info if this is a valid function id, or nullptr.
Definition: MCCodeView.cpp:78
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
static MCSection * getWinCFISection(MCContext &Context, unsigned *NextWinCFIID, MCSection *MainCFISec, const MCSection *TextSec)
Definition: MCStreamer.cpp:766
virtual void EmitWinCFIPushFrame(bool Code, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:902
static void copyBytesForDefRange(SmallString< 20 > &BytePrefix, codeview::SymbolKind SymKind, const T &DefRangeHeader)
Only call this on endian-specific types like ulittle16_t and little32_t, or structs composed of them...
Definition: MCStreamer.cpp:336
const std::vector< MCCFIInstruction > & getInitialFrameState() const
Definition: MCAsmInfo.h:626
static WinEH::Instruction SaveXMM(MCSymbol *L, unsigned Reg, unsigned Offset)
Definition: MCWin64EH.h:42
virtual void EmitTPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a tprel (32-bit TP relative) value.
Definition: MCStreamer.cpp:189
const MCSymbol * PrologEnd
Definition: MCWinEH.h:37
virtual void InitSections(bool NoExecStack)
Create the default sections and set the initial one.
Definition: MCStreamer.cpp:387
virtual void EmitCFIReturnColumn(int64_t Register)
Definition: MCStreamer.cpp:649
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
Definition: MCStreamer.h:64
BlockVerifier::State From
bool getMacOSXVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getMacOSXVersion - Parse the version number as with getOSVersion and then translate generic "darwin" ...
Definition: Triple.cpp:1073
virtual void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size)
Emit the absolute difference between two symbols.
virtual void EmitCOFFSymbolIndex(MCSymbol const *Symbol)
Emits the symbol table index of a Symbol into the current section.
Definition: MCStreamer.cpp:928
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
Definition: LEB128.h:80
ExprKind getKind() const
Definition: MCExpr.h:68
virtual void EmitCFIOffset(int64_t Register, int64_t Offset)
Definition: MCStreamer.cpp:508
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
Definition: MCSymbol.h:258
MCFragment * getFragment(bool SetUsed=true) const
Definition: MCSymbol.h:396
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
Definition: LEB128.h:23
const MCSection * TextSection
Definition: MCWinEH.h:39
virtual void EmitWinCFIEndProlog(SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:916
static WinEH::Instruction Alloc(MCSymbol *L, unsigned Size)
Definition: MCWin64EH.h:29
virtual void EmitCodeAlignment(unsigned ByteAlignment, unsigned MaxBytesToEmit=0)
Emit nops until the byte alignment ByteAlignment is reached.
const MCOperand & getOperand(unsigned i) const
Definition: MCInst.h:179
virtual void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:853
virtual void EmitVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Specify the Mach-O minimum deployment target version.
Definition: MCStreamer.h:460
MCStreamer & Streamer
Definition: MCStreamer.h:93
Promote Memory to Register
Definition: Mem2Reg.cpp:109
virtual void EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
This implements the CodeView &#39;.cv_inline_linetable&#39; assembler directive.
Definition: MCStreamer.cpp:327
MCSymbol * getBeginSymbol()
Definition: MCSection.h:110
const Triple & getTargetTriple() const
virtual void prettyPrintAsm(MCInstPrinter &InstPrinter, raw_ostream &OS, const MCInst &Inst, const MCSubtargetInfo &STI)
Definition: MCStreamer.cpp:979
StringRef str()
Return a StringRef for the vector contents.
Definition: raw_ostream.h:555
void EmitULEB128IntValue(uint64_t Value, unsigned PadTo=0)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
Definition: MCStreamer.cpp:146
virtual void ChangeSection(MCSection *, const MCExpr *)
Update streamer for a new active section.
void setVariableValue(const MCExpr *Value)
Definition: MCSymbol.cpp:48
bool hasUnfinishedDwarfFrameInfo()
Definition: MCStreamer.cpp:257
virtual void changeSection(const MCSection *CurSection, MCSection *Section, const MCExpr *SubSection, raw_ostream &OS)
Update streamer for a new active section.
Definition: MCStreamer.cpp:55
const MCSymbol * Function
Definition: MCWinEH.h:36
Target - Wrapper for Target specific information.
MCSection * getCurrentSectionOnly() const
Definition: MCStreamer.h:351
void visitUsedExpr(const MCExpr &Expr)
Definition: MCStreamer.cpp:988
bool checkCVLocSection(unsigned FuncId, unsigned FileNo, SMLoc Loc)
Returns true if the the .cv_loc directive is in the right section.
Definition: MCStreamer.cpp:301
MCTargetStreamer(MCStreamer &S)
Definition: MCStreamer.cpp:44
virtual MCSymbol * EmitCFILabel()
When emitting an object file, create and emit a real label.
Definition: MCStreamer.cpp:460
bool recordFunctionId(unsigned FuncId)
Records the function id of a normal function.
Definition: MCCodeView.cpp:86
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:39
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:26
virtual void EmitThumbFunc(MCSymbol *Func)
Note in the output that the specified Func is a Thumb mode function (ARM target only).
const MCSymbol * FuncletOrFuncEnd
Definition: MCWinEH.h:34
virtual void EmitCFISignalFrame()
Definition: MCStreamer.cpp:603
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition: MCContext.cpp:129
virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset)
Definition: MCStreamer.cpp:518
const MCSymbol * Personality
Definition: MCDwarf.h:611
MCAssemblerFlag
Definition: MCDirectives.h:49
bool recordInlinedCallSiteId(unsigned FuncId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol)
Records the function id of an inlined call site.
Definition: MCCodeView.cpp:99
bool hasCOFFAssociativeComdats() const
Definition: MCAsmInfo.h:486
virtual void EmitFileDirective(StringRef Filename)
Switch to a new logical file.
virtual void EmitDTPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a dtprel (32-bit DTP relative) value.
Definition: MCStreamer.cpp:181
Generic base class for all target subtargets.
virtual void emitELFSize(MCSymbol *Symbol, const MCExpr *Value)
Emit an ELF .size directive.
References to labels and assigned expressions.
Definition: MCExpr.h:40
uint32_t Size
Definition: Profile.cpp:46
bool isLittleEndian() const
True if the target is little endian.
Definition: MCAsmInfo.h:416
void emitFill(uint64_t NumBytes, uint8_t FillValue)
Emit NumBytes bytes worth of the value specified by FillValue.
Definition: MCStreamer.cpp:203
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
Definition: CodeView.h:47
virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset)
Definition: MCStreamer.cpp:466
MCSymbol * endSection(MCSection *Section)
void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator)
Saves the information from the currently parsed dwarf .loc directive and sets DwarfLocSeen.
Definition: MCContext.h:601
CodeViewContext & getCVContext()
Definition: MCContext.cpp:677
WinEH::FrameInfo * EnsureValidWinFrameInfo(SMLoc Loc)
Retreive the current frame info if one is available and it is not yet closed.
Definition: MCStreamer.cpp:656
virtual void emitRawBytes(StringRef Data)
Emit the bytes in Data into the output.
Definition: MCStreamer.cpp:77
MCSymbol * getLabel() const
Definition: MCDwarf.h:346
MCSection * getTextSection() const
virtual void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset)
Emits a COFF section relative relocation.
Definition: MCStreamer.cpp:932
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual void FinishImpl()
Streamer specific finalization.
void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir, StringRef Filename, Optional< MD5::MD5Result > Checksum, Optional< StringRef > Source)
Specifies the "root" file and directory of the compilation unit.
Definition: MCContext.h:584
virtual bool EmitCVInlineSiteIdDirective(unsigned FunctionId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol, SMLoc Loc)
Introduces an inline call site id for use with .cv_loc.
Definition: MCStreamer.cpp:282
bool isTvOS() const
Is this an Apple tvOS triple.
Definition: Triple.h:467
const MCRegisterInfo * getRegisterInfo() const
Definition: MCContext.h:320
MCVersionMinType
Definition: MCDirectives.h:65
LLVM Value Representation.
Definition: Value.h:74
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:41
static cl::opt< bool, true > Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(DebugFlag))
Constant expressions.
Definition: MCExpr.h:39
Binary expressions.
Definition: MCExpr.h:38
virtual bool EmitCVFuncIdDirective(unsigned FunctionId)
Introduces a function id for use with .cv_loc.
Definition: MCStreamer.cpp:278
raw_ostream & nulls()
This returns a reference to a raw_ostream which simply discards output.
virtual void EmitCFIBKeyFrame()
Definition: MCStreamer.cpp:231
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
Definition: MCStreamer.cpp:400
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
virtual void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count)
Definition: MCStreamer.cpp:762
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
Target specific expression.
Definition: MCExpr.h:42
Information describing a function or inlined call site introduced by .cv_func_id or ...
Definition: MCCodeView.h:91
virtual void visitUsedSymbol(const MCSymbol &Sym)
Definition: MCStreamer.cpp:985
virtual void emitDwarfFileDirective(StringRef Directive)
Definition: MCStreamer.cpp:65
Represents a location in source code.
Definition: SMLoc.h:23
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals)
.cfi_escape Allows the user to add arbitrary bytes to the unwind info.
Definition: MCDwarf.h:568
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
Definition: MathExtras.h:429
const MCSymbol * ExceptionHandler
Definition: MCWinEH.h:35
void EmitVersionForTarget(const Triple &Target, const VersionTuple &SDKVersion)
void setTargetStreamer(MCTargetStreamer *TS)
Definition: MCStreamer.h:250
virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Definition: MCStreamer.cpp:89
virtual void EmitCOFFSectionIndex(MCSymbol const *Symbol)
Emits a COFF section index.
Definition: MCStreamer.cpp:930
virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment)
Definition: MCStreamer.cpp:487
void setLabel(MCSymbol *Label)
Definition: MCDwarf.h:350
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2)
.cfi_register Previous value of Register1 is saved in register Register2.
Definition: MCDwarf.h:522
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue)
Set the DescValue for the Symbol.
void EmitCFIStartProc(bool IsSimple, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:422
virtual void EmitCFIWindowSave()
Definition: MCStreamer.cpp:630
MCSection * getAssociatedXDataSection(const MCSection *TextSec)
Get the .xdata section used for the given section.
Definition: MCStreamer.cpp:807
void resize(size_type N)
Definition: SmallVector.h:344
Holds state from .cv_file and .cv_loc directives for later emission.
Definition: MCCodeView.h:137