diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -2047,6 +2047,9 @@ /// This function should return the name of the AbstractAttribute virtual const std::string getName() const = 0; + + /// This function should return the address of the ID of the AbstractAttribute + virtual const char *getIdAddr() const = 0; ///} /// Allow the Attributor access to the protected methods. @@ -2164,6 +2167,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAReturnedValues"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAReturnedValues + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2185,6 +2197,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AANoUnwind"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AANoUnwind + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2206,6 +2226,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AANoSync"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AANoSync + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2228,6 +2256,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AANonNull"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AANonNull + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2250,6 +2286,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AANoRecurse"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AANoRecurse + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2272,6 +2316,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAWillReturn"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AAWillReturn + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2301,6 +2353,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAUndefinedBehavior"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAUndefineBehavior + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2332,6 +2393,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAReachability"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAReachability + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2354,6 +2424,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AANoAlias"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AANoAlias + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2376,6 +2454,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AANoFree"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AANoFree + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2398,6 +2484,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AANoReturn"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AANoReturn + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2455,6 +2549,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAIsDead"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AAIsDead + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; @@ -2648,6 +2750,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AADereferenceable"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AADereferenceable + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2669,6 +2780,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAAlign"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AAAlign + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Create an abstract attribute view for the position \p IRP. static AAAlign &createForPosition(const IRPosition &IRP, Attributor &A); @@ -2726,6 +2845,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AANoCapture"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AANoCapture + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2747,6 +2874,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAValueSimplify"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAValueSimplify + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2767,6 +2903,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAHeapToStack"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AAHeapToStack + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2803,6 +2947,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAPrivatizablePtr"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAPricatizablePtr + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -2857,6 +3010,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAMemoryBehavior"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAMemoryBehavior + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -3018,6 +3180,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAMemoryLocation"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAMemoryLocation + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; @@ -3066,6 +3237,15 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAValueConstantRange"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAValueConstantRange + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + /// Unique ID (due to the unique address) static const char ID; }; diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -23,6 +23,7 @@ #include "llvm/IR/NoFolder.h" #include "llvm/IR/Verifier.h" #include "llvm/InitializePasses.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Local.h" diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp --- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -1113,6 +1113,14 @@ /// See AbstractAttribute::getName() const std::string getName() const override { return "AAICVTracker"; } + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is AAICVTracker + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + static const char ID; };