[llvm] 01c4574 - [Attributor] Create getName() method for abstract attribute

Luofan Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 00:23:38 PDT 2020


Author: Luofan Chen
Date: 2020-07-03T15:22:35+08:00
New Revision: 01c4574a129e987cd89daf94969bda2e929fe5a8

URL: https://github.com/llvm/llvm-project/commit/01c4574a129e987cd89daf94969bda2e929fe5a8
DIFF: https://github.com/llvm/llvm-project/commit/01c4574a129e987cd89daf94969bda2e929fe5a8.diff

LOG: [Attributor] Create getName() method for abstract attribute

Summary: The `getName()` method returns the name of the abstract attribute

Reviewers: jdoerfert, sstefan1, uenoku, homerdin, baziotis

Reviewed By: sstefan1

Subscribers: uenoku, kuter, llvm-commits

Tags: #llvm

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

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/IPO/Attributor.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index e4fc70253c55..93fc89278c79 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -2014,6 +2014,9 @@ struct AbstractAttribute : public IRPosition {
 
   /// This function should return the "summarized" assumed state as string.
   virtual const std::string getAsStr() const = 0;
+
+  /// This function should return the name of the AbstractAttribute
+  virtual const std::string getName() const = 0;
   ///}
 
   /// Allow the Attributor access to the protected methods.
@@ -2128,6 +2131,9 @@ struct AAReturnedValues
   static AAReturnedValues &createForPosition(const IRPosition &IRP,
                                              Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAReturnedValues"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2146,6 +2152,9 @@ struct AANoUnwind
   /// Create an abstract attribute view for the position \p IRP.
   static AANoUnwind &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AANoUnwind"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2164,6 +2173,9 @@ struct AANoSync
   /// Create an abstract attribute view for the position \p IRP.
   static AANoSync &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AANoSync"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2183,6 +2195,9 @@ struct AANonNull
   /// Create an abstract attribute view for the position \p IRP.
   static AANonNull &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AANonNull"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2202,6 +2217,9 @@ struct AANoRecurse
   /// Create an abstract attribute view for the position \p IRP.
   static AANoRecurse &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AANoRecurse"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2221,6 +2239,9 @@ struct AAWillReturn
   /// Create an abstract attribute view for the position \p IRP.
   static AAWillReturn &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAWillReturn"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2247,6 +2268,9 @@ struct AAUndefinedBehavior
   static AAUndefinedBehavior &createForPosition(const IRPosition &IRP,
                                                 Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAUndefinedBehavior"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2275,6 +2299,9 @@ struct AAReachability : public StateWrapper<BooleanState, AbstractAttribute> {
   static AAReachability &createForPosition(const IRPosition &IRP,
                                            Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAReachability"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2294,6 +2321,9 @@ struct AANoAlias
   /// Create an abstract attribute view for the position \p IRP.
   static AANoAlias &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AANoAlias"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2313,6 +2343,9 @@ struct AANoFree
   /// Create an abstract attribute view for the position \p IRP.
   static AANoFree &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AANoFree"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2332,6 +2365,9 @@ struct AANoReturn
   /// Create an abstract attribute view for the position \p IRP.
   static AANoReturn &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AANoReturn"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2386,6 +2422,9 @@ struct AAIsDead : public StateWrapper<BooleanState, AbstractAttribute> {
     return F.hasPersonalityFn() && !canSimplifyInvokeNoUnwind(&F);
   }
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAIsDead"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 
@@ -2576,6 +2615,9 @@ struct AADereferenceable
   static AADereferenceable &createForPosition(const IRPosition &IRP,
                                               Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AADereferenceable"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2594,6 +2636,9 @@ struct AAAlign : public IRAttribute<
   /// Return known alignment.
   unsigned getKnownAlign() const { return getKnown(); }
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAAlign"; }
+
   /// Create an abstract attribute view for the position \p IRP.
   static AAAlign &createForPosition(const IRPosition &IRP, Attributor &A);
 
@@ -2648,6 +2693,9 @@ struct AANoCapture
   /// Create an abstract attribute view for the position \p IRP.
   static AANoCapture &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AANoCapture"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2666,6 +2714,9 @@ struct AAValueSimplify : public StateWrapper<BooleanState, AbstractAttribute> {
   static AAValueSimplify &createForPosition(const IRPosition &IRP,
                                             Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAValueSimplify"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2683,6 +2734,9 @@ struct AAHeapToStack : public StateWrapper<BooleanState, AbstractAttribute> {
   /// Create an abstract attribute view for the position \p IRP.
   static AAHeapToStack &createForPosition(const IRPosition &IRP, Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAHeapToStack"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2716,6 +2770,9 @@ struct AAPrivatizablePtr
   static AAPrivatizablePtr &createForPosition(const IRPosition &IRP,
                                               Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAPrivatizablePtr"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2767,6 +2824,9 @@ struct AAMemoryBehavior
   static AAMemoryBehavior &createForPosition(const IRPosition &IRP,
                                              Attributor &A);
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAMemoryBehavior"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2925,6 +2985,9 @@ struct AAMemoryLocation
     return getMemoryLocationsAsStr(getAssumedNotAccessedLocation());
   }
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAMemoryLocation"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };
@@ -2970,6 +3033,9 @@ struct AAValueConstantRange
     return nullptr;
   }
 
+  /// See AbstractAttribute::getName()
+  const std::string getName() const override { return "AAValueConstantRange"; }
+
   /// Unique ID (due to the unique address)
   static const char ID;
 };


        


More information about the llvm-commits mailing list