Andrew Lenharth | bb227c1 | 2005-11-28 18:00:38 +0000 | [diff] [blame] | 1 | //===- RSProfiling.h - Various profiling using random sampling ----------===// |
Andrew Lenharth | 701f5ac | 2005-11-28 00:58:09 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame^] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Andrew Lenharth | 701f5ac | 2005-11-28 00:58:09 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // See notes in RSProfiling.cpp |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
Andrew Lenharth | bb227c1 | 2005-11-28 18:00:38 +0000 | [diff] [blame] | 13 | #include "llvm/Transforms/RSProfiling.h" |
Reid Spencer | 6734b57 | 2007-02-04 00:40:42 +0000 | [diff] [blame] | 14 | #include <set> |
Andrew Lenharth | 701f5ac | 2005-11-28 00:58:09 +0000 | [diff] [blame] | 15 | |
| 16 | namespace llvm { |
Andrew Lenharth | bb227c1 | 2005-11-28 18:00:38 +0000 | [diff] [blame] | 17 | /// 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 Patel | 1997473 | 2007-05-03 01:11:54 +0000 | [diff] [blame] | 20 | static char ID; |
Andrew Lenharth | 701f5ac | 2005-11-28 00:58:09 +0000 | [diff] [blame] | 21 | std::set<Value*> profcode; |
Andrew Lenharth | bb227c1 | 2005-11-28 18:00:38 +0000 | [diff] [blame] | 22 | // Lookup up values in profcode |
Andrew Lenharth | 701f5ac | 2005-11-28 00:58:09 +0000 | [diff] [blame] | 23 | virtual bool isProfiling(Value* v); |
Andrew Lenharth | bb227c1 | 2005-11-28 18:00:38 +0000 | [diff] [blame] | 24 | // handles required chaining |
Andrew Lenharth | 701f5ac | 2005-11-28 00:58:09 +0000 | [diff] [blame] | 25 | virtual void getAnalysisUsage(AnalysisUsage &AU) const; |
Andrew Lenharth | bb227c1 | 2005-11-28 18:00:38 +0000 | [diff] [blame] | 26 | // places counter updates in basic blocks and recordes added instructions in |
| 27 | // profcode |
Andrew Lenharth | 701f5ac | 2005-11-28 00:58:09 +0000 | [diff] [blame] | 28 | void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum, |
| 29 | GlobalValue *CounterArray); |
| 30 | }; |
Chris Lattner | d74ea2b | 2006-05-24 17:04:05 +0000 | [diff] [blame] | 31 | } |