LLVM 20.0.0git
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
Attributor.h File Reference
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Analysis/AssumeBundleQueries.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Analysis/LazyCallGraph.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/MustExecute.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/AbstractCallSite.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/DOTGraphTraits.h"
#include "llvm/Support/DebugCounter.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ModRef.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/TypeSize.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Utils/CallGraphUpdater.h"
#include <limits>
#include <map>
#include <optional>

Go to the source code of this file.

Classes

struct  llvm::AA::ValueAndContext
 
struct  llvm::AA::RangeTy
 Helper to represent an access offset and size, with logic to deal with uncertainty and check for overlapping accesses. More...
 
struct  llvm::DenseMapInfo< AA::ValueAndContext >
 
struct  llvm::DenseMapInfo< AA::ValueScope >
 
struct  llvm::DenseMapInfo< const AA::InstExclusionSetTy * >
 
struct  llvm::AADepGraphNode
 } More...
 
struct  llvm::AADepGraph
 The data structure for the dependency graph. More...
 
struct  llvm::IRPosition
 Helper to describe and deal with positions in the LLVM-IR. More...
 
struct  llvm::DenseMapInfo< IRPosition >
 Helper that allows IRPosition as a key in a DenseMap. More...
 
class  llvm::SubsumingPositionIterator
 A visitor class for IR positions. More...
 
struct  llvm::AnalysisGetter
 Wrapper for FunctionAnalysisManager. More...
 
struct  llvm::InformationCache
 Data structure to hold cached (LLVM-IR) information. More...
 
struct  llvm::AttributorConfig
 Configuration for the Attributor. More...
 
struct  llvm::Attributor
 The fixpoint analysis framework that orchestrates the attribute deduction. More...
 
struct  llvm::Attributor::ArgumentReplacementInfo
 Helper struct used in the communication between an abstract attribute (AA) that wants to change the signature of a function and the Attributor which applies the changes. More...
 
struct  llvm::AbstractState
 An interface to query the internal state of an abstract attribute. More...
 
struct  llvm::IntegerStateBase< base_ty, BestState, WorstState >
 Simple state with integers encoding. More...
 
struct  llvm::BitIntegerState< base_ty, BestState, WorstState >
 Specialization of the integer state for a bit-wise encoding. More...
 
struct  llvm::IncIntegerState< base_ty, BestState, WorstState >
 Specialization of the integer state for an increasing value, hence ~0u is the best state and 0 the worst. More...
 
struct  llvm::DecIntegerState< base_ty >
 Specialization of the integer state for a decreasing value, hence 0 is the best state and ~0u the worst. More...
 
struct  llvm::BooleanState
 Simple wrapper for a single bit (boolean) state. More...
 
struct  llvm::IntegerRangeState
 State for an integer range. More...
 
struct  llvm::SetState< BaseTy >
 Simple state for a set. More...
 
struct  llvm::SetState< BaseTy >::SetContents
 A wrapper around a set that has semantics for handling unions and intersections with a "universal" set that contains all elements. More...
 
struct  llvm::StateWrapper< StateTy, BaseType, Ts >
 Helper to tie a abstract state implementation to an abstract attribute. More...
 
struct  llvm::IRAttribute< AK, BaseType, AAType >
 Helper class that provides common functionality to manifest IR attributes. More...
 
struct  llvm::AbstractAttribute
 Base struct for all "concrete attribute" deductions. More...
 
struct  llvm::AttributorPass
 } More...
 
struct  llvm::AttributorCGSCCPass
 
struct  llvm::AttributorLightPass
 A more lightweight version of the Attributor which only runs attribute inference but no simplifications. More...
 
struct  llvm::AttributorLightCGSCCPass
 A more lightweight version of the Attributor which only runs attribute inference but no simplifications. More...
 
struct  llvm::AANoUnwind
 
struct  llvm::AANoSync
 
struct  llvm::AAMustProgress
 An abstract interface for all nonnull attributes. More...
 
struct  llvm::AANonNull
 An abstract interface for all nonnull attributes. More...
 
struct  llvm::AANoRecurse
 An abstract attribute for norecurse. More...
 
struct  llvm::AAWillReturn
 An abstract attribute for willreturn. More...
 
struct  llvm::AAUndefinedBehavior
 An abstract attribute for undefined behavior. More...
 
struct  llvm::AAIntraFnReachability
 An abstract interface to determine reachability of point A to B. More...
 
struct  llvm::AANoAlias
 An abstract interface for all noalias attributes. More...
 
