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
bbc6291b
Commit
bbc6291b
authored
Apr 05, 2008
by
Michael Beck
Browse files
switch scalar replacement to new style debug output
[r19145]
parent
06e99bb8
Changes
3
Hide whitespace changes
Inline
Side-by-side
ir/common/firm.c
View file @
bbc6291b
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
#include
"type_t.h"
#include
"type_t.h"
#include
"entity_t.h"
#include
"entity_t.h"
#include
"opt_inline_t.h"
#include
"opt_inline_t.h"
#include
"scalar_replace.h"
#include
"firmstat.h"
#include
"firmstat.h"
#include
"irarch.h"
#include
"irarch.h"
#include
"reassoc_t.h"
#include
"reassoc_t.h"
...
@@ -129,6 +130,8 @@ void init_firm(const firm_parameter_t *param)
...
@@ -129,6 +130,8 @@ void init_firm(const firm_parameter_t *param)
firm_init_funccalls
();
firm_init_funccalls
();
/* initialize function inlining */
/* initialize function inlining */
firm_init_inline
();
firm_init_inline
();
/* initialize scalar replacement */
firm_init_scalar_replace
();
/* Builds a construct allowing to access all information to be constructed
/* Builds a construct allowing to access all information to be constructed
later. */
later. */
init_irprog_2
();
init_irprog_2
();
...
...
ir/opt/scalar_replace.c
View file @
bbc6291b
...
@@ -44,6 +44,8 @@
...
@@ -44,6 +44,8 @@
#include
"irnode_t.h"
#include
"irnode_t.h"
#include
"irtools.h"
#include
"irtools.h"
#include
"xmalloc.h"
#include
"xmalloc.h"
#include
"debug.h"
#include
"error.h"
#define SET_VNUM(node, vnum) set_irn_link(node, INT_TO_PTR(vnum))
#define SET_VNUM(node, vnum) set_irn_link(node, INT_TO_PTR(vnum))
#define GET_VNUM(node) (unsigned)PTR_TO_INT(get_irn_link(node))
#define GET_VNUM(node) (unsigned)PTR_TO_INT(get_irn_link(node))
...
@@ -76,6 +78,7 @@ typedef struct _scalars_t {
...
@@ -76,6 +78,7 @@ typedef struct _scalars_t {
ir_type
*
ent_owner
;
/**< The owner of this entity. */
ir_type
*
ent_owner
;
/**< The owner of this entity. */
}
scalars_t
;
}
scalars_t
;
DEBUG_ONLY
(
static
firm_dbg_module_t
*
dbg
;)
/**
/**
* Compare two pathes.
* Compare two pathes.
...
@@ -442,16 +445,16 @@ static unsigned allocate_value_numbers(pset *sels, ir_entity *ent, unsigned vnum
...
@@ -442,16 +445,16 @@ static unsigned allocate_value_numbers(pset *sels, ir_entity *ent, unsigned vnum
#ifdef DEBUG_libfirm
#ifdef DEBUG_libfirm
/* Debug output */
/* Debug output */
if
(
get_opt_scalar_replacement_verbose
()
&&
get_firm_verbosity
()
>
1
)
{
{
unsigned
i
;
unsigned
i
;
printf
(
" %s"
,
get_entity_name
(
key
->
path
[
0
].
ent
));
DB
((
dbg
,
SET_LEVEL_2
,
" %s"
,
get_entity_name
(
key
->
path
[
0
].
ent
))
)
;
for
(
i
=
1
;
i
<
key
->
path_len
;
++
i
)
{
for
(
i
=
1
;
i
<
key
->
path_len
;
++
i
)
{
if
(
is_entity
(
key
->
path
[
i
].
ent
))
if
(
is_entity
(
key
->
path
[
i
].
ent
))
printf
(
".%s"
,
get_entity_name
(
key
->
path
[
i
].
ent
));
DB
((
dbg
,
SET_LEVEL_2
,
".%s"
,
get_entity_name
(
key
->
path
[
i
].
ent
))
)
;
else
else
printf
(
"[%ld]"
,
get_tarval_long
(
key
->
path
[
i
].
tv
));
DB
((
dbg
,
SET_LEVEL_2
,
"[%ld]"
,
get_tarval_long
(
key
->
path
[
i
].
tv
))
)
;
}
}
printf
(
" = %u (%s)
\n
"
,
PTR_TO_INT
(
get_irn_link
(
sel
)),
get_mode_name
((
*
modes
)[
key
->
vnum
]));
DB
((
dbg
,
SET_LEVEL_2
,
" = %u (%s)
\n
"
,
PTR_TO_INT
(
get_irn_link
(
sel
)),
get_mode_name
((
*
modes
)[
key
->
vnum
]))
)
;
}
}
#endif
/* DEBUG_libfirm */
#endif
/* DEBUG_libfirm */
}
}
...
@@ -770,10 +773,7 @@ void scalar_replacement_opt(ir_graph *irg) {
...
@@ -770,10 +773,7 @@ void scalar_replacement_opt(ir_graph *irg) {
/* Find possible scalar replacements */
/* Find possible scalar replacements */
if
(
find_possible_replacements
(
irg
))
{
if
(
find_possible_replacements
(
irg
))
{
DB
((
dbg
,
SET_LEVEL_1
,
"Scalar Replacement: %s
\n
"
,
get_entity_name
(
get_irg_entity
(
irg
))));
if
(
get_opt_scalar_replacement_verbose
())
{
printf
(
"Scalar Replacement: %s
\n
"
,
get_entity_name
(
get_irg_entity
(
irg
)));
}
/* Insert in set the scalar replacements. */
/* Insert in set the scalar replacements. */
irg_frame
=
get_irg_frame
(
irg
);
irg_frame
=
get_irg_frame
(
irg
);
...
@@ -797,42 +797,32 @@ void scalar_replacement_opt(ir_graph *irg) {
...
@@ -797,42 +797,32 @@ void scalar_replacement_opt(ir_graph *irg) {
key
.
ent_owner
=
get_entity_owner
(
ent
);
key
.
ent_owner
=
get_entity_owner
(
ent
);
set_insert
(
set_ent
,
&
key
,
sizeof
(
key
),
HASH_PTR
(
key
.
ent
));
set_insert
(
set_ent
,
&
key
,
sizeof
(
key
),
HASH_PTR
(
key
.
ent
));
if
(
get_opt_scalar_replacement_verbose
())
{
#ifdef DEBUG_libfirm
if
(
is_Array_type
(
ent_type
))
{
if
(
is_Array_type
(
ent_type
))
{
printf
(
" found array %s
\n
"
,
get_entity_name
(
ent
));
DB
((
dbg
,
SET_LEVEL_1
,
" found array %s
\n
"
,
get_entity_name
(
ent
)));
}
}
else
if
(
is_Struct_type
(
ent_type
))
{
else
if
(
is_Struct_type
(
ent_type
))
{
DB
((
dbg
,
SET_LEVEL_1
,
" found struct %s
\n
"
,
get_entity_name
(
ent
)));
printf
(
" found struct %s
\n
"
,
get_entity_name
(
ent
));
}
else
if
(
is_atomic_type
(
ent_type
))
}
DB
((
dbg
,
SET_LEVEL_1
,
" found atomic value %s
\n
"
,
get_entity_name
(
ent
)));
else
if
(
is_atomic_type
(
ent_type
))
else
{
printf
(
" found atomic value %s
\n
"
,
get_entity_name
(
ent
));
panic
(
"Neither an array nor a struct or atomic value found in scalar replace"
);
else
{
assert
(
0
&&
"Neither an array nor a struct or atomic value"
);
}
}
}
#endif
/* DEBUG_libfirm */
nvals
=
allocate_value_numbers
(
sels
,
ent
,
nvals
,
&
modes
);
nvals
=
allocate_value_numbers
(
sels
,
ent
,
nvals
,
&
modes
);
}
}
}
}
if
(
get_opt_scalar_replacement_verbose
())
{
DB
((
dbg
,
SET_LEVEL_1
,
" %u values will be needed
\n
"
,
nvals
));
printf
(
" %u values will be needed
\n
"
,
nvals
);
}
/* If scalars were found. */
/* If scalars were found. */
if
(
nvals
)
{
if
(
nvals
>
0
)
{
do_scalar_replacements
(
sels
,
nvals
,
modes
);
do_scalar_replacements
(
sels
,
nvals
,
modes
);
for
(
value
=
set_firs
t
(
set_ent
);
value
;
value
=
set_next
(
set_ent
)
)
{
for
each_se
t
(
set_ent
,
value
)
{
remove_class_member
(
value
->
ent_owner
,
value
->
ent
);
remove_class_member
(
value
->
ent_owner
,
value
->
ent
);
}
}
}
del_pset
(
sels
);
del_set
(
set_ent
);
DEL_ARR_F
(
modes
);
if
(
nvals
)
{
/*
/*
* We changed the graph, but did NOT introduce new blocks
* We changed the graph, but did NOT introduce new blocks
* neither changed control flow, cf-backedges should be still
* neither changed control flow, cf-backedges should be still
...
@@ -841,7 +831,15 @@ void scalar_replacement_opt(ir_graph *irg) {
...
@@ -841,7 +831,15 @@ void scalar_replacement_opt(ir_graph *irg) {
set_irg_outs_inconsistent
(
irg
);
set_irg_outs_inconsistent
(
irg
);
set_irg_loopinfo_inconsistent
(
irg
);
set_irg_loopinfo_inconsistent
(
irg
);
}
}
del_pset
(
sels
);
del_set
(
set_ent
);
DEL_ARR_F
(
modes
);
}
}
current_ir_graph
=
rem
;
current_ir_graph
=
rem
;
}
}
void
firm_init_scalar_replace
(
void
)
{
FIRM_DBG_REGISTER
(
dbg
,
"firm.opt.scalar_replace"
);
}
ir/opt/scalar_replace.h
View file @
bbc6291b
...
@@ -36,4 +36,6 @@
...
@@ -36,4 +36,6 @@
*/
*/
int
is_address_taken
(
ir_node
*
sel
);
int
is_address_taken
(
ir_node
*
sel
);
void
firm_init_scalar_replace
(
void
);
#endif
/* FIRM_OPT_SCALAR_REPLACE_H */
#endif
/* FIRM_OPT_SCALAR_REPLACE_H */
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