be_t.h 4.31 KB
Newer Older
Christian Würdig's avatar
Christian Würdig committed
1
/*
Michael Beck's avatar
Michael Beck committed
2
 * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
Christian Würdig's avatar
Christian Würdig committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 * This file is part of libFirm.
 *
 * This file may be distributed and/or modified under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation and appearing in the file LICENSE.GPL included in the
 * packaging of this file.
 *
 * Licensees holding valid libFirm Professional Edition licenses may use
 * this file in accordance with the libFirm Commercial License.
 * Agreement provided with the Software.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.
 */

Sebastian Hack's avatar
Sebastian Hack committed
20
/**
Christian Würdig's avatar
Christian Würdig committed
21
22
23
24
 * @file
 * @brief   Internal backend global data structures.
 * @author  Sebastian Hack
 * @version $Id$
Sebastian Hack's avatar
Sebastian Hack committed
25
 */
Christian Würdig's avatar
Christian Würdig committed
26
27
#ifndef FIRM_BE_BE_T_H
#define FIRM_BE_BE_T_H
Sebastian Hack's avatar
Sebastian Hack committed
28

Matthias Braun's avatar
Matthias Braun committed
29
30
#include <libcore/lc_timing.h>

31
#include "firm_types.h"
32
#include "obst.h"
33
#include "debug.h"
Sebastian Hack's avatar
Sebastian Hack committed
34
#include "bitset.h"
35

Sebastian Hack's avatar
Sebastian Hack committed
36
#include "be.h"
Sebastian Hack's avatar
Sebastian Hack committed
37
#include "bearch.h"
38
#include "be_dbgout.h"
39
#include "beirg.h"
Daniel Grund's avatar
Daniel Grund committed
40

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#define DUMP_NONE       0
#define DUMP_INITIAL    (1 << 0)
#define DUMP_ABI        (1 << 1)
#define DUMP_SCHED      (1 << 2)
#define DUMP_PREPARED   (1 << 3)
#define DUMP_RA         (1 << 4)
#define DUMP_FINAL      (1 << 5)
#define DUMP_BE         (1 << 6)

enum {
	BE_TIME_OFF,
	BE_TIME_ON
};

enum {
	BE_VRFY_OFF,
	BE_VRFY_WARN,
	BE_VRFY_ASSERT
};

61
62
63
64
65
enum {
	BE_SCHED_LIST,
	BE_SCHED_ILP
};

66
/** Backend options */
67
struct be_options_t {
Christian Würdig's avatar
Christian Würdig committed
68
	unsigned dump_flags;      /**< backend dumping flags */
69
70
71
72
73
	int  timing;              /**< time the backend phases */
	int  opt_profile;         /**< instrument code for profiling */
	int  omit_fp;             /**< try to omit the frame pointer */
	int  stabs_debug_support; /**< enable stabs debugging support */
	int  vrfy_option;         /**< backend verify option */
74
	int  scheduler;           /**< the scheduler */
75
76
	char ilp_server[128];     /**< the ilp server name */
	char ilp_solver[128];     /**< the ilp solver name */
Sebastian Hack's avatar
Sebastian Hack committed
77
	int  statev;              /**< enable stat event dumping */
78
	char printev[128];
Sebastian Hack's avatar
Sebastian Hack committed
79
80
};

81
82
83
84
85
86
87
struct be_main_env_t {
	struct obstack         obst;
	arch_env_t            *arch_env;
	be_options_t          *options;
	arch_code_generator_t *cg;
	arch_irn_handler_t    *phi_handler;
	dbg_handle            *db_handle;
88
	const char            *cup_name;
Sebastian Hack's avatar
Sebastian Hack committed
89
90
};

Sebastian Hack's avatar
Sebastian Hack committed
91
92
93
94
95
96
97
/**
* Put the registers to be ignored in this IRG into a bitset.
* @param birg The backend IRG data structure.
* @param cls  The register class.
* @param bs   The bitset (may be NULL).
* @return The number of registers to be ignored.
*/
Matthias Braun's avatar
Matthias Braun committed
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
unsigned be_put_ignore_regs(const be_irg_t *birg,
		const arch_register_class_t *cls, bitset_t *bs);

extern int be_timing;

#define BE_TIMER_PUSH(timer)                                              \
    if (be_timing) {                                                      \
        int res = lc_timer_push(timer);                                   \
		assert(res && "Timer already on stack, cannot be pushed twice."); \
    }

#define BE_TIMER_POP(timer)                                               \
    if (be_timing) {                                                      \
        lc_timer_t *tmp = lc_timer_pop();                                 \
        assert(tmp == timer && "Attempt to pop wrong timer.");            \
    }

extern lc_timer_t *t_abi;
extern lc_timer_t *t_codegen;
extern lc_timer_t *t_sched;
extern lc_timer_t *t_constr;
extern lc_timer_t *t_finish;
extern lc_timer_t *t_emit;
extern lc_timer_t *t_other;
extern lc_timer_t *t_verify;
extern lc_timer_t *t_heights;
extern lc_timer_t *t_live;         /**< timer for liveness calculation */
extern lc_timer_t *t_ssa_constr;   /**< timer for ssa reconstruction */
extern lc_timer_t *t_ra_prolog;    /**< timer for prolog */
extern lc_timer_t *t_ra_epilog;    /**< timer for epilog */
extern lc_timer_t *t_ra_constr;    /**< timer for spill constraints */
extern lc_timer_t *t_ra_spill;     /**< timer for spilling */
extern lc_timer_t *t_ra_spill_apply;
extern lc_timer_t *t_ra_color;     /**< timer for graph coloring */
extern lc_timer_t *t_ra_ifg;       /**< timer for building interference graph */
extern lc_timer_t *t_ra_copymin;   /**< timer for copy minimization */
extern lc_timer_t *t_ra_ssa;       /**< timer for ssa destruction */
extern lc_timer_t *t_ra_other;     /**< timer for remaining stuff */
Sebastian Hack's avatar
Sebastian Hack committed
136

Christian Würdig's avatar
Christian Würdig committed
137
#endif /* FIRM_BE_BE_T_H */