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
31f31dc4
Commit
31f31dc4
authored
Dec 12, 2008
by
Matthias Braun
Browse files
don't have new_immBlock set the current block
[r24566]
parent
cafbc21b
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/libfirm/ircons.h
View file @
31f31dc4
...
@@ -345,12 +345,12 @@
...
@@ -345,12 +345,12 @@
* ir_node *new_immBlock (void)
* ir_node *new_immBlock (void)
* ----------------------------
* ----------------------------
*
*
* Creates a new block.
Sets current_block to itself. When a new block is
* Creates a new block.
When a new block is created it cannot be known how
*
created it cannot be known how
many predecessors this block will have in the
* many predecessors this block will have in the
control flow graph.
*
control flow graph.
Therefore the list of inputs can not be fixed at
* Therefore the list of inputs can not be fixed at
creation. Predecessors
*
creation. Predecessors
can be added with add_immBlock_pred (block, control flow
* can be added with add_immBlock_pred (block, control flow
operation).
*
operation).
With every added predecessor the number of inputs to Phi nodes
* With every added predecessor the number of inputs to Phi nodes
also
*
also
changes.
* changes.
*
*
* The block can be completed by mature_immBlock(block) if all predecessors are
* The block can be completed by mature_immBlock(block) if all predecessors are
* known. If several blocks are built at once, mature_immBlock can only be called
* known. If several blocks are built at once, mature_immBlock can only be called
...
@@ -364,15 +364,18 @@
...
@@ -364,15 +364,18 @@
* Example for faulty IR construction: (draw the graph on a paper and you'll
* Example for faulty IR construction: (draw the graph on a paper and you'll
* get it ;-)
* get it ;-)
*
*
* block_before_loop = new_block();
* block_before_loop = new_immBlock();
* set_cur_block(block_before_loop);
* set_value(x);
* set_value(x);
* mature_immBlock(block_before_loop);
* mature_immBlock(block_before_loop);
* before2header = new_Jmp;
* before2header = new_Jmp;
*
*
* loop_header = new_block ();
* loop_header = new_immBlock ();
* set_cur_block(loop_header);
* header2body - new_Jmp();
* header2body - new_Jmp();
*
*
* loop_body = new_block ();
* loop_body = new_immBlock ();
* set_cur_block(loop_body);
* body2header = new_Jmp();
* body2header = new_Jmp();
*
*
* add_immBlock_pred(loop_header, before2header);
* add_immBlock_pred(loop_header, before2header);
...
@@ -4389,10 +4392,9 @@ ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
...
@@ -4389,10 +4392,9 @@ ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
* can be added with add_immBlock_pred(). Once all predecessors are
* can be added with add_immBlock_pred(). Once all predecessors are
* added the block must be matured.
* added the block must be matured.
*
*
* Adds the block to the graph in current_ir_graph. Does set
* Adds the block to the graph in current_ir_graph. Can be used with automatic
* current_block. Can be used with automatic Phi node construction.
* Phi node construction.
* This constructor can only be used if the graph is in
* This constructor can only be used if the graph is in state_building.
* state_building.
*/
*/
ir_node
*
new_d_immBlock
(
dbg_info
*
db
);
ir_node
*
new_d_immBlock
(
dbg_info
*
db
);
ir_node
*
new_immBlock
(
void
);
ir_node
*
new_immBlock
(
void
);
...
...
include/libfirm/irnode.h
View file @
31f31dc4
...
@@ -1437,6 +1437,11 @@ dbg_info *get_irn_dbg_info(const ir_node *n);
...
@@ -1437,6 +1437,11 @@ dbg_info *get_irn_dbg_info(const ir_node *n);
*/
*/
unsigned
firm_default_hash
(
const
ir_node
*
node
);
unsigned
firm_default_hash
(
const
ir_node
*
node
);
/**
* returns a descriptive name of a node (containing type+number)
*/
const
char
*
gdb_node_helper
(
void
*
firm_object
);
/*@}*/
/* end of ir_node group definition */
/*@}*/
/* end of ir_node group definition */
#endif
#endif
ir/external/read.c
View file @
31f31dc4
...
@@ -1308,6 +1308,7 @@ static void create_abstract_join (ir_graph *irg, proc_t *proc, eff_t *eff)
...
@@ -1308,6 +1308,7 @@ static void create_abstract_join (ir_graph *irg, proc_t *proc, eff_t *eff)
cond
=
new_Cond
(
unknown
);
cond
=
new_Cond
(
unknown
);
c_block
=
new_immBlock
();
/* for the Phi after the branch(es) */
c_block
=
new_immBlock
();
/* for the Phi after the branch(es) */
set_cur_block
(
c_block
);
ins
=
XMALLOCN
(
ir_node
*
,
n_ins
);
ins
=
XMALLOCN
(
ir_node
*
,
n_ins
);
for
(
i
=
0
;
i
<
n_ins
;
i
++
)
{
for
(
i
=
0
;
i
<
n_ins
;
i
++
)
{
...
@@ -1322,6 +1323,7 @@ static void create_abstract_join (ir_graph *irg, proc_t *proc, eff_t *eff)
...
@@ -1322,6 +1323,7 @@ static void create_abstract_join (ir_graph *irg, proc_t *proc, eff_t *eff)
/* this also sets current_block, so the rest of the code ends up there: */
/* this also sets current_block, so the rest of the code ends up there: */
s_block
=
new_immBlock
();
s_block
=
new_immBlock
();
set_cur_block
(
s_block
);
add_immBlock_pred
(
s_block
,
projX
);
add_immBlock_pred
(
s_block
,
projX
);
mature_immBlock
(
s_block
);
mature_immBlock
(
s_block
);
...
@@ -1373,6 +1375,7 @@ static void create_abstract_raise (ir_graph *irg, proc_t *proc, eff_t *eff)
...
@@ -1373,6 +1375,7 @@ static void create_abstract_raise (ir_graph *irg, proc_t *proc, eff_t *eff)
ir_node
*
thrw
=
NULL
;
ir_node
*
thrw
=
NULL
;
eff_t
*
thrw_eff
=
NULL
;
eff_t
*
thrw_eff
=
NULL
;
set_cur_block
(
b_exc
);
add_immBlock_pred
(
b_exc
,
projX
);
add_immBlock_pred
(
b_exc
,
projX
);
thrw_eff
=
find_valueid_in_proc_effects
(
eff
->
effect
.
raise
.
valref
,
proc
);
thrw_eff
=
find_valueid_in_proc_effects
(
eff
->
effect
.
raise
.
valref
,
proc
);
...
@@ -1390,10 +1393,12 @@ static void create_abstract_raise (ir_graph *irg, proc_t *proc, eff_t *eff)
...
@@ -1390,10 +1393,12 @@ static void create_abstract_raise (ir_graph *irg, proc_t *proc, eff_t *eff)
/* one branch for 'non-exception' case */
/* one branch for 'non-exception' case */
{
{
ir_node
*
block
;
ir_node
*
projX
=
new_Proj
(
cond
,
mode_X
,
0
);
ir_node
*
projX
=
new_Proj
(
cond
,
mode_X
,
0
);
new_immBlock
();
/* also sets current_block */
block
=
new_immBlock
();
add_immBlock_pred
(
get_cur_block
(),
projX
);
set_cur_block
(
block
);
mature_immBlock
(
get_cur_block
());
add_immBlock_pred
(
block
,
projX
);
mature_immBlock
(
block
);
/* continue building in current_block */
/* continue building in current_block */
}
}
...
...
ir/ir/ircons.c
View file @
31f31dc4
...
@@ -2682,7 +2682,6 @@ new_d_immBlock(dbg_info *db) {
...
@@ -2682,7 +2682,6 @@ new_d_immBlock(dbg_info *db) {
assert
(
get_irg_phase_state
(
current_ir_graph
)
==
phase_building
);
assert
(
get_irg_phase_state
(
current_ir_graph
)
==
phase_building
);
/* creates a new dynamic in-array as length of in is -1 */
/* creates a new dynamic in-array as length of in is -1 */
res
=
new_ir_node
(
db
,
current_ir_graph
,
NULL
,
op_Block
,
mode_BB
,
-
1
,
NULL
);
res
=
new_ir_node
(
db
,
current_ir_graph
,
NULL
,
op_Block
,
mode_BB
,
-
1
,
NULL
);
current_ir_graph
->
current_block
=
res
;
/* macroblock head */
/* macroblock head */
res
->
in
[
0
]
=
res
;
res
->
in
[
0
]
=
res
;
...
...
ir/ir/irgraph.c
View file @
31f31dc4
...
@@ -239,12 +239,14 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
...
@@ -239,12 +239,14 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
/*-- Nodes needed in every graph --*/
/*-- Nodes needed in every graph --*/
set_irg_end_block
(
res
,
new_immBlock
());
set_irg_end_block
(
res
,
new_immBlock
());
set_cur_block
(
get_irg_end_block
(
res
));
end
=
new_End
();
end
=
new_End
();
set_irg_end
(
res
,
end
);
set_irg_end
(
res
,
end
);
set_irg_end_reg
(
res
,
end
);
set_irg_end_reg
(
res
,
end
);
set_irg_end_except
(
res
,
end
);
set_irg_end_except
(
res
,
end
);
start_block
=
new_immBlock
();
start_block
=
new_immBlock
();
set_cur_block
(
start_block
);
set_irg_start_block
(
res
,
start_block
);
set_irg_start_block
(
res
,
start_block
);
set_irg_bad
(
res
,
new_ir_node
(
NULL
,
res
,
start_block
,
op_Bad
,
mode_T
,
0
,
NULL
));
set_irg_bad
(
res
,
new_ir_node
(
NULL
,
res
,
start_block
,
op_Bad
,
mode_T
,
0
,
NULL
));
set_irg_no_mem
(
res
,
new_ir_node
(
NULL
,
res
,
start_block
,
op_NoMem
,
mode_M
,
0
,
NULL
));
set_irg_no_mem
(
res
,
new_ir_node
(
NULL
,
res
,
start_block
,
op_NoMem
,
mode_M
,
0
,
NULL
));
...
@@ -278,6 +280,7 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
...
@@ -278,6 +280,7 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
/*-- Make a block to start with --*/
/*-- Make a block to start with --*/
first_block
=
new_immBlock
();
first_block
=
new_immBlock
();
set_cur_block
(
first_block
);
add_immBlock_pred
(
first_block
,
projX
);
add_immBlock_pred
(
first_block
,
projX
);
res
->
method_execution_frequency
=
-
1
.
0
;
res
->
method_execution_frequency
=
-
1
.
0
;
...
@@ -297,6 +300,7 @@ ir_graph *new_ir_graph(ir_entity *ent, int n_loc) {
...
@@ -297,6 +300,7 @@ ir_graph *new_ir_graph(ir_entity *ent, int n_loc) {
ir_graph
*
new_const_code_irg
(
void
)
{
ir_graph
*
new_const_code_irg
(
void
)
{
ir_graph
*
res
;
ir_graph
*
res
;
ir_node
*
end
,
*
start_block
,
*
start
,
*
projX
;
ir_node
*
end
,
*
start_block
,
*
start
,
*
projX
;
ir_node
*
body_block
;
res
=
alloc_graph
();
res
=
alloc_graph
();
...
@@ -329,6 +333,7 @@ ir_graph *new_const_code_irg(void) {
...
@@ -329,6 +333,7 @@ ir_graph *new_const_code_irg(void) {
/* -- The end block -- */
/* -- The end block -- */
set_irg_end_block
(
res
,
new_immBlock
());
set_irg_end_block
(
res
,
new_immBlock
());
set_cur_block
(
get_irg_end_block
(
res
));
end
=
new_End
();
end
=
new_End
();
set_irg_end
(
res
,
end
);
set_irg_end
(
res
,
end
);
set_irg_end_reg
(
res
,
end
);
set_irg_end_reg
(
res
,
end
);
...
@@ -337,6 +342,7 @@ ir_graph *new_const_code_irg(void) {
...
@@ -337,6 +342,7 @@ ir_graph *new_const_code_irg(void) {
/* -- The start block -- */
/* -- The start block -- */
start_block
=
new_immBlock
();
start_block
=
new_immBlock
();
set_cur_block
(
start_block
);
set_irg_start_block
(
res
,
start_block
);
set_irg_start_block
(
res
,
start_block
);
set_irg_bad
(
res
,
new_ir_node
(
NULL
,
res
,
start_block
,
op_Bad
,
mode_T
,
0
,
NULL
));
set_irg_bad
(
res
,
new_ir_node
(
NULL
,
res
,
start_block
,
op_Bad
,
mode_T
,
0
,
NULL
));
set_irg_no_mem
(
res
,
new_ir_node
(
NULL
,
res
,
start_block
,
op_NoMem
,
mode_M
,
0
,
NULL
));
set_irg_no_mem
(
res
,
new_ir_node
(
NULL
,
res
,
start_block
,
op_NoMem
,
mode_M
,
0
,
NULL
));
...
@@ -349,8 +355,11 @@ ir_graph *new_const_code_irg(void) {
...
@@ -349,8 +355,11 @@ ir_graph *new_const_code_irg(void) {
add_immBlock_pred
(
start_block
,
projX
);
add_immBlock_pred
(
start_block
,
projX
);
mature_immBlock
(
start_block
);
/* mature the start block */
mature_immBlock
(
start_block
);
/* mature the start block */
add_immBlock_pred
(
new_immBlock
(),
projX
);
mature_immBlock
(
get_cur_block
());
/* mature the 'body' block for expressions */
body_block
=
new_immBlock
();
add_immBlock_pred
(
body_block
,
projX
);
mature_immBlock
(
body_block
);
/* mature the 'body' block for expressions */
set_cur_block
(
body_block
);
/* Set the visited flag high enough that the blocks will never be visited. */
/* Set the visited flag high enough that the blocks will never be visited. */
set_irn_visited
(
get_cur_block
(),
-
1
);
set_irn_visited
(
get_cur_block
(),
-
1
);
...
...
Write
Preview
Supports
Markdown
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