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
c27a52c7
Commit
c27a52c7
authored
Feb 03, 2010
by
Matthias Braun
Browse files
fix some assertions; correctly handle weak symbols
[r27031]
parent
2bc2dd4b
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/libfirm/firm_types.h
View file @
c27a52c7
...
...
@@ -133,16 +133,14 @@ typedef enum {
GCC: __attribute__((naked)). */
mtp_property_malloc
=
0x00000020
,
/**< This method returns newly allocate memory.
GCC: __attribute__((malloc)). */
mtp_property_weak
=
0x00000040
,
/**< This method is weak. It is expected that
GCC: __attribute__((weak)). */
mtp_property_returns_twice
=
0x00000080
,
/**< This method can return more than one (typically setjmp).
mtp_property_returns_twice
=
0x00000040
,
/**< This method can return more than one (typically setjmp).
GCC: __attribute__((returns_twice)). */
mtp_property_intrinsic
=
0x00000
1
00
,
/**< This method is intrinsic. It is expected that
mtp_property_intrinsic
=
0x000000
8
0
,
/**< This method is intrinsic. It is expected that
a lowering phase will remove all calls to it. */
mtp_property_runtime
=
0x00000
2
00
,
/**< This method represents a runtime routine. */
mtp_property_private
=
0x00000
4
00
,
/**< All method invocations are known, the backend is free to
mtp_property_runtime
=
0x00000
1
00
,
/**< This method represents a runtime routine. */
mtp_property_private
=
0x00000
2
00
,
/**< All method invocations are known, the backend is free to
optimize the call in any possible way. */
mtp_property_has_loop
=
0x00000
8
00
,
/**< Set, if this method contains one possible endless loop. */
mtp_property_has_loop
=
0x00000
4
00
,
/**< Set, if this method contains one possible endless loop. */
mtp_property_inherited
=
(
1
<<
31
)
/**< Internal. Used only in irg's, means property is
inherited from type. */
}
mtp_additional_property
;
...
...
ir/ir/irdumptxt.c
View file @
c27a52c7
...
...
@@ -715,7 +715,6 @@ void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix, unsigned
if
(
mask
&
mtp_property_nothrow
)
fputs
(
"nothrow_function, "
,
F
);
if
(
mask
&
mtp_property_naked
)
fputs
(
"naked_function, "
,
F
);
if
(
mask
&
mtp_property_malloc
)
fputs
(
"malloc_function, "
,
F
);
if
(
mask
&
mtp_property_weak
)
fputs
(
"weak_function, "
,
F
);
if
(
mask
&
mtp_property_returns_twice
)
fputs
(
"weak_function, "
,
F
);
if
(
mask
&
mtp_property_intrinsic
)
fputs
(
"intrinsic_function, "
,
F
);
if
(
mask
&
mtp_property_runtime
)
fputs
(
"runtime_function, "
,
F
);
...
...
ir/opt/opt_inline.c
View file @
c27a52c7
...
...
@@ -1285,12 +1285,17 @@ typedef struct _inline_env_t {
*
* @param call the call node
*/
static
ir_graph
*
get_call_called_irg
(
ir_node
*
call
)
{
static
ir_graph
*
get_call_called_irg
(
ir_node
*
call
)
{
ir_node
*
addr
;
addr
=
get_Call_ptr
(
call
);
if
(
is_Global
(
addr
))
{
ir_entity
*
ent
=
get_Global_entity
(
addr
);
/* we don't know which function gets finally bound to a weak symbol */
if
(
get_entity_linkage
(
ent
)
&
IR_LINKAGE_WEAK
)
return
NULL
;
return
get_entity_irg
(
ent
);
}
...
...
@@ -1357,8 +1362,7 @@ void inline_small_irgs(ir_graph *irg, int size) {
ir_graph
*
callee
=
entry
->
callee
;
irg_inline_property
prop
=
get_irg_inline_property
(
callee
);
if
(
prop
==
irg_inline_forbidden
||
get_irg_additional_properties
(
callee
)
&
mtp_property_weak
)
{
/* do not inline forbidden / weak graphs */
if
(
prop
==
irg_inline_forbidden
)
{
continue
;
}
...
...
@@ -1636,8 +1640,7 @@ void inline_leave_functions(unsigned maxsize, unsigned leavesize,
callee
=
entry
->
callee
;
prop
=
get_irg_inline_property
(
callee
);
if
(
prop
==
irg_inline_forbidden
||
get_irg_additional_properties
(
callee
)
&
mtp_property_weak
)
{
/* do not inline forbidden / weak graphs */
if
(
prop
==
irg_inline_forbidden
)
{
continue
;
}
...
...
@@ -1691,8 +1694,7 @@ void inline_leave_functions(unsigned maxsize, unsigned leavesize,
callee
=
entry
->
callee
;
prop
=
get_irg_inline_property
(
callee
);
if
(
prop
==
irg_inline_forbidden
||
get_irg_additional_properties
(
callee
)
&
mtp_property_weak
)
{
/* do not inline forbidden / weak graphs */
if
(
prop
==
irg_inline_forbidden
)
{
continue
;
}
...
...
@@ -1995,7 +1997,7 @@ static int calc_inline_benefice(call_entry *entry, ir_graph *callee)
return
entry
->
benefice
=
INT_MIN
;
}
if
(
get_irg_additional_properties
(
callee
)
&
(
mtp_property_noreturn
|
mtp_property_weak
)
)
{
if
(
get_irg_additional_properties
(
callee
)
&
mtp_property_noreturn
)
{
DB
((
dbg
,
LEVEL_2
,
"In %+F Call to %+F: not inlining noreturn or weak
\n
"
,
call
,
callee
));
return
entry
->
benefice
=
INT_MIN
;
...
...
ir/opt/proc_cloning.c
View file @
c27a52c7
...
...
@@ -187,12 +187,12 @@ static void collect_irg_calls(ir_node *call, void *env) {
callee
=
get_Global_entity
(
call_ptr
);
/* we
can only clone calls to existing entities
*/
if
(
get_entity_
irg
(
callee
)
==
NULL
)
/* we
don't know which function gets finally bound to a weak symbol
*/
if
(
get_entity_
linkage
(
callee
)
&
IR_LINKAGE_WEAK
)
return
;
/* we can
not
clone calls to
weak function
s */
if
(
get_entity_
additional_properties
(
callee
)
&
mtp_property_weak
)
/* we can
only
clone calls to
existing entitie
s */
if
(
get_entity_
irg
(
callee
)
==
NULL
)
return
;
process_call
(
call
,
callee
,
hmap
);
...
...
ir/tr/entity.c
View file @
c27a52c7
...
...
@@ -440,7 +440,10 @@ static void verify_linkage(ir_entity *entity)
/* local and extern are mutually exclusive */
(
void
)
linkage
;
assert
(
!
((
linkage
&
IR_LINKAGE_EXTERN
)
&&
(
linkage
&
IR_LINKAGE_LOCAL
)));
assert
(
!
(
linkage
&
IR_LINKAGE_EXTERN
)
||
!
entity_has_definition
(
entity
));
if
(
!
is_method_entity
(
entity
)
&&
(
linkage
&
IR_LINKAGE_EXTERN
))
{
assert
(
!
entity_has_definition
(
entity
));
}
assert
(
!
((
linkage
&
IR_LINKAGE_CONSTANT
)
&&
(
linkage
&
IR_LINKAGE_WEAK
)));
}
void
set_entity_linkage
(
ir_entity
*
entity
,
ir_linkage
linkage
)
...
...
ir/tr/type.c
View file @
c27a52c7
...
...
@@ -365,7 +365,6 @@ void set_type_state(ir_type *tp, ir_type_state state)
case
tpo_struct
:
for
(
i
=
0
;
i
<
get_struct_n_members
(
tp
);
i
++
)
{
assert
(
get_entity_offset
(
get_struct_member
(
tp
,
i
))
>
-
1
);
assert
((
get_entity_allocation
(
get_struct_member
(
tp
,
i
))
==
allocation_automatic
));
}
break
;
case
tpo_union
:
...
...
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