[clang] 719a728 - [15/15][Clang][RISCV][NFC] Set data member under Policy as constants

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 07:06:38 PST 2023


Author: eopXD
Date: 2023-01-26T07:06:33-08:00
New Revision: 719a728b86a1ce6b7bcf1eb9fd6860c4a88391bd

URL: https://github.com/llvm/llvm-project/commit/719a728b86a1ce6b7bcf1eb9fd6860c4a88391bd
DIFF: https://github.com/llvm/llvm-project/commit/719a728b86a1ce6b7bcf1eb9fd6860c4a88391bd.diff

LOG: [15/15][Clang][RISCV][NFC] Set data member under Policy as constants

The object is now correct by construction.

This is the 15th 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.

Depends on D141793.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D141796

Added: 
    

Modified: 
    clang/include/clang/Support/RISCVVIntrinsicUtils.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
index fc53d70019c55..415179a6f441a 100644
--- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -92,15 +92,22 @@ enum class TypeModifier : uint8_t {
   LLVM_MARK_AS_BITMASK_ENUM(LMUL1),
 };
 
-struct Policy {
-  bool IsUnspecified = false;
+class Policy {
+public:
   enum PolicyType {
     Undisturbed,
     Agnostic,
   };
-  PolicyType TailPolicy = Agnostic;
-  PolicyType MaskPolicy = Agnostic;
+  bool IsUnspecified = false;
+
+private:
+  // The default assumption for an RVV instruction is TAMA, as an undisturbed
+  // policy generally will affect the performance of an out-of-order core.
+  const PolicyType TailPolicy = Agnostic;
+  const PolicyType MaskPolicy = Agnostic;
   bool HasTailPolicy, HasMaskPolicy;
+
+public:
   Policy(bool HasTailPolicy, bool HasMaskPolicy)
       : IsUnspecified(true), HasTailPolicy(HasTailPolicy),
         HasMaskPolicy(HasMaskPolicy) {}


        


More information about the cfe-commits mailing list