#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ObjCARCAliasAnalysis.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include <algorithm>
#include <cassert>
#include <functional>
#include <iterator>
#define DEBUG_TYPE …
usingnamespacellvm;
STATISTIC(NumNoAlias, "Number of NoAlias results");
STATISTIC(NumMayAlias, "Number of MayAlias results");
STATISTIC(NumMustAlias, "Number of MustAlias results");
namespace llvm {
cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false));
}
#ifndef NDEBUG
static cl::opt<bool> EnableAATrace("aa-trace", cl::Hidden, cl::init(false));
#else
static const bool EnableAATrace = …;
#endif
AAResults::AAResults(const TargetLibraryInfo &TLI) : … { … }
AAResults::AAResults(AAResults &&Arg)
: … { … }
AAResults::~AAResults() { … }
bool AAResults::invalidate(Function &F, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &Inv) { … }
AliasResult AAResults::alias(const MemoryLocation &LocA,
const MemoryLocation &LocB) { … }
AliasResult AAResults::alias(const MemoryLocation &LocA,
const MemoryLocation &LocB, AAQueryInfo &AAQI,
const Instruction *CtxI) { … }
ModRefInfo AAResults::getModRefInfoMask(const MemoryLocation &Loc,
bool IgnoreLocals) { … }
ModRefInfo AAResults::getModRefInfoMask(const MemoryLocation &Loc,
AAQueryInfo &AAQI, bool IgnoreLocals) { … }
ModRefInfo AAResults::getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) { … }
ModRefInfo AAResults::getModRefInfo(const Instruction *I,
const CallBase *Call2) { … }
ModRefInfo AAResults::getModRefInfo(const Instruction *I, const CallBase *Call2,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const CallBase *Call,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const CallBase *Call1,
const CallBase *Call2, AAQueryInfo &AAQI) { … }
MemoryEffects AAResults::getMemoryEffects(const CallBase *Call,
AAQueryInfo &AAQI) { … }
MemoryEffects AAResults::getMemoryEffects(const CallBase *Call) { … }
MemoryEffects AAResults::getMemoryEffects(const Function *F) { … }
raw_ostream &llvm::operator<<(raw_ostream &OS, AliasResult AR) { … }
ModRefInfo AAResults::getModRefInfo(const LoadInst *L,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const StoreInst *S,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const FenceInst *S,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const VAArgInst *V,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const CatchPadInst *CatchPad,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const CatchReturnInst *CatchRet,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const AtomicCmpXchgInst *CX,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const AtomicRMWInst *RMW,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) { … }
ModRefInfo AAResults::getModRefInfo(const Instruction *I,
const std::optional<MemoryLocation> &OptLoc,
AAQueryInfo &AAQIP) { … }
ModRefInfo AAResults::callCapturesBefore(const Instruction *I,
const MemoryLocation &MemLoc,
DominatorTree *DT,
AAQueryInfo &AAQI) { … }
bool AAResults::canBasicBlockModify(const BasicBlock &BB,
const MemoryLocation &Loc) { … }
bool AAResults::canInstructionRangeModRef(const Instruction &I1,
const Instruction &I2,
const MemoryLocation &Loc,
const ModRefInfo Mode) { … }
AAResults::Concept::~Concept() = default;
AnalysisKey AAManager::Key;
ExternalAAWrapperPass::ExternalAAWrapperPass() : … { … }
ExternalAAWrapperPass::ExternalAAWrapperPass(CallbackT CB)
: … { … }
char ExternalAAWrapperPass::ID = …;
INITIALIZE_PASS(…)
ImmutablePass *
llvm::createExternalAAWrapperPass(ExternalAAWrapperPass::CallbackT Callback) { … }
AAResultsWrapperPass::AAResultsWrapperPass() : … { … }
char AAResultsWrapperPass::ID = …;
INITIALIZE_PASS_BEGIN(AAResultsWrapperPass, "aa",
"Function Alias Analysis Results", false, true)
INITIALIZE_PASS_DEPENDENCY(BasicAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(ExternalAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(SCEVAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(ScopedNoAliasAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(TypeBasedAAWrapperPass)
INITIALIZE_PASS_END(AAResultsWrapperPass, "aa",
"Function Alias Analysis Results", false, true)
bool AAResultsWrapperPass::runOnFunction(Function &F) { … }
void AAResultsWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { … }
AAManager::Result AAManager::run(Function &F, FunctionAnalysisManager &AM) { … }
bool llvm::isNoAliasCall(const Value *V) { … }
static bool isNoAliasOrByValArgument(const Value *V) { … }
bool llvm::isIdentifiedObject(const Value *V) { … }
bool llvm::isIdentifiedFunctionLocal(const Value *V) { … }
bool llvm::isEscapeSource(const Value *V) { … }
bool llvm::isNotVisibleOnUnwind(const Value *Object,
bool &RequiresNoCaptureBeforeUnwind) { … }
bool llvm::isWritableObject(const Value *Object,
bool &ExplicitlyDereferenceableOnly) { … }