blob: 8bbe7c7b28fe53d99a130588e47db4fa7f32a9de [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//
Chris Lattnerf3ebc3f2007-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 Lenharth93e59f62005-11-28 00:58:09 +00007//
8//===----------------------------------------------------------------------===//
9//
10// See notes in RSProfiling.cpp
11//
12//===----------------------------------------------------------------------===//
Andrew Lenharth517caef2005-11-28 18:00:38 +000013#include "llvm/Transforms/RSProfiling.h"
Reid Spencer3f4e6e82007-02-04 00:40:42 +000014#include <set>
Andrew Lenharth93e59f62005-11-28 00:58:09 +000015
16namespace llvm {
Andrew Lenharth517caef2005-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 Patel8c78a0b2007-05-03 01:11:54 +000020 static char ID;
Andrew Lenharth93e59f62005-11-28 00:58:09 +000021 std::set<Value*> profcode;
Andrew Lenharth517caef2005-11-28 18:00:38 +000022 // Lookup up values in profcode
Andrew Lenharth93e59f62005-11-28 00:58:09 +000023 virtual bool isProfiling(Value* v);
Andrew Lenharth517caef2005-11-28 18:00:38 +000024 // handles required chaining
Andrew Lenharth93e59f62005-11-28 00:58:09 +000025 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
Andrew Lenharth517caef2005-11-28 18:00:38 +000026 // places counter updates in basic blocks and recordes added instructions in
27 // profcode
Andrew Lenharth93e59f62005-11-28 00:58:09 +000028 void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
29 GlobalValue *CounterArray);
30 };
Chris Lattneraa2372562006-05-24 17:04:05 +000031}