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
e11232be
Commit
e11232be
authored
Mar 10, 2005
by
Götz Lindenmaier
Browse files
bugfix
[r5339]
parent
ed5876ae
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
ir/ana/cgana.c
View file @
e11232be
This diff is collapsed.
Click to expand it.
ir/ana/cgana.h
View file @
e11232be
...
...
@@ -34,20 +34,22 @@
*
* Die main-Methode ist immer in der Menge enthalten.
*
* Die Links an den "ir_node"s werden geloescht. */
* Die Links an den "ir_node"s werden geloescht.
*/
/** Analyses a rough estimation of the possible call graph.
*
* Determines for each Call node the set of possibly called methods.
* Stores the result in the field 'callees' of the Call node. If the
* address can not be analysed, e.g. because it is loaded from a
* variable, the array contains
NULL. @@@ the array should contain a
*
special entity 'unknown'. (See
"set_Call_callee"). cgana returns
* the
set of 'free' methods, i.e., the methods that can be called
*
from external or via function
pointers. This datastructure must
*
be freed with 'free()' by the
caller of cgana.
* variable, the array contains
the unknown_entity. (See
* "set_Call_callee"). cgana returns
the set of 'free' methods, i.e.,
* the
methods that can be called from external or via function
* pointers. This datastructure must
be freed with 'free()' by the
* caller of cgana.
*
* cgana sets the callee_info_state of each graph to consistent.
* cgana sets the callee_info_state of each graph and the program to
* consistent.
*
* The algorithm implements roughly Static Class Hierarchy Analysis
* as described in "Optimization of Object-Oriented Programs Using
...
...
@@ -58,7 +60,7 @@
* - Replace SymConst-name nodes by SymConst-entity nodes if possible.
* - Replace (Sel-method(Alloc)) by SymConst-entity.
* - Replaces Sel nodes by Bad if there is no implementation for the
* selected entity.
(@@@ was genau meint unreachable?)
* selected entity.
* - Replaces Sel-method by SymConst-entity if the method is never overwritten.
* - Replaces Calls by Tuple containing Bads if callee array is empty
* (there is no implementation to call)
...
...
ir/opt/ldstopt.c
View file @
e11232be
...
...
@@ -307,11 +307,14 @@ static long get_Sel_array_index_long(ir_node *n, int dim) {
return
get_tarval_long
(
get_Const_tarval
(
index
));
}
compound_graph_path
*
rec_get_accessed_path
(
ir_node
*
ptr
,
int
depth
)
{
static
compound_graph_path
*
rec_get_accessed_path
(
ir_node
*
ptr
,
int
depth
)
{
compound_graph_path
*
res
;
if
(
get_irn_op
(
ptr
)
==
op_SymConst
)
{
assert
(
get_SymConst_kind
(
ptr
)
==
symconst_addr_ent
);
entity
*
root
=
get_SymConst_entity
(
ptr
);
if
(
depth
==
0
)
res
=
NULL
;
else
res
=
new_compound_graph_path
(
get_entity_type
(
root
),
depth
);
}
else
{
assert
(
get_irn_op
(
ptr
)
==
op_Sel
);
...
...
@@ -328,7 +331,10 @@ compound_graph_path *rec_get_accessed_path(ir_node *ptr, int depth) {
return
res
;
}
compound_graph_path
*
get_accessed_path
(
ir_node
*
ptr
)
{
/** Returns an access path or NULL. The access path is only
* valid, if the graph is in phase_high and _no_ address computation is used. */
static
compound_graph_path
*
get_accessed_path
(
ir_node
*
ptr
)
{
return
rec_get_accessed_path
(
ptr
,
0
);
}
...
...
@@ -463,6 +469,7 @@ static int optimize_load(ir_node *load)
printf
(
" ptr: "
);
DDMN
(
ptr
);
compound_graph_path
*
path
=
get_accessed_path
(
ptr
);
if
(
path
)
{
assert
(
is_proper_compound_graph_path
(
path
,
get_compound_graph_path_length
(
path
)
-
1
));
ir_node
*
c
=
get_compound_ent_value_by_path
(
ent
,
path
);
...
...
@@ -483,7 +490,9 @@ static int optimize_load(ir_node *load)
}
printf
(
"
\n
"
);
}
}
else
{
printf
(
"cannot optimize.
\n
"
);
}
}
/* we changed the irg, but try further */
...
...
Write
Preview
Markdown
is supported
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