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
33d28f79
Commit
33d28f79
authored
Nov 28, 2012
by
Christoph Mallon
Browse files
bessaconstr: Factorise common code.
parent
2cfb4be3
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/be/bessaconstr.c
View file @
33d28f79
...
...
@@ -260,6 +260,16 @@ static ir_node *get_def_at_idom(be_ssa_construction_env_t *env, ir_node *block)
return
search_def_end_of_block
(
env
,
dom
);
}
static
ir_node
*
get_def_from_preds
(
be_ssa_construction_env_t
*
const
env
,
ir_node
*
const
block
)
{
/* Create a phi if the block is in the dominance frontier. */
if
(
Block_block_visited
(
block
))
{
return
insert_dummy_phi
(
env
,
block
);
}
else
{
return
get_def_at_idom
(
env
,
block
);
}
}
/**
* Fixes all operands of a use.
*
...
...
@@ -304,12 +314,7 @@ static void process_block(be_ssa_construction_env_t *env, ir_node *block)
if
(
def
==
NULL
)
{
/* Create a phi if the block is in the dominance frontier. */
if
(
Block_block_visited
(
block
))
{
def
=
insert_dummy_phi
(
env
,
block
);
}
else
{
def
=
get_def_at_idom
(
env
,
block
);
}
def
=
get_def_from_preds
(
env
,
block
);
}
set_operands
(
env
,
node
,
def
,
info
);
...
...
@@ -358,17 +363,9 @@ static ir_node *search_def_end_of_block(be_ssa_construction_env_t *env,
}
return
block_info
->
u
.
last_definition
;
}
else
if
(
Block_block_visited
(
block
))
{
ir_node
*
phi
=
insert_dummy_phi
(
env
,
block
);
block_info
->
u
.
last_definition
=
phi
;
return
phi
;
}
else
{
ir_node
*
def
=
get_def_at_idom
(
env
,
block
);
ir_node
*
const
def
=
get_def_from_preds
(
env
,
block
);
block_info
->
u
.
last_definition
=
def
;
return
def
;
}
}
...
...
@@ -386,13 +383,8 @@ static void search_def_at_block(be_ssa_construction_env_t *const env, ir_node *c
if
(
has_definition
(
block
))
{
process_block
(
env
,
block
);
}
else
if
(
Block_block_visited
(
block
))
{
ir_node
*
phi
=
insert_dummy_phi
(
env
,
block
);
set_operands
(
env
,
use
,
phi
,
info
);
}
else
{
ir_node
*
def
=
get_def_at_idom
(
env
,
block
);
ir_node
*
const
def
=
get_def_from_preds
(
env
,
block
);
set_operands
(
env
,
use
,
def
,
info
);
}
}
...
...
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