1 //===- llvm/Analysis/ProfileInfo.h - Profile Info Interface -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the generic ProfileInfo interface, which is used as the
11 // common interface used by all clients of profiling information, and
12 // implemented either by making static guestimations, or by actually reading in
13 // profiling information gathered by running the program.
15 // Note that to be useful, all profile-based optimizations should preserve
16 // ProfileInfo, which requires that they notify it when changes to the CFG are
19 //===----------------------------------------------------------------------===//
21 #ifndef LLVM_ANALYSIS_PROFILEINFO_H
22 #define LLVM_ANALYSIS_PROFILEINFO_H
31 /// createProfileLoaderPass - This function returns a Pass that loads the
32 /// profiling information for the module from the specified filename, making
33 /// it available to the optimizers.
34 Pass *createProfileLoaderPass(const std::string &Filename);
38 std::map<BasicBlock*, unsigned> ExecutionCounts;
40 virtual ~ProfileInfo(); // We want to be subclassed
42 //===------------------------------------------------------------------===//
43 /// Profile Information Queries
45 unsigned getExecutionCount(BasicBlock *BB) {
46 std::map<BasicBlock*, unsigned>::iterator I = ExecutionCounts.find(BB);
47 return I != ExecutionCounts.end() ? I->second : 0;
50 //===------------------------------------------------------------------===//
51 /// Analysis Update Methods
56 } // End llvm namespace