Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
9538a69d
Commit
9538a69d
authored
Jul 07, 2014
by
Matthias Braun
Browse files
new copy/value statistics
parent
b071cda4
Changes
4
Hide whitespace changes
Inline
Side-by-side
ir/be/bemain.c
View file @
9538a69d
...
...
@@ -617,6 +617,10 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
be_timer_pop
(
T_RA_CONSTR
);
be_dump
(
DUMP_RA
,
irg
,
"spillprepare"
);
if
(
stat_ev_enabled
)
{
be_stat_values
(
irg
);
}
/* Do register allocation */
be_allocate_registers
(
irg
);
...
...
ir/be/bera.c
View file @
9538a69d
...
...
@@ -28,7 +28,7 @@
#include
"besched.h"
#include
"beutil.h"
DEBUG_ONLY
(
static
firm_dbg_module_t
*
dbg
)
;
DEBUG_ONLY
(
static
firm_dbg_module_t
*
dbg
;
)
static
be_irg_t
*
birg
;
static
be_lv_t
*
lv
;
...
...
ir/be/bestat.c
View file @
9538a69d
...
...
@@ -209,3 +209,65 @@ unsigned long be_count_blocks(ir_graph *irg)
irg_block_walk_graph
(
irg
,
block_count_walker
,
NULL
,
&
cnt
);
return
cnt
;
}
typedef
struct
stat_t
{
unsigned
long
values
;
unsigned
long
unused_values
;
unsigned
long
uses
;
unsigned
long
should_be_sames
;
unsigned
long
constrained_values
;
unsigned
long
constrained_uses
;
unsigned
long
unused_constrained_values
;
}
stat_t
;
static
void
block_count_values
(
ir_node
*
block
,
void
*
data
)
{
stat_t
*
stats
=
(
stat_t
*
)
data
;
sched_foreach
(
block
,
node
)
{
be_foreach_value
(
node
,
value
,
arch_register_req_t
const
*
const
req
=
arch_get_irn_register_req
(
value
);
if
(
req
->
cls
==
NULL
)
continue
;
++
stats
->
values
;
if
(
arch_register_req_is
(
req
,
should_be_same
)
||
is_Phi
(
value
))
++
stats
->
should_be_sames
;
if
(
arch_register_req_is
(
req
,
limited
))
++
stats
->
constrained_values
;
);
for
(
int
i
=
0
,
arity
=
get_irn_arity
(
node
);
i
<
arity
;
++
i
)
{
const
arch_register_req_t
*
req
=
arch_get_irn_register_req_in
(
node
,
i
);
if
(
req
->
cls
==
NULL
)
continue
;
++
stats
->
uses
;
if
(
be_is_Keep
(
node
))
{
ir_node
*
value
=
get_irn_n
(
node
,
i
);
if
(
get_irn_n_edges
(
value
)
<=
1
)
{
++
stats
->
unused_values
;
const
arch_register_req_t
*
const
req
=
arch_get_irn_register_req
(
value
);
if
(
arch_register_req_is
(
req
,
limited
))
++
stats
->
unused_constrained_values
;
}
}
if
(
arch_register_req_is
(
req
,
limited
))
++
stats
->
constrained_uses
;
}
}
}
void
be_stat_values
(
ir_graph
*
irg
)
{
stat_t
stats
;
memset
(
&
stats
,
0
,
sizeof
(
stats
));
irg_block_walk_graph
(
irg
,
block_count_values
,
NULL
,
&
stats
);
stat_ev_ull
(
"valstat_values"
,
stats
.
values
);
stat_ev_ull
(
"valstat_unused"
,
stats
.
unused_values
);
stat_ev_ull
(
"valstat_uses"
,
stats
.
uses
);
stat_ev_ull
(
"valstat_should_be_sames"
,
stats
.
should_be_sames
);
stat_ev_ull
(
"valstat_constrained_values"
,
stats
.
constrained_values
);
stat_ev_ull
(
"valstat_constrained_uses"
,
stats
.
constrained_uses
);
stat_ev_ull
(
"valstat_unused_constrained_values"
,
stats
.
unused_constrained_values
);
}
ir/be/bestat.h
View file @
9538a69d
...
...
@@ -59,5 +59,9 @@ unsigned long be_count_insns(ir_graph *irg);
*/
unsigned
long
be_count_blocks
(
ir_graph
*
irg
);
/**
* Count values
*/
void
be_stat_values
(
ir_graph
*
irg
);
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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