class GlobalsAAResult

Declaration

class GlobalsAAResult : public AAResultBase { /* full declaration omitted */ };

Description

An alias analysis result set for globals. This focuses on handling aliasing properties of globals and interprocedural function call mod/ref information.

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:30

Inherits from: AAResultBase

Member Variables

private const llvm::DataLayout& DL
private std::function<const TargetLibraryInfo&(Function&)> GetTLI
private SmallPtrSet<const llvm::GlobalValue*, 8> NonAddressTakenGlobals
The globals that do not have their addresses taken.
private bool UnknownFunctionsWithLocalLinkage = false
Are there functions with local linkage that may modify globals.
private SmallPtrSet<const llvm::GlobalValue*, 8> IndirectGlobals
IndirectGlobals - The memory pointed to by this global is known to be 'owned' by the global.
private DenseMap<const llvm::Value*, const llvm::GlobalValue*> AllocsForIndirectGlobals
AllocsForIndirectGlobals - If an instruction allocates memory for an indirect global, this map indicates which one.
private DenseMap<const llvm::Function*, llvm::GlobalsAAResult::FunctionInfo> FunctionInfos
For each function, keep track of what globals are modified or read.
private DenseMap<const llvm::Function*, unsigned int> FunctionToSCCMap
A map of functions to SCC. The SCCs are described by a simple integer ID that is only useful for comparing for equality (are two functions in the same SCC or not?)
private std::list<DeletionCallbackHandle> Handles
List of callbacks for globals being tracked by this analysis. Note that these objects are quite large, but we only anticipate having one per global tracked by this analysis. There are numerous optimizations we could perform to the memory utilization here if this becomes a problem.

Method Overview

  • private void AnalyzeCallGraph(llvm::CallGraph & CG, llvm::Module & M)
  • private void AnalyzeGlobals(llvm::Module & M)
  • private bool AnalyzeIndirectGlobalMemory(llvm::GlobalVariable * GV)
  • private bool AnalyzeUsesOfPointer(llvm::Value * V, SmallPtrSetImpl<llvm::Function *> * Readers = nullptr, SmallPtrSetImpl<llvm::Function *> * Writers = nullptr, llvm::GlobalValue * OkayStoreDest = nullptr)
  • private void CollectSCCMembership(llvm::CallGraph & CG)
  • private GlobalsAAResult(const llvm::DataLayout & DL, std::function<const TargetLibraryInfo &(Function &)> GetTLI)
  • public GlobalsAAResult(llvm::GlobalsAAResult && Arg)
  • public llvm::AliasResult alias(const llvm::MemoryLocation & LocA, const llvm::MemoryLocation & LocB, llvm::AAQueryInfo & AAQI)
  • public static llvm::GlobalsAAResult analyzeModule(llvm::Module & M, std::function<const TargetLibraryInfo &(Function &)> GetTLI, llvm::CallGraph & CG)
  • private llvm::GlobalsAAResult::FunctionInfo * getFunctionInfo(const llvm::Function * F)
  • public llvm::FunctionModRefBehavior getModRefBehavior(const llvm::Function * F)
  • public llvm::ModRefInfo getModRefInfo(const llvm::CallBase * Call, const llvm::MemoryLocation & Loc, llvm::AAQueryInfo & AAQI)
  • private llvm::ModRefInfo getModRefInfoForArgument(const llvm::CallBase * Call, const llvm::GlobalValue * GV, llvm::AAQueryInfo & AAQI)
  • public bool invalidate(llvm::Module & M, const llvm::PreservedAnalyses & PA, ModuleAnalysisManager::Invalidator &)
  • private bool isNonEscapingGlobalNoAlias(const llvm::GlobalValue * GV, const llvm::Value * V)
  • public ~GlobalsAAResult()

Methods

void AnalyzeCallGraph(llvm::CallGraph& CG,
                      llvm::Module& M)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:115

Parameters

llvm::CallGraph& CG
llvm::Module& M

void AnalyzeGlobals(llvm::Module& M)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:114

Parameters

llvm::Module& M

bool AnalyzeIndirectGlobalMemory(
    llvm::GlobalVariable* GV)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:120

Parameters

llvm::GlobalVariable* GV

bool AnalyzeUsesOfPointer(
    llvm::Value* V,
    SmallPtrSetImpl<llvm::Function*>* Readers =
        nullptr,
    SmallPtrSetImpl<llvm::Function*>* Writers =
        nullptr,
    llvm::GlobalValue* OkayStoreDest = nullptr)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:116

Parameters

llvm::Value* V
SmallPtrSetImpl<llvm::Function*>* Readers = nullptr
SmallPtrSetImpl<llvm::Function*>* Writers = nullptr
llvm::GlobalValue* OkayStoreDest = nullptr

void CollectSCCMembership(llvm::CallGraph& CG)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:121

Parameters

llvm::CallGraph& CG

GlobalsAAResult(
    const llvm::DataLayout& DL,
    std::function<const TargetLibraryInfo&(
        Function&)> GetTLI)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:77

Parameters

const llvm::DataLayout& DL
std::function<const TargetLibraryInfo&(Function&)> GetTLI

GlobalsAAResult(llvm::GlobalsAAResult&& Arg)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:84

Parameters

llvm::GlobalsAAResult&& Arg

llvm::AliasResult alias(
    const llvm::MemoryLocation& LocA,
    const llvm::MemoryLocation& LocB,
    llvm::AAQueryInfo& AAQI)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:98

Parameters

const llvm::MemoryLocation& LocA
const llvm::MemoryLocation& LocB
llvm::AAQueryInfo& AAQI

static llvm::GlobalsAAResult analyzeModule(
    llvm::Module& M,
    std::function<const TargetLibraryInfo&(
        Function&)> GetTLI,
    llvm::CallGraph& CG)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:91

Parameters

llvm::Module& M
std::function<const TargetLibraryInfo&(Function&)> GetTLI
llvm::CallGraph& CG

llvm::GlobalsAAResult::FunctionInfo*
getFunctionInfo(const llvm::Function* F)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:112

Parameters

const llvm::Function* F

llvm::FunctionModRefBehavior getModRefBehavior(
    const llvm::Function* F)

Description

getModRefBehavior - Return the behavior of the specified function if called from the specified call site. The call site may be null in which case the most generic behavior of this function should be returned.

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:109

Parameters

const llvm::Function* F

llvm::ModRefInfo getModRefInfo(
    const llvm::CallBase* Call,
    const llvm::MemoryLocation& Loc,
    llvm::AAQueryInfo& AAQI)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:102

Parameters

const llvm::CallBase* Call
const llvm::MemoryLocation& Loc
llvm::AAQueryInfo& AAQI

llvm::ModRefInfo getModRefInfoForArgument(
    const llvm::CallBase* Call,
    const llvm::GlobalValue* GV,
    llvm::AAQueryInfo& AAQI)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:124

Parameters

const llvm::CallBase* Call
const llvm::GlobalValue* GV
llvm::AAQueryInfo& AAQI

bool invalidate(
    llvm::Module& M,
    const llvm::PreservedAnalyses& PA,
    ModuleAnalysisManager::Invalidator&)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:87

Parameters

llvm::Module& M
const llvm::PreservedAnalyses& PA
ModuleAnalysisManager::Invalidator&

bool isNonEscapingGlobalNoAlias(
    const llvm::GlobalValue* GV,
    const llvm::Value* V)

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:123

Parameters

const llvm::GlobalValue* GV
const llvm::Value* V

~GlobalsAAResult()

Declared at: llvm/include/llvm/Analysis/GlobalsModRef.h:85