merge kaps
[libfirm] / ir / ir / irprofile.h
1 /*
2  * Copyright (C) 1995-2008 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 /**
21  * @file
22  * @brief       Code instrumentation and execution count profiling.
23  * @author      Adam M. Szalkowski
24  * @date        06.04.2006
25  * @version     $Id$
26  */
27 #ifndef FIRM_BE_BEPROFILE_H
28 #define FIRM_BE_BEPROFILE_H
29
30 #include "irgraph.h"
31 #include "irnode.h"
32
33 /** Additional flags for profiling */
34 enum profile_flags {
35         profile_with_locations = 0x0001,   /**< create location table */
36         profile_default        = 0         /**< default settings */
37 };
38
39 /**
40  * Instruments irgs with profile code
41  *
42  * @param filename  The name of the output file for the profile information
43  * @param flags     Additional flags
44  *
45  * @return The irg doing the profile initialization.
46  */
47 ir_graph *ir_profile_instrument(const char *filename, unsigned flags);
48
49 /**
50  * Reads the corresponding profile info file if it exists and returns a
51  * profile info struct
52  * @param filename The name of the file containing profile information
53  */
54 void ir_profile_read(const char *filename);
55
56 /**
57  * Frees the profile info
58  */
59 void ir_profile_free(void);
60
61 /**
62  * Get block execution count as determined be profiling
63  */
64 unsigned int ir_profile_get_block_execcount(const ir_node * block);
65
66 /**
67  * Initializes exec_freq structure for an irg based on profile data
68  */
69 ir_exec_freq *ir_create_execfreqs_from_profile(ir_graph *irg);
70
71 /**
72  * Tells whether profile module has acquired data
73  */
74 int ir_profile_has_data(void);
75
76 #endif /* FIRM_BE_BEPROFILE_H */