LLVM  14.0.0git
CodeViewYAMLTypes.cpp
Go to the documentation of this file.
1 //===- CodeViewYAMLTypes.cpp - CodeView YAMLIO types implementation -------===//
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 // This file defines classes for handling the YAML representation of CodeView
10 // Debug Info.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "llvm/ADT/APSInt.h"
16 #include "llvm/ADT/ArrayRef.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/BinaryFormat/COFF.h"
27 #include "llvm/Support/Allocator.h"
30 #include "llvm/Support/Endian.h"
31 #include "llvm/Support/Error.h"
35 #include <algorithm>
36 #include <cassert>
37 #include <cstdint>
38 #include <vector>
39 
40 using namespace llvm;
41 using namespace llvm::codeview;
42 using namespace llvm::CodeViewYAML;
43 using namespace llvm::CodeViewYAML::detail;
44 using namespace llvm::yaml;
45 
49 
52 
64 
70 
73 
74 namespace llvm {
75 namespace CodeViewYAML {
76 namespace detail {
77 
80 
81  explicit LeafRecordBase(TypeLeafKind K) : Kind(K) {}
82  virtual ~LeafRecordBase() = default;
83 
84  virtual void map(yaml::IO &io) = 0;
85  virtual CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const = 0;
86  virtual Error fromCodeViewRecord(CVType Type) = 0;
87 };
88 
89 template <typename T> struct LeafRecordImpl : public LeafRecordBase {
91  : LeafRecordBase(K), Record(static_cast<TypeRecordKind>(K)) {}
92 
93  void map(yaml::IO &io) override;
94 
96  return TypeDeserializer::deserializeAs<T>(Type, Record);
97  }
98 
100  TS.writeLeafType(Record);
101  return CVType(TS.records().back());
102  }
103 
104  mutable T Record;
105 };
106 
107 template <> struct LeafRecordImpl<FieldListRecord> : public LeafRecordBase {
109 
110  void map(yaml::IO &io) override;
111  CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override;
112  Error fromCodeViewRecord(CVType Type) override;
113 
114  std::vector<MemberRecord> Members;
115 };
116 
119 
120  explicit MemberRecordBase(TypeLeafKind K) : Kind(K) {}
121  virtual ~MemberRecordBase() = default;
122 
123  virtual void map(yaml::IO &io) = 0;
124  virtual void writeTo(ContinuationRecordBuilder &CRB) = 0;
125 };
126 
127 template <typename T> struct MemberRecordImpl : public MemberRecordBase {
129  : MemberRecordBase(K), Record(static_cast<TypeRecordKind>(K)) {}
130 
131  void map(yaml::IO &io) override;
132 
133  void writeTo(ContinuationRecordBuilder &CRB) override {
134  CRB.writeMemberType(Record);
135  }
136 
137  mutable T Record;
138 };
139 
140 } // end namespace detail
141 } // end namespace CodeViewYAML
142 } // end namespace llvm
143 
144 void ScalarTraits<GUID>::output(const GUID &G, void *, llvm::raw_ostream &OS) {
145  OS << G;
146 }
147 
148 StringRef ScalarTraits<GUID>::input(StringRef Scalar, void *Ctx, GUID &S) {
149  if (Scalar.size() != 38)
150  return "GUID strings are 38 characters long";
151  if (Scalar.front() != '{' || Scalar.back() != '}')
152  return "GUID is not enclosed in {}";
153  Scalar = Scalar.substr(1, Scalar.size() - 2);
155  Scalar.split(A, '-', 5);
156  if (A.size() != 5 || Scalar[8] != '-' || Scalar[13] != '-' ||
157  Scalar[18] != '-' || Scalar[23] != '-')
158  return "GUID sections are not properly delineated with dashes";
159  struct MSGuid {
160  support::ulittle32_t Data1;
161  support::ulittle16_t Data2;
162  support::ulittle16_t Data3;
163  support::ubig64_t Data4;
164  };
165  MSGuid G = {};
166  uint64_t D41{}, D42{};
167  if (!to_integer(A[0], G.Data1, 16) || !to_integer(A[1], G.Data2, 16) ||
168  !to_integer(A[2], G.Data3, 16) || !to_integer(A[3], D41, 16) ||
169  !to_integer(A[4], D42, 16))
170  return "GUID contains non hex digits";
171  G.Data4 = (D41 << 48) | D42;
172  ::memcpy(&S, &G, sizeof(GUID));
173  return "";
174 }
175 
176 void ScalarTraits<TypeIndex>::output(const TypeIndex &S, void *,
177  raw_ostream &OS) {
178  OS << S.getIndex();
179 }
180 
182  TypeIndex &S) {
183  uint32_t I;
185  S.setIndex(I);
186  return Result;
187 }
188 
189 void ScalarTraits<APSInt>::output(const APSInt &S, void *, raw_ostream &OS) {
190  S.print(OS, S.isSigned());
191 }
192 
194  S = APSInt(Scalar);
195  return "";
196 }
197 
198 void ScalarEnumerationTraits<TypeLeafKind>::enumeration(IO &io,
199  TypeLeafKind &Value) {
200 #define CV_TYPE(name, val) io.enumCase(Value, #name, name);
201 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
202 #undef CV_TYPE
203 }
204 
205 void ScalarEnumerationTraits<PointerToMemberRepresentation>::enumeration(
207  IO.enumCase(Value, "Unknown", PointerToMemberRepresentation::Unknown);
208  IO.enumCase(Value, "SingleInheritanceData",
210  IO.enumCase(Value, "MultipleInheritanceData",
212  IO.enumCase(Value, "VirtualInheritanceData",
214  IO.enumCase(Value, "GeneralData", PointerToMemberRepresentation::GeneralData);
215  IO.enumCase(Value, "SingleInheritanceFunction",
217  IO.enumCase(Value, "MultipleInheritanceFunction",
219  IO.enumCase(Value, "VirtualInheritanceFunction",
221  IO.enumCase(Value, "GeneralFunction",
223 }
224 
225 void ScalarEnumerationTraits<VFTableSlotKind>::enumeration(
226  IO &IO, VFTableSlotKind &Kind) {
227  IO.enumCase(Kind, "Near16", VFTableSlotKind::Near16);
228  IO.enumCase(Kind, "Far16", VFTableSlotKind::Far16);
229  IO.enumCase(Kind, "This", VFTableSlotKind::This);
230  IO.enumCase(Kind, "Outer", VFTableSlotKind::Outer);
231  IO.enumCase(Kind, "Meta", VFTableSlotKind::Meta);
232  IO.enumCase(Kind, "Near", VFTableSlotKind::Near);
233  IO.enumCase(Kind, "Far", VFTableSlotKind::Far);
234 }
235 
236 void ScalarEnumerationTraits<CallingConvention>::enumeration(
237  IO &IO, CallingConvention &Value) {
238  IO.enumCase(Value, "NearC", CallingConvention::NearC);
239  IO.enumCase(Value, "FarC", CallingConvention::FarC);
240  IO.enumCase(Value, "NearPascal", CallingConvention::NearPascal);
241  IO.enumCase(Value, "FarPascal", CallingConvention::FarPascal);
242  IO.enumCase(Value, "NearFast", CallingConvention::NearFast);
243  IO.enumCase(Value, "FarFast", CallingConvention::FarFast);
244  IO.enumCase(Value, "NearStdCall", CallingConvention::NearStdCall);
245  IO.enumCase(Value, "FarStdCall", CallingConvention::FarStdCall);
246  IO.enumCase(Value, "NearSysCall", CallingConvention::NearSysCall);
247  IO.enumCase(Value, "FarSysCall", CallingConvention::FarSysCall);
248  IO.enumCase(Value, "ThisCall", CallingConvention::ThisCall);
249  IO.enumCase(Value, "MipsCall", CallingConvention::MipsCall);
250  IO.enumCase(Value, "Generic", CallingConvention::Generic);
251  IO.enumCase(Value, "AlphaCall", CallingConvention::AlphaCall);
252  IO.enumCase(Value, "PpcCall", CallingConvention::PpcCall);
253  IO.enumCase(Value, "SHCall", CallingConvention::SHCall);
254  IO.enumCase(Value, "ArmCall", CallingConvention::ArmCall);
255  IO.enumCase(Value, "AM33Call", CallingConvention::AM33Call);
256  IO.enumCase(Value, "TriCall", CallingConvention::TriCall);
257  IO.enumCase(Value, "SH5Call", CallingConvention::SH5Call);
258  IO.enumCase(Value, "M32RCall", CallingConvention::M32RCall);
259  IO.enumCase(Value, "ClrCall", CallingConvention::ClrCall);
260  IO.enumCase(Value, "Inline", CallingConvention::Inline);
261  IO.enumCase(Value, "NearVector", CallingConvention::NearVector);
262 }
263 
264 void ScalarEnumerationTraits<PointerKind>::enumeration(IO &IO,
265  PointerKind &Kind) {
266  IO.enumCase(Kind, "Near16", PointerKind::Near16);
267  IO.enumCase(Kind, "Far16", PointerKind::Far16);
268  IO.enumCase(Kind, "Huge16", PointerKind::Huge16);
269  IO.enumCase(Kind, "BasedOnSegment", PointerKind::BasedOnSegment);
270  IO.enumCase(Kind, "BasedOnValue", PointerKind::BasedOnValue);
271  IO.enumCase(Kind, "BasedOnSegmentValue", PointerKind::BasedOnSegmentValue);
272  IO.enumCase(Kind, "BasedOnAddress", PointerKind::BasedOnAddress);
273  IO.enumCase(Kind, "BasedOnSegmentAddress",
275  IO.enumCase(Kind, "BasedOnType", PointerKind::BasedOnType);
276  IO.enumCase(Kind, "BasedOnSelf", PointerKind::BasedOnSelf);
277  IO.enumCase(Kind, "Near32", PointerKind::Near32);
278  IO.enumCase(Kind, "Far32", PointerKind::Far32);
279  IO.enumCase(Kind, "Near64", PointerKind::Near64);
280 }
281 
282 void ScalarEnumerationTraits<PointerMode>::enumeration(IO &IO,
283  PointerMode &Mode) {
284  IO.enumCase(Mode, "Pointer", PointerMode::Pointer);
285  IO.enumCase(Mode, "LValueReference", PointerMode::LValueReference);
286  IO.enumCase(Mode, "PointerToDataMember", PointerMode::PointerToDataMember);
287  IO.enumCase(Mode, "PointerToMemberFunction",
289  IO.enumCase(Mode, "RValueReference", PointerMode::RValueReference);
290 }
291 
292 void ScalarEnumerationTraits<HfaKind>::enumeration(IO &IO, HfaKind &Value) {
293  IO.enumCase(Value, "None", HfaKind::None);
294  IO.enumCase(Value, "Float", HfaKind::Float);
295  IO.enumCase(Value, "Double", HfaKind::Double);
296  IO.enumCase(Value, "Other", HfaKind::Other);
297 }
298 
299 void ScalarEnumerationTraits<MemberAccess>::enumeration(IO &IO,
300  MemberAccess &Access) {
301  IO.enumCase(Access, "None", MemberAccess::None);
302  IO.enumCase(Access, "Private", MemberAccess::Private);
303  IO.enumCase(Access, "Protected", MemberAccess::Protected);
304  IO.enumCase(Access, "Public", MemberAccess::Public);
305 }
306 
307 void ScalarEnumerationTraits<MethodKind>::enumeration(IO &IO,
308  MethodKind &Kind) {
309  IO.enumCase(Kind, "Vanilla", MethodKind::Vanilla);
310  IO.enumCase(Kind, "Virtual", MethodKind::Virtual);
311  IO.enumCase(Kind, "Static", MethodKind::Static);
312  IO.enumCase(Kind, "Friend", MethodKind::Friend);
313  IO.enumCase(Kind, "IntroducingVirtual", MethodKind::IntroducingVirtual);
314  IO.enumCase(Kind, "PureVirtual", MethodKind::PureVirtual);
315  IO.enumCase(Kind, "PureIntroducingVirtual",
317 }
318 
319 void ScalarEnumerationTraits<WindowsRTClassKind>::enumeration(
320  IO &IO, WindowsRTClassKind &Value) {
321  IO.enumCase(Value, "None", WindowsRTClassKind::None);
322  IO.enumCase(Value, "Ref", WindowsRTClassKind::RefClass);
323  IO.enumCase(Value, "Value", WindowsRTClassKind::ValueClass);
324  IO.enumCase(Value, "Interface", WindowsRTClassKind::Interface);
325 }
326 
327 void ScalarEnumerationTraits<LabelType>::enumeration(IO &IO, LabelType &Value) {
328  IO.enumCase(Value, "Near", LabelType::Near);
329  IO.enumCase(Value, "Far", LabelType::Far);
330 }
331 
332 void ScalarBitSetTraits<PointerOptions>::bitset(IO &IO,
334  IO.bitSetCase(Options, "None", PointerOptions::None);
335  IO.bitSetCase(Options, "Flat32", PointerOptions::Flat32);
336  IO.bitSetCase(Options, "Volatile", PointerOptions::Volatile);
337  IO.bitSetCase(Options, "Const", PointerOptions::Const);
338  IO.bitSetCase(Options, "Unaligned", PointerOptions::Unaligned);
339  IO.bitSetCase(Options, "Restrict", PointerOptions::Restrict);
340  IO.bitSetCase(Options, "WinRTSmartPointer",
342 }
343 
344 void ScalarBitSetTraits<ModifierOptions>::bitset(IO &IO,
346  IO.bitSetCase(Options, "None", ModifierOptions::None);
347  IO.bitSetCase(Options, "Const", ModifierOptions::Const);
348  IO.bitSetCase(Options, "Volatile", ModifierOptions::Volatile);
349  IO.bitSetCase(Options, "Unaligned", ModifierOptions::Unaligned);
350 }
351 
352 void ScalarBitSetTraits<FunctionOptions>::bitset(IO &IO,
354  IO.bitSetCase(Options, "None", FunctionOptions::None);
355  IO.bitSetCase(Options, "CxxReturnUdt", FunctionOptions::CxxReturnUdt);
356  IO.bitSetCase(Options, "Constructor", FunctionOptions::Constructor);
357  IO.bitSetCase(Options, "ConstructorWithVirtualBases",
359 }
360 
361 void ScalarBitSetTraits<ClassOptions>::bitset(IO &IO, ClassOptions &Options) {
362  IO.bitSetCase(Options, "None", ClassOptions::None);
363  IO.bitSetCase(Options, "HasConstructorOrDestructor",
365  IO.bitSetCase(Options, "HasOverloadedOperator",
367  IO.bitSetCase(Options, "Nested", ClassOptions::Nested);
368  IO.bitSetCase(Options, "ContainsNestedClass",
370  IO.bitSetCase(Options, "HasOverloadedAssignmentOperator",
372  IO.bitSetCase(Options, "HasConversionOperator",
374  IO.bitSetCase(Options, "ForwardReference", ClassOptions::ForwardReference);
375  IO.bitSetCase(Options, "Scoped", ClassOptions::Scoped);
376  IO.bitSetCase(Options, "HasUniqueName", ClassOptions::HasUniqueName);
377  IO.bitSetCase(Options, "Sealed", ClassOptions::Sealed);
378  IO.bitSetCase(Options, "Intrinsic", ClassOptions::Intrinsic);
379 }
380 
381 void ScalarBitSetTraits<MethodOptions>::bitset(IO &IO, MethodOptions &Options) {
382  IO.bitSetCase(Options, "None", MethodOptions::None);
383  IO.bitSetCase(Options, "Pseudo", MethodOptions::Pseudo);
384  IO.bitSetCase(Options, "NoInherit", MethodOptions::NoInherit);
385  IO.bitSetCase(Options, "NoConstruct", MethodOptions::NoConstruct);
386  IO.bitSetCase(Options, "CompilerGenerated", MethodOptions::CompilerGenerated);
387  IO.bitSetCase(Options, "Sealed", MethodOptions::Sealed);
388 }
389 
391  IO.mapRequired("ContainingType", MPI.ContainingType);
392  IO.mapRequired("Representation", MPI.Representation);
393 }
394 
395 namespace llvm {
396 namespace CodeViewYAML {
397 namespace detail {
398 
399 template <> void LeafRecordImpl<ModifierRecord>::map(IO &IO) {
400  IO.mapRequired("ModifiedType", Record.ModifiedType);
401  IO.mapRequired("Modifiers", Record.Modifiers);
402 }
403 
404 template <> void LeafRecordImpl<ProcedureRecord>::map(IO &IO) {
405  IO.mapRequired("ReturnType", Record.ReturnType);
406  IO.mapRequired("CallConv", Record.CallConv);
407  IO.mapRequired("Options", Record.Options);
408  IO.mapRequired("ParameterCount", Record.ParameterCount);
409  IO.mapRequired("ArgumentList", Record.ArgumentList);
410 }
411 
413  IO.mapRequired("ReturnType", Record.ReturnType);
414  IO.mapRequired("ClassType", Record.ClassType);
415  IO.mapRequired("ThisType", Record.ThisType);
416  IO.mapRequired("CallConv", Record.CallConv);
417  IO.mapRequired("Options", Record.Options);
418  IO.mapRequired("ParameterCount", Record.ParameterCount);
419  IO.mapRequired("ArgumentList", Record.ArgumentList);
420  IO.mapRequired("ThisPointerAdjustment", Record.ThisPointerAdjustment);
421 }
422 
423 template <> void LeafRecordImpl<LabelRecord>::map(IO &IO) {
424  IO.mapRequired("Mode", Record.Mode);
425 }
426 
427 template <> void LeafRecordImpl<MemberFuncIdRecord>::map(IO &IO) {
428  IO.mapRequired("ClassType", Record.ClassType);
429  IO.mapRequired("FunctionType", Record.FunctionType);
430  IO.mapRequired("Name", Record.Name);
431 }
432 
433 template <> void LeafRecordImpl<ArgListRecord>::map(IO &IO) {
434  IO.mapRequired("ArgIndices", Record.ArgIndices);
435 }
436 
437 template <> void LeafRecordImpl<StringListRecord>::map(IO &IO) {
438  IO.mapRequired("StringIndices", Record.StringIndices);
439 }
440 
441 template <> void LeafRecordImpl<PointerRecord>::map(IO &IO) {
442  IO.mapRequired("ReferentType", Record.ReferentType);
443  IO.mapRequired("Attrs", Record.Attrs);
444  IO.mapOptional("MemberInfo", Record.MemberInfo);
445 }
446 
447 template <> void LeafRecordImpl<ArrayRecord>::map(IO &IO) {
448  IO.mapRequired("ElementType", Record.ElementType);
449  IO.mapRequired("IndexType", Record.IndexType);
450  IO.mapRequired("Size", Record.Size);
451  IO.mapRequired("Name", Record.Name);
452 }
453 
455  IO.mapRequired("FieldList", Members);
456 }
457 
458 } // end namespace detail
459 } // end namespace CodeViewYAML
460 } // end namespace llvm
461 
462 namespace {
463 
464 class MemberRecordConversionVisitor : public TypeVisitorCallbacks {
465 public:
466  explicit MemberRecordConversionVisitor(std::vector<MemberRecord> &Records)
467  : Records(Records) {}
468 
469 #define TYPE_RECORD(EnumName, EnumVal, Name)
470 #define MEMBER_RECORD(EnumName, EnumVal, Name) \
471  Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
472  return visitKnownMemberImpl(Record); \
473  }
474 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
475 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
476 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
477 private:
478  template <typename T> Error visitKnownMemberImpl(T &Record) {
479  TypeLeafKind K = static_cast<TypeLeafKind>(Record.getKind());
480  auto Impl = std::make_shared<MemberRecordImpl<T>>(K);
481  Impl->Record = Record;
482  Records.push_back(MemberRecord{Impl});
483  return Error::success();
484  }
485 
486  std::vector<MemberRecord> &Records;
487 };
488 
489 } // end anonymous namespace
490 
492  MemberRecordConversionVisitor V(Members);
493  return visitMemberRecordStream(Type.content(), V);
494 }
495 
497  AppendingTypeTableBuilder &TS) const {
500  for (const auto &Member : Members) {
501  Member.Member->writeTo(CRB);
502  }
503  TS.insertRecord(CRB);
504  return CVType(TS.records().back());
505 }
506 
508  io.mapRequired("Type", Record.Type);
509  io.mapRequired("Attrs", Record.Attrs.Attrs);
510  io.mapRequired("VFTableOffset", Record.VFTableOffset);
511  io.mapRequired("Name", Record.Name);
512 }
513 
514 namespace llvm {
515 namespace CodeViewYAML {
516 namespace detail {
517 
518 template <> void LeafRecordImpl<ClassRecord>::map(IO &IO) {
519  IO.mapRequired("MemberCount", Record.MemberCount);
520  IO.mapRequired("Options", Record.Options);
521  IO.mapRequired("FieldList", Record.FieldList);
522  IO.mapRequired("Name", Record.Name);
523  IO.mapRequired("UniqueName", Record.UniqueName);
524  IO.mapRequired("DerivationList", Record.DerivationList);
525  IO.mapRequired("VTableShape", Record.VTableShape);
526  IO.mapRequired("Size", Record.Size);
527 }
528 
529 template <> void LeafRecordImpl<UnionRecord>::map(IO &IO) {
530  IO.mapRequired("MemberCount", Record.MemberCount);
531  IO.mapRequired("Options", Record.Options);
532  IO.mapRequired("FieldList", Record.FieldList);
533  IO.mapRequired("Name", Record.Name);
534  IO.mapRequired("UniqueName", Record.UniqueName);
535  IO.mapRequired("Size", Record.Size);
536 }
537 
538 template <> void LeafRecordImpl<EnumRecord>::map(IO &IO) {
539  IO.mapRequired("NumEnumerators", Record.MemberCount);
540  IO.mapRequired("Options", Record.Options);
541  IO.mapRequired("FieldList", Record.FieldList);
542  IO.mapRequired("Name", Record.Name);
543  IO.mapRequired("UniqueName", Record.UniqueName);
544  IO.mapRequired("UnderlyingType", Record.UnderlyingType);
545 }
546 
547 template <> void LeafRecordImpl<BitFieldRecord>::map(IO &IO) {
548  IO.mapRequired("Type", Record.Type);
549  IO.mapRequired("BitSize", Record.BitSize);
550  IO.mapRequired("BitOffset", Record.BitOffset);
551 }
552 
553 template <> void LeafRecordImpl<VFTableShapeRecord>::map(IO &IO) {
554  IO.mapRequired("Slots", Record.Slots);
555 }
556 
557 template <> void LeafRecordImpl<TypeServer2Record>::map(IO &IO) {
558  IO.mapRequired("Guid", Record.Guid);
559  IO.mapRequired("Age", Record.Age);
560  IO.mapRequired("Name", Record.Name);
561 }
562 
563 template <> void LeafRecordImpl<StringIdRecord>::map(IO &IO) {
564  IO.mapRequired("Id", Record.Id);
565  IO.mapRequired("String", Record.String);
566 }
567 
568 template <> void LeafRecordImpl<FuncIdRecord>::map(IO &IO) {
569  IO.mapRequired("ParentScope", Record.ParentScope);
570  IO.mapRequired("FunctionType", Record.FunctionType);
571  IO.mapRequired("Name", Record.Name);
572 }
573 
575  IO.mapRequired("UDT", Record.UDT);
576  IO.mapRequired("SourceFile", Record.SourceFile);
577  IO.mapRequired("LineNumber", Record.LineNumber);
578 }
579 
581  IO.mapRequired("UDT", Record.UDT);
582  IO.mapRequired("SourceFile", Record.SourceFile);
583  IO.mapRequired("LineNumber", Record.LineNumber);
584  IO.mapRequired("Module", Record.Module);
585 }
586 
587 template <> void LeafRecordImpl<BuildInfoRecord>::map(IO &IO) {
588  IO.mapRequired("ArgIndices", Record.ArgIndices);
589 }
590 
591 template <> void LeafRecordImpl<VFTableRecord>::map(IO &IO) {
592  IO.mapRequired("CompleteClass", Record.CompleteClass);
593  IO.mapRequired("OverriddenVFTable", Record.OverriddenVFTable);
594  IO.mapRequired("VFPtrOffset", Record.VFPtrOffset);
595  IO.mapRequired("MethodNames", Record.MethodNames);
596 }
597 
599  IO.mapRequired("Methods", Record.Methods);
600 }
601 
602 template <> void LeafRecordImpl<PrecompRecord>::map(IO &IO) {
603  IO.mapRequired("StartTypeIndex", Record.StartTypeIndex);
604  IO.mapRequired("TypesCount", Record.TypesCount);
605  IO.mapRequired("Signature", Record.Signature);
606  IO.mapRequired("PrecompFilePath", Record.PrecompFilePath);
607 }
608 
609 template <> void LeafRecordImpl<EndPrecompRecord>::map(IO &IO) {
610  IO.mapRequired("Signature", Record.Signature);
611 }
612 
613 template <> void MemberRecordImpl<OneMethodRecord>::map(IO &IO) {
615 }
616 
618  IO.mapRequired("NumOverloads", Record.NumOverloads);
619  IO.mapRequired("MethodList", Record.MethodList);
620  IO.mapRequired("Name", Record.Name);
621 }
622 
623 template <> void MemberRecordImpl<NestedTypeRecord>::map(IO &IO) {
624  IO.mapRequired("Type", Record.Type);
625  IO.mapRequired("Name", Record.Name);
626 }
627 
628 template <> void MemberRecordImpl<DataMemberRecord>::map(IO &IO) {
629  IO.mapRequired("Attrs", Record.Attrs.Attrs);
630  IO.mapRequired("Type", Record.Type);
631  IO.mapRequired("FieldOffset", Record.FieldOffset);
632  IO.mapRequired("Name", Record.Name);
633 }
634 
636  IO.mapRequired("Attrs", Record.Attrs.Attrs);
637  IO.mapRequired("Type", Record.Type);
638  IO.mapRequired("Name", Record.Name);
639 }
640 
641 template <> void MemberRecordImpl<EnumeratorRecord>::map(IO &IO) {
642  IO.mapRequired("Attrs", Record.Attrs.Attrs);
643  IO.mapRequired("Value", Record.Value);
644  IO.mapRequired("Name", Record.Name);
645 }
646 
647 template <> void MemberRecordImpl<VFPtrRecord>::map(IO &IO) {
648  IO.mapRequired("Type", Record.Type);
649 }
650 
651 template <> void MemberRecordImpl<BaseClassRecord>::map(IO &IO) {
652  IO.mapRequired("Attrs", Record.Attrs.Attrs);
653  IO.mapRequired("Type", Record.Type);
654  IO.mapRequired("Offset", Record.Offset);
655 }
656 
658  IO.mapRequired("Attrs", Record.Attrs.Attrs);
659  IO.mapRequired("BaseType", Record.BaseType);
660  IO.mapRequired("VBPtrType", Record.VBPtrType);
661  IO.mapRequired("VBPtrOffset", Record.VBPtrOffset);
662  IO.mapRequired("VTableIndex", Record.VTableIndex);
663 }
664 
666  IO.mapRequired("ContinuationIndex", Record.ContinuationIndex);
667 }
668 
669 } // end namespace detail
670 } // end namespace CodeViewYAML
671 } // end namespace llvm
672 
673 template <typename T>
675  LeafRecord Result;
676 
677  auto Impl = std::make_shared<LeafRecordImpl<T>>(Type.kind());
678  if (auto EC = Impl->fromCodeViewRecord(Type))
679  return std::move(EC);
680  Result.Leaf = Impl;
681  return Result;
682 }
683 
684 Expected<LeafRecord> LeafRecord::fromCodeViewRecord(CVType Type) {
685 #define TYPE_RECORD(EnumName, EnumVal, ClassName) \
686  case EnumName: \
687  return fromCodeViewRecordImpl<ClassName##Record>(Type);
688 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
689  TYPE_RECORD(EnumName, EnumVal, ClassName)
690 #define MEMBER_RECORD(EnumName, EnumVal, ClassName)
691 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
692  switch (Type.kind()) {
693 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
694  default:
695  llvm_unreachable("Unknown leaf kind!");
696  }
697  return make_error<CodeViewError>(cv_error_code::corrupt_record);
698 }
699 
700 CVType
701 LeafRecord::toCodeViewRecord(AppendingTypeTableBuilder &Serializer) const {
702  return Leaf->toCodeViewRecord(Serializer);
703 }
704 
705 namespace llvm {
706 namespace yaml {
707 
708 template <> struct MappingTraits<LeafRecordBase> {
709  static void mapping(IO &io, LeafRecordBase &Record) { Record.map(io); }
710 };
711 
712 template <> struct MappingTraits<MemberRecordBase> {
713  static void mapping(IO &io, MemberRecordBase &Record) { Record.map(io); }
714 };
715 
716 } // end namespace yaml
717 } // end namespace llvm
718 
719 template <typename ConcreteType>
720 static void mapLeafRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind,
721  LeafRecord &Obj) {
722  if (!IO.outputting())
723  Obj.Leaf = std::make_shared<LeafRecordImpl<ConcreteType>>(Kind);
724 
725  if (Kind == LF_FIELDLIST)
726  Obj.Leaf->map(IO);
727  else
728  IO.mapRequired(Class, *Obj.Leaf);
729 }
730 
733  if (IO.outputting())
734  Kind = Obj.Leaf->Kind;
735  IO.mapRequired("Kind", Kind);
736 
737 #define TYPE_RECORD(EnumName, EnumVal, ClassName) \
738  case EnumName: \
739  mapLeafRecordImpl<ClassName##Record>(IO, #ClassName, Kind, Obj); \
740  break;
741 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
742  TYPE_RECORD(EnumName, EnumVal, ClassName)
743 #define MEMBER_RECORD(EnumName, EnumVal, ClassName)
744 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
745  switch (Kind) {
746 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
747  default: { llvm_unreachable("Unknown leaf kind!"); }
748  }
749 }
750 
751 template <typename ConcreteType>
752 static void mapMemberRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind,
753  MemberRecord &Obj) {
754  if (!IO.outputting())
755  Obj.Member = std::make_shared<MemberRecordImpl<ConcreteType>>(Kind);
756 
757  IO.mapRequired(Class, *Obj.Member);
758 }
759 
762  if (IO.outputting())
763  Kind = Obj.Member->Kind;
764  IO.mapRequired("Kind", Kind);
765 
766 #define MEMBER_RECORD(EnumName, EnumVal, ClassName) \
767  case EnumName: \
768  mapMemberRecordImpl<ClassName##Record>(IO, #ClassName, Kind, Obj); \
769  break;
770 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
771  MEMBER_RECORD(EnumName, EnumVal, ClassName)
772 #define TYPE_RECORD(EnumName, EnumVal, ClassName)
773 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName)
774  switch (Kind) {
775 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
776  default: { llvm_unreachable("Unknown member kind!"); }
777  }
778 }
779 
780 std::vector<LeafRecord>
783  ExitOnError Err("Invalid " + std::string(SectionName) + " section!");
784  BinaryStreamReader Reader(DebugTorP, support::little);
785  CVTypeArray Types;
786  uint32_t Magic;
787 
788  Err(Reader.readInteger(Magic));
790  "Invalid .debug$T or .debug$P section!");
791 
792  std::vector<LeafRecord> Result;
793  Err(Reader.readArray(Types, Reader.bytesRemaining()));
794  for (const auto &T : Types) {
795  auto CVT = Err(LeafRecord::fromCodeViewRecord(T));
796  Result.push_back(CVT);
797  }
798  return Result;
799 }
800 
802  BumpPtrAllocator &Alloc,
804  AppendingTypeTableBuilder TS(Alloc);
805  uint32_t Size = sizeof(uint32_t);
806  for (const auto &Leaf : Leafs) {
807  CVType T = Leaf.Leaf->toCodeViewRecord(TS);
808  Size += T.length();
809  assert(T.length() % 4 == 0 && "Improper type record alignment!");
810  }
811  uint8_t *ResultBuffer = Alloc.Allocate<uint8_t>(Size);
812  MutableArrayRef<uint8_t> Output(ResultBuffer, Size);
813  BinaryStreamWriter Writer(Output, support::little);
814  ExitOnError Err("Error writing type record to " + std::string(SectionName) +
815  " section");
817  for (const auto &R : TS.records()) {
818  Err(Writer.writeBytes(R));
819  }
820  assert(Writer.bytesRemaining() == 0 && "Didn't write all type record bytes!");
821  return Output;
822 }
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::CodeViewYAML::detail::LeafRecordBase
Definition: CodeViewYAMLTypes.cpp:78
BinaryStreamReader.h
llvm::codeview::ClassOptions::ForwardReference
@ ForwardReference
llvm::BinaryStreamReader::bytesRemaining
uint32_t bytesRemaining() const
Definition: BinaryStreamReader.h:257
llvm::codeview::MemberAccess
MemberAccess
Source-level access specifier. (CV_access_e)
Definition: CodeView.h:263
LLVM_YAML_DECLARE_MAPPING_TRAITS
#define LLVM_YAML_DECLARE_MAPPING_TRAITS(Type)
llvm::yaml::MappingTraits< MemberRecordBase >::mapping
static void mapping(IO &io, MemberRecordBase &Record)
Definition: CodeViewYAMLTypes.cpp:713
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::CodeViewYAML::detail::LeafRecordImpl
Definition: CodeViewYAMLTypes.cpp:89
llvm::BinaryStreamWriter::writeInteger
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
Definition: BinaryStreamWriter.h:64
llvm::codeview::WindowsRTClassKind
WindowsRTClassKind
Definition: CodeView.h:396
llvm::codeview::MethodKind::PureVirtual
@ PureVirtual
LLVM_YAML_DECLARE_ENUM_TRAITS
#define LLVM_YAML_DECLARE_ENUM_TRAITS(Type)
llvm::CodeViewYAML::detail::MemberRecordImpl::MemberRecordImpl
MemberRecordImpl(TypeLeafKind K)
Definition: CodeViewYAMLTypes.cpp:128
llvm::pdb::PDB_DataKind::Member
@ Member
llvm::CodeViewYAML::detail::MemberRecordImpl::Record
T Record
Definition: CodeViewYAMLTypes.cpp:137
llvm::support::detail::packed_endian_specific_integral
Definition: Endian.h:206
llvm::codeview::AppendingTypeTableBuilder
Definition: AppendingTypeTableBuilder.h:26
llvm::codeview::LabelType::Far
@ Far
llvm::codeview::ModifierOptions
ModifierOptions
Equivalent to CV_modifier_t.
Definition: CodeView.h:302
llvm::codeview::TypeVisitorCallbacks
Definition: TypeVisitorCallbacks.h:18
StringRef.h
llvm::codeview::MethodOptions::NoInherit
@ NoInherit
llvm::codeview::PointerKind::BasedOnSegmentAddress
@ BasedOnSegmentAddress
llvm::codeview::ClassOptions::HasConstructorOrDestructor
@ HasConstructorOrDestructor
llvm::codeview::FunctionOptions
FunctionOptions
Definition: CodeView.h:247
llvm::CodeViewYAML::fromDebugT
std::vector< LeafRecord > fromDebugT(ArrayRef< uint8_t > DebugTorP, StringRef SectionName)
Definition: CodeViewYAMLTypes.cpp:781
llvm::BinaryStreamWriter
Provides write only access to a subclass of WritableBinaryStream.
Definition: BinaryStreamWriter.h:31
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::codeview::CallingConvention::AlphaCall
@ AlphaCall
output
Current output
Definition: README.txt:1350
llvm::codeview::CallingConvention::AM33Call
@ AM33Call
llvm::codeview::CallingConvention::ThisCall
@ ThisCall
ErrorHandling.h
llvm::codeview::PointerToMemberRepresentation::VirtualInheritanceData
@ VirtualInheritanceData
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
Allocator.h
llvm::codeview::GUID
This represents the 'GUID' type from windows.h.
Definition: GUID.h:21
Error.h
llvm::codeview::PointerToMemberRepresentation::GeneralData
@ GeneralData
llvm::codeview::MemberAccess::Protected
@ Protected
llvm::codeview::PointerOptions::None
@ None
LLVM_YAML_IS_SEQUENCE_VECTOR
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
llvm::lltok::APSInt
@ APSInt
Definition: LLToken.h:492
COFF.h
llvm::codeview::PointerToMemberRepresentation::VirtualInheritanceFunction
@ VirtualInheritanceFunction
llvm::codeview::CallingConvention::NearC
@ NearC
llvm::codeview::MethodKind::Vanilla
@ Vanilla
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::codeview::CallingConvention::FarFast
@ FarFast
llvm::codeview::FunctionOptions::ConstructorWithVirtualBases
@ ConstructorWithVirtualBases
llvm::ExitOnError
Helper for check-and-exit error handling.
Definition: Error.h:1335
llvm::CodeViewYAML::detail::LeafRecordImpl< FieldListRecord >::LeafRecordImpl
LeafRecordImpl(TypeLeafKind K)
Definition: CodeViewYAMLTypes.cpp:108
TypeVisitorCallbacks.h
llvm::codeview::AppendingTypeTableBuilder::records
ArrayRef< ArrayRef< uint8_t > > records() const
Definition: AppendingTypeTableBuilder.cpp:71
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::codeview::CallingConvention::NearVector
@ NearVector
llvm::CodeViewYAML::detail::LeafRecordImpl::LeafRecordImpl
LeafRecordImpl(TypeLeafKind K)
Definition: CodeViewYAMLTypes.cpp:90
llvm::codeview::VFTableSlotKind::Outer
@ Outer
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::codeview::ModifierOptions::None
@ None
llvm::yaml::MappingTraits
Definition: ModuleSummaryIndex.h:52
llvm::codeview::PointerOptions::Volatile
@ Volatile
llvm::codeview::MemberAccess::Public
@ Public
llvm::codeview::LabelType
LabelType
Equivalent to CV_LABEL_TYPE_e.
Definition: CodeView.h:295
llvm::codeview::PointerMode::Pointer
@ Pointer
llvm::codeview::ClassOptions::HasOverloadedOperator
@ HasOverloadedOperator
llvm::codeview::WindowsRTClassKind::RefClass
@ RefClass
llvm::codeview::PointerKind::BasedOnSegmentValue
@ BasedOnSegmentValue
llvm::codeview::ClassOptions::ContainsNestedClass
@ ContainsNestedClass
llvm::codeview::ClassOptions::Scoped
@ Scoped
llvm::CodeViewYAML::detail
Definition: CodeViewYAMLDebugSections.h:39
llvm::codeview::MethodKind::IntroducingVirtual
@ IntroducingVirtual
llvm::codeview::MethodKind::Virtual
@ Virtual
llvm::codeview::PointerOptions::WinRTSmartPointer
@ WinRTSmartPointer
llvm::codeview::visitMemberRecordStream
Error visitMemberRecordStream(ArrayRef< uint8_t > FieldList, TypeVisitorCallbacks &Callbacks)
Definition: CVTypeVisitor.cpp:270
llvm::codeview::MethodKind::Friend
@ Friend
llvm::codeview::PointerKind::Far32
@ Far32
llvm::CodeViewYAML::toDebugT
ArrayRef< uint8_t > toDebugT(ArrayRef< LeafRecord >, BumpPtrAllocator &Alloc, StringRef SectionName)
Definition: CodeViewYAMLTypes.cpp:801
llvm::codeview::ContinuationRecordBuilder::writeMemberType
void writeMemberType(RecordType &Record)
Definition: ContinuationRecordBuilder.cpp:78
llvm::codeview::MemberAccess::Private
@ Private
llvm::codeview::PointerOptions::Restrict
@ Restrict
llvm::MutableArrayRef< uint8_t >
llvm::BumpPtrAllocatorImpl::Allocate
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
Definition: Allocator.h:145
llvm::codeview::PointerToMemberRepresentation::SingleInheritanceFunction
@ SingleInheritanceFunction
llvm::codeview::CallingConvention::SHCall
@ SHCall
llvm::support::little
@ little
Definition: Endian.h:27
llvm::codeview::PointerOptions::Flat32
@ Flat32
llvm::codeview::CallingConvention::SH5Call
@ SH5Call
llvm::codeview::VFTableSlotKind::Meta
@ Meta
llvm::ARM_PROC::A
@ A
Definition: ARMBaseInfo.h:34
llvm::codeview::CallingConvention::FarC
@ FarC
llvm::VarStreamArray< CVType >
llvm::BinaryStreamWriter::bytesRemaining
uint32_t bytesRemaining() const
Definition: BinaryStreamWriter.h:186
llvm::CodeViewYAML::detail::MemberRecordImpl::writeTo
void writeTo(ContinuationRecordBuilder &CRB) override
Definition: CodeViewYAMLTypes.cpp:133
llvm::codeview::PointerOptions
PointerOptions
Equivalent to misc lfPointerAttr bitfields.
Definition: CodeView.h:360
llvm::ms_demangle::QualifierMangleMode::Result
@ Result
llvm::codeview::ClassOptions::None
@ None
llvm::codeview::MethodKind
MethodKind
Part of member attribute flags. (CV_methodprop_e)
Definition: CodeView.h:271
llvm::codeview::ClassOptions::Sealed
@ Sealed
llvm::BinaryStreamReader::readInteger
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
Definition: BinaryStreamReader.h:75
llvm::APSInt
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:22
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::yaml::MappingTraits< LeafRecordBase >::mapping
static void mapping(IO &io, LeafRecordBase &Record)
Definition: CodeViewYAMLTypes.cpp:709
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::codeview::VFTableSlotKind::Near
@ Near
llvm::codeview::PointerToMemberRepresentation::SingleInheritanceData
@ SingleInheritanceData
llvm::codeview::ModifierOptions::Volatile
@ Volatile
llvm::codeview::TypeRecordKind
TypeRecordKind
Distinguishes individual records in .debug$T or .debug$P section or PDB type stream.
Definition: CodeView.h:26
llvm::CodeViewYAML::detail::MemberRecordBase::MemberRecordBase
MemberRecordBase(TypeLeafKind K)
Definition: CodeViewYAMLTypes.cpp:120
llvm::CodeViewYAML::detail::LeafRecordImpl::Record
T Record
Definition: CodeViewYAMLTypes.cpp:104
llvm::codeview::VFTableSlotKind::Far16
@ Far16
llvm::codeview::WindowsRTClassKind::Interface
@ Interface
llvm::codeview::WindowsRTClassKind::None
@ None
llvm::codeview::ClassOptions
ClassOptions
Definition: CodeView.h:204
input
The initial backend is deliberately restricted to z10 We should add support for later architectures at some point If an asm ties an i32 r result to an i64 input
Definition: README.txt:10
CodeView.h
llvm::NVPTX::PTXLdStInstCode::Scalar
@ Scalar
Definition: NVPTX.h:122
llvm::codeview::MethodOptions::None
@ None
llvm::None
const NoneType None
Definition: None.h:23
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::codeview::MemberPointerInfo::ContainingType
TypeIndex ContainingType
Definition: TypeRecord.h:113
llvm::codeview::CallingConvention::NearFast
@ NearFast
llvm::codeview::PointerMode::LValueReference
@ LValueReference
llvm::codeview::ClassOptions::Intrinsic
@ Intrinsic
llvm::codeview::PointerMode
PointerMode
Equivalent to CV_ptrmode_e.
Definition: CodeView.h:351
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition: BinaryStreamReader.h:31
LLVM_YAML_DECLARE_SCALAR_TRAITS
#define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote)
llvm::codeview::CallingConvention::FarPascal
@ FarPascal
llvm::CodeViewYAML::MemberRecord::Member
std::shared_ptr< detail::MemberRecordBase > Member
Definition: CodeViewYAMLTypes.h:42
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
llvm::codeview::ContinuationRecordBuilder
Definition: ContinuationRecordBuilder.h:33
llvm::codeview::OneMethodRecord
Definition: TypeRecord.h:719
llvm::CodeViewYAML::detail::MemberRecordBase
Definition: CodeViewYAMLTypes.cpp:117
llvm::codeview::ContinuationRecordBuilder::begin
void begin(ContinuationRecordKind RecordKind)
Definition: ContinuationRecordBuilder.cpp:51
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type)
llvm::codeview::HfaKind::Double
@ Double
llvm::codeview::VFTableSlotKind::Near16
@ Near16
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
mapMemberRecordImpl
static void mapMemberRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind, MemberRecord &Obj)
Definition: CodeViewYAMLTypes.cpp:752
llvm::codeview::HfaKind::Float
@ Float
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::CodeViewYAML::detail::MemberRecordBase::Kind
TypeLeafKind Kind
Definition: CodeViewYAMLTypes.cpp:118
llvm::codeview::ContinuationRecordKind::FieldList
@ FieldList
AppendingTypeTableBuilder.h
Magic
const char Magic[]
Definition: Archive.cpp:41
fromCodeViewRecordImpl
static Expected< LeafRecord > fromCodeViewRecordImpl(CVType Type)
Definition: CodeViewYAMLTypes.cpp:674
ArrayRef.h
LLVM_YAML_DECLARE_BITSET_TRAITS
#define LLVM_YAML_DECLARE_BITSET_TRAITS(Type)
llvm::codeview::CallingConvention::ClrCall
@ ClrCall
llvm::codeview::CallingConvention::NearSysCall
@ NearSysCall
llvm::codeview::WindowsRTClassKind::ValueClass
@ ValueClass
llvm::codeview::CallingConvention::Inline
@ Inline
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::codeview::PointerKind::Huge16
@ Huge16
llvm::CodeViewYAML
Definition: CodeViewYAMLDebugSections.h:37
memcpy
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
llvm::codeview::CompileSym2Flags::EC
@ EC
APSInt.h
Mode
SI Whole Quad Mode
Definition: SIWholeQuadMode.cpp:262
llvm::codeview::PointerOptions::Const
@ Const
CodeViewYAMLTypes.h
llvm::Record
Definition: Record.h:1472
llvm::codeview::HfaKind
HfaKind
Definition: CodeView.h:255
llvm::codeview::CallingConvention::FarStdCall
@ FarStdCall
YAMLTraits.h
llvm::codeview::PointerKind::Near16
@ Near16
llvm::codeview::PointerKind::Near32
@ Near32
llvm::ArrayRef< uint8_t >
llvm::codeview::FieldListRecord
Definition: TypeRecord.h:384
llvm::CodeViewYAML::MemberRecord
Definition: CodeViewYAMLTypes.h:41
llvm::BinaryStreamWriter::writeBytes
Error writeBytes(ArrayRef< uint8_t > Buffer)
Write the bytes specified in Buffer to the underlying stream.
Definition: BinaryStreamWriter.cpp:28
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::codeview::CVRecord< TypeLeafKind >
llvm::codeview::ClassOptions::HasOverloadedAssignmentOperator
@ HasOverloadedAssignmentOperator
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::codeview::PointerMode::RValueReference
@ RValueReference
llvm::codeview::VFTableSlotKind
VFTableSlotKind
Definition: CodeView.h:386
uint32_t
llvm::codeview::CallingConvention::M32RCall
@ M32RCall
llvm::codeview::PointerOptions::Unaligned
@ Unaligned
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::codeview::MethodOptions::CompilerGenerated
@ CompilerGenerated
llvm::codeview::CallingConvention::PpcCall
@ PpcCall
llvm::codeview::PointerToMemberRepresentation
PointerToMemberRepresentation
Equivalent to CV_pmtype_e.
Definition: CodeView.h:374
mapLeafRecordImpl
static void mapLeafRecordImpl(IO &IO, const char *Class, TypeLeafKind Kind, LeafRecord &Obj)
Definition: CodeViewYAMLTypes.cpp:720
llvm::CodeViewYAML::detail::LeafRecordImpl::toCodeViewRecord
CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override
Definition: CodeViewYAMLTypes.cpp:99
llvm::codeview::MethodKind::Static
@ Static
llvm::CodeViewYAML::detail::LeafRecordImpl< FieldListRecord >::Members
std::vector< MemberRecord > Members
Definition: CodeViewYAMLTypes.cpp:114
llvm::codeview::CallingConvention::NearStdCall
@ NearStdCall
llvm::COFF::DEBUG_SECTION_MAGIC
@ DEBUG_SECTION_MAGIC
Definition: COFF.h:726
llvm::codeview::MethodOptions::NoConstruct
@ NoConstruct
llvm::codeview::FunctionOptions::Constructor
@ Constructor
llvm::codeview::PointerToMemberRepresentation::Unknown
@ Unknown
llvm::codeview::PointerKind::BasedOnSelf
@ BasedOnSelf
llvm::codeview::LabelType::Near
@ Near
TypeDeserializer.h
llvm::SectionName
Definition: DWARFSection.h:21
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::codeview::MemberAccess::None
@ None
llvm::codeview::PointerMode::PointerToMemberFunction
@ PointerToMemberFunction
llvm::codeview::ModifierOptions::Unaligned
@ Unaligned
llvm::codeview::PointerToMemberRepresentation::GeneralFunction
@ GeneralFunction
CVTypeVisitor.h
llvm::codeview::cv_error_code::corrupt_record
@ corrupt_record
llvm::CodeViewYAML::detail::LeafRecordBase::Kind
TypeLeafKind Kind
Definition: CodeViewYAMLTypes.cpp:79
llvm::codeview::PointerKind::BasedOnType
@ BasedOnType
llvm::codeview::PointerMode::PointerToDataMember
@ PointerToDataMember
llvm::yaml
Definition: MIRYamlMapping.h:30
TypeIndex.h
llvm::codeview::FunctionOptions::CxxReturnUdt
@ CxxReturnUdt
llvm::codeview::PointerKind::BasedOnValue
@ BasedOnValue
llvm::codeview::FunctionOptions::None
@ None
ContinuationRecordBuilder.h
llvm::codeview::PointerKind::Near64
@ Near64
llvm::codeview::ModifierOptions::Const
@ Const
llvm::CodeViewYAML::detail::MemberRecordImpl
Definition: CodeViewYAMLTypes.cpp:127
llvm::codeview::TypeLeafKind
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
Definition: CodeView.h:33
llvm::codeview::MethodKind::PureIntroducingVirtual
@ PureIntroducingVirtual
llvm::codeview::VFTableSlotKind::This
@ This
llvm::codeview
Definition: AppendingTypeTableBuilder.h:22
llvm::codeview::MethodOptions::Sealed
@ Sealed
llvm::codeview::CallingConvention::ArmCall
@ ArmCall
llvm::codeview::AppendingTypeTableBuilder::writeLeafType
TypeIndex writeLeafType(T &Record)
Definition: AppendingTypeTableBuilder.h:58
llvm::CodeViewYAML::detail::LeafRecordBase::LeafRecordBase
LeafRecordBase(TypeLeafKind K)
Definition: CodeViewYAMLTypes.cpp:81
llvm::codeview::CallingConvention::FarSysCall
@ FarSysCall
llvm::codeview::ClassOptions::HasConversionOperator
@ HasConversionOperator
llvm::codeview::PointerKind::BasedOnAddress
@ BasedOnAddress
llvm::codeview::VFTableSlotKind::Far
@ Far
llvm::codeview::MemberPointerInfo::Representation
PointerToMemberRepresentation Representation
Definition: TypeRecord.h:114
llvm::codeview::CallingConvention::Generic
@ Generic
llvm::codeview::CallingConvention
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
Definition: CodeView.h:176
llvm::CodeViewYAML::LeafRecord
Definition: CodeViewYAMLTypes.h:45
llvm::codeview::ClassOptions::HasUniqueName
@ HasUniqueName
llvm::codeview::CallingConvention::NearPascal
@ NearPascal
llvm::codeview::CallingConvention::TriCall
@ TriCall
llvm::CodeViewYAML::detail::LeafRecordImpl::fromCodeViewRecord
Error fromCodeViewRecord(CVType Type) override
Definition: CodeViewYAMLTypes.cpp:95
llvm::codeview::PointerKind
PointerKind
Equivalent to CV_ptrtype_e.
Definition: CodeView.h:334
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:95
llvm::codeview::AppendingTypeTableBuilder::insertRecord
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
Definition: AppendingTypeTableBuilder.cpp:93
llvm::codeview::PointerToMemberRepresentation::MultipleInheritanceData
@ MultipleInheritanceData
BinaryStreamWriter.h
llvm::codeview::PointerToMemberRepresentation::MultipleInheritanceFunction
@ MultipleInheritanceFunction
CodeViewError.h
llvm::codeview::PointerKind::Far16
@ Far16
llvm::codeview::CallingConvention::MipsCall
@ MipsCall
raw_ostream.h
llvm::codeview::CVType
CVRecord< TypeLeafKind > CVType
Definition: CVRecord.h:65
Endian.h
llvm::codeview::MemberPointerInfo
Definition: TypeRecord.h:100
llvm::codeview::MethodOptions::Pseudo
@ Pseudo
llvm::codeview::HfaKind::Other
@ Other
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::codeview::PointerKind::BasedOnSegment
@ BasedOnSegment
llvm::codeview::HfaKind::None
@ None
llvm::codeview::ClassOptions::Nested
@ Nested
llvm::BinaryStreamReader::readArray
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
Definition: BinaryStreamReader.h:187
llvm::CodeViewYAML::LeafRecord::Leaf
std::shared_ptr< detail::LeafRecordBase > Leaf
Definition: CodeViewYAMLTypes.h:46
llvm::codeview::MethodOptions
MethodOptions
Equivalent to CV_fldattr_t bitfield.
Definition: CodeView.h:282