LLVM  14.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
llvm::InformationCache Struct Reference

Data structure to hold cached (LLVM-IR) information. More...

#include "llvm/Transforms/IPO/Attributor.h"

Collaboration diagram for llvm::InformationCache:
Collaboration graph
[legend]

Public Types

using InstructionVectorTy = SmallVector< Instruction *, 8 >
 A vector type to hold instructions. More...
 
using OpcodeInstMapTy = DenseMap< unsigned, InstructionVectorTy * >
 A map type from opcodes to instructions with this opcode. More...
 

Public Member Functions

 InformationCache (const Module &M, AnalysisGetter &AG, BumpPtrAllocator &Allocator, SetVector< Function * > *CGSCC)
 
 ~InformationCache ()
 
void initializeModuleSlice (SetVector< Function * > &SCC)
 Initialize the ModuleSlice member based on SCC. More...
 
OpcodeInstMapTygetOpcodeInstMapForFunction (const Function &F)
 Return the map that relates "interesting" opcodes with all instructions with that opcode in F. More...
 
InstructionVectorTygetReadOrWriteInstsForFunction (const Function &F)
 Return the instructions in F that may read or write memory. More...
 
MustBeExecutedContextExplorergetMustBeExecutedContextExplorer ()
 Return MustBeExecutedContextExplorer. More...
 
TargetLibraryInfogetTargetLibraryInfoForFunction (const Function &F)
 Return TargetLibraryInfo for function F. More...
 
AAResultsgetAAResultsForFunction (const Function &F)
 Return AliasAnalysis Result for function F. More...
 
bool isInvolvedInMustTailCall (const Argument &Arg)
 Return true if Arg is involved in a must-tail call, thus the argument of the caller or callee. More...
 
template<typename AP >
AP::Result * getAnalysisResultForFunction (const Function &F)
 Return the analysis result from a pass AP for function F. More...
 
unsigned getSccSize (const Function &F)
 Return SCC size on call graph for function F or 0 if unknown. More...
 
const DataLayoutgetDL ()
 Return datalayout used in the module. More...
 
const RetainedKnowledgeMapgetKnowledgeMap () const
 Return the map conaining all the knowledge we have from llvm.assumes. More...
 
bool getPotentiallyReachable (const Instruction &From, const Instruction &To)
 Return if To is potentially reachable form From or not If the same query was answered, return cached result. More...
 
bool isInModuleSlice (const Function &F)
 Check whether F is part of module slice. More...
 
bool stackIsAccessibleByOtherThreads ()
 Return true if the stack (llvm::Alloca) can be accessed by other threads. More...
 
bool targetIsGPU ()
 Return true if the target is a GPU. More...
 

Static Public Member Functions

template<typename CBTy >
static void foreachUse (Function &F, CBTy CB, bool LookThroughConstantExprUses=true)
 Apply CB to all uses of F. More...
 

Public Attributes

SmallPtrSet< Function *, 8 > ModuleSlice
 The slice of the module we are allowed to look at. More...
 

Friends

struct Attributor
 Give the Attributor access to the members so Attributor::identifyDefaultAbstractAttributes(...) can initialize them. More...
 

Detailed Description

Data structure to hold cached (LLVM-IR) information.

All attributes are given an InformationCache object at creation time to avoid inspection of the IR by all of them individually. This default InformationCache will hold information required by 'default' attributes, thus the ones deduced when Attributor::identifyDefaultAbstractAttributes(..) is called.

If custom abstract attributes, registered manually through Attributor::registerAA(...), need more information, especially if it is not reusable, it is advised to inherit from the InformationCache and cast the instance down in the abstract attributes.

Definition at line 865 of file Attributor.h.

Member Typedef Documentation

◆ InstructionVectorTy

A vector type to hold instructions.

Definition at line 957 of file Attributor.h.

◆ OpcodeInstMapTy

A map type from opcodes to instructions with this opcode.

Definition at line 960 of file Attributor.h.

Constructor & Destructor Documentation

◆ InformationCache()

llvm::InformationCache::InformationCache ( const Module M,
AnalysisGetter AG,
BumpPtrAllocator Allocator,
SetVector< Function * > *  CGSCC 
)
inline

Definition at line 866 of file Attributor.h.

References Allocator, F, llvm::AnalysisGetter::getAnalysis(), and M.

◆ ~InformationCache()

llvm::InformationCache::~InformationCache ( )
inline

Definition at line 887 of file Attributor.h.

Member Function Documentation

◆ foreachUse()

template<typename CBTy >
static void llvm::InformationCache::foreachUse ( Function F,
CBTy  CB,
bool  LookThroughConstantExprUses = true 
)
inlinestatic

Apply CB to all uses of F.

If LookThroughConstantExprUses is true, constant expression users are not given to CB but their uses are traversed transitively.

Definition at line 898 of file Attributor.h.

References F, llvm::Use::getUser(), llvm::make_pointer_range(), and llvm::Value::uses().

Referenced by initializeModuleSlice().

◆ getAAResultsForFunction()

AAResults * InformationCache::getAAResultsForFunction ( const Function F)

Return AliasAnalysis Result for function F.

Definition at line 2415 of file Attributor.cpp.

References F, and llvm::AnalysisGetter::getAnalysis().

◆ getAnalysisResultForFunction()

