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
96cf55be
Commit
96cf55be
authored
Sep 06, 2011
by
Matthias Braun
Browse files
functions with compound parameters are never const in firm
This should fix fehler200.c
parent
06bb2260
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/opt/funccall.c
View file @
96cf55be
...
...
@@ -508,8 +508,23 @@ static mtp_additional_properties check_const_or_pure_function(ir_graph *irg, int
{
ir_node
*
end
,
*
endbl
;
int
j
;
ir_entity
*
entity
=
get_irg_entity
(
irg
);
ir_type
*
type
=
get_entity_type
(
entity
);
size_t
n_params
=
get_method_n_params
(
type
);
size_t
i
;
mtp_additional_properties
may_be_const
=
mtp_property_const
;
mtp_additional_properties
prop
=
get_irg_additional_properties
(
irg
);
/* libfirm handles aggregate parameters by passing around pointers to
* stuff in memory, so if we have compound parameters we are never const */
for
(
i
=
0
;
i
<
n_params
;
++
i
)
{
ir_type
*
param
=
get_method_param_type
(
type
,
i
);
if
(
is_compound_type
(
param
))
{
prop
&=
~
mtp_property_const
;
may_be_const
=
mtp_no_property
;
}
}
if
(
prop
&
mtp_property_const
)
{
/* already marked as a const function */
return
mtp_property_const
;
...
...
@@ -533,7 +548,7 @@ static mtp_additional_properties check_const_or_pure_function(ir_graph *irg, int
end
=
get_irg_end
(
irg
);
endbl
=
get_nodes_block
(
end
);
prop
=
m
tp_property
_const
;
prop
=
m
ay_be
_const
;
ir_reserve_resources
(
irg
,
IR_RESOURCE_IRN_VISITED
);
inc_irg_visited
(
irg
);
...
...
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