+ if (block == start_block)
+ need_label = 0;
+
+ if (need_label && get_irn_arity(block) == 1) {
+ ir_node *pred_block = get_Block_cfgpred_block(block, 0);
+
+ if (pred_block == last_block && get_irn_n_edges_kind(pred_block, EDGE_KIND_BLOCK) <= 2)
+ need_label = 0;
+ }
+
+ /* special case: if one of our cfg preds is a switch-jmp we need a label, */
+ /* otherwise there might be jump table entries jumping to */
+ /* non-existent (omitted) labels */
+ for (i = get_Block_n_cfgpreds(block) - 1; i >= 0; --i) {
+ ir_node *pred = get_Block_cfgpred(block, i);
+
+ if (is_Proj(pred)) {
+ assert(get_irn_mode(pred) == mode_X);
+ if (is_ia32_SwitchJmp(get_Proj_pred(pred))) {
+ need_label = 1;
+ break;
+ }
+ }
+ }
+
+ /* special case because the start block contains no jump instruction */
+ if (last_block == start_block) {
+ const ir_edge_t *edge;
+ ir_node *startsucc = NULL;
+
+ foreach_block_succ(start_block, edge) {
+ startsucc = get_edge_src_irn(edge);
+ if (startsucc != start_block)
+ break;
+ }
+ assert(startsucc != NULL);
+
+ /* if the last block was the start block and we are not inside the */
+ /* start successor, emit a jump to the start successor */
+ if (startsucc != block) {
+ char buf[SNPRINTF_BUF_LEN];
+ ir_snprintf(buf, sizeof(buf), BLOCK_PREFIX("%d"),
+ get_irn_node_nr(startsucc));
+ ir_fprintf(F, "\tjmp %s\n", buf);
+ }