Author: eopXD Date: 2023-01-24T00:05:31-08:00 New Revision: 74252fb115b42bab2c050086603c1385c8a2ffb6
URL: https://github.com/llvm/llvm-project/commit/74252fb115b42bab2c050086603c1385c8a2ffb6 DIFF: https://github.com/llvm/llvm-project/commit/74252fb115b42bab2c050086603c1385c8a2ffb6.diff LOG: [2/15][Clang][RISCV][NFC] Rename Policy::IsPolicyNone to IsUnspecifed The original naming is inaccurate. An RVV intrinsic always comes with a corresponding policy behavior. When the policy is unspecified for an intrinsic, its policy behavior should be it's default assumption. This is the 2nd commit of a patch-set that aims to change the default policy for RVV intrinsics from TAMU to TAMA. Please refer to the cover letter in the 1st commit (D141573) for an overview. Reviewed By: kito-cheng Differential Revision: https://reviews.llvm.org/D141574 Added: Modified: clang/include/clang/Support/RISCVVIntrinsicUtils.h clang/lib/Support/RISCVVIntrinsicUtils.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h index a0c72d9f2cdba..425784b4b6fd3 100644 --- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h +++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h @@ -93,7 +93,7 @@ enum class TypeModifier : uint8_t { }; struct Policy { - bool PolicyNone = false; + bool IsUnspecified = false; enum PolicyType { Undisturbed, Agnostic, @@ -102,7 +102,7 @@ struct Policy { PolicyType TailPolicy = Omit; PolicyType MaskPolicy = Omit; bool IntrinsicWithoutMU = false; - Policy() : PolicyNone(true) {} + Policy() : IsUnspecified(true) {} Policy(PolicyType _TailPolicy, PolicyType _MaskPolicy, bool _IntrinsicWithoutMU = false) : TailPolicy(_TailPolicy), MaskPolicy(_MaskPolicy), @@ -150,11 +150,11 @@ struct Policy { return MaskPolicy == Undisturbed && TailPolicy == Omit; } - bool isPolicyNonePolicy() const { return PolicyNone; } + bool isUnspecified() const { return IsUnspecified; } bool operator==(const Policy &Other) const { - return PolicyNone == Other.PolicyNone && TailPolicy == Other.TailPolicy && - MaskPolicy == Other.MaskPolicy && + return IsUnspecified == Other.IsUnspecified && + TailPolicy == Other.TailPolicy && MaskPolicy == Other.MaskPolicy && IntrinsicWithoutMU == Other.IntrinsicWithoutMU; } @@ -431,7 +431,7 @@ class RVVIntrinsic { return IntrinsicTypes; } Policy getPolicyAttrs() const { - assert(PolicyAttrs.PolicyNone == false); + assert(PolicyAttrs.IsUnspecified == false); return PolicyAttrs; } unsigned getPolicyAttrsBits() const { @@ -441,7 +441,7 @@ class RVVIntrinsic { // constexpr unsigned TAIL_AGNOSTIC_MASK_AGNOSTIC = 3; // FIXME: how about value 2 // int PolicyAttrs = TAIL_UNDISTURBED; - assert(PolicyAttrs.PolicyNone == false); + assert(PolicyAttrs.IsUnspecified == false); if (PolicyAttrs.isTUMAPolicy()) return 2; diff --git a/clang/lib/Support/RISCVVIntrinsicUtils.cpp b/clang/lib/Support/RISCVVIntrinsicUtils.cpp index 502242655f24a..93ade07b583b7 100644 --- a/clang/lib/Support/RISCVVIntrinsicUtils.cpp +++ b/clang/lib/Support/RISCVVIntrinsicUtils.cpp @@ -917,9 +917,9 @@ llvm::SmallVector<PrototypeDescriptor> RVVIntrinsic::computeBuiltinTypes( // Update PolicyAttrs if need (TA or TAMA) for compute builtin types. if (PolicyAttrs.isMAPolicy()) PolicyAttrs.TailPolicy = Policy::PolicyType::Agnostic; // TAMA - if (PolicyAttrs.isPolicyNonePolicy()) { + if (PolicyAttrs.isUnspecified()) { if (!IsMasked) { - PolicyAttrs.PolicyNone = false; + PolicyAttrs.IsUnspecified = false; PolicyAttrs.TailPolicy = Policy::PolicyType::Agnostic; // TA } } @@ -1016,8 +1016,8 @@ void RVVIntrinsic::updateNamesAndPolicy(bool IsMasked, bool HasPolicy, OverloadedName += suffix; }; - if (PolicyAttrs.isPolicyNonePolicy()) { - PolicyAttrs.PolicyNone = false; + if (PolicyAttrs.isUnspecified()) { + PolicyAttrs.IsUnspecified = false; if (IsMasked) { Name += "_m"; // FIXME: Currently _m default policy implementation is diff erent with _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits