beifg: Factorise code to count interference components.
[libfirm] / ir / ir / irprofile.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       Code instrumentation and execution count profiling.
9  * @author      Adam M. Szalkowski
10  * @date        06.04.2006
11  */
12 #ifndef FIRM_BE_BEPROFILE_H
13 #define FIRM_BE_BEPROFILE_H
14
15 #include <stdbool.h>
16 #include <stdint.h>
17 #include "irgraph.h"
18 #include "irnode.h"
19
20 /**
21  * Instruments all irgs in the program with profile code.
22  * The final code will have a counter for each basic block which is
23  * incremented in that block. After the program has run the info is written
24  * to @p filename.
25  */
26 ir_graph *ir_profile_instrument(const char *filename);
27
28 /**
29  * Reads the corresponding profile info file if it exists and returns a
30  * profile info struct
31  * @param filename The name of the file containing profile information
32  */
33 bool ir_profile_read(const char *filename);
34
35 /**
36  * Frees the profile info
37  */
38 void ir_profile_free(void);
39
40 /**
41  * Get block execution count as determined be profiling
42  */
43 uint32_t ir_profile_get_block_execcount(const ir_node *block);
44
45 /**
46  * Initializes exec_freq structure for an irg based on profile data
47  */
48 void ir_create_execfreqs_from_profile(void);
49
50 #endif