summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/RSProfiling.h
blob: 96554c59043b0e638e3084005d329be8550db077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//===- RSProfiling.cpp - Various profiling using random sampling ----------===//
//
//                      The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the abstract interface that a profiler must implement to
// support the random profiling transform.
//
//===----------------------------------------------------------------------===//

namespace llvm {
  //===--------------------------------------------------------------------===//
  /// RSProfilers - The basic Random Sampling Profiler Interface  Any profiler 
  /// that implements this interface can be transformed by the random sampling
  /// pass to be sample based rather than always on.
  ///
  /// The only exposed function can be queried to find out if an instruction
  /// was original or if it was inserted by the profiler.  Implementations of
  /// this interface are expected to chain to other implementations, such that
  /// multiple profilers can be support simultaniously.
  struct RSProfilers : public ModulePass {
    static const char ID; // Pass identification, replacement for typeinfo
    RSProfilers() : ModulePass((intptr_t)&ID) {}

    /// isProfiling - This method returns true if the value passed it was 
    /// inserted by the profiler.
    virtual bool isProfiling(Value* v) = 0;
  };
}