Chris Lattner | 467dd2e | 2004-03-08 17:06:13 +0000 | [diff] [blame] | 1 | //===- ProfilingUtils.h - Helper functions shared by profilers --*- C++ -*-===// |
Misha Brukman | fd93908 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 2 | // |
Chris Lattner | 467dd2e | 2004-03-08 17:06:13 +0000 | [diff] [blame] | 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. |
Misha Brukman | fd93908 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 7 | // |
Chris Lattner | 467dd2e | 2004-03-08 17:06:13 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Gabor Greif | 29d8aa7 | 2008-03-06 10:36:00 +0000 | [diff] [blame] | 10 | // This file defines a few helper functions which are used by profile |
Chris Lattner | 467dd2e | 2004-03-08 17:06:13 +0000 | [diff] [blame] | 11 | // instrumentation code to instrument the code. This allows the profiler pass |
| 12 | // to worry about *what* to insert, and these functions take care of *how* to do |
| 13 | // it. |
| 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
| 17 | #ifndef PROFILINGUTILS_H |
| 18 | #define PROFILINGUTILS_H |
| 19 | |
| 20 | namespace llvm { |
Nick Lewycky | 918035f | 2011-04-08 22:19:52 +0000 | [diff] [blame] | 21 | class BasicBlock; |
Chris Lattner | 467dd2e | 2004-03-08 17:06:13 +0000 | [diff] [blame] | 22 | class Function; |
| 23 | class GlobalValue; |
Nick Lewycky | 918035f | 2011-04-08 22:19:52 +0000 | [diff] [blame] | 24 | class Module; |
Andrew Trick | 04317cc | 2011-01-29 01:09:53 +0000 | [diff] [blame] | 25 | class PointerType; |
Chris Lattner | 467dd2e | 2004-03-08 17:06:13 +0000 | [diff] [blame] | 26 | |
| 27 | void InsertProfilingInitCall(Function *MainFn, const char *FnName, |
Andrew Trick | 04317cc | 2011-01-29 01:09:53 +0000 | [diff] [blame] | 28 | GlobalValue *Arr = 0, |
| 29 | PointerType *arrayType = 0); |
Chris Lattner | 467dd2e | 2004-03-08 17:06:13 +0000 | [diff] [blame] | 30 | void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum, |
Andrew Trick | 04317cc | 2011-01-29 01:09:53 +0000 | [diff] [blame] | 31 | GlobalValue *CounterArray, |
| 32 | bool beginning = true); |
Nick Lewycky | 918035f | 2011-04-08 22:19:52 +0000 | [diff] [blame] | 33 | void InsertProfilingShutdownCall(Function *Callee, Module *Mod); |
Chris Lattner | 467dd2e | 2004-03-08 17:06:13 +0000 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | #endif |