LCOV - code coverage report
Current view: top level - include/llvm/CodeGen - MIRYamlMapping.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 172 196 87.8 %
Date: 2017-09-14 15:23:50 Functions: 32 41 78.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- MIRYAMLMapping.h - Describes the mapping between MIR and YAML ------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file implements the mapping between various MIR data structures and
      11             : // their corresponding YAML representation.
      12             : //
      13             : //===----------------------------------------------------------------------===//
      14             : 
      15             : #ifndef LLVM_LIB_CODEGEN_MIRYAMLMAPPING_H
      16             : #define LLVM_LIB_CODEGEN_MIRYAMLMAPPING_H
      17             : 
      18             : #include "llvm/ADT/StringRef.h"
      19             : #include "llvm/CodeGen/MachineJumpTableInfo.h"
      20             : #include "llvm/Support/YAMLTraits.h"
      21             : #include <vector>
      22             : 
      23             : namespace llvm {
      24             : namespace yaml {
      25             : 
      26             : /// A wrapper around std::string which contains a source range that's being
      27             : /// set during parsing.
      28      557264 : struct StringValue {
      29             :   std::string Value;
      30             :   SMRange SourceRange;
      31             : 
      32      326511 :   StringValue() {}
      33       33753 :   StringValue(std::string Value) : Value(std::move(Value)) {}
      34             : 
      35             :   bool operator==(const StringValue &Other) const {
      36       28596 :     return Value == Other.Value;
      37             :   }
      38             : };
      39             : 
      40             : template <> struct ScalarTraits<StringValue> {
      41             :   static void output(const StringValue &S, void *, llvm::raw_ostream &OS) {
      42       69686 :     OS << S.Value;
      43             :   }
      44             : 
      45       11723 :   static StringRef input(StringRef Scalar, void *Ctx, StringValue &S) {
      46       23446 :     S.Value = Scalar.str();
      47       11723 :     if (const auto *Node =
      48       11723 :             reinterpret_cast<yaml::Input *>(Ctx)->getCurrentNode())
      49       11723 :       S.SourceRange = Node->getSourceRange();
      50       11723 :     return "";
      51             :   }
      52             : 
      53       40566 :   static bool mustQuote(StringRef Scalar) { return needsQuotes(Scalar); }
      54             : };
      55             : 
      56       14752 : struct FlowStringValue : StringValue {
      57        2470 :   FlowStringValue() {}
      58         292 :   FlowStringValue(std::string Value) : StringValue(std::move(Value)) {}
      59             : };
      60             : 
      61             : template <> struct ScalarTraits<FlowStringValue> {
      62             :   static void output(const FlowStringValue &S, void *, llvm::raw_ostream &OS) {
      63         972 :     return ScalarTraits<StringValue>::output(S, nullptr, OS);
      64             :   }
      65             : 
      66             :   static StringRef input(StringRef Scalar, void *Ctx, FlowStringValue &S) {
      67         822 :     return ScalarTraits<StringValue>::input(Scalar, Ctx, S);
      68             :   }
      69             : 
      70        1308 :   static bool mustQuote(StringRef Scalar) { return needsQuotes(Scalar); }
      71             : };
      72             : 
      73       37696 : struct BlockStringValue {
      74             :   StringValue Value;
      75             :   bool operator==(const BlockStringValue &Other) const {
      76        4910 :     return Value == Other.Value;
      77             :   }
      78             : };
      79             : 
      80             : template <> struct BlockScalarTraits<BlockStringValue> {
      81             :   static void output(const BlockStringValue &S, void *Ctx, raw_ostream &OS) {
      82        4910 :     return ScalarTraits<StringValue>::output(S.Value, Ctx, OS);
      83             :   }
      84             : 
      85             :   static StringRef input(StringRef Scalar, void *Ctx, BlockStringValue &S) {
      86        2237 :     return ScalarTraits<StringValue>::input(Scalar, Ctx, S.Value);
      87             :   }
      88             : };
      89             : 
      90             : /// A wrapper around unsigned which contains a source range that's being set
      91             : /// during parsing.
      92             : struct UnsignedValue {
      93             :   unsigned Value;
      94             :   SMRange SourceRange;
      95             : 
      96       37856 :   UnsignedValue() : Value(0) {}
      97       23190 :   UnsignedValue(unsigned Value) : Value(Value) {}
      98             : 
      99             :   bool operator==(const UnsignedValue &Other) const {
     100             :     return Value == Other.Value;
     101             :   }
     102             : };
     103             : 
     104             : template <> struct ScalarTraits<UnsignedValue> {
     105             :   static void output(const UnsignedValue &Value, void *Ctx, raw_ostream &OS) {
     106       11595 :     return ScalarTraits<unsigned>::output(Value.Value, Ctx, OS);
     107             :   }
     108             : 
     109        7333 :   static StringRef input(StringRef Scalar, void *Ctx, UnsignedValue &Value) {
     110        7333 :     if (const auto *Node =
     111        7333 :             reinterpret_cast<yaml::Input *>(Ctx)->getCurrentNode())
     112        7333 :       Value.SourceRange = Node->getSourceRange();
     113        7333 :     return ScalarTraits<unsigned>::input(Scalar, Ctx, Value.Value);
     114             :   }
     115             : 
     116             :   static bool mustQuote(StringRef Scalar) {
     117             :     return ScalarTraits<unsigned>::mustQuote(Scalar);
     118             :   }
     119             : };
     120             : 
     121             : template <> struct ScalarEnumerationTraits<MachineJumpTableInfo::JTEntryKind> {
     122          17 :   static void enumeration(yaml::IO &IO,
     123             :                           MachineJumpTableInfo::JTEntryKind &EntryKind) {
     124          17 :     IO.enumCase(EntryKind, "block-address",
     125             :                 MachineJumpTableInfo::EK_BlockAddress);
     126          17 :     IO.enumCase(EntryKind, "gp-rel64-block-address",
     127             :                 MachineJumpTableInfo::EK_GPRel64BlockAddress);
     128          17 :     IO.enumCase(EntryKind, "gp-rel32-block-address",
     129             :                 MachineJumpTableInfo::EK_GPRel32BlockAddress);
     130          17 :     IO.enumCase(EntryKind, "label-difference32",
     131             :                 MachineJumpTableInfo::EK_LabelDifference32);
     132          17 :     IO.enumCase(EntryKind, "inline", MachineJumpTableInfo::EK_Inline);
     133          17 :     IO.enumCase(EntryKind, "custom32", MachineJumpTableInfo::EK_Custom32);
     134          17 :   }
     135             : };
     136             : 
     137             : } // end namespace yaml
     138             : } // end namespace llvm
     139             : 
     140             : LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::StringValue)
     141             : LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::FlowStringValue)
     142             : LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::UnsignedValue)
     143             : 
     144             : namespace llvm {
     145             : namespace yaml {
     146             : 
     147      311346 : struct VirtualRegisterDefinition {
     148             :   UnsignedValue ID;
     149             :   StringValue Class;
     150             :   StringValue PreferredRegister;
     151             :   // TODO: Serialize the target specific register hints.
     152           0 :   bool operator==(const VirtualRegisterDefinition &Other) const {
     153           0 :     return ID == Other.ID && Class == Other.Class &&
     154           0 :            PreferredRegister == Other.PreferredRegister;
     155             :   }
     156             : };
     157             : 
     158             : template <> struct MappingTraits<VirtualRegisterDefinition> {
     159       18126 :   static void mapping(IO &YamlIO, VirtualRegisterDefinition &Reg) {
     160       36252 :     YamlIO.mapRequired("id", Reg.ID);
     161       36252 :     YamlIO.mapRequired("class", Reg.Class);
     162       36252 :     YamlIO.mapOptional("preferred-register", Reg.PreferredRegister,
     163       36252 :                        StringValue()); // Don't print out when it's empty.
     164       18126 :   }
     165             : 
     166             :   static const bool flow = true;
     167             : };
     168             : 
     169       12630 : struct MachineFunctionLiveIn {
     170             :   StringValue Register;
     171             :   StringValue VirtualRegister;
     172           0 :   bool operator==(const MachineFunctionLiveIn &Other) const {
     173           0 :     return Register == Other.Register &&
     174           0 :            VirtualRegister == Other.VirtualRegister;
     175             :   }
     176             : };
     177             : 
     178             : template <> struct MappingTraits<MachineFunctionLiveIn> {
     179        1018 :   static void mapping(IO &YamlIO, MachineFunctionLiveIn &LiveIn) {
     180        2036 :     YamlIO.mapRequired("reg", LiveIn.Register);
     181        2036 :     YamlIO.mapOptional(
     182             :         "virtual-reg", LiveIn.VirtualRegister,
     183        2036 :         StringValue()); // Don't print the virtual register when it's empty.
     184        1018 :   }
     185             : 
     186             :   static const bool flow = true;
     187             : };
     188             : 
     189             : /// Serializable representation of stack object from the MachineFrameInfo class.
     190             : ///
     191             : /// The flags 'isImmutable' and 'isAliased' aren't serialized, as they are
     192             : /// determined by the object's type and frame information flags.
     193             : /// Dead stack objects aren't serialized.
     194             : ///
     195             : /// The 'isPreallocated' flag is determined by the local offset.
     196       11375 : struct MachineStackObject {
     197             :   enum ObjectType { DefaultType, SpillSlot, VariableSized };
     198             :   UnsignedValue ID;
     199             :   StringValue Name;
     200             :   // TODO: Serialize unnamed LLVM alloca reference.
     201             :   ObjectType Type = DefaultType;
     202             :   int64_t Offset = 0;
     203             :   uint64_t Size = 0;
     204             :   unsigned Alignment = 0;
     205             :   uint8_t StackID = 0;
     206             :   StringValue CalleeSavedRegister;
     207             :   Optional<int64_t> LocalOffset;
     208             :   StringValue DebugVar;
     209             :   StringValue DebugExpr;
     210             :   StringValue DebugLoc;
     211           0 :   bool operator==(const MachineStackObject &Other) const {
     212           0 :     return ID == Other.ID && Name == Other.Name && Type == Other.Type &&
     213           0 :            Offset == Other.Offset && Size == Other.Size &&
     214           0 :            Alignment == Other.Alignment &&
     215           0 :            StackID == Other.StackID &&
     216           0 :            CalleeSavedRegister == Other.CalleeSavedRegister &&
     217           0 :            LocalOffset == Other.LocalOffset && DebugVar == Other.DebugVar &&
     218           0 :            DebugExpr == Other.DebugExpr && DebugLoc == Other.DebugLoc;
     219             :   }
     220             : };
     221             : 
     222             : template <> struct ScalarEnumerationTraits<MachineStackObject::ObjectType> {
     223         280 :   static void enumeration(yaml::IO &IO, MachineStackObject::ObjectType &Type) {
     224         280 :     IO.enumCase(Type, "default", MachineStackObject::DefaultType);
     225         280 :     IO.enumCase(Type, "spill-slot", MachineStackObject::SpillSlot);
     226         280 :     IO.enumCase(Type, "variable-sized", MachineStackObject::VariableSized);
     227         280 :   }
     228             : };
     229             : 
     230             : template <> struct MappingTraits<MachineStackObject> {
     231         357 :   static void mapping(yaml::IO &YamlIO, MachineStackObject &Object) {
     232         714 :     YamlIO.mapRequired("id", Object.ID);
     233         714 :     YamlIO.mapOptional("name", Object.Name,
     234         714 :                        StringValue()); // Don't print out an empty name.
     235         714 :     YamlIO.mapOptional(
     236             :         "type", Object.Type,
     237             :         MachineStackObject::DefaultType); // Don't print the default type.
     238         714 :     YamlIO.mapOptional("offset", Object.Offset, (int64_t)0);
     239         357 :     if (Object.Type != MachineStackObject::VariableSized)
     240         346 :       YamlIO.mapRequired("size", Object.Size);
     241         714 :     YamlIO.mapOptional("alignment", Object.Alignment, (unsigned)0);
     242         714 :     YamlIO.mapOptional("stack-id", Object.StackID);
     243         714 :     YamlIO.mapOptional("callee-saved-register", Object.CalleeSavedRegister,
     244         714 :                        StringValue()); // Don't print it out when it's empty.
     245        1071 :     YamlIO.mapOptional("local-offset", Object.LocalOffset, Optional<int64_t>());
     246         714 :     YamlIO.mapOptional("di-variable", Object.DebugVar,
     247         714 :                        StringValue()); // Don't print it out when it's empty.
     248         714 :     YamlIO.mapOptional("di-expression", Object.DebugExpr,
     249         714 :                        StringValue()); // Don't print it out when it's empty.
     250         714 :     YamlIO.mapOptional("di-location", Object.DebugLoc,
     251         714 :                        StringValue()); // Don't print it out when it's empty.
     252         357 :   }
     253             : 
     254             :   static const bool flow = true;
     255             : };
     256             : 
     257             : /// Serializable representation of the fixed stack object from the
     258             : /// MachineFrameInfo class.
     259        4174 : struct FixedMachineStackObject {
     260             :   enum ObjectType { DefaultType, SpillSlot };
     261             :   UnsignedValue ID;
     262             :   ObjectType Type = DefaultType;
     263             :   int64_t Offset = 0;
     264             :   uint64_t Size = 0;
     265             :   unsigned Alignment = 0;
     266             :   uint8_t StackID = 0;
     267             :   bool IsImmutable = false;
     268             :   bool IsAliased = false;
     269             :   StringValue CalleeSavedRegister;
     270           0 :   bool operator==(const FixedMachineStackObject &Other) const {
     271           0 :     return ID == Other.ID && Type == Other.Type && Offset == Other.Offset &&
     272           0 :            Size == Other.Size && Alignment == Other.Alignment &&
     273             :            StackID == Other.StackID &&
     274           0 :            IsImmutable == Other.IsImmutable && IsAliased == Other.IsAliased &&
     275           0 :            CalleeSavedRegister == Other.CalleeSavedRegister;
     276             :   }
     277             : };
     278             : 
     279             : template <>
     280             : struct ScalarEnumerationTraits<FixedMachineStackObject::ObjectType> {
     281         347 :   static void enumeration(yaml::IO &IO,
     282             :                           FixedMachineStackObject::ObjectType &Type) {
     283         347 :     IO.enumCase(Type, "default", FixedMachineStackObject::DefaultType);
     284         347 :     IO.enumCase(Type, "spill-slot", FixedMachineStackObject::SpillSlot);
     285         347 :   }
     286             : };
     287             : 
     288             : template <> struct MappingTraits<FixedMachineStackObject> {
     289         382 :   static void mapping(yaml::IO &YamlIO, FixedMachineStackObject &Object) {
     290         764 :     YamlIO.mapRequired("id", Object.ID);
     291         764 :     YamlIO.mapOptional(
     292             :         "type", Object.Type,
     293             :         FixedMachineStackObject::DefaultType); // Don't print the default type.
     294         764 :     YamlIO.mapOptional("offset", Object.Offset, (int64_t)0);
     295         764 :     YamlIO.mapOptional("size", Object.Size, (uint64_t)0);
     296         764 :     YamlIO.mapOptional("alignment", Object.Alignment, (unsigned)0);
     297         764 :     YamlIO.mapOptional("stack-id", Object.StackID);
     298         382 :     if (Object.Type != FixedMachineStackObject::SpillSlot) {
     299         574 :       YamlIO.mapOptional("isImmutable", Object.IsImmutable, false);
     300         574 :       YamlIO.mapOptional("isAliased", Object.IsAliased, false);
     301             :     }
     302         764 :     YamlIO.mapOptional("callee-saved-register", Object.CalleeSavedRegister,
     303         764 :                        StringValue()); // Don't print it out when it's empty.
     304         382 :   }
     305             : 
     306             :   static const bool flow = true;
     307             : };
     308             : 
     309         386 : struct MachineConstantPoolValue {
     310             :   UnsignedValue ID;
     311             :   StringValue Value;
     312             :   unsigned Alignment = 0;
     313             :   bool IsTargetSpecific = false;
     314           0 :   bool operator==(const MachineConstantPoolValue &Other) const {
     315           0 :     return ID == Other.ID && Value == Other.Value &&
     316           0 :            Alignment == Other.Alignment &&
     317           0 :            IsTargetSpecific == Other.IsTargetSpecific;
     318             :   }
     319             : };
     320             : 
     321             : template <> struct MappingTraits<MachineConstantPoolValue> {
     322          46 :   static void mapping(IO &YamlIO, MachineConstantPoolValue &Constant) {
     323          92 :     YamlIO.mapRequired("id", Constant.ID);
     324         138 :     YamlIO.mapOptional("value", Constant.Value, StringValue());
     325          92 :     YamlIO.mapOptional("alignment", Constant.Alignment, (unsigned)0);
     326          92 :     YamlIO.mapOptional("isTargetSpecific", Constant.IsTargetSpecific, false);
     327          46 :   }
     328             : };
     329             : 
     330       23152 : struct MachineJumpTable {
     331          85 :   struct Entry {
     332             :     UnsignedValue ID;
     333             :     std::vector<FlowStringValue> Blocks;
     334             :     bool operator==(const Entry &Other) const {
     335           0 :       return ID == Other.ID && Blocks == Other.Blocks;
     336             :     }
     337             :   };
     338             : 
     339             :   MachineJumpTableInfo::JTEntryKind Kind = MachineJumpTableInfo::EK_Custom32;
     340             :   std::vector<Entry> Entries;
     341             :   bool operator==(const MachineJumpTable &Other) const {
     342           7 :     return Kind == Other.Kind && Entries == Other.Entries;
     343             :   }
     344             : };
     345             : 
     346             : template <> struct MappingTraits<MachineJumpTable::Entry> {
     347          17 :   static void mapping(IO &YamlIO, MachineJumpTable::Entry &Entry) {
     348          34 :     YamlIO.mapRequired("id", Entry.ID);
     349          34 :     YamlIO.mapOptional("blocks", Entry.Blocks, std::vector<FlowStringValue>());
     350          17 :   }
     351             : };
     352             : 
     353             : } // end namespace yaml
     354             : } // end namespace llvm
     355             : 
     356             : LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineFunctionLiveIn)
     357             : LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::VirtualRegisterDefinition)
     358             : LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineStackObject)
     359             : LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::FixedMachineStackObject)
     360             : LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineConstantPoolValue)
     361             : LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineJumpTable::Entry)
     362             : 
     363             : namespace llvm {
     364             : namespace yaml {
     365             : 
     366             : template <> struct MappingTraits<MachineJumpTable> {
     367          17 :   static void mapping(IO &YamlIO, MachineJumpTable &JT) {
     368          34 :     YamlIO.mapRequired("kind", JT.Kind);
     369          34 :     YamlIO.mapOptional("entries", JT.Entries,
     370          34 :                        std::vector<MachineJumpTable::Entry>());
     371          17 :   }
     372             : };
     373             : 
     374             : /// Serializable representation of MachineFrameInfo.
     375             : ///
     376             : /// Doesn't serialize attributes like 'StackAlignment', 'IsStackRealignable' and
     377             : /// 'RealignOption' as they are determined by the target and LLVM function
     378             : /// attributes.
     379             : /// It also doesn't serialize attributes like 'NumFixedObject' and
     380             : /// 'HasVarSizedObjects' as they are determined by the frame objects themselves.
     381       83540 : struct MachineFrameInfo {
     382             :   bool IsFrameAddressTaken = false;
     383             :   bool IsReturnAddressTaken = false;
     384             :   bool HasStackMap = false;
     385             :   bool HasPatchPoint = false;
     386             :   uint64_t StackSize = 0;
     387             :   int OffsetAdjustment = 0;
     388             :   unsigned MaxAlignment = 0;
     389             :   bool AdjustsStack = false;
     390             :   bool HasCalls = false;
     391             :   StringValue StackProtector;
     392             :   // TODO: Serialize FunctionContextIdx
     393             :   unsigned MaxCallFrameSize = ~0u; ///< ~0u means: not computed yet.
     394             :   bool HasOpaqueSPAdjustment = false;
     395             :   bool HasVAStart = false;
     396             :   bool HasMustTailInVarArgFunc = false;
     397             :   StringValue SavePoint;
     398             :   StringValue RestorePoint;
     399        2455 :   bool operator==(const MachineFrameInfo &Other) const {
     400             :     return IsFrameAddressTaken == Other.IsFrameAddressTaken &&
     401             :            IsReturnAddressTaken == Other.IsReturnAddressTaken &&
     402        2455 :            HasStackMap == Other.HasStackMap &&
     403        2446 :            HasPatchPoint == Other.HasPatchPoint &&
     404        2446 :            StackSize == Other.StackSize &&
     405        2401 :            OffsetAdjustment == Other.OffsetAdjustment &&
     406             :            MaxAlignment == Other.MaxAlignment &&
     407        4347 :            AdjustsStack == Other.AdjustsStack && HasCalls == Other.HasCalls &&
     408        4210 :            StackProtector == Other.StackProtector &&
     409             :            MaxCallFrameSize == Other.MaxCallFrameSize &&
     410             :            HasOpaqueSPAdjustment == Other.HasOpaqueSPAdjustment &&
     411        2105 :            HasVAStart == Other.HasVAStart &&
     412        1865 :            HasMustTailInVarArgFunc == Other.HasMustTailInVarArgFunc &&
     413        9915 :            SavePoint == Other.SavePoint && RestorePoint == Other.RestorePoint;
     414             :   }
     415             : };
     416             : 
     417             : template <> struct MappingTraits<MachineFrameInfo> {
     418        2657 :   static void mapping(IO &YamlIO, MachineFrameInfo &MFI) {
     419        5314 :     YamlIO.mapOptional("isFrameAddressTaken", MFI.IsFrameAddressTaken, false);
     420        5314 :     YamlIO.mapOptional("isReturnAddressTaken", MFI.IsReturnAddressTaken, false);
     421        5314 :     YamlIO.mapOptional("hasStackMap", MFI.HasStackMap, false);
     422        5314 :     YamlIO.mapOptional("hasPatchPoint", MFI.HasPatchPoint, false);
     423        5314 :     YamlIO.mapOptional("stackSize", MFI.StackSize, (uint64_t)0);
     424        5314 :     YamlIO.mapOptional("offsetAdjustment", MFI.OffsetAdjustment, (int)0);
     425        5314 :     YamlIO.mapOptional("maxAlignment", MFI.MaxAlignment, (unsigned)0);
     426        5314 :     YamlIO.mapOptional("adjustsStack", MFI.AdjustsStack, false);
     427        5314 :     YamlIO.mapOptional("hasCalls", MFI.HasCalls, false);
     428        5314 :     YamlIO.mapOptional("stackProtector", MFI.StackProtector,
     429        5314 :                        StringValue()); // Don't print it out when it's empty.
     430        5314 :     YamlIO.mapOptional("maxCallFrameSize", MFI.MaxCallFrameSize, (unsigned)~0);
     431        5314 :     YamlIO.mapOptional("hasOpaqueSPAdjustment", MFI.HasOpaqueSPAdjustment,
     432             :                        false);
     433        5314 :     YamlIO.mapOptional("hasVAStart", MFI.HasVAStart, false);
     434        5314 :     YamlIO.mapOptional("hasMustTailInVarArgFunc", MFI.HasMustTailInVarArgFunc,
     435             :                        false);
     436        5314 :     YamlIO.mapOptional("savePoint", MFI.SavePoint,
     437        5314 :                        StringValue()); // Don't print it out when it's empty.
     438        5314 :     YamlIO.mapOptional("restorePoint", MFI.RestorePoint,
     439        5314 :                        StringValue()); // Don't print it out when it's empty.
     440        2657 :   }
     441             : };
     442             : 
     443       70630 : struct MachineFunction {
     444             :   StringRef Name;
     445             :   unsigned Alignment = 0;
     446             :   bool ExposesReturnsTwice = false;
     447             :   // GISel MachineFunctionProperties.
     448             :   bool Legalized = false;
     449             :   bool RegBankSelected = false;
     450             :   bool Selected = false;
     451             :   // Register information
     452             :   bool TracksRegLiveness = false;
     453             :   std::vector<VirtualRegisterDefinition> VirtualRegisters;
     454             :   std::vector<MachineFunctionLiveIn> LiveIns;
     455             :   Optional<std::vector<FlowStringValue>> CalleeSavedRegisters;
     456             :   // TODO: Serialize the various register masks.
     457             :   // Frame information
     458             :   MachineFrameInfo FrameInfo;
     459             :   std::vector<FixedMachineStackObject> FixedStackObjects;
     460             :   std::vector<MachineStackObject> StackObjects;
     461             :   std::vector<MachineConstantPoolValue> Constants; /// Constant pool.
     462             :   MachineJumpTable JumpTableInfo;
     463             :   BlockStringValue Body;
     464             : };
     465             : 
     466             : template <> struct MappingTraits<MachineFunction> {
     467        4710 :   static void mapping(IO &YamlIO, MachineFunction &MF) {
     468        9420 :     YamlIO.mapRequired("name", MF.Name);
     469        9420 :     YamlIO.mapOptional("alignment", MF.Alignment, (unsigned)0);
     470        9420 :     YamlIO.mapOptional("exposesReturnsTwice", MF.ExposesReturnsTwice, false);
     471        9420 :     YamlIO.mapOptional("legalized", MF.Legalized, false);
     472        9420 :     YamlIO.mapOptional("regBankSelected", MF.RegBankSelected, false);
     473        9420 :     YamlIO.mapOptional("selected", MF.Selected, false);
     474        9420 :     YamlIO.mapOptional("tracksRegLiveness", MF.TracksRegLiveness, false);
     475        9420 :     YamlIO.mapOptional("registers", MF.VirtualRegisters,
     476        9420 :                        std::vector<VirtualRegisterDefinition>());
     477        9420 :     YamlIO.mapOptional("liveins", MF.LiveIns,
     478        9420 :                        std::vector<MachineFunctionLiveIn>());
     479        9420 :     YamlIO.mapOptional("calleeSavedRegisters", MF.CalleeSavedRegisters,
     480        9420 :                        Optional<std::vector<FlowStringValue>>());
     481       14130 :     YamlIO.mapOptional("frameInfo", MF.FrameInfo, MachineFrameInfo());
     482        9420 :     YamlIO.mapOptional("fixedStack", MF.FixedStackObjects,
     483        9420 :                        std::vector<FixedMachineStackObject>());
     484        9420 :     YamlIO.mapOptional("stack", MF.StackObjects,
     485        9420 :                        std::vector<MachineStackObject>());
     486        9420 :     YamlIO.mapOptional("constants", MF.Constants,
     487        9420 :                        std::vector<MachineConstantPoolValue>());
     488        7165 :     if (!YamlIO.outputting() || !MF.JumpTableInfo.Entries.empty())
     489        9048 :       YamlIO.mapOptional("jumpTable", MF.JumpTableInfo, MachineJumpTable());
     490       18840 :     YamlIO.mapOptional("body", MF.Body, BlockStringValue());
     491        4710 :   }
     492             : };
     493             : 
     494             : } // end namespace yaml
     495             : } // end namespace llvm
     496             : 
     497             : #endif

Generated by: LCOV version 1.13