1//- CFLAndersAliasAnalysis.cpp - Unification-based Alias Analysis ---*- C++-*-// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file implements a CFL-based, summary-based alias analysis algorithm. It 11// differs from CFLSteensAliasAnalysis in its inclusion-based nature while 12// CFLSteensAliasAnalysis is unification-based. This pass has worse performance 13// than CFLSteensAliasAnalysis (the worst case complexity of 14// CFLAndersAliasAnalysis is cubic, while the worst case complexity of 15// CFLSteensAliasAnalysis is almost linear), but it is able to yield more 16// precise analysis result. The precision of this analysis is roughly the same 17// as that of an one level context-sensitive Andersen's algorithm. 18// 19//===----------------------------------------------------------------------===// 20 21// N.B. AliasAnalysis as a whole is phrased as a FunctionPass at the moment, and 22// CFLAndersAA is interprocedural. This is *technically* A Bad Thing, because 23// FunctionPasses are only allowed to inspect the Function that they're being 24// run on. Realistically, this likely isn't a problem until we allow 25// FunctionPasses to run concurrently. 26 27#include "llvm/Analysis/CFLAndersAliasAnalysis.h" 28#include "CFLGraph.h" 29#include "llvm/Pass.h" 30 31using namespace llvm; 32using namespace llvm::cflaa; 33 34#define DEBUG_TYPE "cfl-anders-aa" 35 36CFLAndersAAResult::CFLAndersAAResult() = default; 37 38char CFLAndersAA::PassID; 39 40CFLAndersAAResult CFLAndersAA::run(Function &F, AnalysisManager<Function> &AM) { 41 return CFLAndersAAResult(); 42} 43 44char CFLAndersAAWrapperPass::ID = 0; 45INITIALIZE_PASS(CFLAndersAAWrapperPass, "cfl-anders-aa", 46 "Inclusion-Based CFL Alias Analysis", false, true) 47 48ImmutablePass *llvm::createCFLAndersAAWrapperPass() { 49 return new CFLAndersAAWrapperPass(); 50} 51 52CFLAndersAAWrapperPass::CFLAndersAAWrapperPass() : ImmutablePass(ID) { 53 initializeCFLAndersAAWrapperPassPass(*PassRegistry::getPassRegistry()); 54} 55 56void CFLAndersAAWrapperPass::initializePass() {} 57 58void CFLAndersAAWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { 59 AU.setPreservesAll(); 60} 61