|
LLVM 24.0.0git
|
#include "llvm/Transforms/IPO/Attributor.h"#include "IPOOptions.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/PointerIntPair.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/Statistic.h"#include "llvm/Analysis/AliasAnalysis.h"#include "llvm/Analysis/CallGraph.h"#include "llvm/Analysis/InlineCost.h"#include "llvm/Analysis/MemoryBuiltins.h"#include "llvm/Analysis/MustExecute.h"#include "llvm/IR/AttributeMask.h"#include "llvm/IR/Attributes.h"#include "llvm/IR/Constant.h"#include "llvm/IR/ConstantFold.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/GlobalValue.h"#include "llvm/IR/GlobalVariable.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/ValueHandle.h"#include "llvm/Support/Casting.h"#include "llvm/Support/Debug.h"#include "llvm/Support/DebugCounter.h"#include "llvm/Support/FileSystem.h"#include "llvm/Support/GraphWriter.h"#include "llvm/Support/ModRef.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/Cloning.h"#include "llvm/Transforms/Utils/Local.h"#include <cstdint>#include <memory>#include <cassert>#include <optional>#include <string>Go to the source code of this file.
Classes | |
| struct | llvm::GraphTraits< AADepGraphNode * > |
| struct | llvm::GraphTraits< AADepGraph * > |
| struct | llvm::DOTGraphTraits< AADepGraph * > |
Namespaces | |
| namespace | llvm |
| This is an optimization pass for GlobalISel generic memory operations. | |
Macros | |
| #define | DEBUG_TYPE "attributor" |
| #define | VERBOSE_DEBUG_TYPE DEBUG_TYPE "-verbose" |
Functions | |
| DEBUG_COUNTER (ManifestDBGCounter, "attributor-manifest", "Determine what attributes are manifested in the IR") | |
| DEBUG_COUNTER (NumAbstractAttributes, "num-abstract-attributes", "How many AAs should be initialized") | |
| A debug counter to limit the number of AAs created. | |
| STATISTIC (NumFnDeleted, "Number of function deleted") | |
| STATISTIC (NumFnWithExactDefinition, "Number of functions with exact definitions") | |
| STATISTIC (NumFnWithoutExactDefinition, "Number of functions without exact definitions") | |
| STATISTIC (NumFnShallowWrappersCreated, "Number of shallow wrappers created") | |
| STATISTIC (NumAttributesTimedOut, "Number of abstract attributes timed out before fixpoint") | |
| STATISTIC (NumAttributesValidFixpoint, "Number of abstract attributes in a valid fixpoint state") | |
| STATISTIC (NumAttributesManifested, "Number of abstract attributes manifested in IR") | |
| template<bool IsLoad, typename Ty> | |
| static bool | getPotentialCopiesOfMemoryValue (Attributor &A, Ty &I, SmallSetVector< Value *, 4 > &PotentialCopies, SmallSetVector< Instruction *, 4 > *PotentialValueOrigins, const AbstractAttribute &QueryingAA, bool &UsedAssumedInformation, bool OnlyExact) |
| static bool | isAssumedReadOnlyOrReadNone (Attributor &A, const IRPosition &IRP, const AbstractAttribute &QueryingAA, bool RequireReadNone, bool &IsKnown) |
| static bool | isPotentiallyReachable (Attributor &A, const Instruction &FromI, const Instruction *ToI, const Function &ToFn, const AbstractAttribute &QueryingAA, const AA::InstExclusionSetTy *ExclusionSet, std::function< bool(const Function &F)> GoBackwardsCB) |
| static bool | isEqualOrWorse (const Attribute &New, const Attribute &Old) |
Return true if New is equal or worse than Old. | |
| static Attribute | getAttrToAdd (LLVMContext &Ctx, Attribute Attr, Attribute Existing, bool ForceReplace) |
Return the attribute to add to a position to provide the information of Attr, given the attribute Existing of the same kind at the position (or none), or an invalid attribute if Existing already provides it. | |
| bool | canMarkAsVisited (const User *Usr) |
| static bool | checkForAllInstructionsImpl (Attributor *A, InformationCache::OpcodeInstMapTy &OpcodeInstMap, function_ref< bool(Instruction &)> Pred, const AbstractAttribute *QueryingAA, const AAIsDead *LivenessAA, ArrayRef< unsigned > Opcodes, bool &UsedAssumedInformation, bool CheckBBLivenessOnly=false, bool CheckPotentiallyDead=false) |
| static bool | runAttributorOnFunctions (InformationCache &InfoCache, SetVector< Function * > &Functions, CallGraphUpdater &CGUpdater, FunctionAnalysisManager &FAM, bool DeleteFns, bool IsModulePass) |
| } | |
| static bool | runAttributorLightOnFunctions (InformationCache &InfoCache, SetVector< Function * > &Functions, CallGraphUpdater &CGUpdater, FunctionAnalysisManager &FAM, bool IsModulePass) |
Variables | |
| static constexpr unsigned | InterestingOpcodes [] |
| The opcodes of the instructions recorded in FunctionInfo::OpcodeInstMap. | |
| #define DEBUG_TYPE "attributor" |
Definition at line 65 of file Attributor.cpp.
| #define VERBOSE_DEBUG_TYPE DEBUG_TYPE "-verbose" |
Definition at line 66 of file Attributor.cpp.
Referenced by llvm::Attributor::checkForAllCallSites(), checkForAllInstructionsImpl(), llvm::Attributor::checkForAllUses(), and isPotentiallyReachable().
Definition at line 1747 of file Attributor.cpp.
References llvm::isa().
Referenced by llvm::Attributor::checkForAllUses().
|
static |
Definition at line 2005 of file Attributor.cpp.
References A(), llvm::dbgs(), DEBUG_WITH_TYPE, I, llvm::IRPosition::inst(), Pred, and VERBOSE_DEBUG_TYPE.
Referenced by llvm::Attributor::checkForAllInstructions(), llvm::Attributor::identifyDefaultAbstractAttributes(), and llvm::Attributor::isValidFunctionSignatureRewrite().
| DEBUG_COUNTER | ( | ManifestDBGCounter | , |
| "attributor-manifest" | , | ||
| "Determine what attributes are manifested in the IR" | ) |
| DEBUG_COUNTER | ( | NumAbstractAttributes | , |
| "num-abstract-attributes" | , | ||
| "How many AAs should be initialized" | ) |
A debug counter to limit the number of AAs created.
|
static |
Return the attribute to add to a position to provide the information of Attr, given the attribute Existing of the same kind at the position (or none), or an invalid attribute if Existing already provides it.
Definition at line 916 of file Attributor.cpp.
References llvm::Attribute, llvm::Attribute::getKindAsEnum(), llvm::Attribute::getMemoryEffects(), llvm::Attribute::getWithMemoryEffects(), llvm::Attribute::isConstantRangeAttribute(), llvm::Attribute::isEnumAttribute(), isEqualOrWorse(), llvm::Attribute::isIntAttribute(), llvm::Attribute::isStringAttribute(), llvm::Attribute::isValid(), llvm_unreachable, and llvm::MemoryEffectsBase< IRMemLocation >::unknown().
Referenced by llvm::Attributor::manifestAttrs().
|
static |
Definition at line 324 of file Attributor.cpp.
References A(), assert(), llvm::cast(), llvm::SetVector< T, Vector, Set, N >::count(), llvm::dbgs(), DL, llvm::dyn_cast(), llvm::AAPointerInfo::Access::getContent(), llvm::AA::getInitialValueForObj(), llvm::AAPointerInfo::Access::getRemoteInst(), llvm::AA::getWithType(), llvm::AAPointerInfo::Access::getWrittenValue(), I, llvm::SetVector< T, Vector, Set, N >::insert(), llvm::SetVector< T, Vector, Set, N >::insert_range(), llvm::AA::Interprocedural, llvm::isa(), llvm::isa_and_nonnull(), llvm::isAllocationFn(), llvm::isNoAliasCall(), llvm::AAPointerInfo::Access::isRead(), llvm::AAPointerInfo::Access::isWriteOrAssumption(), llvm::AAPointerInfo::Access::isWrittenValueUnknown(), llvm::AAPointerInfo::Access::isWrittenValueYetUndetermined(), LLVM_DEBUG, llvm::NONE, llvm::NullPointerIsDefined(), llvm::OPTIONAL, Pred, llvm::SmallVectorTemplateBase< T, bool >::push_back(), Range, TLI, V, and llvm::IRPosition::value().
Referenced by llvm::AA::getPotentialCopiesOfStoredValue(), and llvm::AA::getPotentiallyLoadedValues().
|
static |
Definition at line 568 of file Attributor.cpp.
References A(), llvm::IRPosition::getPositionKind(), llvm::AA::hasAssumedIRAttr(), llvm::IRPosition::IRP_CALL_SITE, llvm::IRPosition::IRP_FUNCTION, llvm::NONE, and llvm::OPTIONAL.
Referenced by llvm::AA::isAssumedReadNone(), and llvm::AA::isAssumedReadOnly().
Return true if New is equal or worse than Old.
Definition at line 906 of file Attributor.cpp.
References llvm::Attribute::getValueAsInt(), and llvm::Attribute::isIntAttribute().
Referenced by getAttrToAdd().
|
static |
Definition at line 620 of file Attributor.cpp.
References A(), llvm::dbgs(), DEBUG_WITH_TYPE, llvm::SmallVectorTemplateCommon< T, typename >::empty(), F, llvm::BasicBlock::front(), llvm::IRPosition::function(), llvm::Function::getEntryBlock(), llvm::Instruction::getFunction(), llvm::Value::getName(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isa(), llvm::GlobalValue::isDeclaration(), LLVM_DEBUG, llvm::OPTIONAL, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallPtrSetImplBase::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and VERBOSE_DEBUG_TYPE.
|
static |
Definition at line 3948 of file Attributor.cpp.
References A(), llvm::all_of(), Call, llvm::CHANGED, Changed, llvm::dbgs(), llvm::dyn_cast(), F, FAM, llvm::AAKindSet::get(), llvm::Value::getName(), LLVM_DEBUG, llvm::PreservedAnalyses::preserve(), and llvm::PreservedAnalyses::preserveSet().
Referenced by llvm::AttributorLightCGSCCPass::run(), and llvm::AttributorLightPass::run().
|
static |
}
Tracking callback for specialization of indirect calls.
Definition at line 3836 of file Attributor.cpp.
References A(), llvm::all_of(), assert(), llvm::CHANGED, Changed, llvm::Attributor::createShallowWrapper(), llvm::dbgs(), DEBUG_TYPE, llvm::dyn_cast(), F, FAM, llvm::getIPOOptions(), llvm::InformationCache::getModule(), llvm::Value::getName(), llvm::Attributor::internalizeFunction(), llvm::GlobalValue::isInterposableLinkage(), LLVM_DEBUG, llvm::CallGraphUpdater::reanalyzeFunction(), llvm::CallGraphUpdater::replaceFunctionWith(), and llvm::Value::uses().
Referenced by llvm::AttributorCGSCCPass::run(), and llvm::AttributorPass::run().
| STATISTIC | ( | NumAttributesManifested | , |
| "Number of abstract attributes manifested in IR" | ) |
| STATISTIC | ( | NumAttributesTimedOut | , |
| "Number of abstract attributes timed out before fixpoint" | ) |
| STATISTIC | ( | NumAttributesValidFixpoint | , |
| "Number of abstract attributes in a valid fixpoint state" | ) |
| STATISTIC | ( | NumFnDeleted | , |
| "Number of function deleted" | ) |
| STATISTIC | ( | NumFnShallowWrappersCreated | , |
| "Number of shallow wrappers created" | ) |
| STATISTIC | ( | NumFnWithExactDefinition | , |
| "Number of functions with exact definitions" | ) |
| STATISTIC | ( | NumFnWithoutExactDefinition | , |
| "Number of functions without exact definitions" | ) |
|
staticconstexpr |
The opcodes of the instructions recorded in FunctionInfo::OpcodeInstMap.
Definition at line 3187 of file Attributor.cpp.