blob: 09b22171ff04d6cf9a9ee3ef346012de1f761ef5 [file] [log] [blame]
Chris Lattner467dd2e2004-03-08 17:06:13 +00001//===- ProfilingUtils.h - Helper functions shared by profilers --*- C++ -*-===//
Misha Brukmanfd939082005-04-21 23:48:37 +00002//
Chris Lattner467dd2e2004-03-08 17:06:13 +00003// 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.
Misha Brukmanfd939082005-04-21 23:48:37 +00007//
Chris Lattner467dd2e2004-03-08 17:06:13 +00008//===----------------------------------------------------------------------===//
9//
Gabor Greif29d8aa72008-03-06 10:36:00 +000010// This file defines a few helper functions which are used by profile
Chris Lattner467dd2e2004-03-08 17:06:13 +000011// 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
20namespace llvm {
Nick Lewycky918035f2011-04-08 22:19:52 +000021 class BasicBlock;
Chris Lattner467dd2e2004-03-08 17:06:13 +000022 class Function;
23 class GlobalValue;
Nick Lewycky918035f2011-04-08 22:19:52 +000024 class Module;
Andrew Trick04317cc2011-01-29 01:09:53 +000025 class PointerType;
Chris Lattner467dd2e2004-03-08 17:06:13 +000026
27 void InsertProfilingInitCall(Function *MainFn, const char *FnName,
Andrew Trick04317cc2011-01-29 01:09:53 +000028 GlobalValue *Arr = 0,
29 PointerType *arrayType = 0);
Chris Lattner467dd2e2004-03-08 17:06:13 +000030 void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
Andrew Trick04317cc2011-01-29 01:09:53 +000031 GlobalValue *CounterArray,
32 bool beginning = true);
Nick Lewycky918035f2011-04-08 22:19:52 +000033 void InsertProfilingShutdownCall(Function *Callee, Module *Mod);
Chris Lattner467dd2e2004-03-08 17:06:13 +000034}
35
36#endif