diff options
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h')
-rw-r--r-- | contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h b/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h index c68b073ebb8c..4a7406473b11 100644 --- a/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h +++ b/contrib/llvm-project/llvm/include/llvm/CodeGen/MIRYamlMapping.h @@ -159,6 +159,22 @@ template <> struct ScalarTraits<MaybeAlign> { static QuotingType mustQuote(StringRef) { return QuotingType::None; } }; +template <> struct ScalarTraits<Align> { + static void output(const Align &Alignment, void *, llvm::raw_ostream &OS) { + OS << Alignment.value(); + } + static StringRef input(StringRef Scalar, void *, Align &Alignment) { + unsigned long long N; + if (getAsUnsignedInteger(Scalar, 10, N)) + return "invalid number"; + if (!isPowerOf2_64(N)) + return "must be a power of two"; + Alignment = Align(N); + return StringRef(); + } + static QuotingType mustQuote(StringRef) { return QuotingType::None; } +}; + } // end namespace yaml } // end namespace llvm @@ -331,7 +347,7 @@ struct ScalarEnumerationTraits<TargetStackID::Value> { static void enumeration(yaml::IO &IO, TargetStackID::Value &ID) { IO.enumCase(ID, "default", TargetStackID::Default); IO.enumCase(ID, "sgpr-spill", TargetStackID::SGPRSpill); - IO.enumCase(ID, "sve-vec", TargetStackID::SVEVector); + IO.enumCase(ID, "scalable-vector", TargetStackID::ScalableVector); IO.enumCase(ID, "noalloc", TargetStackID::NoAlloc); } }; @@ -425,6 +441,36 @@ template <> struct MappingTraits<CallSiteInfo> { static const bool flow = true; }; +/// Serializable representation of debug value substitutions. +struct DebugValueSubstitution { + unsigned SrcInst; + unsigned SrcOp; + unsigned DstInst; + unsigned DstOp; + + bool operator==(const DebugValueSubstitution &Other) const { + return std::tie(SrcInst, SrcOp, DstInst, DstOp) == + std::tie(Other.SrcInst, Other.SrcOp, Other.DstInst, Other.DstOp); + } +}; + +template <> struct MappingTraits<DebugValueSubstitution> { + static void mapping(IO &YamlIO, DebugValueSubstitution &Sub) { + YamlIO.mapRequired("srcinst", Sub.SrcInst); + YamlIO.mapRequired("srcop", Sub.SrcOp); + YamlIO.mapRequired("dstinst", Sub.DstInst); + YamlIO.mapRequired("dstop", Sub.DstOp); + } + + static const bool flow = true; +}; +} // namespace yaml +} // namespace llvm + +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::DebugValueSubstitution) + +namespace llvm { +namespace yaml { struct MachineConstantPoolValue { UnsignedValue ID; StringValue Value; @@ -609,6 +655,7 @@ struct MachineFunction { std::vector<MachineConstantPoolValue> Constants; /// Constant pool. std::unique_ptr<MachineFunctionInfo> MachineFuncInfo; std::vector<CallSiteInfo> CallSitesInfo; + std::vector<DebugValueSubstitution> DebugValueSubstitutions; MachineJumpTable JumpTableInfo; BlockStringValue Body; }; @@ -637,6 +684,8 @@ template <> struct MappingTraits<MachineFunction> { std::vector<MachineStackObject>()); YamlIO.mapOptional("callSites", MF.CallSitesInfo, std::vector<CallSiteInfo>()); + YamlIO.mapOptional("debugValueSubstitutions", MF.DebugValueSubstitutions, + std::vector<DebugValueSubstitution>()); YamlIO.mapOptional("constants", MF.Constants, std::vector<MachineConstantPoolValue>()); YamlIO.mapOptional("machineFunctionInfo", MF.MachineFuncInfo); |