2005-11-28 18:00:38 +00:00
|
|
|
//===- RSProfiling.cpp - Various profiling using random sampling ----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-11-28 18:00:38 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the abstract interface that a profiler must implement to
|
|
|
|
// support the random profiling transform.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-08-10 15:53:08 +00:00
|
|
|
#ifndef LLVM_TRANSFORMS_RSPROFILING_H
|
|
|
|
#define LLVM_TRANSFORMS_RSPROFILING_H
|
|
|
|
|
2009-11-05 23:01:30 +00:00
|
|
|
#include "llvm/Pass.h"
|
|
|
|
|
2005-11-28 18:00:38 +00:00
|
|
|
namespace llvm {
|
2009-11-05 23:01:30 +00:00
|
|
|
class Value;
|
|
|
|
|
2005-11-28 18:00:38 +00:00
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
/// 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 {
|
2007-05-03 01:11:54 +00:00
|
|
|
static char ID; // Pass identification, replacement for typeinfo
|
2008-09-04 17:05:41 +00:00
|
|
|
RSProfilers() : ModulePass(&ID) {}
|
2007-05-01 21:15:47 +00:00
|
|
|
|
2005-11-28 18:00:38 +00:00
|
|
|
/// isProfiling - This method returns true if the value passed it was
|
|
|
|
/// inserted by the profiler.
|
|
|
|
virtual bool isProfiling(Value* v) = 0;
|
|
|
|
};
|
2006-02-22 16:23:43 +00:00
|
|
|
}
|
2007-08-10 15:53:08 +00:00
|
|
|
|
|
|
|
#endif
|