blob: 8bbe7c7b28fe53d99a130588e47db4fa7f32a9de [file] [log] [blame]
Andrew Lenharthbb227c12005-11-28 18:00:38 +00001//===- RSProfiling.h - Various profiling using random sampling ----------===//
Andrew Lenharth701f5ac2005-11-28 00:58:09 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Andrew Lenharth701f5ac2005-11-28 00:58:09 +00007//
8//===----------------------------------------------------------------------===//
9//
10// See notes in RSProfiling.cpp
11//
12//===----------------------------------------------------------------------===//
Andrew Lenharthbb227c12005-11-28 18:00:38 +000013#include "llvm/Transforms/RSProfiling.h"
Reid Spencer6734b572007-02-04 00:40:42 +000014#include <set>
Andrew Lenharth701f5ac2005-11-28 00:58:09 +000015
16namespace llvm {
Andrew Lenharthbb227c12005-11-28 18:00:38 +000017 /// RSProfilers_std - a simple support class for profilers that handles most
18 /// of the work of chaining and tracking inserted code.
19 struct RSProfilers_std : public RSProfilers {
Devang Patel19974732007-05-03 01:11:54 +000020 static char ID;
Andrew Lenharth701f5ac2005-11-28 00:58:09 +000021 std::set<Value*> profcode;
Andrew Lenharthbb227c12005-11-28 18:00:38 +000022 // Lookup up values in profcode
Andrew Lenharth701f5ac2005-11-28 00:58:09 +000023 virtual bool isProfiling(Value* v);
Andrew Lenharthbb227c12005-11-28 18:00:38 +000024 // handles required chaining
Andrew Lenharth701f5ac2005-11-28 00:58:09 +000025 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
Andrew Lenharthbb227c12005-11-28 18:00:38 +000026 // places counter updates in basic blocks and recordes added instructions in
27 // profcode
Andrew Lenharth701f5ac2005-11-28 00:58:09 +000028 void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
29 GlobalValue *CounterArray);
30 };
Chris Lattnerd74ea2b2006-05-24 17:04:05 +000031}