added new licence header
[libfirm] / ir / be / beprofile.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /** vim: set sw=4 ts=4:
21  * @file   beprofile.h
22  * @date   2006-04-06
23  * @author Adam M. Szalkowski
24  * @cvs-id $Id$
25  *
26  * Code instrumentation and execution count profiling
27  *
28  * Copyright (C) 2006 Universitaet Karlsruhe
29  * Released under the GPL
30  */
31
32 #ifndef _BEPROFILE_H_
33 #define _BEPROFILE_H_
34
35 /** Additional flags for profiling */
36 enum profile_flags {
37         profile_with_locations = 0x0001,   /**< create location table */
38         profile_default        = 0         /**< default settings */
39 };
40
41 /**
42  * Instruments irgs with profile code
43  *
44  * @param filename  The name of the output file for the profile information
45  * @param flags     Additional flags
46  *
47  * @return The irg doing the profile initialization.
48  */
49 ir_graph *be_profile_instrument(const char *filename, unsigned flags);
50
51 /**
52  * Reads the corresponding profile info file if it exists and returns a
53  * profile info struct
54  * @param filename The name of the file containing profile information
55  */
56 void be_profile_read(const char *filename);
57
58 /**
59  * Frees the profile info
60  */
61 void be_profile_free(void);
62
63 /**
64  * Get block execution count as determined be profiling
65  */
66 unsigned int be_profile_get_block_execcount(const ir_node * block);
67
68 /**
69  * Initializes exec_freq structure for an irg based on profile data
70  */
71 ir_exec_freq *be_create_execfreqs_from_profile(ir_graph *irg);
72
73 /**
74  * Tells whether profile module has acquired data
75  */
76 int be_profile_has_data(void);
77
78 #endif /* _BEPROFILE_H_ */