Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:11

0001 //===- AliasAnalysisEvaluator.h - Alias Analysis Accuracy Evaluator -------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 /// \file
0009 ///
0010 /// This file implements a simple N^2 alias analysis accuracy evaluator. The
0011 /// analysis result is a set of statistics of how many times the AA
0012 /// infrastructure provides each kind of alias result and mod/ref result when
0013 /// queried with all pairs of pointers in the function.
0014 ///
0015 /// It can be used to evaluate a change in an alias analysis implementation,
0016 /// algorithm, or the AA pipeline infrastructure itself. It acts like a stable
0017 /// and easily tested consumer of all AA information exposed.
0018 ///
0019 /// This is inspired and adapted from code by: Naveen Neelakantam, Francesco
0020 /// Spadini, and Wojciech Stryjewski.
0021 ///
0022 //===----------------------------------------------------------------------===//
0023 
0024 #ifndef LLVM_ANALYSIS_ALIASANALYSISEVALUATOR_H
0025 #define LLVM_ANALYSIS_ALIASANALYSISEVALUATOR_H
0026 
0027 #include "llvm/IR/PassManager.h"
0028 
0029 namespace llvm {
0030 class AAResults;
0031 class Function;
0032 
0033 class AAEvaluator : public PassInfoMixin<AAEvaluator> {
0034   int64_t FunctionCount = 0;
0035   int64_t NoAliasCount = 0, MayAliasCount = 0, PartialAliasCount = 0;
0036   int64_t MustAliasCount = 0;
0037   int64_t NoModRefCount = 0, ModCount = 0, RefCount = 0, ModRefCount = 0;
0038 
0039 public:
0040   AAEvaluator() = default;
0041   AAEvaluator(AAEvaluator &&Arg)
0042       : FunctionCount(Arg.FunctionCount), NoAliasCount(Arg.NoAliasCount),
0043         MayAliasCount(Arg.MayAliasCount),
0044         PartialAliasCount(Arg.PartialAliasCount),
0045         MustAliasCount(Arg.MustAliasCount), NoModRefCount(Arg.NoModRefCount),
0046         ModCount(Arg.ModCount), RefCount(Arg.RefCount),
0047         ModRefCount(Arg.ModRefCount) {
0048     Arg.FunctionCount = 0;
0049   }
0050   ~AAEvaluator();
0051 
0052   /// Run the pass over the function.
0053   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
0054 
0055 private:
0056   void runInternal(Function &F, AAResults &AA);
0057 };
0058 }
0059 
0060 #endif