2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
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.
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.
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
22 * @brief Internal backend global data structures.
23 * @author Sebastian Hack
26 #ifndef FIRM_BE_BE_T_H
27 #define FIRM_BE_BE_T_H
29 #include "firm_types.h"
41 DUMP_INITIAL = 1 << 0,
44 DUMP_PREPARED = 1 << 3,
61 /** Backend options */
63 unsigned dump_flags; /**< backend dumping flags */
64 int timing; /**< time the backend phases */
65 int opt_profile; /**< instrument code for profiling */
66 int omit_fp; /**< try to omit the frame pointer */
67 int pic; /**< create position independent code */
68 int gprof; /**< create gprof compatible profiling code */
69 int verify_option; /**< backend verify option */
70 char target_os[128]; /**< target operating system name */
71 char ilp_server[128]; /**< the ilp server name */
72 char ilp_solver[128]; /**< the ilp solver name */
73 int statev; /**< enable stat event dumping */
74 char filtev[128]; /**< filter mask for stat events (regex is supported) */
77 struct be_main_env_t {
79 be_options_t *options; /**< backend options */
80 const char *cup_name; /**< name of the compilation unit */
81 pmap *ent_trampoline_map; /**< A map containing PIC trampolines for methods. */
82 ir_type *pic_trampolines_type; /**< Class type containing all trampolines */
83 pmap *ent_pic_symbol_map;
84 ir_type *pic_symbols_type;
87 extern unsigned short asm_constraint_flags[256];
89 void be_init_default_asm_constraint_flags(void);
92 * Put the registers to be ignored in this IRG into a bitset.
93 * @param irg The graph
94 * @param cls The register class.
95 * @param bs The bitset (may be NULL).
96 * @return The number of registers to be ignored.
98 unsigned be_put_ignore_regs(const ir_graph *irg,
99 const arch_register_class_t *cls, bitset_t *bs);
103 * Initialize the backend. Must be run first in init_firm();
105 void firm_be_init(void);
106 void firm_be_finish(void);
108 extern int be_timing;
136 extern ir_timer_t *be_timers[T_LAST+1];
138 static inline void be_timer_push(be_timer_id_t id)
144 assert(id <= T_LAST);
145 res = ir_timer_push(be_timers[id]);
147 assert(res && "Timer already on stack, cannot be pushed twice.");
150 static inline void be_timer_pop(be_timer_id_t id)
156 tmp = ir_timer_pop();
159 assert(tmp == be_timers[id] && "Attempt to pop wrong timer.");