Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
c65b13d9
Commit
c65b13d9
authored
Dec 14, 2006
by
Matthias Braun
Browse files
move birg to an own file, use more of the birg analysis data
parent
208809bd
Changes
19
Show whitespace changes
Inline
Side-by-side
ir/be/be.h
View file @
c65b13d9
...
...
@@ -7,6 +7,7 @@
#include
"lower_dw.h"
#include
"dbginfo.h"
#include
"ifconv.h"
#include
"beirg.h"
#define LC_STOP_AND_RESET_TIMER(timer) do { lc_timer_stop(timer); lc_timer_reset(timer); } while(0)
...
...
@@ -73,7 +74,6 @@ void be_set_debug_retrieve(retrieve_dbg_func func);
const
char
*
be_retrieve_dbg_info
(
const
dbg_info
*
dbg
,
unsigned
*
line
);
typedef
struct
_be_main_env_t
be_main_env_t
;
typedef
struct
_be_irg_t
be_irg_t
;
typedef
struct
_be_options_t
be_options_t
;
#endif
/* _BE_MAIN_H */
ir/be/be_t.h
View file @
c65b13d9
...
...
@@ -16,6 +16,7 @@
#include
"bearch.h"
#include
"beirgmod.h"
#include
"be_dbgout.h"
#include
"beirg_t.h"
#define DUMP_NONE 0
#define DUMP_INITIAL (1 << 0)
...
...
@@ -67,26 +68,6 @@ struct _be_main_env_t {
DEBUG_ONLY
(
firm_dbg_module_t
*
dbg
;)
};
/**
* An irg with additional analysis data about this irg. Also includes some
* backend structures
*/
struct
_be_irg_t
{
ir_graph
*
irg
;
struct
_be_main_env_t
*
main_env
;
struct
_be_abi_irg_t
*
abi
;
struct
_arch_code_generator_t
*
cg
;
ir_exec_freq
*
exec_freq
;
be_dom_front_info_t
*
dom_front
;
be_lv_t
*
lv
;
};
void
be_assure_liveness
(
be_irg_t
*
birg
);
void
be_invalidate_liveness
(
be_irg_t
*
birg
);
void
be_assure_dom_front
(
be_irg_t
*
birg
);
void
be_invalidate_dom_front
(
be_irg_t
*
birg
);
/**
* Put the registers to be ignored in this IRG into a bitset.
* @param birg The backend IRG data structure.
...
...
ir/be/beabi.c
View file @
c65b13d9
...
...
@@ -35,6 +35,7 @@
#include
"benode_t.h"
#include
"belive_t.h"
#include
"besched_t.h"
#include
"beirg.h"
typedef
struct
_be_abi_call_arg_t
{
unsigned
is_res
:
1
;
/**< 1: the call argument is a return value. 0: it's a call parameter. */
...
...
ir/be/bearch.h
View file @
c65b13d9
...
...
@@ -527,7 +527,7 @@ struct _arch_code_generator_if_t {
* @param birg A backend IRG session.
* @return A newly created code generator.
*/
void
*
(
*
init
)(
const
be_irg_t
*
birg
);
void
*
(
*
init
)(
be_irg_t
*
birg
);
/**
* Called before abi introduce.
...
...
ir/be/bechordal.c
View file @
c65b13d9
...
...
@@ -50,6 +50,7 @@
#include
"beifg.h"
#include
"beinsn_t.h"
#include
"bestatevent.h"
#include
"beirg_t.h"
#include
"bechordal_t.h"
#include
"bechordal_draw.h"
...
...
ir/be/bechordal_draw.c
View file @
c65b13d9
...
...
@@ -375,8 +375,8 @@ static void draw_block(ir_node *bl, void *data)
static
const
color_t
black
=
{
0
,
0
,
0
};
const
draw_chordal_env_t
*
env
=
data
;
pset
*
live_in
=
be_lv_pset_put_in
(
env
->
chordal_env
->
birg
->
lv
,
bl
,
pset_new_ptr_default
()
);
be_lv_t
*
lv
=
env
->
chordal_env
->
birg
->
lv
;
const
be_lv_t
*
lv
=
be_get_birg_liveness
(
env
->
chordal_env
->
birg
);
pset
*
live_in
=
be_lv_pset_put_in
(
lv
,
bl
,
pset_new_ptr_default
())
;
ir_node
*
irn
;
border_t
*
b
;
struct
list_head
*
head
=
get_block_border_head
(
env
->
chordal_env
,
bl
);
...
...
ir/be/bechordal_main.c
View file @
c65b13d9
...
...
@@ -363,7 +363,7 @@ static void memory_operand_walker(ir_node *irn, void *env) {
if
(
get_nodes_block
(
src
)
==
block
&&
arch_possible_memory_operand
(
aenv
,
src
,
pos
))
{
DBG
((
cenv
->
dbg
,
LEVEL_3
,
"performing memory operand %+F at %+F
\n
"
,
irn
,
src
));
//
arch_perform_memory_operand(aenv, src, spill, pos);
arch_perform_memory_operand
(
aenv
,
src
,
spill
,
pos
);
}
}
...
...
ir/be/bechordal_t.h
View file @
c65b13d9
...
...
@@ -29,6 +29,7 @@
#include
"bechordal.h"
#include
"beirgmod.h"
#include
"belive.h"
#include
"beirg.h"
typedef
struct
_be_ra_chordal_opts_t
be_ra_chordal_opts_t
;
...
...
ir/be/becopyilp.c
View file @
c65b13d9
...
...
@@ -7,13 +7,13 @@
* Common stuff used by all ILP fomulations.
*
*/
#include
"bestatevent.h"
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
/* HAVE_CONFIG_H */
#include
"bestatevent.h"
#include
"beirg_t.h"
#ifdef WITH_ILP
#define DUMP_ILP 1
...
...
ir/be/becopyopt.c
View file @
c65b13d9
...
...
@@ -7,6 +7,7 @@
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#ifdef HAVE_ALLOCA_H
#include
<alloca.h>
#endif
...
...
@@ -41,6 +42,7 @@
#include
"benodesets.h"
#include
"bejavacoal.h"
#include
"bestatevent.h"
#include
"beirg_t.h"
#ifdef WITH_LIBCORE
#include
<libcore/lc_timing.h>
...
...
ir/be/becopystat.c
View file @
c65b13d9
...
...
@@ -21,6 +21,7 @@
#include
"beutil.h"
#include
"becopyopt_t.h"
#include
"becopystat.h"
#include
"beirg_t.h"
#define DEBUG_LVL SET_LEVEL_1
DEBUG_ONLY
(
static
firm_dbg_module_t
*
dbg
=
NULL
;)
...
...
ir/be/beifg.c
View file @
c65b13d9
...
...
@@ -6,13 +6,12 @@
* Copyright (C) 2005 Universitaet Karlsruhe
* Released under the GPL
*/
#include
<stdlib.h>
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#include
<stdlib.h>
#ifdef HAVE_MALLOC_H
#include
<malloc.h>
#endif
...
...
@@ -46,6 +45,7 @@
#include
"becopystat.h"
#include
"becopyopt.h"
#include
"beirg_t.h"
/** Defines values for the ifg performance test */
#define BE_CH_PERFORMANCETEST_MIN_NODES (50)
...
...
ir/be/beirg.c
0 → 100644
View file @
c65b13d9
/*
* Author: Matthias Braun
* Date: 13.12.2006
* Copyright: (c) Universitaet Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include
"config.h"
#endif
#include
"execfreq.h"
#include
"beirg_t.h"
void
be_assure_liveness
(
be_irg_t
*
birg
)
{
if
(
birg
->
lv
!=
NULL
)
return
;
birg
->
lv
=
be_liveness
(
birg
->
irg
);
}
void
be_invalidate_liveness
(
be_irg_t
*
birg
)
{
if
(
birg
->
lv
==
NULL
)
return
;
be_liveness_free
(
birg
->
lv
);
birg
->
lv
=
NULL
;
}
void
be_assure_dom_front
(
be_irg_t
*
birg
)
{
if
(
birg
->
dom_front
!=
NULL
)
return
;
birg
->
dom_front
=
be_compute_dominance_frontiers
(
birg
->
irg
);
}
void
be_invalidate_dom_front
(
be_irg_t
*
birg
)
{
if
(
birg
->
dom_front
==
NULL
)
return
;
be_free_dominance_frontiers
(
birg
->
dom_front
);
birg
->
dom_front
=
NULL
;
}
void
be_free_birg
(
be_irg_t
*
birg
)
{
free_execfreq
(
birg
->
exec_freq
);
birg
->
exec_freq
=
NULL
;
if
(
birg
->
dom_front
!=
NULL
)
{
be_free_dominance_frontiers
(
birg
->
dom_front
);
birg
->
dom_front
=
NULL
;
}
if
(
birg
->
lv
!=
NULL
)
{
be_liveness_free
(
birg
->
lv
);
birg
->
lv
=
NULL
;
}
}
ir/be/beirg.h
0 → 100644
View file @
c65b13d9
/**
* Author: Matthias Braun
* Date: 05.05.2006
* Copyright: (c) Universitaet Karlsruhe
* License: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
*
* Backend irg - a ir_graph with additional analysis information
*/
#ifndef BEIRG_H_
#define BEIRG_H_
#include
"belive.h"
#include
"beirgmod.h"
typedef
struct
_be_irg_t
be_irg_t
;
ir_graph
*
be_get_ir_graph
(
be_irg_t
*
birg
);
void
be_assure_liveness
(
be_irg_t
*
birg
);
void
be_invalidate_liveness
(
be_irg_t
*
birg
);
be_lv_t
*
be_get_birg_liveness
(
be_irg_t
*
birg
);
void
be_assure_dom_front
(
be_irg_t
*
birg
);
void
be_invalidate_dom_front
(
be_irg_t
*
birg
);
be_dom_front_info_t
*
be_get_birg_dom_front
(
be_irg_t
*
birg
);
ir_exec_freq
*
be_get_birg_exec_freq
(
be_irg_t
*
birg
);
/**
* frees all memory allocated by birg structures (liveness, dom_front, ...).
* The memory of the birg structure itself is not freed.
*/
void
be_free_birg
(
be_irg_t
*
birg
);
#endif
ir/be/beirg_t.h
0 → 100644
View file @
c65b13d9
/**
* Author: Matthias Braun
* Date: 05.05.2006
* Copyright: (c) Universitaet Karlsruhe
* License: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
*
* Backend irg - a ir_graph with additional analysis information
*/
#ifndef BEIRG_T_H_
#define BEIRG_T_H_
#include
"beirg.h"
/**
* An ir_graph with additional analysis data about this irg. Also includes some
* backend structures
*/
struct
_be_irg_t
{
ir_graph
*
irg
;
struct
_be_main_env_t
*
main_env
;
struct
_be_abi_irg_t
*
abi
;
struct
_arch_code_generator_t
*
cg
;
ir_exec_freq
*
exec_freq
;
be_dom_front_info_t
*
dom_front
;
be_lv_t
*
lv
;
};
static
INLINE
be_lv_t
*
_be_get_birg_liveness
(
const
be_irg_t
*
birg
)
{
return
birg
->
lv
;
}
static
INLINE
ir_exec_freq
*
_be_get_birg_exec_freq
(
const
be_irg_t
*
birg
)
{
return
birg
->
exec_freq
;
}
static
INLINE
be_dom_front_info_t
*
_be_get_birg_dom_front
(
const
be_irg_t
*
birg
)
{
return
birg
->
dom_front
;
}
static
INLINE
ir_graph
*
_be_get_birg_irg
(
const
be_irg_t
*
birg
)
{
return
birg
->
irg
;
}
#define be_get_birg_exec_freq(birg) _be_get_birg_exec_freq(birg)
#define be_get_birg_liveness(birg) _be_get_birg_liveness(birg)
#define be_get_birg_dom_front(birg) _be_get_birg_dom_front(birg)
#define be_get_birg_irg(birg) _be_get_birg_irg(birg)
#endif
ir/be/belive_t.h
View file @
c65b13d9
...
...
@@ -80,7 +80,7 @@ static INLINE int _be_is_live_xxx(const struct _be_lv_t *li, const ir_node *bloc
for(i = _be_lv_next_irn(lv, bl, flags, 0); i >= 0; i = _be_lv_next_irn(lv, bl, flags, i + 1))
static
INLINE
pset
*
_be_lv_pset_put
(
struct
_be_lv_t
*
lv
,
const
ir_node
*
block
,
int
state
,
pset
*
s
)
static
INLINE
pset
*
_be_lv_pset_put
(
const
struct
_be_lv_t
*
lv
,
const
ir_node
*
block
,
int
state
,
pset
*
s
)
{
int
i
;
be_lv_foreach
(
lv
,
block
,
state
,
i
)
...
...
ir/be/bemain.c
View file @
c65b13d9
...
...
@@ -773,17 +773,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
#undef LC_EMIT_RA
#undef LC_EMIT
free_execfreq
(
birg
->
exec_freq
);
birg
->
exec_freq
=
NULL
;
if
(
birg
->
dom_front
!=
NULL
)
{
be_free_dominance_frontiers
(
birg
->
dom_front
);
birg
->
dom_front
=
NULL
;
}
if
(
birg
->
lv
!=
NULL
)
{
be_liveness_free
(
birg
->
lv
);
birg
->
lv
=
NULL
;
}
be_free_birg
(
birg
);
/* switched off due to statistics (statistic module needs all irgs) */
#ifdef FIRM_STATISTICS
...
...
@@ -889,37 +879,3 @@ int be_put_ignore_regs(const be_irg_t *birg, const arch_register_class_t *cls, b
return
bitset_popcnt
(
bs
);
}
void
be_assure_liveness
(
be_irg_t
*
birg
)
{
if
(
birg
->
lv
!=
NULL
)
return
;
birg
->
lv
=
be_liveness
(
birg
->
irg
);
}
void
be_invalidate_liveness
(
be_irg_t
*
birg
)
{
if
(
birg
->
lv
==
NULL
)
return
;
be_liveness_free
(
birg
->
lv
);
birg
->
lv
=
NULL
;
}
void
be_assure_dom_front
(
be_irg_t
*
birg
)
{
if
(
birg
->
dom_front
!=
NULL
)
return
;
birg
->
dom_front
=
be_compute_dominance_frontiers
(
birg
->
irg
);
}
void
be_invalidate_dom_front
(
be_irg_t
*
birg
)
{
if
(
birg
->
dom_front
==
NULL
)
return
;
be_free_dominance_frontiers
(
birg
->
dom_front
);
birg
->
dom_front
=
NULL
;
}
ir/be/ia32/bearch_ia32.c
View file @
c65b13d9
...
...
@@ -1287,14 +1287,16 @@ static void ia32_finish(void *self) {
ia32_code_gen_t
*
cg
=
self
;
ir_graph
*
irg
=
cg
->
irg
;
//be_remove_empty_blocks(irg);
cg
->
blk_sched
=
be_create_block_schedule
(
irg
,
cg
->
birg
->
exec_freq
);
/* if we do x87 code generation, rewrite all the virtual instructions and registers */
if
(
cg
->
used_fp
==
fp_x87
||
cg
->
force_sim
)
{
x87_simulate_graph
(
cg
->
arch_env
,
irg
,
cg
->
blk_sched
);
x87_simulate_graph
(
cg
->
arch_env
,
cg
->
birg
);
}
/* create block schedule, this also removes empty blocks which might
* produce critical edges */
cg
->
blk_sched
=
be_create_block_schedule
(
irg
,
cg
->
birg
->
exec_freq
);
/* do peephole optimisations */
ia32_peephole_optimization
(
irg
,
cg
);
}
...
...
@@ -1318,7 +1320,7 @@ static void ia32_codegen(void *self) {
free
(
cg
);
}
static
void
*
ia32_cg_init
(
const
be_irg_t
*
birg
);
static
void
*
ia32_cg_init
(
be_irg_t
*
birg
);
static
const
arch_code_generator_if_t
ia32_code_gen_if
=
{
ia32_cg_init
,
...
...
@@ -1335,7 +1337,7 @@ static const arch_code_generator_if_t ia32_code_gen_if = {
/**
* Initializes a IA32 code generator.
*/
static
void
*
ia32_cg_init
(
const
be_irg_t
*
birg
)
{
static
void
*
ia32_cg_init
(
be_irg_t
*
birg
)
{
ia32_isa_t
*
isa
=
(
ia32_isa_t
*
)
birg
->
main_env
->
arch_env
->
isa
;
ia32_code_gen_t
*
cg
=
xcalloc
(
1
,
sizeof
(
*
cg
));
...
...
ir/be/ia32/bearch_ia32_t.h
View file @
c65b13d9
...
...
@@ -96,7 +96,7 @@ typedef struct _ia32_code_gen_t {
const
arch_env_t
*
arch_env
;
/**< the arch env */
set
*
reg_set
;
/**< set to memorize registers for non-ia32 nodes (e.g. phi nodes) */
ia32_isa_t
*
isa
;
/**< for fast access to the isa object */
const
be_irg_t
*
birg
;
/**< The be-irg (contains additional information about the irg) */
be_irg_t
*
birg
;
/**< The be-irg (contains additional information about the irg) */
ir_node
**
blk_sched
;
/**< an array containing the scheduled blocks */
ia32_optimize_t
opt
;
/**< contains optimization information */
ir_entity
*
fp_to_gp
;
/**< allocated entity for fp to gp conversion */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment