blob: e07db00452394aafb9e374267ad5671ed943d989 [file] [log] [blame]
Andrew Lenharth517caef2005-11-28 18:00:38 +00001//===- RSProfiling.h - Various profiling using random sampling ----------===//
Andrew Lenharth93e59f62005-11-28 00:58:09 +00002//
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// See notes in RSProfiling.cpp
11//
12//===----------------------------------------------------------------------===//
Andrew Lenharth517caef2005-11-28 18:00:38 +000013#include "llvm/Transforms/RSProfiling.h"
Andrew Lenharth93e59f62005-11-28 00:58:09 +000014
15namespace llvm {
Andrew Lenharth517caef2005-11-28 18:00:38 +000016 /// RSProfilers_std - a simple support class for profilers that handles most
17 /// of the work of chaining and tracking inserted code.
18 struct RSProfilers_std : public RSProfilers {
Andrew Lenharth93e59f62005-11-28 00:58:09 +000019 std::set<Value*> profcode;
Andrew Lenharth517caef2005-11-28 18:00:38 +000020 // Lookup up values in profcode
Andrew Lenharth93e59f62005-11-28 00:58:09 +000021 virtual bool isProfiling(Value* v);
Andrew Lenharth517caef2005-11-28 18:00:38 +000022 // handles required chaining
Andrew Lenharth93e59f62005-11-28 00:58:09 +000023 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
Andrew Lenharth517caef2005-11-28 18:00:38 +000024 // places counter updates in basic blocks and recordes added instructions in
25 // profcode
Andrew Lenharth93e59f62005-11-28 00:58:09 +000026 void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
27 GlobalValue *CounterArray);
28 };
Chris Lattneraa2372562006-05-24 17:04:05 +000029}