struct  llvm::AANoFree
 An AbstractAttribute for nofree. More...
 
struct  llvm::AANoReturn
 An AbstractAttribute for noreturn. More...
 
struct  llvm::AAIsDead
 An abstract interface for liveness abstract attribute. More...
 
struct  llvm::DerefState
 State for dereferenceable attribute. More...
 
struct  llvm::AADereferenceable
 An abstract interface for all dereferenceable attribute. More...
 
struct  llvm::AAAlign
 An abstract interface for all align attributes. More...
 
struct  llvm::AAInstanceInfo
 An abstract interface to track if a value leaves it's defining function instance. More...
 
struct  llvm::AANoCapture
 An abstract interface for all nocapture attributes. More...
 
struct  llvm::ValueSimplifyStateType
 
struct  llvm::AAValueSimplify
 An abstract interface for value simplify abstract attribute. More...
 
struct  llvm::AAHeapToStack
 
struct  llvm::AAPrivatizablePtr
 An abstract interface for privatizability. More...
 
struct  llvm::AAMemoryBehavior
 An abstract interface for memory access kind related attributes (readnone/readonly/writeonly). More...
 
struct  llvm::AAMemoryLocation
 An abstract interface for all memory location attributes (readnone/argmemonly/inaccessiblememonly/inaccessibleorargmemonly). More...
 
struct  llvm::AAValueConstantRange
 An abstract interface for range value analysis. More...
 
struct  llvm::PotentialValuesState< MemberTy >
 A class for a set state. More...
 
struct  llvm::DenormalFPMathState
 
struct  llvm::DenormalFPMathState::DenormalState
 
struct  llvm::AAPotentialConstantValues
 An abstract interface for potential values analysis. More...
 
struct  llvm::AAPotentialValues
 
struct  llvm::AANoUndef
 An abstract interface for all noundef attributes. More...
 
struct  llvm::AANoFPClass
 
class  llvm::AACallEdgeIterator
 An Iterator for call edges, creates AACallEdges attributes in a lazy way. More...
 
struct  llvm::AACallGraphNode
 
struct  llvm::AACallEdges
 An abstract state for querying live call edges. More...
 
struct  llvm::AttributorCallGraph
 
struct  llvm::GraphTraits< AACallGraphNode * >
 
struct  llvm::GraphTraits< AttributorCallGraph * >
 
struct  llvm::DOTGraphTraits< AttributorCallGraph * >
 
struct  llvm::AAExecutionDomain
 
struct  llvm::AAExecutionDomain::ExecutionDomainTy
 Summary about the execution domain of a block or instruction. More...
 
struct  llvm::AAInterFnReachability
 An abstract Attribute for computing reachability between functions. More...
 
struct  llvm::AANonConvergent
 An abstract Attribute for determining the necessity of the convergent attribute. More...
 
struct  llvm::AAPointerInfo
 An abstract interface for struct information. More...
 
struct  llvm::AAPointerInfo::OffsetInfo
 A helper containing a list of offsets computed for a Use. More...
 
struct  llvm::AAPointerInfo::RangeList
 A container for a list of ranges. More...
 
struct  llvm::AAPointerInfo::Access
 An access description. More...
 
struct  llvm::AAAssumptionInfo
 An abstract attribute for getting assumption information. More...
 
struct  llvm::AAUnderlyingObjects
 An abstract attribute for getting all assumption underlying objects. More...
 
struct  llvm::AAAddressSpace
 An abstract interface for address space information. More...
 
struct  llvm::AAAllocationInfo
 
struct  llvm::AAGlobalValueInfo
 An abstract interface for llvm::GlobalValue information interference. More...
 
struct  llvm::AAIndirectCallInfo
 An abstract interface for indirect call information interference. More...
 
struct  llvm::AADenormalFPMath
 An abstract Attribute for specializing "dynamic" components of "denormal-fp-math" and "denormal-fp-math-f32" to a known denormal mode. More...
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::AA
 Abstract Attribute helper functions.
 

Macros

#define CASE(ATTRNAME, AANAME, ...)
 

Typedefs

using llvm::AA::InstExclusionSetTy = SmallPtrSet< Instruction *, 4 >
 
using llvm::AAAlignmentStateType = IncIntegerState< uint64_t, Value::MaximumAlignment, 1 >
 
using llvm::PotentialConstantIntValuesState = PotentialValuesState< APInt >
 
using llvm::PotentialLLVMValuesState = PotentialValuesState< std::pair< AA::ValueAndContext, AA::ValueScope > >
 

