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