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
36332e71
Commit
36332e71
authored
Apr 02, 2008
by
Michael Beck
Browse files
used new is_Global() and get_Global_entity() instead of SymConst calls
[r19066]
parent
030f541e
Changes
12
Hide whitespace changes
Inline
Side-by-side
include/libfirm/irnode.h
View file @
36332e71
...
...
@@ -1417,7 +1417,7 @@ void set_Cond_jmp_pred(ir_node *cond, cond_jmp_predicate pred);
int
is_Global
(
const
ir_node
*
node
);
/* Returns the entity of a global address. */
ir_entity
*
get_Global_ent
(
const
ir_node
*
node
);
ir_entity
*
get_Global_ent
ity
(
const
ir_node
*
node
);
/**
* Access custom node data.
...
...
ir/ana/cgana.c
View file @
36332e71
...
...
@@ -487,8 +487,8 @@ static void add_method_address_intitialzer(ir_initializer_t *initializer,
ir_node
*
n
=
initializer
->
consti
.
value
;
/* let's check if it's the address of a function */
if
(
is_
SymConst_addr_ent
(
n
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
n
);
if
(
is_
Global
(
n
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
n
);
if
(
is_Method_type
(
get_entity_type
(
ent
)))
eset_insert
(
set
,
ent
);
...
...
@@ -544,8 +544,8 @@ static void add_method_address(ir_entity *ent, eset *set)
/* let's check if it's the address of a function */
n
=
get_atomic_ent_value
(
ent
);
if
(
is_
SymConst_addr_ent
(
n
))
{
ent
=
get_
SymConst
_entity
(
n
);
if
(
is_
Global
(
n
))
{
ent
=
get_
Global
_entity
(
n
);
if
(
is_Method_type
(
get_entity_type
(
ent
)))
eset_insert
(
set
,
ent
);
...
...
@@ -555,8 +555,8 @@ static void add_method_address(ir_entity *ent, eset *set)
n
=
get_compound_ent_value
(
ent
,
i
);
/* let's check if it's the address of a function */
if
(
is_
SymConst_addr_ent
(
n
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
n
);
if
(
is_
Global
(
n
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
n
);
if
(
is_Method_type
(
get_entity_type
(
ent
)))
eset_insert
(
set
,
ent
);
...
...
ir/ana/irmemory.c
View file @
36332e71
...
...
@@ -339,13 +339,13 @@ static ir_alias_relation different_types(ir_node *adr1, ir_node *adr2)
{
ir_entity
*
ent1
=
NULL
,
*
ent2
=
NULL
;
if
(
is_
SymConst_addr_ent
(
adr1
))
ent1
=
get_
SymConst
_entity
(
adr1
);
if
(
is_
Global
(
adr1
))
ent1
=
get_
Global
_entity
(
adr1
);
else
if
(
is_Sel
(
adr1
))
ent1
=
get_Sel_entity
(
adr1
);
if
(
is_
SymConst_addr_ent
(
adr2
))
ent2
=
get_
SymConst
_entity
(
adr2
);
if
(
is_
Global
(
adr2
))
ent2
=
get_
Global
_entity
(
adr2
);
else
if
(
is_Sel
(
adr2
))
ent2
=
get_Sel_entity
(
adr2
);
...
...
@@ -407,8 +407,8 @@ static int is_malloc_Result(ir_node *node) {
if
(
!
is_Call
(
node
))
return
0
;
node
=
get_Call_ptr
(
node
);
if
(
is_
SymConst_addr_ent
(
node
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
node
);
if
(
is_
Global
(
node
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
node
);
if
(
get_entity_additional_properties
(
ent
)
&
mtp_property_malloc
)
return
1
;
...
...
@@ -417,15 +417,6 @@ static int is_malloc_Result(ir_node *node) {
return
0
;
}
/* is_malloc_Result */
/**
* Returns true if an address represents a global variable.
*
* @param irn the node representing the address
*/
static
INLINE
int
is_global_var
(
ir_node
*
irn
)
{
return
is_SymConst_addr_ent
(
irn
);
}
/* is_global_var */
/**
* classify storage locations.
* Except STORAGE_CLASS_POINTER they are all disjoint.
...
...
@@ -453,8 +444,8 @@ typedef enum {
static
storage_class_class_t
classify_pointer
(
ir_graph
*
irg
,
ir_node
*
irn
,
ir_entity
*
ent
)
{
storage_class_class_t
res
=
STORAGE_CLASS_POINTER
;
if
(
is_
SymConst_addr_ent
(
irn
))
{
ir_entity
*
entity
=
get_
SymConst
_entity
(
irn
);
if
(
is_
Global
(
irn
))
{
ir_entity
*
entity
=
get_
Global
_entity
(
irn
);
res
=
STORAGE_CLASS_GLOBALVAR
;
if
(
get_entity_address_taken
(
entity
)
==
ir_address_not_taken
)
res
|=
STORAGE_CLASS_MODIFIER_NOTTAKEN
;
...
...
@@ -939,13 +930,13 @@ static void init_taken_flag(ir_type * tp) {
static
void
check_initializer_nodes
(
ir_initializer_t
*
initializer
)
{
switch
(
initializer
->
kind
)
{
switch
(
initializer
->
kind
)
{
case
IR_INITIALIZER_CONST
:
{
ir_node
*
n
=
initializer
->
consti
.
value
;
/* let's check if it's an address */
if
(
is_
SymConst_addr_ent
(
n
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
n
);
if
(
is_
Global
(
n
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
n
);
set_entity_address_taken
(
ent
,
ir_address_taken
);
}
return
;
...
...
@@ -956,7 +947,7 @@ static void check_initializer_nodes(ir_initializer_t *initializer)
case
IR_INITIALIZER_COMPOUND
:
{
size_t
i
;
for
(
i
=
0
;
i
<
initializer
->
compound
.
n_initializers
;
++
i
)
{
for
(
i
=
0
;
i
<
initializer
->
compound
.
n_initializers
;
++
i
)
{
ir_initializer_t
*
sub_initializer
=
initializer
->
compound
.
initializers
[
i
];
check_initializer_nodes
(
sub_initializer
);
...
...
@@ -988,8 +979,8 @@ static void check_initializer(ir_entity *ent) {
}
else
if
(
is_atomic_entity
(
ent
))
{
/* let's check if it's an address */
n
=
get_atomic_ent_value
(
ent
);
if
(
is_
SymConst_addr_ent
(
n
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
n
);
if
(
is_
Global
(
n
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
n
);
set_entity_address_taken
(
ent
,
ir_address_taken
);
}
}
else
{
...
...
@@ -997,8 +988,8 @@ static void check_initializer(ir_entity *ent) {
n
=
get_compound_ent_value
(
ent
,
i
);
/* let's check if it's an address */
if
(
is_
SymConst_addr_ent
(
n
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
n
);
if
(
is_
Global
(
n
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
n
);
set_entity_address_taken
(
ent
,
ir_address_taken
);
}
}
...
...
@@ -1045,9 +1036,9 @@ static void check_global_address(ir_node *irn, void *env) {
ir_entity
*
ent
;
ir_address_taken_state
state
;
if
(
is_
SymConst_addr_ent
(
irn
))
{
if
(
is_
Global
(
irn
))
{
/* A global. */
ent
=
get_
SymConst
_entity
(
irn
);
ent
=
get_
Global
_entity
(
irn
);
}
else
if
(
is_Sel
(
irn
)
&&
get_Sel_ptr
(
irn
)
==
tls
)
{
/* A TLS variable. */
ent
=
get_Sel_entity
(
irn
);
...
...
ir/ir/irdump.c
View file @
36332e71
...
...
@@ -802,8 +802,8 @@ int dump_node_opcode(FILE *F, ir_node *n)
ir_entity
*
ent
=
NULL
;
if
(
get_irn_op
(
addr
)
==
op_Sel
)
ent
=
get_Sel_entity
(
addr
);
else
if
(
is_
SymConst_addr_ent
(
addr
))
ent
=
get_
SymConst
_entity
(
addr
);
else
if
(
is_
Global
(
addr
))
ent
=
get_
Global
_entity
(
addr
);
fprintf
(
F
,
"%s"
,
get_irn_opname
(
n
));
if
(
ent
)
fprintf
(
F
,
" %s"
,
get_entity_name
(
ent
));
break
;
...
...
ir/ir/irgopt.c
View file @
36332e71
...
...
@@ -88,7 +88,7 @@ static INLINE void do_local_optimize(ir_node *n) {
assert
(
get_irg_phase_state
(
current_ir_graph
)
!=
phase_building
);
if
(
get_opt_global_cse
())
set_irg_pinned
(
current_ir_graph
,
op_pin_state_floats
);
set_irg_pinned
(
current_ir_graph
,
op_pin_state_floats
);
set_irg_outs_inconsistent
(
current_ir_graph
);
set_irg_doms_inconsistent
(
current_ir_graph
);
set_irg_loopinfo_inconsistent
(
current_ir_graph
);
...
...
@@ -1359,8 +1359,8 @@ static ir_graph *get_call_called_irg(ir_node *call) {
ir_node
*
addr
;
addr
=
get_Call_ptr
(
call
);
if
(
is_
SymConst_addr_ent
(
addr
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
addr
);
if
(
is_
Global
(
addr
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
addr
);
return
get_entity_irg
(
ent
);
}
...
...
@@ -1499,8 +1499,8 @@ static void collect_calls2(ir_node *call, void *ctx) {
if
(
env
->
ignore_runtime
)
{
ir_node
*
symc
=
get_Call_ptr
(
call
);
if
(
is_
SymConst_addr_ent
(
symc
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
symc
);
if
(
is_
Global
(
symc
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
symc
);
if
(
get_entity_additional_properties
(
ent
)
&
mtp_property_runtime
)
return
;
...
...
ir/ir/irnode.c
View file @
36332e71
...
...
@@ -3098,7 +3098,7 @@ int is_Global(const ir_node *node) {
}
/* returns the entity of a global address */
ir_entity
*
get_Global_ent
(
const
ir_node
*
node
)
{
ir_entity
*
get_Global_ent
ity
(
const
ir_node
*
node
)
{
if
(
is_SymConst
(
node
))
return
get_SymConst_entity
(
node
);
else
...
...
ir/lower/lower_hl.c
View file @
36332e71
...
...
@@ -52,13 +52,14 @@ static void lower_sel(ir_node *sel) {
assert
(
is_Sel
(
sel
));
/* Do not lower frame type/global offset table access: must be lowered by the backend. */
ptr
=
get_Sel_ptr
(
sel
);
if
(
ptr
==
get_irg_frame
(
current_ir_graph
)
||
ptr
==
get_irg_globals
(
current_ir_graph
))
return
;
ent
=
get_Sel_entity
(
sel
);
owner
=
get_entity_owner
(
ent
);
/* Do not lower frame type access: must be lowered by the backend. */
if
(
is_frame_type
(
owner
))
return
;
/*
* Cannot handle value param entities here.
* Must be lowered by the backend.
...
...
@@ -66,7 +67,6 @@ static void lower_sel(ir_node *sel) {
if
(
is_value_param_type
(
owner
))
return
;
ptr
=
get_Sel_ptr
(
sel
);
dbg
=
get_irn_dbg_info
(
sel
);
mode
=
get_irn_mode
(
sel
);
...
...
ir/lower/lower_intrinsics.c
View file @
36332e71
...
...
@@ -64,10 +64,10 @@ static void call_mapper(ir_node *node, void *env) {
ir_entity
*
ent
;
symconst
=
get_Call_ptr
(
node
);
if
(
!
is_
SymConst_addr_ent
(
symconst
))
if
(
!
is_
Global
(
symconst
))
return
;
ent
=
get_
SymConst
_entity
(
symconst
);
ent
=
get_
Global
_entity
(
symconst
);
p
=
pmap_find
(
wenv
->
c_map
,
ent
);
if
(
p
)
{
...
...
@@ -484,8 +484,8 @@ int i_mapper_tanh(ir_node *call, void *ctx) {
*/
static
ir_entity
*
get_const_entity
(
ir_node
*
ptr
)
{
/* FIXME: this cannot handle constant strings inside struct initializers yet */
if
(
is_
SymConst_addr_ent
(
ptr
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
ptr
);
if
(
is_
Global
(
ptr
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
ptr
);
if
(
get_entity_variability
(
ent
)
==
variability_constant
)
{
/* a constant entity */
...
...
ir/opt/funccall.c
View file @
36332e71
...
...
@@ -90,8 +90,8 @@ static void collect_const_and_pure_calls(ir_node *node, void *env) {
/* set the link to NULL for all non-const/pure calls */
set_irn_link
(
call
,
NULL
);
ptr
=
get_Call_ptr
(
call
);
if
(
is_
SymConst_addr_ent
(
ptr
))
{
ent
=
get_
SymConst
_entity
(
ptr
);
if
(
is_
Global
(
ptr
))
{
ent
=
get_
Global
_entity
(
ptr
);
prop
=
get_entity_additional_properties
(
ent
);
if
((
prop
&
(
mtp_property_const
|
mtp_property_pure
))
==
0
)
...
...
@@ -261,8 +261,8 @@ static void collect_nothrow_calls(ir_node *node, void *env) {
/* set the link to NULL for all non-const/pure calls */
set_irn_link
(
call
,
NULL
);
ptr
=
get_Call_ptr
(
call
);
if
(
is_
SymConst_addr_ent
(
ptr
))
{
ent
=
get_
SymConst
_entity
(
ptr
);
if
(
is_
Global
(
ptr
))
{
ent
=
get_
Global
_entity
(
ptr
);
prop
=
get_entity_additional_properties
(
ent
);
if
((
prop
&
mtp_property_nothrow
)
==
0
)
...
...
@@ -677,8 +677,8 @@ static int is_malloc_call_result(const ir_node *node) {
if
(
is_alloc_entity
!=
NULL
&&
is_Call
(
node
))
{
ir_node
*
ptr
=
get_Call_ptr
(
node
);
if
(
is_
SymConst_addr_ent
(
ptr
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
ptr
);
if
(
is_
Global
(
ptr
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
ptr
);
return
is_alloc_entity
(
ent
);
}
}
...
...
@@ -723,8 +723,8 @@ static int is_stored(const ir_node *n) {
break
;
case
iro_Call
:
ptr
=
get_Call_ptr
(
succ
);
if
(
is_
SymConst_addr_ent
(
ptr
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
ptr
);
if
(
is_
Global
(
ptr
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
ptr
);
int
i
;
/* we know the called entity */
...
...
@@ -831,9 +831,9 @@ static unsigned check_nothrow_or_malloc(ir_graph *irg, int top) {
}
else
if
(
is_Call
(
res
))
{
ir_node
*
ptr
=
get_Call_ptr
(
res
);
if
(
is_
SymConst_addr_ent
(
ptr
))
{
if
(
is_
Global
(
ptr
))
{
/* a direct call */
ir_entity
*
ent
=
get_
SymConst
_entity
(
ptr
);
ir_entity
*
ent
=
get_
Global
_entity
(
ptr
);
ir_graph
*
callee
=
get_entity_irg
(
ent
);
if
(
callee
==
irg
)
{
...
...
@@ -887,9 +887,9 @@ static unsigned check_nothrow_or_malloc(ir_graph *irg, int top) {
if
(
is_Call
(
pred
))
{
ir_node
*
ptr
=
get_Call_ptr
(
pred
);
if
(
is_
SymConst_addr_ent
(
ptr
))
{
if
(
is_
Global
(
ptr
))
{
/* a direct call */
ir_entity
*
ent
=
get_
SymConst
_entity
(
ptr
);
ir_entity
*
ent
=
get_
Global
_entity
(
ptr
);
ir_graph
*
callee
=
get_entity_irg
(
ent
);
if
(
callee
==
irg
)
{
...
...
ir/opt/ldstopt.c
View file @
36332e71
...
...
@@ -446,8 +446,8 @@ static unsigned is_Call_pure(ir_node *call) {
/* try the called entity */
ir_node
*
ptr
=
get_Call_ptr
(
call
);
if
(
is_
SymConst_addr_ent
(
ptr
))
{
ir_entity
*
ent
=
get_
SymConst
_entity
(
ptr
);
if
(
is_
Global
(
ptr
))
{
ir_entity
*
ent
=
get_
Global
_entity
(
ptr
);
prop
=
get_entity_additional_properties
(
ent
);
}
...
...
@@ -1351,10 +1351,10 @@ static void move_loads_out_of_loops(scc *pscc, loop_env *env) {
if
(
info
->
projs
[
pn_Load_res
]
==
NULL
||
info
->
projs
[
pn_Load_X_regular
]
!=
NULL
||
info
->
projs
[
pn_Load_X_except
]
!=
NULL
)
continue
;
/* for now, we can only handle Load(
SymConst
) */
if
(
!
is_
SymConst_addr_ent
(
ptr
))
/* for now, we can only handle Load(
Global
) */
if
(
!
is_
Global
(
ptr
))
continue
;
ent
=
get_
SymConst
_entity
(
ptr
);
ent
=
get_
Global
_entity
(
ptr
);
load_mode
=
get_Load_mode
(
load
);
for
(
other
=
pscc
->
head
;
other
!=
NULL
;
other
=
next_other
)
{
node_entry
*
ne
=
get_irn_ne
(
other
,
env
);
...
...
ir/opt/proc_cloning.c
View file @
36332e71
...
...
@@ -187,10 +187,10 @@ static void collect_irg_calls(ir_node *call, void *env) {
if
(
is_Call
(
call
))
{
call_ptr
=
get_Call_ptr
(
call
);
if
(
!
is_
SymConst_addr_ent
(
call_ptr
))
if
(
!
is_
Global
(
call_ptr
))
return
;
callee
=
get_
SymConst
_entity
(
call_ptr
);
callee
=
get_
Global
_entity
(
call_ptr
);
/* we can only clone calls to existing entities */
if
(
get_entity_visibility
(
callee
)
==
visibility_external_allocated
)
...
...
ir/opt/tailrec.c
View file @
36332e71
...
...
@@ -632,10 +632,10 @@ int opt_tail_rec_irg(ir_graph *irg) {
/* check if it's a recursive call */
call_ptr
=
get_Call_ptr
(
call
);
if
(
!
is_
SymConst_addr_ent
(
call_ptr
))
if
(
!
is_
Global
(
call_ptr
))
continue
;
ent
=
get_
SymConst
_entity
(
call_ptr
);
ent
=
get_
Global
_entity
(
call_ptr
);
if
(
!
ent
||
get_entity_irg
(
ent
)
!=
irg
)
continue
;
...
...
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