[PATCH] D141574: [WIP][2/N][Clang][RISCV][NFC] Rename Policy::IsPolicyNone to IsUnspecifed

Yueh-Ting (eop) Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 00:51:10 PST 2023


eopXD created this revision.
Herald added subscribers: sunshaoce, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141574

Files:
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/Support/RISCVVIntrinsicUtils.cpp


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===================================================================
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -917,9 +917,9 @@
   // 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
     }
   }
@@ -1022,8 +1022,8 @@
     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 different with
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===================================================================
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -93,7 +93,7 @@
 };
 
 struct Policy {
-  bool PolicyNone = false;
+  bool IsUnspecified = false;
   enum PolicyType {
     Undisturbed,
     Agnostic,
@@ -102,7 +102,7 @@
   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 @@
     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;
   }
 
@@ -434,7 +434,7 @@
     return IntrinsicTypes;
   }
   Policy getPolicyAttrs() const {
-    assert(PolicyAttrs.PolicyNone == false);
+    assert(PolicyAttrs.IsUnspecified == false);
     return PolicyAttrs;
   }
   unsigned getPolicyAttrsBits() const {
@@ -444,7 +444,7 @@
     // 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141574.488509.patch
Type: text/x-patch
Size: 2894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230112/36f14628/attachment-0001.bin>


More information about the cfe-commits mailing list