summaryrefslogtreecommitdiffhomepage
path: root/ir/ir/irprofile.h
blob: 4759dee878c1c76ed10d33a02348c3bdf60d1555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * This file is part of libFirm.
 * Copyright (C) 2012 University of Karlsruhe.
 */

/**
 * @file
 * @brief       Code instrumentation and execution count profiling.
 * @author      Adam M. Szalkowski
 * @date        06.04.2006
 */
#ifndef FIRM_BE_BEPROFILE_H
#define FIRM_BE_BEPROFILE_H

#include <stdbool.h>
#include <stdint.h>

#include "firm_types.h"

/**
 * Instruments all irgs in the program with profile code.
 * The final code will have a counter for each basic block which is
 * incremented in that block. After the program has run the info is written
 * to @p filename.
 */
ir_graph *ir_profile_instrument(const char *filename);

/**
 * Reads the corresponding profile info file if it exists and returns a
 * profile info struct
 * @param filename The name of the file containing profile information
 */
bool ir_profile_read(const char *filename);

/**
 * Frees the profile info
 */
void ir_profile_free(void);

/**
 * Get block execution count as determined be profiling
 */
uint32_t ir_profile_get_block_execcount(const ir_node *block);

/**
 * Initializes exec_freq structure for an irg based on profile data
 */
void ir_create_execfreqs_from_profile(void);

#endif