An initial implementation of an LLVM ProfileInfo class which is designed to
[oota-llvm.git] / lib / Analysis / ProfileInfo.cpp
1 //===- ProfileInfo.cpp - Profile Info Interface ---------------------------===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the abstract ProfileInfo interface, and the default
11 // "no profile" implementation.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "llvm/Analysis/ProfileInfo.h"
16 #include "llvm/Pass.h"
17 using namespace llvm;
18
19 // Register the AliasAnalysis interface, providing a nice name to refer to.
20 namespace {
21   RegisterAnalysisGroup<ProfileInfo> Z("Profile Information");
22 }
23
24 ProfileInfo::~ProfileInfo() {}
25
26
27 //===----------------------------------------------------------------------===//
28 //  NoProfile ProfileInfo implementation
29 //
30
31 namespace {
32   struct NoProfileInfo : public ImmutablePass, public ProfileInfo {
33     unsigned getExecutionCount(BasicBlock *BB) { return 0; }
34   };
35  
36   // Register this pass...
37   RegisterOpt<NoProfileInfo>
38   X("no-profile", "No Profile Information");
39
40   // Declare that we implement the AliasAnalysis interface
41   RegisterAnalysisGroup<ProfileInfo, NoProfileInfo> Y;
42 }  // End of anonymous namespace