Enumerations

enum class  llvm::AA::GPUAddressSpace : unsigned {
  llvm::AA::Generic = 0 , llvm::AA::Global = 1 , llvm::AA::Shared = 3 , llvm::AA::Constant = 4 ,
  llvm::AA::Local = 5
}
 
enum  llvm::AA::ValueScope : uint8_t { llvm::AA::Intraprocedural = 1 , llvm::AA::Interprocedural = 2 , llvm::AA::AnyScope = Intraprocedural | Interprocedural }
 Flags to distinguish intra-procedural queries from potentially inter-procedural queries. More...
 
enum class  llvm::ChangeStatus { llvm::CHANGED , llvm::UNCHANGED }
 { More...
 
enum class  llvm::DepClassTy { llvm::REQUIRED , llvm::OPTIONAL , llvm::NONE }
 
enum  llvm::AttributorRunOption { llvm::NONE = 0 , llvm::MODULE = 1 << 0 , llvm::CGSCC = 1 << 1 , llvm::ALL = MODULE | CGSCC }
 Run options, used by the pass manager. More...
 

Functions

bool llvm::AA::isGPU (const Module &M)
 Return true iff M target a GPU (and we can use GPU AS reasoning).
 
bool llvm::AA::isNoSyncInst (Attributor &A, const Instruction &I, const AbstractAttribute &QueryingAA)
 Return true if I is a nosync instruction.
 
bool llvm::AA::isDynamicallyUnique (Attributor &A, const AbstractAttribute &QueryingAA, const Value &V, bool ForAnalysisOnly=true)
 Return true if V is dynamically unique, that is, there are no two "instances" of V at runtime with different values.
 
bool llvm::AA::isValidInScope (const Value &V, const Function *Scope)
 Return true if V is a valid value in Scope, that is a constant or an instruction/argument of Scope.
 
bool llvm::AA::isValidAtPosition (const ValueAndContext &VAC, InformationCache &InfoCache)
 Return true if the value of VAC is a valid at the position of VAC, that is a constant, an argument of the same function, or an instruction in that function that dominates the position.
 
Valuellvm::AA::getWithType (Value &V, Type &Ty)
 Try to convert V to type Ty without introducing new instructions.
 
std::optional< Value * > llvm::AA::combineOptionalValuesInAAValueLatice (const std::optional< Value * > &A, const std::optional< Value * > &B, Type *Ty)
 Return the combination of A and B such that the result is a possible value of both.
 
raw_ostream & llvm::AA::operator<< (raw_ostream &OS, const RangeTy &R)
 
bool llvm::AA::operator== (const RangeTy &A, const RangeTy &B)
 
bool llvm::AA::operator!= (const RangeTy &A, const RangeTy &B)
 
Constantllvm::AA::getInitialValueForObj (Attributor &A, const AbstractAttribute &QueryingAA, Value &Obj, Type &Ty, const TargetLibraryInfo *TLI, const DataLayout &DL, RangeTy *RangePtr=nullptr)
 Return the initial value of Obj with type Ty if that is a constant.
 
bool llvm::AA::getPotentiallyLoadedValues (Attributor &A, LoadInst &LI, SmallSetVector< Value *, 4 > &PotentialValues, SmallSetVector< Instruction *, 4 > &PotentialValueOrigins, const AbstractAttribute &QueryingAA, bool &UsedAssumedInformation, bool OnlyExact=false)
 Collect all potential values LI could read into PotentialValues.
 
bool llvm::AA::getPotentialCopiesOfStoredValue (Attributor &A, StoreInst &SI, SmallSetVector< Value *, 4 > &PotentialCopies, const AbstractAttribute &QueryingAA, bool &UsedAssumedInformation, bool OnlyExact=false)
 Collect all potential values of the one stored by SI into PotentialCopies.
 
bool llvm::AA::isAssumedReadOnly (Attributor &A, const IRPosition &IRP, const AbstractAttribute &QueryingAA, bool &IsKnown)
 Return true if IRP is readonly.
 
bool llvm::AA::isAssumedReadNone (Attributor &A, const IRPosition &IRP, const AbstractAttribute &QueryingAA, bool &IsKnown)
 Return true if IRP is readnone.
 
bool llvm::AA::isPotentiallyReachable (Attributor &A, const Instruction &FromI, const Instruction &ToI, const AbstractAttribute &QueryingAA, const AA::InstExclusionSetTy *ExclusionSet=nullptr, std::function< bool(const Function &F)> GoBackwardsCB=nullptr)
 Return true if ToI is potentially reachable from FromI without running into any instruction in ExclusionSet The two instructions do not need to be in the same function.
 
bool llvm::AA::isPotentiallyReachable (Attributor &A, const Instruction &FromI, const Function &ToFn, const AbstractAttribute &QueryingAA, const AA::InstExclusionSetTy *ExclusionSet=nullptr, std::function< bool(const Function &F)> GoBackwardsCB=nullptr)
 Same as above but it is sufficient to reach any instruction in ToFn.
 
bool llvm::AA::isAssumedThreadLocalObject (Attributor &A, Value &Obj, const AbstractAttribute &QueryingAA)
 Return true if Obj is assumed to be a thread local object.
 
bool llvm::AA::isPotentiallyAffectedByBarrier (Attributor &A, const Instruction &I, const AbstractAttribute &QueryingAA)
 Return true if I is potentially affected by a barrier.
 
bool llvm::AA::isPotentiallyAffectedByBarrier (Attributor &A, ArrayRef< const Value * > Ptrs, const AbstractAttribute &QueryingAA, const Instruction *CtxI)
 
ChangeStatus llvm::operator| (ChangeStatus l, ChangeStatus r)
 Logic operators for the change status enum class.
 
ChangeStatusllvm::operator|= (ChangeStatus &l, ChangeStatus r)
 
ChangeStatus llvm::operator& (ChangeStatus l, ChangeStatus r)
 
ChangeStatusllvm::operator&= (ChangeStatus &l, ChangeStatus r)
 
 llvm::DEBUG_COUNTER (NumAbstractAttributes, "num-abstract-attributes", "How many AAs should be initialized")
 A debug counter to limit the number of AAs created.
 
raw_ostreamllvm::operator<< (raw_ostream &OS, const AbstractAttribute &AA)
 Forward declarations of output streams for debug purposes.
 
raw_ostreamllvm::operator<< (raw_ostream &OS, ChangeStatus S)
 Helpers to ease debugging through output streams and print calls.
 
raw_ostreamllvm::operator<< (raw_ostream &OS, IRPosition::Kind)
 
raw_ostreamllvm::operator<< (raw_ostream &OS, const IRPosition &)
 
raw_ostreamllvm::operator<< (raw_ostream &OS, const AbstractState &State)
 
template<typename base_ty , base_ty BestState, base_ty WorstState>
raw_ostream & llvm::operator<< (raw_ostream &OS, const IntegerStateBase< base_ty, BestState, WorstState > &S)
 
raw_ostreamllvm::operator<< (raw_ostream &OS, const IntegerRangeState &State)
 
template<typename StateType >
ChangeStatus llvm::clampStateAndIndicateChange (StateType &S, const StateType &R)
 Helper function to clamp a state S of type StateType with the information in R and indicate/return if S did change (as-in update is required to be run again).
 
raw_ostreamllvm::operator<< (raw_ostream &OS, const PotentialConstantIntValuesState &R)
 
raw_ostreamllvm::operator<< (raw_ostream &OS, const PotentialLLVMValuesState &R)
 
raw_ostreamllvm::operator<< (raw_ostream &, const AAPointerInfo::Access &)
 
template<Attribute::AttrKind AK, typename AAType = AbstractAttribute>
bool llvm::AA::hasAssumedIRAttr (Attributor &A, const AbstractAttribute *QueryingAA, const IRPosition &IRP, DepClassTy DepClass, bool &IsKnown, bool IgnoreSubsumingPositions=false, const AAType **AAPtr=nullptr)
 Helper to avoid creating an AA for IR Attributes that might already be set.
 

Variables

unsigned llvm::MaxInitializationChainLength
 The value passed to the line option that defines the maximal initialization chain length.
 

Macro Definition Documentation

◆ CASE

#define CASE (   ATTRNAME,
  AANAME,
  ... 
)
Value:
case Attribute::ATTRNAME: { \
if (AANAME::isImpliedByIR(A, IRP, AK, IgnoreSubsumingPositions)) \
return IsKnown = true; \
if (!QueryingAA) \
return false; \
const auto *AA = A.getAAFor<AANAME>(*QueryingAA, IRP, DepClass); \
if (AAPtr) \
*AAPtr = reinterpret_cast<const AAType *>(AA); \
if (!AA || !AA->isAssumed(__VA_ARGS__)) \
return false; \
IsKnown = AA->isKnown(__VA_ARGS__); \
return true; \
}
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")