From: Johannes Doerfert Date: Fri, 16 Aug 2019 19:49:00 +0000 (+0000) Subject: [Attributor][NFC] Introduce aliases for call site attributes X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=910dc4b6855c177c0692a000e0f2c12e9ae3f3e1;p=llvm [Attributor][NFC] Introduce aliases for call site attributes Until we have call site specific liveness and/or value information there is no need to do call site specific deduction. Though, we need the symbols in follow up patches that make Attributor::getAAFor return a reference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369143 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/Attributor.cpp b/lib/Transforms/IPO/Attributor.cpp index 97f0c69067d..5ba0f1b90b7 100644 --- a/lib/Transforms/IPO/Attributor.cpp +++ b/lib/Transforms/IPO/Attributor.cpp @@ -496,6 +496,9 @@ struct AANoUnwindFunction final : public AANoUnwindImpl { void trackStatistics() const override { STATS_DECLTRACK_FN_ATTR(nounwind) } }; +/// NoUnwind attribute deduction for a call sites. +using AANoUnwindCallSite = AANoUnwindFunction; + /// --------------------- Function Return Values ------------------------------- /// "Attribute" that collects all potential returned values and the return @@ -831,6 +834,9 @@ struct AAReturnedValuesFunction final : public AAReturnedValuesImpl { void trackStatistics() const override { STATS_DECLTRACK_ARG_ATTR(returned) } }; +/// Returned values information for a call sites. +using AAReturnedValuesCallSite = AAReturnedValuesFunction; + /// ------------------------ NoSync Function Attribute ------------------------- struct AANoSyncImpl : AANoSync { @@ -862,13 +868,6 @@ struct AANoSyncImpl : AANoSync { static bool isNoSyncIntrinsic(Instruction *I); }; -struct AANoSyncFunction final : public AANoSyncImpl { - AANoSyncFunction(const IRPosition &IRP) : AANoSyncImpl(IRP) {} - - /// See AbstractAttribute::trackStatistics() - void trackStatistics() const override { STATS_DECLTRACK_FN_ATTR(nosync) } -}; - bool AANoSyncImpl::isNonRelaxedAtomic(Instruction *I) { if (!I->isAtomic()) return false; @@ -1001,6 +1000,16 @@ ChangeStatus AANoSyncImpl::updateImpl(Attributor &A) { return ChangeStatus::UNCHANGED; } +struct AANoSyncFunction final : public AANoSyncImpl { + AANoSyncFunction(const IRPosition &IRP) : AANoSyncImpl(IRP) {} + + /// See AbstractAttribute::trackStatistics() + void trackStatistics() const override { STATS_DECLTRACK_FN_ATTR(nosync) } +}; + +/// NoSync attribute deduction for a call sites. +using AANoSyncCallSite = AANoSyncFunction; + /// ------------------------ No-Free Attributes ---------------------------- struct AANoFreeImpl : public AANoFree { @@ -1042,6 +1051,9 @@ struct AANoFreeFunction final : public AANoFreeImpl { void trackStatistics() const override { STATS_DECLTRACK_FN_ATTR(nofree) } }; +/// NoFree attribute deduction for a call sites. +using AANoFreeCallSite = AANoFreeFunction; + /// ------------------------ NonNull Argument Attribute ------------------------ struct AANonNullImpl : AANonNull { AANonNullImpl(const IRPosition &IRP) : AANonNull(IRP) {} @@ -1178,6 +1190,9 @@ struct AANonNullCallSiteArgument final : AANonNullImpl { void trackStatistics() const override { STATS_DECLTRACK_CSARG_ATTR(nonnull) } }; +/// NonNull attribute deduction for a call sites. +using AANonNullCallSiteReturned = AANonNullReturned; + /// ------------------------ Will-Return Attributes ---------------------------- // Helper function that checks whether a function has any cycle. @@ -1256,6 +1271,9 @@ struct AAWillReturnFunction final : AAWillReturnImpl { void trackStatistics() const override { STATS_DECLTRACK_FN_ATTR(norecurse) } }; +/// WillReturn attribute deduction for a call sites. +using AAWillReturnCallSite = AAWillReturnFunction; + /// ------------------------ NoAlias Argument Attribute ------------------------ struct AANoAliasImpl : AANoAlias { @@ -1322,6 +1340,9 @@ struct AANoAliasReturned final : AANoAliasImpl { void trackStatistics() const override { STATS_DECLTRACK_FNRET_ATTR(noalias) } }; +/// NoAlias attribute deduction for a call site return value. +using AANoAliasCallSiteReturned = AANoAliasReturned; + /// -------------------AAIsDead Function Attribute----------------------- struct AAIsDeadImpl : public AAIsDead { @@ -1599,6 +1620,9 @@ ChangeStatus AAIsDeadImpl::updateImpl(Attributor &A) { return Status; } +/// Liveness information for a call sites. +using AAIsDeadCallSite = AAIsDeadFunction; + /// -------------------- Dereferenceable Argument Attribute -------------------- struct DerefState : AbstractState { @@ -1907,6 +1931,9 @@ ChangeStatus AADereferenceableCallSiteArgument::updateImpl(Attributor &A) { : ChangeStatus::CHANGED; } +/// Dereferenceable attribute deduction for a call site return value. +using AADereferenceableCallSiteReturned = AADereferenceableReturned; + // ------------------------ Align Argument Attribute ------------------------ struct AAAlignImpl : AAAlign { @@ -2060,6 +2087,9 @@ ChangeStatus AAAlignCallSiteArgument::updateImpl(Attributor &A) { : ChangeStatus::CHANGED; } +/// Align attribute deduction for a call site return value. +using AAAlignCallSiteReturned = AAAlignReturned; + /// ------------------ Function No-Return Attribute ---------------------------- struct AANoReturnImpl : public AANoReturn { AANoReturnImpl(const IRPosition &IRP) : AANoReturn(IRP) {} @@ -2092,6 +2122,9 @@ struct AANoReturnFunction final : AANoReturnImpl { void trackStatistics() const override { STATS_DECLTRACK_FN_ATTR(noreturn) } }; +/// NoReturn attribute deduction for a call sites. +using AANoReturnCallSite = AANoReturnFunction; + /// ---------------------------------------------------------------------------- /// Attributor /// ----------------------------------------------------------------------------