+/**
+ * The start block has no jump, instead it has an initial exec Proj.
+ * The backend wants to handle all blocks the same way, so we replace
+ * the out cfg edge with a real jump.
+ */
+static void fix_start_block(ir_node *block, void *env) {
+ int *done = env;
+ int i;
+ ir_node *start_block;
+ ir_graph *irg;
+
+ /* we processed the start block, return */
+ if (*done)
+ return;
+
+ irg = get_irn_irg(block);
+ start_block = get_irg_start_block(irg);
+
+ for (i = get_Block_n_cfgpreds(block) - 1; i >= 0; --i) {
+ ir_node *pred = get_Block_cfgpred(block, i);
+ ir_node *pred_block = get_nodes_block(pred);
+
+ /* ok, we are in the block, having start as cfg predecessor */
+ if (pred_block == start_block) {
+ ir_node *jump = new_r_Jmp(irg, pred_block);
+ set_Block_cfgpred(block, i, jump);
+ *done = 1;
+ }
+ }
+}
+