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
ca8347e7
Commit
ca8347e7
authored
Dec 14, 2011
by
Matthias Braun
Browse files
replace pamp_find with pmap_get where possible
parent
89ecd499
Changes
7
Hide whitespace changes
Inline
Side-by-side
ir/ana/irmemory.c
View file @
ca8347e7
...
...
@@ -1257,14 +1257,12 @@ static pmap *mtp_map;
*/
static
ir_type
*
clone_type_and_cache
(
ir_type
*
tp
)
{
ir_type
*
res
;
pmap_entry
*
e
=
pmap_find
(
mtp_map
,
tp
);
ir_type
*
res
=
(
ir_type
*
)
pmap_get
(
mtp_map
,
tp
);
if
(
e
!=
NULL
)
return
(
ir_type
*
)
e
->
value
;
res
=
clone_type_method
(
tp
);
pmap_insert
(
mtp_map
,
tp
,
res
);
if
(
res
==
NULL
)
{
res
=
clone_type_method
(
tp
);
pmap_insert
(
mtp_map
,
tp
,
res
);
}
return
res
;
}
...
...
ir/ana/irtypeinfo.c
View file @
ca8347e7
...
...
@@ -119,14 +119,13 @@ void set_irp_typeinfo_inconsistent(void)
ir_type
*
get_irn_typeinfo_type
(
const
ir_node
*
n
)
{
ir_type
*
res
=
initial_type
;
pmap_entry
*
entry
;
ir_type
*
res
;
assert
(
get_irg_typeinfo_state
(
get_irn_irg
(
n
))
!=
ir_typeinfo_none
);
entry
=
pmap_find
(
type_node_map
,
n
);
if
(
entry
!=
NULL
)
res
=
(
ir_type
*
)
entry
->
value
;
res
=
pmap_get
(
type_node_map
,
n
);
if
(
res
==
NULL
)
{
res
=
initial_type
;
}
return
res
;
}
...
...
ir/be/bestabs.c
View file @
ca8347e7
...
...
@@ -130,19 +130,19 @@ typedef struct stabs_handle {
*/
static
unsigned
get_type_number
(
stabs_handle
*
h
,
ir_type
*
tp
)
{
pmap_entry
*
entry
;
void
*
entry
;
unsigned
num
;
if
(
tp
==
NULL
)
{
/* map to the void type */
return
0
;
}
entry
=
pmap_
find
(
h
->
type_map
,
tp
);
if
(
!
entry
)
{
entry
=
pmap_
get
(
h
->
type_map
,
tp
);
if
(
entry
==
NULL
)
{
num
=
h
->
next_type_nr
++
;
pmap_insert
(
h
->
type_map
,
tp
,
INT_TO_PTR
(
num
));
pmap_insert
(
h
->
type_map
,
tp
,
INT_TO_PTR
(
num
+
1
));
}
else
{
num
=
(
unsigned
)
PTR_TO_INT
(
entry
->
value
)
;
num
=
(
(
unsigned
)
PTR_TO_INT
(
entry
))
-
1
;
}
return
num
;
}
...
...
@@ -152,7 +152,7 @@ static unsigned get_type_number(stabs_handle *h, ir_type *tp)
*/
static
void
map_to_void
(
stabs_handle
*
h
,
ir_type
*
tp
)
{
pmap_insert
(
h
->
type_map
,
tp
,
INT_TO_PTR
(
0
));
pmap_insert
(
h
->
type_map
,
tp
,
INT_TO_PTR
(
1
));
}
/**
...
...
ir/be/ia32/ia32_x87.c
View file @
ca8347e7
...
...
@@ -125,8 +125,6 @@ typedef struct blk_state {
x87_state
*
end
;
/**< state at the end or NULL if not assigned */
}
blk_state
;
#define PTR_TO_BLKSTATE(p) ((blk_state *)(p))
/** liveness bitset for vfp registers. */
typedef
unsigned
char
vfp_liveness
;
...
...
@@ -339,18 +337,17 @@ static void x87_emms(x87_state *state)
*/
static
blk_state
*
x87_get_bl_state
(
x87_simulator
*
sim
,
ir_node
*
block
)
{
pmap_entry
*
entry
=
pmap_
find
(
sim
->
blk_states
,
block
);
blk_state
*
res
=
pmap_
get
(
sim
->
blk_states
,
block
);
if
(
!
entry
)
{
blk_state
*
bl_state
=
OALLOC
(
&
sim
->
obst
,
blk_state
);
bl_state
->
begin
=
NULL
;
bl_state
->
end
=
NULL
;
if
(
res
==
NULL
)
{
res
=
OALLOC
(
&
sim
->
obst
,
blk_state
);
res
->
begin
=
NULL
;
res
->
end
=
NULL
;
pmap_insert
(
sim
->
blk_states
,
block
,
bl_state
);
return
bl_state
;
pmap_insert
(
sim
->
blk_states
,
block
,
res
);
}
return
PTR_TO_BLKSTATE
(
entry
->
value
)
;
return
res
;
}
/**
...
...
ir/lower/lower_calls.c
View file @
ca8347e7
...
...
@@ -507,14 +507,9 @@ static void do_copy_return_opt(ir_node *n, void *ctx)
static
ir_node
*
get_dummy_sel
(
ir_graph
*
irg
,
ir_node
*
block
,
ir_type
*
tp
,
wlk_env
*
env
)
{
ir_entity
*
ent
;
pmap_entry
*
e
;
/* use a map the check if we already create such an entity */
e
=
pmap_find
(
env
->
dummy_map
,
tp
);
if
(
e
)
{
ent
=
(
ir_entity
*
)
e
->
value
;
}
else
{
ir_entity
*
ent
=
pmap_get
(
env
->
dummy_map
,
tp
);
if
(
ent
==
NULL
)
{
ir_type
*
ft
=
get_irg_frame_type
(
irg
);
ident
*
dummy_id
=
id_unique
(
"dummy.%u"
);
ent
=
new_entity
(
ft
,
dummy_id
,
tp
);
...
...
ir/lower/lower_intrinsics.c
View file @
ca8347e7
...
...
@@ -62,7 +62,6 @@ static void call_mapper(ir_node *node, void *env)
if
(
op
==
op_Call
)
{
ir_node
*
symconst
;
pmap_entry
*
p
;
const
i_call_record
*
r
;
ir_entity
*
ent
;
...
...
@@ -71,10 +70,9 @@ static void call_mapper(ir_node *node, void *env)
return
;
ent
=
get_SymConst_entity
(
symconst
);
p
=
pmap_
find
(
wenv
->
c_map
,
ent
);
r
=
(
const
i_call_record
*
)
pmap_
get
(
wenv
->
c_map
,
ent
);
if
(
p
)
{
r
=
(
const
i_call_record
*
)
p
->
value
;
if
(
r
!=
NULL
)
{
wenv
->
nr_of_intrinsics
+=
r
->
i_mapper
(
node
,
r
->
ctx
)
?
1
:
0
;
}
}
else
{
...
...
ir/opt/opt_inline.c
View file @
ca8347e7
...
...
@@ -1073,7 +1073,7 @@ void inline_leave_functions(unsigned maxsize, unsigned leavesize,
list_for_each_entry_safe
(
call_entry
,
entry
,
next
,
&
env
->
calls
,
list
)
{
irg_inline_property
prop
;
ir_graph
*
callee
;
pmap_entry
*
e
;
ir_graph
*
callee
e
;
call
=
entry
->
call
;
callee
=
entry
->
callee
;
...
...
@@ -1083,13 +1083,13 @@ void inline_leave_functions(unsigned maxsize, unsigned leavesize,
continue
;
}
e
=
pmap_
find
(
copied_graphs
,
callee
);
if
(
e
!=
NULL
)
{
calleee
=
(
ir_graph
*
)
pmap_
get
(
copied_graphs
,
callee
);
if
(
callee
e
!=
NULL
)
{
/*
* Remap callee if we have a copy.
* FIXME: Should we do this only for recursive Calls ?
*/
callee
=
(
ir_graph
*
)
e
->
valu
e
;
callee
=
callee
e
;
}
if
(
prop
>=
irg_inline_forced
||
...
...
@@ -1593,9 +1593,9 @@ static void inline_into(ir_graph *irg, unsigned maxsize,
ir_node
*
call_node
=
curr_call
->
call
;
inline_irg_env
*
callee_env
=
(
inline_irg_env
*
)
get_irg_link
(
callee
);
irg_inline_property
prop
=
get_irg_inline_property
(
callee
);
ir_graph
*
calleee
;
int
loop_depth
;
const
call_entry
*
centry
;
pmap_entry
*
e
;
if
((
prop
<
irg_inline_forced
)
&&
env
->
n_nodes
+
callee_env
->
n_nodes
>
maxsize
)
{
DB
((
dbg
,
LEVEL_2
,
"%+F: too big (%d) + %+F (%d)
\n
"
,
irg
,
...
...
@@ -1603,8 +1603,8 @@ static void inline_into(ir_graph *irg, unsigned maxsize,
continue
;
}
e
=
pmap_
find
(
copied_graphs
,
callee
);
if
(
e
!=
NULL
)
{
calleee
=
(
ir_graph
*
)
pmap_
get
(
copied_graphs
,
callee
);
if
(
callee
e
!=
NULL
)
{
int
benefice
=
curr_call
->
benefice
;
/*
* Reduce the weight for recursive function IFF not all arguments are const.
...
...
@@ -1618,7 +1618,7 @@ static void inline_into(ir_graph *irg, unsigned maxsize,
/*
* Remap callee if we have a copy.
*/
callee
=
(
ir_graph
*
)
e
->
valu
e
;
callee
=
callee
e
;
callee_env
=
(
inline_irg_env
*
)
get_irg_link
(
callee
);
}
...
...
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