LLVM 24.0.0git
Attributor.cpp File Reference

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.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "attributor"

Definition at line 65 of file Attributor.cpp.

◆ VERBOSE_DEBUG_TYPE

Function Documentation

◆ canMarkAsVisited()

bool canMarkAsVisited ( const User * Usr)

Definition at line 1747 of file Attributor.cpp.

References llvm::isa().

Referenced by llvm::Attributor::checkForAllUses().

◆ checkForAllInstructionsImpl()

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

◆ DEBUG_COUNTER() [1/2]

DEBUG_COUNTER ( ManifestDBGCounter ,
"attributor-manifest" ,
"Determine what attributes are manifested in the IR"  )

◆ DEBUG_COUNTER() [2/2]

DEBUG_COUNTER ( NumAbstractAttributes ,
"num-abstract-attributes" ,
"How many AAs should be initialized"  )

A debug counter to limit the number of AAs created.

◆ getAttrToAdd()

Attribute getAttrToAdd ( LLVMContext & Ctx,
Attribute Attr,
Attribute Existing,
bool ForceReplace )
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().

◆ getPotentialCopiesOfMemoryValue()

◆ isAssumedReadOnlyOrReadNone()

◆ isEqualOrWorse()

bool isEqualOrWorse ( const Attribute & New,
const Attribute & Old )
static

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().

◆ isPotentiallyReachable()

◆ runAttributorLightOnFunctions()

◆ runAttributorOnFunctions()

◆ STATISTIC() [1/7]

STATISTIC ( NumAttributesManifested ,
"Number of abstract attributes manifested in IR"  )

◆ STATISTIC() [2/7]

STATISTIC ( NumAttributesTimedOut ,
"Number of abstract attributes timed out before fixpoint"  )

◆ STATISTIC() [3/7]

STATISTIC ( NumAttributesValidFixpoint ,
"Number of abstract attributes in a valid fixpoint state"  )

◆ STATISTIC() [4/7]

STATISTIC ( NumFnDeleted ,
"Number of function deleted"  )

◆ STATISTIC() [5/7]

STATISTIC ( NumFnShallowWrappersCreated ,
"Number of shallow wrappers created"  )

◆ STATISTIC() [6/7]

STATISTIC ( NumFnWithExactDefinition ,
"Number of functions with exact definitions"  )

◆ STATISTIC() [7/7]

STATISTIC ( NumFnWithoutExactDefinition ,
"Number of functions without exact definitions"  )

Variable Documentation

◆ InterestingOpcodes

unsigned InterestingOpcodes[]
staticconstexpr
Initial value:
= {
Instruction::Call, Instruction::CallBr,
Instruction::Invoke, Instruction::CleanupRet,
Instruction::CatchSwitch, Instruction::AtomicRMW,
Instruction::AtomicCmpXchg, Instruction::UncondBr,
Instruction::CondBr, Instruction::Resume,
Instruction::Ret, Instruction::Load,
Instruction::Store, Instruction::Alloca,
Instruction::AddrSpaceCast,
}

The opcodes of the instructions recorded in FunctionInfo::OpcodeInstMap.

Definition at line 3187 of file Attributor.cpp.