struct Attributor
Declaration
struct Attributor { /* full declaration omitted */ };
Description
The fixpoint analysis framework that orchestrates the attribute deduction. The Attributor provides a general abstract analysis framework (guided fixpoint iteration) as well as helper functions for the deduction of (LLVM-IR) attributes. However, also other code properties can be deduced, propagated, and ultimately manifested through the Attributor framework. This is particularly useful if these properties interact with attributes and a co-scheduled deduction allows to improve the solution. Even if not, thus if attributes/properties are completely isolated, they should use the Attributor framework to reduce the number of fixpoint iteration frameworks in the code base. Note that the Attributor design makes sure that isolated attributes are not impacted, in any way, by others derived at the same time if there is no cross-reasoning performed. The public facing interface of the Attributor is kept simple and basically allows abstract attributes to one thing, query abstract attributes in-flight. There are two reasons to do this: a) The optimistic state of one abstract attribute can justify an optimistic state of another, allowing to framework to end up with an optimistic (=best possible) fixpoint instead of one based solely on information in the IR. b) This avoids reimplementing various kinds of lookups, e.g., to check for existing IR attributes, in favor of a single lookups interface provided by an abstract attribute subclass. NOTE: The mechanics of adding a new "concrete" abstract attribute are described in the file comment.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1315
Member Variables
- private DenseMap< llvm::IRPosition, SmallVector< llvm::Attributor::SimplifictionCallbackTy, 1>> SimplificationCallbacks
- The vector with all simplification callbacks registered by outside AAs.
- public llvm::BumpPtrAllocator& Allocator
- The allocator used to allocate memory, e.g. for `AbstractAttribute`s.
- private DenseMap<llvm::Attributor::AAMapKeyTy, llvm::AbstractAttribute*> AAMap
- private DenseMap<llvm::Function*, SmallVector<std::unique_ptr< ArgumentReplacementInfo>, 8>> ArgumentReplacementMap
- Map to remember all requested signature changes (= argument replacements).
- private SetVector<llvm::Function*>& Functions
- The set of functions we are deriving attributes for.
- private llvm::InformationCache& InfoCache
- The information cache that holds pre-processed (LLVM-IR) information.
- private llvm::AADepGraph DG
- Abstract Attribute dependency graph
- private SmallSetVector<llvm::Function*, 8> CGModifiedFunctions
- Set of functions for which we modified the content such that it might impact the call graph.
- private SmallVector<llvm::Attributor::DependenceVector*, 16> DependenceStack
- private DenseSet<const llvm::Function*> VisitedFunctions
- A set to remember the functions we already assume to be live and visited.
- private SmallMapVector<llvm::Use*, llvm::Value*, 32> ToBeChangedUses
- Uses we replace with a new value after manifest is done. We will remove then trivially dead instructions as well.
- private SmallMapVector<llvm::Value*, std::pair<Value*, bool>, 32> ToBeChangedValues
- Values we replace with a new value after manifest is done. We will remove then trivially dead instructions as well.
- private SmallSetVector<llvm::WeakVH, 16> ToBeChangedToUnreachableInsts
- Instructions we replace with `unreachable` insts after manifest is done.
- private SmallSetVector<llvm::WeakVH, 16> InvokeWithDeadSuccessor
- Invoke instructions with at least a single dead successor block.
- private enum AttributorPhase Phase = AttributorPhase::SEEDING
- private unsigned int InitializationChainLength = 0
- The current initialization chain length. Tracked to avoid stack overflows.
- private SmallPtrSet<llvm::BasicBlock*, 8> ManifestAddedBlocks
- {
- private SmallSetVector<llvm::Function*, 8> ToBeDeletedFunctions
- private SmallSetVector<llvm::BasicBlock*, 8> ToBeDeletedBlocks
- private SmallSetVector<llvm::WeakVH, 8> ToBeDeletedInsts
- private SmallSetVector<llvm::AbstractAttribute*, 16> QueryAAsAwaitingUpdate
- Container with all the query AAs that requested an update via registerForUpdate.
- private const llvm::AttributorConfig Configuration
- User provided configuration for this Attributor instance.
Method Overview
- public Attributor(SetVector<llvm::Function *> & Functions, llvm::InformationCache & InfoCache, llvm::AttributorConfig Configuration)
- public bool changeAfterManifest(const llvm::IRPosition IRP, llvm::Value & NV, bool ChangeDroppable = true)
- public void changeToUnreachableAfterManifest(llvm::Instruction * I)
- public bool changeUseAfterManifest(llvm::Use & U, llvm::Value & NV)
- public bool checkForAllCallLikeInstructions(function_ref<bool (llvm::Instruction &)> Pred, const llvm::AbstractAttribute & QueryingAA, bool & UsedAssumedInformation, bool CheckBBLivenessOnly = false, bool CheckPotentiallyDead = false)
- public bool checkForAllCallSites(function_ref<bool (llvm::AbstractCallSite)> Pred, const llvm::AbstractAttribute & QueryingAA, bool RequireAllCallSites, bool & UsedAssumedInformation)
- public bool checkForAllCallSites(function_ref<bool (llvm::AbstractCallSite)> Pred, const llvm::Function & Fn, bool RequireAllCallSites, const llvm::AbstractAttribute * QueryingAA, bool & UsedAssumedInformation)
- public bool checkForAllInstructions(function_ref<bool (llvm::Instruction &)> Pred, const llvm::AbstractAttribute & QueryingAA, const ArrayRef<unsigned int> & Opcodes, bool & UsedAssumedInformation, bool CheckBBLivenessOnly = false, bool CheckPotentiallyDead = false)
- public bool checkForAllInstructions(function_ref<bool (llvm::Instruction &)> Pred, const llvm::Function * Fn, const llvm::AbstractAttribute & QueryingAA, const ArrayRef<unsigned int> & Opcodes, bool & UsedAssumedInformation, bool CheckBBLivenessOnly = false, bool CheckPotentiallyDead = false)
- public bool checkForAllReadWriteInstructions(function_ref<bool (llvm::Instruction &)> Pred, llvm::AbstractAttribute & QueryingAA, bool & UsedAssumedInformation)
- public bool checkForAllReturnedValues(function_ref<bool (llvm::Value &)> Pred, const llvm::AbstractAttribute & QueryingAA)
- public bool checkForAllReturnedValuesAndReturnInsts(function_ref<bool (llvm::Value &, const SmallSetVector<llvm::ReturnInst *, 4> &)> Pred, const llvm::AbstractAttribute & QueryingAA)
- public bool checkForAllUses(function_ref<bool (const llvm::Use &, bool &)> Pred, const llvm::AbstractAttribute & QueryingAA, const llvm::Value & V, bool CheckBBLivenessOnly = false, llvm::DepClassTy LivenessDepClass = DepClassTy::OPTIONAL, bool IgnoreDroppableUses = true, function_ref<bool (const llvm::Use &, const llvm::Use &)> EquivalentUseCB = nullptr)
- private llvm::ChangeStatus cleanupIR()
- public static void createShallowWrapper(llvm::Function & F)
- public void deleteAfterManifest(llvm::Function & F)
- public void deleteAfterManifest(llvm::BasicBlock & BB)
- public void deleteAfterManifest(llvm::Instruction & I)
- public template <typename RemarkKind, typename RemarkCallBack>void emitRemark(llvm::Function * F, llvm::StringRef RemarkName, RemarkCallBack && RemarkCB) const
- public template <typename RemarkKind, typename RemarkCallBack>void emitRemark(llvm::Instruction * I, llvm::StringRef RemarkName, RemarkCallBack && RemarkCB) const
- public template <typename AAType>const AAType & getAAFor(const llvm::AbstractAttribute & QueryingAA, const llvm::IRPosition & IRP, llvm::DepClassTy DepClass)
- public template <typename AAType>const AAType & getAndUpdateAAFor(const llvm::AbstractAttribute & QueryingAA, const llvm::IRPosition & IRP, llvm::DepClassTy DepClass)
- public Optional<llvm::Constant *> getAssumedConstant(const llvm::IRPosition & IRP, const llvm::AbstractAttribute & AA, bool & UsedAssumedInformation)
- public Optional<llvm::Constant *> getAssumedConstant(const llvm::Value & V, const llvm::AbstractAttribute & AA, bool & UsedAssumedInformation)
- public Optional<llvm::Value *> getAssumedSimplified(const llvm::IRPosition & IRP, const llvm::AbstractAttribute & AA, bool & UsedAssumedInformation, AA::ValueScope S)
- public Optional<llvm::Value *> getAssumedSimplified(const llvm::Value & V, const llvm::AbstractAttribute & AA, bool & UsedAssumedInformation, AA::ValueScope S)
- public Optional<llvm::Value *> getAssumedSimplified(const llvm::IRPosition & V, const llvm::AbstractAttribute * AA, bool & UsedAssumedInformation, AA::ValueScope S)
- public bool getAssumedSimplifiedValues(const llvm::IRPosition & IRP, const llvm::AbstractAttribute * AA, SmallVectorImpl<AA::ValueAndContext> & Values, AA::ValueScope S, bool & UsedAssumedInformation)
- public const llvm::DataLayout & getDataLayout() const
- public llvm::InformationCache & getInfoCache()
- public template <typename AAType>const AAType & getOrCreateAAFor(const llvm::IRPosition & IRP)
- public template <typename AAType>const AAType & getOrCreateAAFor(llvm::IRPosition IRP, const llvm::AbstractAttribute * QueryingAA, llvm::DepClassTy DepClass, bool ForceUpdate = false, bool UpdateAfterInit = true)
- public bool hasSimplificationCallback(const llvm::IRPosition & IRP)
- private void identifyDeadInternalFunctions()
- public void identifyDefaultAbstractAttributes(llvm::Function & F)
- public static llvm::Function * internalizeFunction(llvm::Function & F, bool Force = false)
- public static bool internalizeFunctions(SmallPtrSetImpl<llvm::Function *> & FnSet, DenseMap<llvm::Function *, llvm::Function *> & FnMap)
- public bool isAssumedDead(const llvm::BasicBlock & BB, const llvm::AbstractAttribute * QueryingAA, const llvm::AAIsDead * FnLivenessAA, llvm::DepClassTy DepClass = DepClassTy::OPTIONAL)
- public bool isAssumedDead(const llvm::IRPosition & IRP, const llvm::AbstractAttribute * QueryingAA, const llvm::AAIsDead * FnLivenessAA, bool & UsedAssumedInformation, bool CheckBBLivenessOnly = false, llvm::DepClassTy DepClass = DepClassTy::OPTIONAL)
- public bool isAssumedDead(const llvm::Use & U, const llvm::AbstractAttribute * QueryingAA, const llvm::AAIsDead * FnLivenessAA, bool & UsedAssumedInformation, bool CheckBBLivenessOnly = false, llvm::DepClassTy DepClass = DepClassTy::OPTIONAL)
- public bool isAssumedDead(const llvm::Instruction & I, const llvm::AbstractAttribute * QueryingAA, const llvm::AAIsDead * LivenessAA, bool & UsedAssumedInformation, bool CheckBBLivenessOnly = false, llvm::DepClassTy DepClass = DepClassTy::OPTIONAL)
- public bool isAssumedDead(const llvm::AbstractAttribute & AA, const llvm::AAIsDead * LivenessAA, bool & UsedAssumedInformation, bool CheckBBLivenessOnly = false, llvm::DepClassTy DepClass = DepClassTy::OPTIONAL)
- public bool isFunctionIPOAmendable(const llvm::Function & F)
- public static bool isInternalizable(llvm::Function & F)
- public bool isModulePass() const
- public bool isRunOn(llvm::Function & Fn) const
- public bool isValidFunctionSignatureRewrite(llvm::Argument & Arg, ArrayRef<llvm::Type *> ReplacementTypes)
- public template <typename AAType>AAType * lookupAAFor(const llvm::IRPosition & IRP, const llvm::AbstractAttribute * QueryingAA = nullptr, llvm::DepClassTy DepClass = DepClassTy::OPTIONAL, bool AllowInvalidState = false)
- private llvm::ChangeStatus manifestAttributes()
- public void markLiveInternalFunction(const llvm::Function & F)
- public void recordDependence(const llvm::AbstractAttribute & FromAA, const llvm::AbstractAttribute & ToAA, llvm::DepClassTy DepClass)
- public template <typename AAType>AAType & registerAA(AAType & AA)
- public void registerForUpdate(llvm::AbstractAttribute & AA)
- public bool registerFunctionSignatureRewrite(llvm::Argument & Arg, ArrayRef<llvm::Type *> ReplacementTypes, ArgumentReplacementInfo::CalleeRepairCBTy && CalleeRepairCB, ArgumentReplacementInfo::ACSRepairCBTy && ACSRepairCB)
- public void registerInvokeWithDeadSuccessor(llvm::InvokeInst & II)
- public void registerManifestAddedBasicBlock(llvm::BasicBlock & BB)
- public void registerSimplificationCallback(const llvm::IRPosition & IRP, const llvm::Attributor::SimplifictionCallbackTy & CB)
- private void rememberDependences()
- public void removeCallSite(llvm::CallInst * CI)
- private llvm::ChangeStatus rewriteFunctionSignatures(SmallSetVector<llvm::Function *, 8> & ModifiedFns)
- public llvm::ChangeStatus run()
- private void runTillFixpoint()
- private bool shouldPropagateCallBaseContext(const llvm::IRPosition & IRP)
- private bool shouldSeedAttribute(llvm::AbstractAttribute & AA)
- public Optional<llvm::Value *> translateArgumentToCallSiteContent(Optional<llvm::Value *> V, llvm::CallBase & CB, const llvm::AbstractAttribute & AA, bool & UsedAssumedInformation)
- private llvm::ChangeStatus updateAA(llvm::AbstractAttribute & AA)
- public ~Attributor()
Methods
¶Attributor(SetVector<llvm::Function*>& Functions,
llvm::InformationCache& InfoCache,
llvm::AttributorConfig Configuration)
Attributor(SetVector<llvm::Function*>& Functions,
llvm::InformationCache& InfoCache,
llvm::AttributorConfig Configuration)
Description
Constructor
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1324
Parameters
- SetVector<llvm::Function*>& Functions
- The set of functions we are deriving attributes for.
- llvm::InformationCache& InfoCache
- Cache to hold various information accessible for the abstract attributes.
- llvm::AttributorConfig Configuration
- The Attributor configuration which determines what generic features to use.
¶bool changeAfterManifest(
const llvm::IRPosition IRP,
llvm::Value& NV,
bool ChangeDroppable = true)
bool changeAfterManifest(
const llvm::IRPosition IRP,
llvm::Value& NV,
bool ChangeDroppable = true)
Description
Helper function to replace all uses associated with \p IRP with \p NV. Return true if there is any change. The flag \p ChangeDroppable indicates if dropppable uses should be changed too.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1617
Parameters
- const llvm::IRPosition IRP
- llvm::Value& NV
- bool ChangeDroppable = true
¶void changeToUnreachableAfterManifest(
llvm::Instruction* I)
void changeToUnreachableAfterManifest(
llvm::Instruction* I)
Description
Record that \p I is to be replaced with `unreachable` after information was manifested.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1639
Parameters
¶bool changeUseAfterManifest(llvm::Use& U,
llvm::Value& NV)
bool changeUseAfterManifest(llvm::Use& U,
llvm::Value& NV)
Description
Record that \p U is to be replaces with \p NV after information was manifested. This also triggers deletion of trivially dead istructions.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1603
Parameters
- llvm::Use& U
- llvm::Value& NV
¶bool checkForAllCallLikeInstructions(
function_ref<bool(llvm::Instruction&)> Pred,
const llvm::AbstractAttribute& QueryingAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false)
bool checkForAllCallLikeInstructions(
function_ref<bool(llvm::Instruction&)> Pred,
const llvm::AbstractAttribute& QueryingAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false)
Description
Check \p Pred on all call-like instructions (=CallBased derived). See checkForAllCallLikeInstructions(...) for more information.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2019
Parameters
- function_ref<bool(llvm::Instruction&)> Pred
- const llvm::AbstractAttribute& QueryingAA
- bool& UsedAssumedInformation
- bool CheckBBLivenessOnly = false
- bool CheckPotentiallyDead = false
¶bool checkForAllCallSites(
function_ref<bool(llvm::AbstractCallSite)>
Pred,
const llvm::AbstractAttribute& QueryingAA,
bool RequireAllCallSites,
bool& UsedAssumedInformation)
bool checkForAllCallSites(
function_ref<bool(llvm::AbstractCallSite)>
Pred,
const llvm::AbstractAttribute& QueryingAA,
bool RequireAllCallSites,
bool& UsedAssumedInformation)
Description
Check \p Pred on all function call sites. This method will evaluate \p Pred on call sites and return true if \p Pred holds in every call sites. However, this is only possible all call sites are known, hence the function has internal linkage. If true is returned, \p UsedAssumedInformation is set if assumed information was used to skip or simplify potential call sites.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1958
Parameters
- function_ref<bool(llvm::AbstractCallSite)> Pred
- const llvm::AbstractAttribute& QueryingAA
- bool RequireAllCallSites
- bool& UsedAssumedInformation
¶bool checkForAllCallSites(
function_ref<bool(llvm::AbstractCallSite)>
Pred,
const llvm::Function& Fn,
bool RequireAllCallSites,
const llvm::AbstractAttribute* QueryingAA,
bool& UsedAssumedInformation)
bool checkForAllCallSites(
function_ref<bool(llvm::AbstractCallSite)>
Pred,
const llvm::Function& Fn,
bool RequireAllCallSites,
const llvm::AbstractAttribute* QueryingAA,
bool& UsedAssumedInformation)
Description
Check \p Pred on all call sites of \p Fn. This method will evaluate \p Pred on call sites and return true if \p Pred holds in every call sites. However, this is only possible all call sites are known, hence the function has internal linkage. If true is returned, \p UsedAssumedInformation is set if assumed information was used to skip or simplify potential call sites.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1970
Parameters
- function_ref<bool(llvm::AbstractCallSite)> Pred
- const llvm::Function& Fn
- bool RequireAllCallSites
- const llvm::AbstractAttribute* QueryingAA
- bool& UsedAssumedInformation
¶bool checkForAllInstructions(
function_ref<bool(llvm::Instruction&)> Pred,
const llvm::AbstractAttribute& QueryingAA,
const ArrayRef<unsigned int>& Opcodes,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false)
bool checkForAllInstructions(
function_ref<bool(llvm::Instruction&)> Pred,
const llvm::AbstractAttribute& QueryingAA,
const ArrayRef<unsigned int>& Opcodes,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false)
Description
Check \p Pred on all instructions with an opcode present in \p Opcodes. This method will evaluate \p Pred on all instructions with an opcode present in \p Opcode and return true if \p Pred holds on all of them.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2009
Parameters
- function_ref<bool(llvm::Instruction&)> Pred
- const llvm::AbstractAttribute& QueryingAA
- const ArrayRef<unsigned int>& Opcodes
- bool& UsedAssumedInformation
- bool CheckBBLivenessOnly = false
- bool CheckPotentiallyDead = false
¶bool checkForAllInstructions(
function_ref<bool(llvm::Instruction&)> Pred,
const llvm::Function* Fn,
const llvm::AbstractAttribute& QueryingAA,
const ArrayRef<unsigned int>& Opcodes,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false)
bool checkForAllInstructions(
function_ref<bool(llvm::Instruction&)> Pred,
const llvm::Function* Fn,
const llvm::AbstractAttribute& QueryingAA,
const ArrayRef<unsigned int>& Opcodes,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
bool CheckPotentiallyDead = false)
Description
Check \p Pred on all instructions in \p Fn with an opcode present in\p Opcodes. This method will evaluate \p Pred on all instructions with an opcode present in \p Opcode and return true if \p Pred holds on all of them.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1997
Parameters
- function_ref<bool(llvm::Instruction&)> Pred
- const llvm::Function* Fn
- const llvm::AbstractAttribute& QueryingAA
- const ArrayRef<unsigned int>& Opcodes
- bool& UsedAssumedInformation
- bool CheckBBLivenessOnly = false
- bool CheckPotentiallyDead = false
¶bool checkForAllReadWriteInstructions(
function_ref<bool(llvm::Instruction&)> Pred,
llvm::AbstractAttribute& QueryingAA,
bool& UsedAssumedInformation)
bool checkForAllReadWriteInstructions(
function_ref<bool(llvm::Instruction&)> Pred,
llvm::AbstractAttribute& QueryingAA,
bool& UsedAssumedInformation)
Description
Check \p Pred on all Read/Write instructions. This method will evaluate \p Pred on all instructions that read or write to memory present in the information cache and return true if \p Pred holds on all of them.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2036
Parameters
- function_ref<bool(llvm::Instruction&)> Pred
- llvm::AbstractAttribute& QueryingAA
- bool& UsedAssumedInformation
¶bool checkForAllReturnedValues(
function_ref<bool(llvm::Value&)> Pred,
const llvm::AbstractAttribute& QueryingAA)
bool checkForAllReturnedValues(
function_ref<bool(llvm::Value&)> Pred,
const llvm::AbstractAttribute& QueryingAA)
Description
Check \p Pred on all values potentially returned by the function associated with \p QueryingAA. This is the context insensitive version of the method above.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1989
Parameters
- function_ref<bool(llvm::Value&)> Pred
- const llvm::AbstractAttribute& QueryingAA
¶bool checkForAllReturnedValuesAndReturnInsts(
function_ref<bool(
llvm::Value&,
const SmallSetVector<llvm::ReturnInst*,
4>&)> Pred,
const llvm::AbstractAttribute& QueryingAA)
bool checkForAllReturnedValuesAndReturnInsts(
function_ref<bool(
llvm::Value&,
const SmallSetVector<llvm::ReturnInst*,
4>&)> Pred,
const llvm::AbstractAttribute& QueryingAA)
Description
Check \p Pred on all values potentially returned by \p F. This method will evaluate \p Pred on all values potentially returned by the function associated with \p QueryingAA. The returned values are matched with their respective return instructions. Returns true if \p Pred holds on all of them.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1981
Parameters
- function_ref<bool( llvm::Value&, const SmallSetVector<llvm::ReturnInst*, 4>&)> Pred
- const llvm::AbstractAttribute& QueryingAA
¶bool checkForAllUses(
function_ref<bool(const llvm::Use&, bool&)>
Pred,
const llvm::AbstractAttribute& QueryingAA,
const llvm::Value& V,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy LivenessDepClass =
DepClassTy::OPTIONAL,
bool IgnoreDroppableUses = true,
function_ref<bool(const llvm::Use&,
const llvm::Use&)>
EquivalentUseCB = nullptr)
bool checkForAllUses(
function_ref<bool(const llvm::Use&, bool&)>
Pred,
const llvm::AbstractAttribute& QueryingAA,
const llvm::Value& V,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy LivenessDepClass =
DepClassTy::OPTIONAL,
bool IgnoreDroppableUses = true,
function_ref<bool(const llvm::Use&,
const llvm::Use&)>
EquivalentUseCB = nullptr)
Description
Check \p Pred on all (transitive) uses of \p V. This method will evaluate \p Pred on all (transitive) uses of the associated value and return true if \p Pred holds every time. If uses are skipped in favor of equivalent ones, e.g., if we look through memory, the \p EquivalentUseCB will be used to give the caller an idea what original used was replaced by a new one (or new ones). The visit is cut short if \p EquivalentUseCB returns false and the function will return false as well.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1791
Parameters
- function_ref<bool(const llvm::Use&, bool&)> Pred
- const llvm::AbstractAttribute& QueryingAA
- const llvm::Value& V
- bool CheckBBLivenessOnly = false
- llvm::DepClassTy LivenessDepClass = DepClassTy::OPTIONAL
- bool IgnoreDroppableUses = true
- function_ref<bool(const llvm::Use&, const llvm::Use&)> EquivalentUseCB = nullptr
¶llvm::ChangeStatus cleanupIR()
llvm::ChangeStatus cleanupIR()
Description
Gets called after attributes have been manifested, cleans up the IR. Deletes dead functions, blocks and instructions. Rewrites function signitures and updates the call graph.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2112
¶static void createShallowWrapper(
llvm::Function& F)
static void createShallowWrapper(
llvm::Function& F)
Description
Create a shallow wrapper for \p F such that \p F has internal linkage afterwards. It also sets the original \p F 's name to anonymous A wrapper is a function with the same type (and attributes) as \p F that will only call \p F and return the result, if any. Assuming the declaration of looks like: rty F(aty0 arg0, ..., atyN argN); The wrapper will then look as follows: rty wrapper(aty0 arg0, ..., atyN argN) { return F(arg0, ..., argN); }
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2054
Parameters
¶void deleteAfterManifest(llvm::Function& F)
void deleteAfterManifest(llvm::Function& F)
Description
Record that \p F is deleted after information was manifested.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1665
Parameters
¶void deleteAfterManifest(llvm::BasicBlock& BB)
void deleteAfterManifest(llvm::BasicBlock& BB)
Description
Record that \p BB is deleted after information was manifested. This also triggers deletion of trivially dead istructions.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1656
Parameters
- llvm::BasicBlock& BB
¶void deleteAfterManifest(llvm::Instruction& I)
void deleteAfterManifest(llvm::Instruction& I)
Description
Record that \p I is deleted after information was manifested. This also triggers deletion of trivially dead istructions.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1652
Parameters
¶template <typename RemarkKind,
typename RemarkCallBack>
void emitRemark(llvm::Function* F,
llvm::StringRef RemarkName,
RemarkCallBack&& RemarkCB) const
template <typename RemarkKind,
typename RemarkCallBack>
void emitRemark(llvm::Function* F,
llvm::StringRef RemarkName,
RemarkCallBack&& RemarkCB) const
Description
Emit a remark on a function.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1832
Templates
- RemarkKind
- RemarkCallBack
Parameters
- llvm::Function* F
- llvm::StringRef RemarkName
- RemarkCallBack&& RemarkCB
¶template <typename RemarkKind,
typename RemarkCallBack>
void emitRemark(llvm::Instruction* I,
llvm::StringRef RemarkName,
RemarkCallBack&& RemarkCB) const
template <typename RemarkKind,
typename RemarkCallBack>
void emitRemark(llvm::Instruction* I,
llvm::StringRef RemarkName,
RemarkCallBack&& RemarkCB) const
Description
Emit a remark generically. This template function can be used to generically emit a remark. The RemarkKind should be one of the following: - OptimizationRemark to indicate a successful optimization attempt - OptimizationRemarkMissed to report a failed optimization attempt - OptimizationRemarkAnalysis to provide additional information about an optimization attempt The remark is built using a callback function \p RemarkCB that takes a RemarkKind as input and returns a RemarkKind.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1811
Templates
- RemarkKind
- RemarkCallBack
Parameters
- llvm::Instruction* I
- llvm::StringRef RemarkName
- RemarkCallBack&& RemarkCB
¶template <typename AAType>
const AAType& getAAFor(
const llvm::AbstractAttribute& QueryingAA,
const llvm::IRPosition& IRP,
llvm::DepClassTy DepClass)
template <typename AAType>
const AAType& getAAFor(
const llvm::AbstractAttribute& QueryingAA,
const llvm::IRPosition& IRP,
llvm::DepClassTy DepClass)
Description
Lookup an abstract attribute of type \p AAType at position \p IRP. While no abstract attribute is found equivalent positions are checked, see SubsumingPositionIterator. Thus, the returned abstract attribute might be anchored at a different position, e.g., the callee if \p IRP is a call base. This method is the only (supported) way an abstract attribute can retrieve information from another abstract attribute. As an example, take an abstract attribute that determines the memory access behavior for a argument (readnone, readonly, ...). It should use `getAAFor` to get the most optimistic information for other abstract attributes in-flight, e.g. the one reasoning about the "captured" state for the argument or the one reasoning on the memory access behavior of the function as a whole. If the DepClass enum is set to `DepClassTy::None` the dependence from\p QueryingAA to the return abstract attribute is not automatically recorded. This should only be used if the caller will record the dependence explicitly if necessary, thus if it the returned abstract attribute is used for reasoning. To record the dependences explicitly use the `Attributor::recordDependence` method.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1360
Templates
- AAType
Parameters
- const llvm::AbstractAttribute& QueryingAA
- const llvm::IRPosition& IRP
- llvm::DepClassTy DepClass
¶template <typename AAType>
const AAType& getAndUpdateAAFor(
const llvm::AbstractAttribute& QueryingAA,
const llvm::IRPosition& IRP,
llvm::DepClassTy DepClass)
template <typename AAType>
const AAType& getAndUpdateAAFor(
const llvm::AbstractAttribute& QueryingAA,
const llvm::IRPosition& IRP,
llvm::DepClassTy DepClass)
Description
Similar to getAAFor but the return abstract attribute will be updated (via `AbstractAttribute::update`) even if it is found in the cache. This is especially useful for AAIsDead as changes in liveness can make updates possible/useful that were not happening before as the abstract attribute was assumed dead.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1372
Templates
- AAType
Parameters
- const llvm::AbstractAttribute& QueryingAA
- const llvm::IRPosition& IRP
- llvm::DepClassTy DepClass
¶Optional<llvm::Constant*> getAssumedConstant(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation)
Optional<llvm::Constant*> getAssumedConstant(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation)
Description
If \p IRP is assumed to be a constant, return it, if it is unclear yet, return None, otherwise return `nullptr`.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1672
Parameters
- const llvm::IRPosition& IRP
- const llvm::AbstractAttribute& AA
- bool& UsedAssumedInformation
¶Optional<llvm::Constant*> getAssumedConstant(
const llvm::Value& V,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation)
Optional<llvm::Constant*> getAssumedConstant(
const llvm::Value& V,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1675
Parameters
- const llvm::Value& V
- const llvm::AbstractAttribute& AA
- bool& UsedAssumedInformation
¶Optional<llvm::Value*> getAssumedSimplified(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation,
AA::ValueScope S)
Optional<llvm::Value*> getAssumedSimplified(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation,
AA::ValueScope S)
Description
If \p V is assumed simplified, return it, if it is unclear yet, return None, otherwise return `nullptr`.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1683
Parameters
- const llvm::IRPosition& IRP
- const llvm::AbstractAttribute& AA
- bool& UsedAssumedInformation
- AA::ValueScope S
¶Optional<llvm::Value*> getAssumedSimplified(
const llvm::Value& V,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation,
AA::ValueScope S)
Optional<llvm::Value*> getAssumedSimplified(
const llvm::Value& V,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation,
AA::ValueScope S)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1689
Parameters
- const llvm::Value& V
- const llvm::AbstractAttribute& AA
- bool& UsedAssumedInformation
- AA::ValueScope S
¶Optional<llvm::Value*> getAssumedSimplified(
const llvm::IRPosition& V,
const llvm::AbstractAttribute* AA,
bool& UsedAssumedInformation,
AA::ValueScope S)
Optional<llvm::Value*> getAssumedSimplified(
const llvm::IRPosition& V,
const llvm::AbstractAttribute* AA,
bool& UsedAssumedInformation,
AA::ValueScope S)
Description
If \p V is assumed simplified, return it, if it is unclear yet, return None, otherwise return `nullptr`. Same as the public version except that it can be used without recording dependences on any \p AA.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1700
Parameters
- const llvm::IRPosition& V
- const llvm::AbstractAttribute* AA
- bool& UsedAssumedInformation
- AA::ValueScope S
¶bool getAssumedSimplifiedValues(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute* AA,
SmallVectorImpl<AA::ValueAndContext>& Values,
AA::ValueScope S,
bool& UsedAssumedInformation)
bool getAssumedSimplifiedValues(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute* AA,
SmallVectorImpl<AA::ValueAndContext>& Values,
AA::ValueScope S,
bool& UsedAssumedInformation)
Description
Try to simplify \p IRP and in the scope \p S. If successful, true is returned and all potential values \p IRP can take are put into \p Values. If false is returned no other information is valid.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1708
Parameters
- const llvm::IRPosition& IRP
- const llvm::AbstractAttribute* AA
- SmallVectorImpl<AA::ValueAndContext>& Values
- AA::ValueScope S
- bool& UsedAssumedInformation
¶const llvm::DataLayout& getDataLayout() const
const llvm::DataLayout& getDataLayout() const
Description
Return the data layout associated with the anchor scope.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2092
¶llvm::InformationCache& getInfoCache()
llvm::InformationCache& getInfoCache()
Description
Return the internal information cache.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1551
¶template <typename AAType>
const AAType& getOrCreateAAFor(
const llvm::IRPosition& IRP)
template <typename AAType>
const AAType& getOrCreateAAFor(
const llvm::IRPosition& IRP)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1471
Templates
- AAType
Parameters
- const llvm::IRPosition& IRP
¶template <typename AAType>
const AAType& getOrCreateAAFor(
llvm::IRPosition IRP,
const llvm::AbstractAttribute* QueryingAA,
llvm::DepClassTy DepClass,
bool ForceUpdate = false,
bool UpdateAfterInit = true)
template <typename AAType>
const AAType& getOrCreateAAFor(
llvm::IRPosition IRP,
const llvm::AbstractAttribute* QueryingAA,
llvm::DepClassTy DepClass,
bool ForceUpdate = false,
bool UpdateAfterInit = true)
Description
The version of getAAFor that allows to omit a querying abstract attribute. Using this after Attributor started running is restricted to only the Attributor itself. Initial seeding of AAs can be done via this function. NOTE: ForceUpdate is ignored in any stage other than the update stage.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1384
Templates
- AAType
Parameters
- llvm::IRPosition IRP
- const llvm::AbstractAttribute* QueryingAA
- llvm::DepClassTy DepClass
- bool ForceUpdate = false
- bool UpdateAfterInit = true
¶bool hasSimplificationCallback(
const llvm::IRPosition& IRP)
bool hasSimplificationCallback(
const llvm::IRPosition& IRP)
Description
Return true if there is a simplification callback for \p IRP.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1727
Parameters
- const llvm::IRPosition& IRP
¶void identifyDeadInternalFunctions()
void identifyDeadInternalFunctions()
Description
Identify internal functions that are effectively dead, thus not reachable from a live entry point. The functions are added to ToBeDeletedFunctions.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2116
¶void identifyDefaultAbstractAttributes(
llvm::Function& F)
void identifyDefaultAbstractAttributes(
llvm::Function& F)
Description
Determine opportunities to derive 'default' attributes in \p F and create abstract attribute objects for them. Note that abstract attribute instances are generally created even if the IR already contains the information they would deduce. The most important reason for this is the single interface, the one of the abstract attribute instance, which can be queried without the need to look at the IR in various places.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1571
Parameters
- llvm::Function& F
- The function that is checked for attribute opportunities.
¶static llvm::Function* internalizeFunction(
llvm::Function& F,
bool Force = false)
static llvm::Function* internalizeFunction(
llvm::Function& F,
bool Force = false)
Description
Make another copy of the function \p F such that the copied version has internal linkage afterwards and can be analysed. Then we replace all uses of the original function to the copied one Only non-locally linked functions that have `linkonce_odr` or `weak_odr` linkage can be internalized because these linkages guarantee that other definitions with the same name have the same semantics as this one. This will only be run if the `attributor-allow-deep-wrappers` option is set, or if the function is called with \p Force set to true. If the function \p F failed to be internalized the return value will be a null pointer.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2073
Parameters
- llvm::Function& F
- bool Force = false
¶static bool internalizeFunctions(
SmallPtrSetImpl<llvm::Function*>& FnSet,
DenseMap<llvm::Function*, llvm::Function*>&
FnMap)
static bool internalizeFunctions(
SmallPtrSetImpl<llvm::Function*>& FnSet,
DenseMap<llvm::Function*, llvm::Function*>&
FnMap)
Description
Make copies of each function in the set \p FnSet such that the copied version has internal linkage afterwards and can be analysed. Then we replace all uses of the original function to the copied one. The map\p FnMap contains a mapping of functions to their internalized versions. Only non-locally linked functions that have `linkonce_odr` or `weak_odr` linkage can be internalized because these linkages guarantee that other definitions with the same name have the same semantics as this one. This version will internalize all the functions in the set \p FnSet at once and then replace the uses. This prevents internalized functions being called by external functions when there is an internalized version in the module.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2088
Parameters
- SmallPtrSetImpl<llvm::Function*>& FnSet
- DenseMap<llvm::Function*, llvm::Function*>& FnMap
¶bool isAssumedDead(
const llvm::BasicBlock& BB,
const llvm::AbstractAttribute* QueryingAA,
const llvm::AAIsDead* FnLivenessAA,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
bool isAssumedDead(
const llvm::BasicBlock& BB,
const llvm::AbstractAttribute* QueryingAA,
const llvm::AAIsDead* FnLivenessAA,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
Description
Return true if \p BB is assumed dead. If \p LivenessAA is not provided it is queried.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1778
Parameters
- const llvm::BasicBlock& BB
- const llvm::AbstractAttribute* QueryingAA
- const llvm::AAIsDead* FnLivenessAA
- llvm::DepClassTy DepClass = DepClassTy::OPTIONAL
¶bool isAssumedDead(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute* QueryingAA,
const llvm::AAIsDead* FnLivenessAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
bool isAssumedDead(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute* QueryingAA,
const llvm::AAIsDead* FnLivenessAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
Description
Return true if \p IRP is assumed dead. If \p FnLivenessAA is not provided it is queried.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1770
Parameters
- const llvm::IRPosition& IRP
- const llvm::AbstractAttribute* QueryingAA
- const llvm::AAIsDead* FnLivenessAA
- bool& UsedAssumedInformation
- bool CheckBBLivenessOnly = false
- llvm::DepClassTy DepClass = DepClassTy::OPTIONAL
¶bool isAssumedDead(
const llvm::Use& U,
const llvm::AbstractAttribute* QueryingAA,
const llvm::AAIsDead* FnLivenessAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
bool isAssumedDead(
const llvm::Use& U,
const llvm::AbstractAttribute* QueryingAA,
const llvm::AAIsDead* FnLivenessAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
Description
Return true if \p U is assumed dead. If \p FnLivenessAA is not provided it is queried.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1762
Parameters
- const llvm::Use& U
- const llvm::AbstractAttribute* QueryingAA
- const llvm::AAIsDead* FnLivenessAA
- bool& UsedAssumedInformation
- bool CheckBBLivenessOnly = false
- llvm::DepClassTy DepClass = DepClassTy::OPTIONAL
¶bool isAssumedDead(
const llvm::Instruction& I,
const llvm::AbstractAttribute* QueryingAA,
const llvm::AAIsDead* LivenessAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
bool isAssumedDead(
const llvm::Instruction& I,
const llvm::AbstractAttribute* QueryingAA,
const llvm::AAIsDead* LivenessAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
Description
Return true if \p I is assumed dead. If \p LivenessAA is not provided it is queried.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1754
Parameters
- const llvm::Instruction& I
- const llvm::AbstractAttribute* QueryingAA
- const llvm::AAIsDead* LivenessAA
- bool& UsedAssumedInformation
- bool CheckBBLivenessOnly = false
- llvm::DepClassTy DepClass = DepClassTy::OPTIONAL
¶bool isAssumedDead(
const llvm::AbstractAttribute& AA,
const llvm::AAIsDead* LivenessAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
bool isAssumedDead(
const llvm::AbstractAttribute& AA,
const llvm::AAIsDead* LivenessAA,
bool& UsedAssumedInformation,
bool CheckBBLivenessOnly = false,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL)
Description
Return true if \p AA (or its context instruction) is assumed dead. If \p LivenessAA is not provided it is queried.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1746
Parameters
- const llvm::AbstractAttribute& AA
- const llvm::AAIsDead* LivenessAA
- bool& UsedAssumedInformation
- bool CheckBBLivenessOnly = false
- llvm::DepClassTy DepClass = DepClassTy::OPTIONAL
¶bool isFunctionIPOAmendable(
const llvm::Function& F)
bool isFunctionIPOAmendable(
const llvm::Function& F)
Description
Determine whether the function \p F is IPO amendable If a function is exactly defined or it has alwaysinline attribute and is viable to be inlined, we say it is IPO amendable
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1577
Parameters
- const llvm::Function& F
¶static bool isInternalizable(llvm::Function& F)
static bool isInternalizable(llvm::Function& F)
Description
Returns true if the function \p F can be internalized. i.e. it has a compatible linkage.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2058
Parameters
¶bool isModulePass() const
bool isModulePass() const
Description
Return true if this is a module pass, false otherwise.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1554
¶bool isRunOn(llvm::Function& Fn) const
bool isRunOn(llvm::Function& Fn) const
Description
Return true if we derive attributes for \p Fn
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1557
Parameters
- llvm::Function& Fn
¶bool isValidFunctionSignatureRewrite(
llvm::Argument& Arg,
ArrayRef<llvm::Type*> ReplacementTypes)
bool isValidFunctionSignatureRewrite(
llvm::Argument& Arg,
ArrayRef<llvm::Type*> ReplacementTypes)
Description
Check if we can rewrite a function signature. The argument \p Arg is replaced with new ones defined by the number, order, and types in \p ReplacementTypes.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1935
Parameters
- llvm::Argument& Arg
- ArrayRef<llvm::Type*> ReplacementTypes
Returns
True, if the replacement can be registered, via registerFunctionSignatureRewrite, false otherwise.
¶template <typename AAType>
AAType* lookupAAFor(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute* QueryingAA =
nullptr,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL,
bool AllowInvalidState = false)
template <typename AAType>
AAType* lookupAAFor(
const llvm::IRPosition& IRP,
const llvm::AbstractAttribute* QueryingAA =
nullptr,
llvm::DepClassTy DepClass =
DepClassTy::OPTIONAL,
bool AllowInvalidState = false)
Description
Return the attribute of \p AAType for \p IRP if existing and valid. This also allows non-AA users lookup.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1479
Templates
- AAType
Parameters
- const llvm::IRPosition& IRP
- const llvm::AbstractAttribute* QueryingAA = nullptr
- llvm::DepClassTy DepClass = DepClassTy::OPTIONAL
- bool AllowInvalidState = false
¶llvm::ChangeStatus manifestAttributes()
llvm::ChangeStatus manifestAttributes()
Description
Gets called after scheduling, manifests attributes to the LLVM IR.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2107
¶void markLiveInternalFunction(
const llvm::Function& F)
void markLiveInternalFunction(
const llvm::Function& F)
Description
Mark the internal function \p F as live. This will trigger the identification and initialization of attributes for\p F.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1585
Parameters
- const llvm::Function& F
¶void recordDependence(
const llvm::AbstractAttribute& FromAA,
const llvm::AbstractAttribute& ToAA,
llvm::DepClassTy DepClass)
void recordDependence(
const llvm::AbstractAttribute& FromAA,
const llvm::AbstractAttribute& ToAA,
llvm::DepClassTy DepClass)
Description
Explicitly record a dependence from \p FromAA to \p ToAA, that is if\p FromAA changes \p ToAA should be updated as well. This method should be used in conjunction with the `getAAFor` method and with the DepClass enum passed to the method set to None. This can be beneficial to avoid false dependences but it requires the users of `getAAFor` to explicitly record true dependences through this method. The \p DepClass flag indicates if the dependence is striclty necessary. That means for required dependences, if \p FromAA changes to an invalid state, \p ToAA can be moved to a pessimistic fixpoint because it required information from \p FromAA but none are available anymore.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1520
Parameters
- const llvm::AbstractAttribute& FromAA
- const llvm::AbstractAttribute& ToAA
- llvm::DepClassTy DepClass
¶template <typename AAType>
AAType& registerAA(AAType& AA)
template <typename AAType>
AAType& registerAA(AAType& AA)
Description
Introduce a new abstract attribute into the fixpoint analysis. Note that ownership of the attribute is given to the Attributor. It will invoke delete for the Attributor on destruction of the Attributor. Attributes are identified by their IR position (AAType::getIRPosition()) and the address of their static member (see AAType::ID).
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1530
Templates
- AAType
Parameters
- AAType& AA
¶void registerForUpdate(
llvm::AbstractAttribute& AA)
void registerForUpdate(
llvm::AbstractAttribute& AA)
Description
Allows a query AA to request an update if a new query was received.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1507
Parameters
¶bool registerFunctionSignatureRewrite(
llvm::Argument& Arg,
ArrayRef<llvm::Type*> ReplacementTypes,
ArgumentReplacementInfo::CalleeRepairCBTy&&
CalleeRepairCB,
ArgumentReplacementInfo::ACSRepairCBTy&&
ACSRepairCB)
bool registerFunctionSignatureRewrite(
llvm::Argument& Arg,
ArrayRef<llvm::Type*> ReplacementTypes,
ArgumentReplacementInfo::CalleeRepairCBTy&&
CalleeRepairCB,
ArgumentReplacementInfo::ACSRepairCBTy&&
ACSRepairCB)
Description
Register a rewrite for a function signature. The argument \p Arg is replaced with new ones defined by the number, order, and types in \p ReplacementTypes. The rewiring at the call sites is done through \p ACSRepairCB and at the callee site through\p CalleeRepairCB.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1946
Parameters
- llvm::Argument& Arg
- ArrayRef<llvm::Type*> ReplacementTypes
- ArgumentReplacementInfo::CalleeRepairCBTy&& CalleeRepairCB
- ArgumentReplacementInfo::ACSRepairCBTy&& ACSRepairCB
Returns
True, if the replacement was registered, false otherwise.
¶void registerInvokeWithDeadSuccessor(
llvm::InvokeInst& II)
void registerInvokeWithDeadSuccessor(
llvm::InvokeInst& II)
Description
Record that \p II has at least one dead successor block. This information is used, e.g., to replace \p II with a call, after information was manifested.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1646
Parameters
- llvm::InvokeInst& II
¶void registerManifestAddedBasicBlock(
llvm::BasicBlock& BB)
void registerManifestAddedBasicBlock(
llvm::BasicBlock& BB)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1660
Parameters
- llvm::BasicBlock& BB
¶void registerSimplificationCallback(
const llvm::IRPosition& IRP,
const llvm::Attributor::
SimplifictionCallbackTy& CB)
void registerSimplificationCallback(
const llvm::IRPosition& IRP,
const llvm::Attributor::
SimplifictionCallbackTy& CB)
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1721
Parameters
- const llvm::IRPosition& IRP
- const llvm::Attributor::SimplifictionCallbackTy& CB
¶void rememberDependences()
void rememberDependences()
Description
Remember the dependences on the top of the dependence stack such that they may trigger further updates. (
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2124
¶void removeCallSite(llvm::CallInst* CI)
void removeCallSite(llvm::CallInst* CI)
Description
Helper function to remove callsite.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1594
Parameters
- llvm::CallInst* CI
¶llvm::ChangeStatus rewriteFunctionSignatures(
SmallSetVector<llvm::Function*, 8>&
ModifiedFns)
llvm::ChangeStatus rewriteFunctionSignatures(
SmallSetVector<llvm::Function*, 8>&
ModifiedFns)
Description
Apply all requested function signature rewrites (
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2133
Parameters
- SmallSetVector<llvm::Function*, 8>& ModifiedFns
¶llvm::ChangeStatus run()
llvm::ChangeStatus run()
Description
Run the analyses until a fixpoint is reached or enforced (timeout). The attributes registered with this Attributor can be used after as long as the Attributor is not destroyed (it owns the attributes now).
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1337
Returns
CHANGED if the IR was changed, otherwise UNCHANGED.
¶void runTillFixpoint()
void runTillFixpoint()
Description
This method will do fixpoint iteration until fixpoint or the maximum iteration count is reached. If the maximum iteration count is reached, This method will indicate pessimistic fixpoint on attributes that transitively depend on attributes that were scheduled for an update.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2104
¶bool shouldPropagateCallBaseContext(
const llvm::IRPosition& IRP)
bool shouldPropagateCallBaseContext(
const llvm::IRPosition& IRP)
Description
Determine if CallBase context in \p IRP should be propagated.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2127
Parameters
- const llvm::IRPosition& IRP
¶bool shouldSeedAttribute(
llvm::AbstractAttribute& AA)
bool shouldSeedAttribute(
llvm::AbstractAttribute& AA)
Description
Check if the Attribute \p AA should be seeded. See getOrCreateAAFor.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2137
Parameters
¶Optional<llvm::Value*>
translateArgumentToCallSiteContent(
Optional<llvm::Value*> V,
llvm::CallBase& CB,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation)
Optional<llvm::Value*>
translateArgumentToCallSiteContent(
Optional<llvm::Value*> V,
llvm::CallBase& CB,
const llvm::AbstractAttribute& AA,
bool& UsedAssumedInformation)
Description
Translate \p V from the callee context into the call site context.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1739
Parameters
- Optional<llvm::Value*> V
- llvm::CallBase& CB
- const llvm::AbstractAttribute& AA
- bool& UsedAssumedInformation
¶llvm::ChangeStatus updateAA(
llvm::AbstractAttribute& AA)
llvm::ChangeStatus updateAA(
llvm::AbstractAttribute& AA)
Description
Run `::update` on \p AA and track the dependences queried while doing so. Also adjust the state if we know further updates are not necessary.
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:2120
Parameters
¶~Attributor()
~Attributor()
Declared at: llvm/include/llvm/Transforms/IPO/Attributor.h:1329