template<typename AP >
AP::Result* llvm::InformationCache::getAnalysisResultForFunction ( const Function F)
inline

Return the analysis result from a pass AP for function F.

Definition at line 995 of file Attributor.h.

References F, and llvm::AnalysisGetter::getAnalysis().

Referenced by llvm::AA::isValidAtPosition().

◆ getDL()

const DataLayout& llvm::InformationCache::getDL ( )
inline

Return datalayout used in the module.

Definition at line 1007 of file Attributor.h.

◆ getKnowledgeMap()

const RetainedKnowledgeMap& llvm::InformationCache::getKnowledgeMap ( ) const
inline

Return the map conaining all the knowledge we have from llvm.assumes.

Definition at line 1010 of file Attributor.h.

◆ getMustBeExecutedContextExplorer()

MustBeExecutedContextExplorer& llvm::InformationCache::getMustBeExecutedContextExplorer ( )
inline

Return MustBeExecutedContextExplorer.

Definition at line 974 of file Attributor.h.

◆ getOpcodeInstMapForFunction()

OpcodeInstMapTy& llvm::InformationCache::getOpcodeInstMapForFunction ( const Function F)
inline

Return the map that relates "interesting" opcodes with all instructions with that opcode in F.

Definition at line 964 of file Attributor.h.

References F.

Referenced by llvm::Attributor::checkForAllInstructions(), llvm::Attributor::identifyDefaultAbstractAttributes(), and llvm::Attributor::isValidFunctionSignatureRewrite().

◆ getPotentiallyReachable()

bool llvm::InformationCache::getPotentiallyReachable ( const Instruction From,
const Instruction To 
)
inline

Return if To is potentially reachable form From or not If the same query was answered, return cached result.

Definition at line 1014 of file Attributor.h.

References F, From, llvm::AnalysisGetter::getAnalysis(), llvm::Instruction::getFunction(), and llvm::isPotentiallyReachable().

◆ getReadOrWriteInstsForFunction()

InstructionVectorTy& llvm::InformationCache::getReadOrWriteInstsForFunction ( const Function F)
inline

Return the instructions in F that may read or write memory.

Definition at line 969 of file Attributor.h.

References F.

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

◆ getSccSize()

unsigned llvm::InformationCache::getSccSize ( const Function F)
inline

Return SCC size on call graph for function F or 0 if unknown.

Definition at line 1000 of file Attributor.h.

References llvm::SetVector< T, Vector, Set >::count(), F, and llvm::SetVector< T, Vector, Set >::size().

◆ getTargetLibraryInfoForFunction()

TargetLibraryInfo* llvm::InformationCache::getTargetLibraryInfoForFunction ( const Function F)
inline

Return TargetLibraryInfo for function F.

Definition at line 979 of file Attributor.h.

References F, and llvm::AnalysisGetter::getAnalysis().

◆ initializeModuleSlice()

void llvm::InformationCache::initializeModuleSlice ( SetVector< Function * > &  SCC)
inline

Initialize the ModuleSlice member based on SCC.

ModuleSlices contains (a subset of) all functions that we can look at during this SCC traversal. This includes functions (transitively) called from the SCC and the (transitive) callers of SCC functions. We also can look at a function if there is a "reference edge", i.a., if the function somehow uses (!=calls) a function in the SCC or a caller of a function in the SCC.

Definition at line 922 of file Attributor.h.

References llvm::SmallVectorImpl< T >::append(), Callee, llvm::SmallPtrSetImplBase::clear(), F, foreachUse(), llvm::Use::getUser(), I, if(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::instructions(), ModuleSlice, llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::AMDGPU::CPol::SCC.

◆ isInModuleSlice()

bool llvm::InformationCache::isInModuleSlice ( const Function F)
inline

Check whether F is part of module slice.

Definition at line 1030 of file Attributor.h.

References F, and ModuleSlice.

◆ isInvolvedInMustTailCall()

bool llvm::InformationCache::isInvolvedInMustTailCall ( const Argument Arg)
inline

Return true if Arg is involved in a must-tail call, thus the argument of the caller or callee.

Definition at line 988 of file Attributor.h.

References Arg.

◆ stackIsAccessibleByOtherThreads()

bool llvm::InformationCache::stackIsAccessibleByOtherThreads ( )
inline

Return true if the stack (llvm::Alloca) can be accessed by other threads.

Definition at line 1035 of file Attributor.h.

References targetIsGPU().

◆ targetIsGPU()

bool llvm::InformationCache::targetIsGPU ( )
inline

Return true if the target is a GPU.

Definition at line 1038 of file Attributor.h.

References llvm::Triple::isAMDGPU(), and llvm::Triple::isNVPTX().

Referenced by stackIsAccessibleByOtherThreads().

Friends And Related Function Documentation

◆ Attributor

friend struct Attributor
friend

Give the Attributor access to the members so Attributor::identifyDefaultAbstractAttributes(...) can initialize them.

Definition at line 1110 of file Attributor.h.

Member Data Documentation

◆ ModuleSlice

SmallPtrSet<Function *, 8> llvm::InformationCache::ModuleSlice

The slice of the module we are allowed to look at.

Definition at line 954 of file Attributor.h.

Referenced by initializeModuleSlice(), and isInModuleSlice().


The documentation for this struct was generated from the following files: