+ if(error_count > 0) {
+ /* parsing failed because of errors */
+ fprintf(stderr, "%u error(s), %u warning(s)\n", error_count,
+ warning_count);
+ result = EXIT_FAILURE;
+ continue;
+ } else if(warning_count > 0) {
+ fprintf(stderr, "%u warning(s)\n", warning_count);
+ }
+
+ if(mode == BenchmarkParser) {
+ return result;
+ } else if(mode == PrintFluffy) {
+ write_fluffy_decls(out, unit);
+ continue;
+ } else if (mode == PrintCaml) {
+ write_caml_decls(out, unit);
+ continue;
+ }
+
+ translation_unit_to_firm(unit);
+
+ if (mode == ParseOnly) {
+ continue;
+ }
+
+ if (mode == CompileDump) {
+ /* find irg */
+ ident *id = new_id_from_str(dumpfunction);
+ ir_graph *irg = NULL;
+ int n_irgs = get_irp_n_irgs();
+ for(int i = 0; i < n_irgs; ++i) {
+ ir_graph *tirg = get_irp_irg(i);
+ ident *irg_id = get_entity_ident(get_irg_entity(tirg));
+ if(irg_id == id) {
+ irg = tirg;
+ break;
+ }
+ }
+
+ if(irg == NULL) {
+ fprintf(stderr, "No graph for function '%s' found\n",
+ dumpfunction);
+ exit(1);
+ }
+
+ dump_ir_block_graph_file(irg, out);
+ fclose(out);
+ exit(0);
+ }
+
+ gen_firm_finish(asm_out, filename, /*c_mode=*/1,
+ /*firm_const_exists=*/0);
+ if (asm_out != out) {
+ fclose(asm_out);
+ }
+
+ } else if (filetype == FILETYPE_PREPROCESSED_ASSEMBLER) {
+ copy_file(asm_out, in);
+ if (in == preprocessed_in) {
+ int pp_result = pclose(preprocessed_in);
+ if (pp_result != EXIT_SUCCESS) {
+ return pp_result;
+ }
+ }
+ if(asm_out != out) {
+ fclose(asm_out);
+ }