George Burgess IV | bfa401e | 2016-07-06 00:26:41 +0000 | [diff] [blame^] | 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 "llvm/Pass.h" |
| 29 | |
| 30 | using namespace llvm; |
| 31 | |
| 32 | #define DEBUG_TYPE "cfl-anders-aa" |
| 33 | |
| 34 | CFLAndersAAResult::CFLAndersAAResult() = default; |
| 35 | |
| 36 | char CFLAndersAA::PassID; |
| 37 | |
| 38 | CFLAndersAAResult CFLAndersAA::run(Function &F, AnalysisManager<Function> &AM) { |
| 39 | return CFLAndersAAResult(); |
| 40 | } |
| 41 | |
| 42 | char CFLAndersAAWrapperPass::ID = 0; |
| 43 | INITIALIZE_PASS(CFLAndersAAWrapperPass, "cfl-anders-aa", |
| 44 | "Inclusion-Based CFL Alias Analysis", false, true) |
| 45 | |
| 46 | ImmutablePass *llvm::createCFLAndersAAWrapperPass() { |
| 47 | return new CFLAndersAAWrapperPass(); |
| 48 | } |
| 49 | |
| 50 | CFLAndersAAWrapperPass::CFLAndersAAWrapperPass() : ImmutablePass(ID) { |
| 51 | initializeCFLAndersAAWrapperPassPass(*PassRegistry::getPassRegistry()); |
| 52 | } |
| 53 | |
| 54 | void CFLAndersAAWrapperPass::initializePass() {} |
| 55 | |
| 56 | void CFLAndersAAWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { |
| 57 | AU.setPreservesAll(); |
| 58 | } |