void timevar_pop (timevar_id_t timevar) { struct timevar_time_def now; struct timevar_stack_def *popped = stack; if (!timevar_enable) return; if (&timevars[timevar] != stack->timevar) { sorry ("cannot timevar_pop '%s' when top of timevars stack is '%s'", timevars[timevar].name, stack->timevar->name); abort (); } /* What time is it? */ get_time (&now); /* Attribute the elapsed time to the element we're popping. */ timevar_accumulate (&popped->timevar->elapsed, &start_time, &now); /* Reset the start time; from now on, time is attributed to the element just exposed on the stack. */ start_time = now; /* Take the item off the stack. */ stack = stack->next; /* Don't delete the stack element; instead, add it to the list of unused elements for later use. */ popped->next = unused_stack_instances; unused_stack_instances = popped; }
static void sorry_no_eh () { static int warned = 0; if (! warned) { sorry ("exception handling not supported"); warned = 1; } }
// llvm_emit_code_for_current_function - Top level interface for emitting a // function to the .s file. void llvm_emit_code_for_current_function(tree fndecl) { if (cfun->nonlocal_goto_save_area) sorry("%Jnon-local gotos not supported by LLVM", fndecl); if (errorcount || sorrycount) { TREE_ASM_WRITTEN(fndecl) = 1; return; // Do not process broken code. } timevar_push(TV_LLVM_FUNCS); // Convert the AST to raw/ugly LLVM code. Function *Fn; { TreeToLLVM Emitter(fndecl); // Set up parameters and prepare for return, for the function. Emitter.StartFunctionBody(); // Emit the body of the function. Emitter.Emit(DECL_SAVED_TREE(fndecl), 0); // Wrap things up. Fn = Emitter.FinishFunctionBody(); } #if 0 if (dump_file) { fprintf (dump_file, "\n\n;;\n;; Full LLVM generated for this function:\n;;\n"); Fn->dump(); } #endif if (PerFunctionPasses) PerFunctionPasses->run(*Fn); // TODO: Nuke the .ll code for the function at -O[01] if we don't want to // inline it or something else. // There's no need to defer outputting this function any more; we // know we want to output it. DECL_DEFER_OUTPUT(fndecl) = 0; // Finally, we have written out this function! TREE_ASM_WRITTEN(fndecl) = 1; timevar_pop(TV_LLVM_FUNCS); }
/// ValidateRegisterVariable - Check that a static "asm" variable is /// well-formed. If not, emit error messages and return true. If so, return /// false. bool ValidateRegisterVariable(tree decl) { const char *Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); int RegNumber = decode_reg_name(Name); const Type *Ty = ConvertType(TREE_TYPE(decl)); // If this has already been processed, don't emit duplicate error messages. if (DECL_LLVM_SET_P(decl)) { // Error state encoded into DECL_LLVM. return cast<ConstantInt>(DECL_LLVM(decl))->getZExtValue(); } /* Detect errors in declaring global registers. */ if (RegNumber == -1) error("%Jregister name not specified for %qD", decl, decl); else if (RegNumber < 0) error("%Jinvalid register name for %qD", decl, decl); else if (TYPE_MODE(TREE_TYPE(decl)) == BLKmode) error("%Jdata type of %qD isn%'t suitable for a register", decl, decl); #if 0 // FIXME: enable this. else if (!HARD_REGNO_MODE_OK(RegNumber, TYPE_MODE(TREE_TYPE(decl)))) error("%Jregister specified for %qD isn%'t suitable for data type", decl, decl); #endif else if (DECL_INITIAL(decl) != 0 && TREE_STATIC(decl)) error("global register variable has initial value"); else if (!Ty->isFirstClassType()) sorry("%JLLVM cannot handle register variable %qD, report a bug", decl, decl); else { if (TREE_THIS_VOLATILE(decl)) warning("volatile register variables don%'t work as you might wish"); SET_DECL_LLVM(decl, ConstantInt::getFalse()); return false; // Everything ok. } SET_DECL_LLVM(decl, ConstantInt::getTrue()); return true; }
main() { char *all_in = NULL ; char *grp_in = NULL ; char *fam_in = NULL ; char *gen_in = NULL ; char *spec_in = NULL ; char *x_in = NULL, *y_in = NULL ; char *loc_in = NULL ; char *loc_name = NULL ; char query_str[512] ; void *qd, *lp=NULL ; taxon *root, *grp_p, *fam_p, *gen_p, *spe_p, *inf_p ; char grp_out[32], fam_out[32], gen_out[32], spec_out[32] ; decode_query_string(8, "all", &all_in, "grp", &grp_in, "fam", &fam_in, "gen", &gen_in, "spec", &spec_in, "x", &x_in, "y", &y_in, "loc", &loc_in) ; if (nonempty(x_in)) { loc_in = map_convert_xy_to_name(atoi(x_in),atoi(y_in), "/bwg/FLORA/cgi/maps", "ca_pswrs", "abbr") ; if (loc_in == NULL) { return_nothing() ; exit(1) ; } } if (nonempty(loc_in)) loc_name = map_convert_region_name("/bwg/FLORA/cgi/maps", "ca_pswrs", "abbr", "name", loc_in) ; if (!mg_db_available("/bwg/FLORA/calflora/mgdata", "calmap")) { return_header("text/html") ; sorry() ; exit(1) ; } if (nonempty(all_in)) sprintf(query_str, "qqall") ; else if (nonempty(grp_in)) sprintf(query_str, "qqgro%s", grp_in) ; else if (nonempty(fam_in)) sprintf(query_str, "qqfam%s", fam_in) ; else if (nonempty(gen_in)) { if (nonempty(spec_in)) sprintf(query_str, "qqgen%s&qqspe%s", gen_in, spec_in) ; else sprintf(query_str, "qqgen%s", gen_in) ; } else { return_header("text/html") ; printf("<title>Sorry!</title>") ; printf("<h1>Sorry!</h1>") ; printf("Your list query to the CalFlora plant ") ; printf("distributions database was improperly formed.") ; printf("Please check that the URL ") ; printf("is properly formed, and contact Erich Schneider ") ; printf("<a href=\"mailto:[email protected]\">(<b>[email protected]") ; printf("</b>)</a> if you have further problems.") ; exit(1) ; } if (nonempty(loc_in)) sprintf(query_str+strlen(query_str), "&(qqcpl%s|qqupl%s|qqijl%s)", loc_in, loc_in, loc_in) ; mg_bool_query(query_str, "/herbaria/FLORA/calflora/mgdata", "calmap",&qd); if (mg_get_num_returned(qd) == 0) { if (nonempty(x_in)) { return_nothing() ; exit(1) ; } else { return_header("text/html") ; printf("<title>Sorry!</title>") ; printf("<h1>Sorry!</h1>") ; printf("Your request did not correspond to any items in the CalFlora ") ; printf("plant distributions database. Please check that the URL ") ; printf("is properly formed, and contact Erich Schneider ") ; printf("<a href=\"mailto:[email protected]\">(<b>[email protected]") ; printf("</b>)</a> if you have further problems.") ; exit(0) ; } } root = NULL ; do { int first=1 ; char *grp, fam[32], gen[32], spec[32], infra[32], source[64] ; char name[256], rank ; item_data_t *item_data ; mg_setup_doc_line_producer(qd, mg_get_doc_num(qd), &lp) ; while (mg_dlp_more_lines(lp)) { char s[256] ; mg_dlp_next_line(lp, s) ; if (first) { if (!strncmp(s, "qqgro", 5)) strcpy(grp_out, s+5) ; else if (!strncmp(s, "qqfam", 5)) strcpy(fam_out, s+5) ; else if (!strncmp(s, "qqgen", 5)) strcpy(gen_out, s+5) ; else if (!strncmp(s, "qqspe", 5)) strcpy(spec_out, strchr(s, ' ')+1) ; } if (!strncmp(s, "qqgro", 5)) { if (!strcmp(s+5, "Pteridophyte")) grp = "1Pteridophytes"; else if (!strcmp(s+5, "Gymnosperm")) grp="2Gymnosperms"; else if (!strcmp(s+5, "Dicot")) grp="3Dicots"; else if (!strcmp(s+5, "Monocot")) grp="4Monocots"; } else if (!strncmp(s, "qqfam", 5)) strcpy(fam, s+5) ; else if (!strncmp(s, "qqgen", 5)) strcpy(gen, s+5) ; else if (!strncmp(s, "qqspe", 5)) strcpy(spec, strchr(s, ' ')+1) ; else if (!strncmp(s, "qqtri", 5)) strcpy(infra, s+5) ; else if (!strncmp(s, "qqnam", 5)) strcpy(name, s+6) ; else if (!strncmp(s, "qqsrc", 5)) strcpy(source, s+6) ; else if (!strncmp(s, "qqrnk", 5)) rank = s[5] ; } grp_p = insert_taxon_item(&root, grp, NULL, 0) ; fam_p = insert_taxon_child(grp_p, fam, NULL, 0) ; gen_p = insert_taxon_child(fam_p, gen, NULL, 0) ; spe_p = insert_taxon_child(gen_p, spec, NULL, 0) ; item_data = (item_data_t *)malloc(sizeof(item_data_t)) ; item_data->name = strdup(name) ; if (strcmp(source, "No distribution source referenced")) item_data->has_dist = 1 ; else item_data->has_dist = 0 ; if (rank == 'b') { inf_p = insert_taxon_child(spe_p, infra, item_data, 1) ; } else { spe_p->other_data = item_data ; } first = 0 ; } while (mg_goto_next_doc(qd)) ; return_header("text/html") ; header() ; puts("<h1>") ; if (nonempty(all_in)) { printf("Plants ") ; if (nonempty(loc_name)) printf("of %s", loc_name) ; else printf("of California") ; } else if (nonempty(grp_in)) { printf("%ss ", grp_out) ; if (nonempty(loc_name)) printf("of %s", loc_name) ; else printf("of California") ; } else if (nonempty(fam_in)) { printf("Plants of family %s ", fam_out) ; if (nonempty(loc_name)) printf("in %s", loc_name) ; else printf("in California") ; } else if (nonempty(gen_in)) { if (!nonempty(spec_in)) printf("Plants of genus <i>%s</i> ", gen_out) ; else printf("Varieties/subspecies of <i>%s %s</i> ", gen_out, spec_out) ; if (nonempty(loc_name)) printf("in %s", loc_name) ; else printf("in California") ; } puts("</h1>") ; printf("Links in the list below go to diversity maps of the item ") ; printf("in question, or to distribution maps if the item is a ") ; printf("bottom-level species (indicated by the presence of an ") ; printf("authority). Species containing varieities or subspecies ") ; printf("which have distribution data in their own right have links ") ; printf("both to diversity maps of their infraspecific taxa as well ") ; printf("as to a map of their own distribution. A map of ") ; printf("<a href=\"/FLORA/cgi/calmap?all=yes&div=yes\">") ; printf("all California plants</a> in the database is also available.") ; printf("<p>") ; for (grp_p = root ; grp_p != NULL ; step_taxon(grp_p)) { printf("<a href=\"/FLORA/cgi/calmap?div=yes&grp=") ; switch(grp_p->name[0]) { case '1': printf("pteridophyte") ; break ; case '2': printf("gymnosperm") ; break ; case '3': printf("dicot") ; break ; case '4': printf("monocot") ; break ; } printf("\">") ; printf("%s", grp_p->name+1) ; printf("</a>") ; puts("<br><ul>") ; for (fam_p = grp_p->nextlevel ; fam_p != NULL ; step_taxon(fam_p)) { printf("Family ") ; printf("<a href=\"/FLORA/cgi/calmap?div=yes&fam=%s\">", fam_p->name) ; printf("%s", fam_p->name) ; printf("</a>") ; puts("<br><ul>") ; for (gen_p = fam_p->nextlevel ; gen_p != NULL ; step_taxon(gen_p)) { printf("Genus ") ; printf("<a href=\"/FLORA/cgi/calmap?div=yes&gen=%s\">", gen_p->name) ; printf("<i>%s</i>", gen_p->name) ; printf("</a>") ; printf("<br><ul>") ; for (spe_p = gen_p->nextlevel ; spe_p != NULL ; step_taxon(spe_p)) { int spec_has_own_identity = 0 ; int spec_has_infras = 0 ; int spec_has_distribution = 0 ; if (spe_p->other_data != NULL) spec_has_own_identity = 1 ; if (spe_p->nextlevel != NULL) spec_has_infras = 1 ; if (spec_has_own_identity && ((item_data_t *)spe_p->other_data)->has_dist) spec_has_distribution = 1; if (spec_has_distribution || spec_has_infras) { printf("<a href=\"/FLORA/cgi/calmap?") ; if (spec_has_infras) printf("div=yes&") ; printf("gen=%s&spec=%s\">", gen_p->name, spe_p->name) ; } if (spec_has_own_identity) { printf("%s", ((item_data_t *)spe_p->other_data)->name) ; } else { printf("<i>%s %s</i>", gen_p->name, spe_p->name) ; } if (spec_has_distribution || spec_has_infras) printf("</a>") ; if (spec_has_distribution && spec_has_infras) { printf(" <a href=\"/FLORA/cgi/calmap?") ; printf("gen=%s&spec=%s\">(species distribution)</a>", gen_p->name, spe_p->name) ; } if (!spec_has_distribution && !spec_has_infras) printf(" (No distribution data in database)") ; puts("<br>") ; if (spec_has_infras) { puts("<ul>") ; for (inf_p = spe_p->nextlevel ; inf_p != NULL ; step_taxon(inf_p)) { if (((item_data_t *)inf_p->other_data)->has_dist) { printf("<a href=\"/FLORA/cgi/calmap?") ; printf("gen=%s&spec=%s&inf=%s\">", gen_p->name, spe_p->name, inf_p->name) ; } printf("%s", ((item_data_t *)inf_p->other_data)->name) ; if (((item_data_t *)inf_p->other_data)->has_dist) printf("</a>") ; else printf(" (No distribution data in database)") ; puts("<br>") ; } puts("</ul>") ; } } puts("</ul>") ; } puts("</ul>") ; } puts("</ul>") ; } footer() ; }
void graphite_transform_loops (void) { sorry ("Graphite loop optimizations cannot be used"); }
/* Stub routine to tell people that this doesn't work yet. */ void c_reset_state (void) { sorry ("inter-module optimisations not implemented yet"); }
static void nogo (void) { sorry ("mudflap: this language is not supported"); }
static void handle_pragma_vtable (cpp_reader* /*dfile*/) { parse_strconst_pragma ("vtable", 0); sorry ("#pragma vtable no longer supported"); }
bool gfc_post_options (const char **pfilename) { const char *filename = *pfilename, *canon_source_file = NULL; char *source_path; int i; /* Excess precision other than "fast" requires front-end support. */ if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD && TARGET_FLT_EVAL_METHOD_NON_DEFAULT) sorry ("-fexcess-precision=standard for Fortran"); flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; /* Whole program needs whole file mode. */ if (flag_whole_program) gfc_option.flag_whole_file = 1; /* Enable whole-file mode if LTO is in effect. */ if (flag_lto) gfc_option.flag_whole_file = 1; /* Fortran allows associative math - but we cannot reassociate if we want traps or signed zeros. Cf. also flag_protect_parens. */ if (flag_associative_math == -1) flag_associative_math = (!flag_trapping_math && !flag_signed_zeros); /* By default, disable (re)allocation during assignment for -std=f95, and enable it for F2003/F2008/GNU/Legacy. */ if (gfc_option.flag_realloc_lhs == -1) { if (gfc_option.allow_std & GFC_STD_F2003) gfc_option.flag_realloc_lhs = 1; else gfc_option.flag_realloc_lhs = 0; } /* -fbounds-check is equivalent to -fcheck=bounds */ if (flag_bounds_check) gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS; if (flag_compare_debug) gfc_option.dump_fortran_original = 0; /* Make -fmax-errors visible to gfortran's diagnostic machinery. */ if (global_options_set.x_flag_max_errors) gfc_option.max_errors = flag_max_errors; /* Verify the input file name. */ if (!filename || strcmp (filename, "-") == 0) { filename = ""; } if (gfc_option.flag_preprocessed) { /* For preprocessed files, if the first tokens are of the form # NUM. handle the directives so we know the original file name. */ gfc_source_file = gfc_read_orig_filename (filename, &canon_source_file); if (gfc_source_file == NULL) gfc_source_file = filename; else *pfilename = gfc_source_file; } else gfc_source_file = filename; if (canon_source_file == NULL) canon_source_file = gfc_source_file; /* Adds the path where the source file is to the list of include files. */ i = strlen (canon_source_file); while (i > 0 && !IS_DIR_SEPARATOR (canon_source_file[i])) i--; if (i != 0) { source_path = (char *) alloca (i + 1); memcpy (source_path, canon_source_file, i); source_path[i] = 0; gfc_add_include_path (source_path, true, true); } else gfc_add_include_path (".", true, true); if (canon_source_file != gfc_source_file) gfc_free (CONST_CAST (char *, canon_source_file)); /* Decide which form the file will be read in as. */ if (gfc_option.source_form != FORM_UNKNOWN) gfc_current_form = gfc_option.source_form; else { gfc_current_form = form_from_filename (filename); if (gfc_current_form == FORM_UNKNOWN) { gfc_current_form = FORM_FREE; gfc_warning_now ("Reading file '%s' as free form", (filename[0] == '\0') ? "<stdin>" : filename); } } /* If the user specified -fd-lines-as-{code|comments} verify that we're in fixed form. */ if (gfc_current_form == FORM_FREE) { if (gfc_option.flag_d_lines == 0) gfc_warning_now ("'-fd-lines-as-comments' has no effect " "in free form"); else if (gfc_option.flag_d_lines == 1) gfc_warning_now ("'-fd-lines-as-code' has no effect in free form"); } /* If -pedantic, warn about the use of GNU extensions. */ if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0) gfc_option.warn_std |= GFC_STD_GNU; /* -std=legacy -pedantic is effectively -std=gnu. */ if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0) gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_LEGACY; /* If the user didn't explicitly specify -f(no)-second-underscore we use it if we're trying to be compatible with f2c, and not otherwise. */ if (gfc_option.flag_second_underscore == -1) gfc_option.flag_second_underscore = gfc_option.flag_f2c; if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2 && gfc_option.flag_max_stack_var_size != 0) gfc_warning_now ("Flag -fno-automatic overwrites -fmax-stack-var-size=%d", gfc_option.flag_max_stack_var_size); else if (!gfc_option.flag_automatic && gfc_option.flag_recursive) gfc_warning_now ("Flag -fno-automatic overwrites -frecursive"); else if (!gfc_option.flag_automatic && gfc_option.gfc_flag_openmp) gfc_warning_now ("Flag -fno-automatic overwrites -frecursive implied by " "-fopenmp"); else if (gfc_option.flag_max_stack_var_size != -2 && gfc_option.flag_recursive) gfc_warning_now ("Flag -frecursive overwrites -fmax-stack-var-size=%d", gfc_option.flag_max_stack_var_size); else if (gfc_option.flag_max_stack_var_size != -2 && gfc_option.gfc_flag_openmp) gfc_warning_now ("Flag -fmax-stack-var-size=%d overwrites -frecursive " "implied by -fopenmp", gfc_option.flag_max_stack_var_size); /* Implement -frecursive as -fmax-stack-var-size=-1. */ if (gfc_option.flag_recursive) gfc_option.flag_max_stack_var_size = -1; /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */ if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.gfc_flag_openmp && gfc_option.flag_automatic) { gfc_option.flag_recursive = 1; gfc_option.flag_max_stack_var_size = -1; } /* Set default. */ if (gfc_option.flag_max_stack_var_size == -2) gfc_option.flag_max_stack_var_size = 32768; /* Implement -fno-automatic as -fmax-stack-var-size=0. */ if (!gfc_option.flag_automatic) gfc_option.flag_max_stack_var_size = 0; if (pedantic) { gfc_option.warn_ampersand = 1; gfc_option.warn_tabs = 0; } if (pedantic && gfc_option.flag_whole_file) gfc_option.flag_whole_file = 2; gfc_cpp_post_options (); /* FIXME: return gfc_cpp_preprocess_only (); The return value of this function indicates whether the backend needs to be initialized. On -E, we don't need the backend. However, if we return 'true' here, an ICE occurs. Initializing the backend doesn't hurt much, hence, for now we can live with it as is. */ return false; }
void streamer_write_builtin (struct output_block *ob, tree expr) { gcc_assert (streamer_handle_as_builtin_p (expr)); if (DECL_BUILT_IN_CLASS (expr) == BUILT_IN_MD && !targetm.builtin_decl) sorry ("tree bytecode streams do not support machine specific builtin " "functions on this target"); streamer_write_record_start (ob, LTO_builtin_decl); streamer_write_enum (ob->main_stream, built_in_class, BUILT_IN_LAST, DECL_BUILT_IN_CLASS (expr)); streamer_write_uhwi (ob, DECL_FUNCTION_CODE (expr)); if (DECL_ASSEMBLER_NAME_SET_P (expr)) { /* When the assembler name of a builtin gets a user name, the new name is always prefixed with '*' by set_builtin_user_assembler_name. So, to prevent the reader side from adding a second '*', we omit it here. */ const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (expr)); if (strlen (str) > 1 && str[0] == '*') streamer_write_string (ob, ob->main_stream, &str[1], true); else streamer_write_string (ob, ob->main_stream, NULL, true); } else streamer_write_string (ob, ob->main_stream, NULL, true); }