- except_block = create_Block(1, &proj);
- set_nodes_Block(proj, except_block);
- exchange(proj, new_Break());
- set_irg_current_block(current_ir_graph, pre_block);
- set_irn_n(except_block, 0, new_Proj(call, mode_X, 1));
- set_irg_current_block(current_ir_graph, post_block);
+ int preds = 0;
+ bool exc_to_end = false;
+ if (exc_branches_to_end(current_ir_graph, proj)) {
+ /* The Call aborts the procedure if it returns with an exception.
+ If this is an outermost procedure, the normal handling of exceptions
+ will generate a Break that goes to the end block. This is illegal
+ Frim. So directly branch to the end block with all exceptions. */
+ exc_to_end = true;
+ if (is_outermost_graph(current_ir_graph)) {
+ except_block = get_irg_end_block(current_ir_graph);
+ } else {
+ irg_data_t * tmp_data = get_entity_link(get_irg_entity(current_ir_graph));
+ except_block = get_nodes_block(tmp_data->except);
+ }
+ } else
+ {
+ except_block = create_Block(1, &proj);
+ set_nodes_block(proj, except_block);
+ exchange(proj, new_Break());
+ set_irg_current_block(current_ir_graph, pre_block);
+ set_irn_n(except_block, 0, new_Proj(call, mode_X, 1));
+ set_irg_current_block(current_ir_graph, post_block);
+ }
+
+ /*
+ * Set flag to suppress verifying placement on proper irg:
+ * optimization can return block on other irg.
+ */
+ set_interprocedural_view(1);
+