Esempio n. 1
0
struct target_globals *
save_target_globals (void)
{
  struct target_globals *g = ggc_cleared_alloc <target_globals> ();
  g->flag_state = XCNEW (struct target_flag_state);
  g->regs = XCNEW (struct target_regs);
  g->rtl = ggc_cleared_alloc<target_rtl> ();
  g->recog = XCNEW (struct target_recog);
  g->hard_regs = XCNEW (struct target_hard_regs);
  g->reload = XCNEW (struct target_reload);
  g->expmed = XCNEW (struct target_expmed);
  g->optabs = XCNEW (struct target_optabs);
  g->libfuncs = ggc_cleared_alloc<target_libfuncs> ();
  g->cfgloop = XCNEW (struct target_cfgloop);
  g->ira = XCNEW (struct target_ira);
  g->ira_int = XCNEW (struct target_ira_int);
  g->builtins = XCNEW (struct target_builtins);
  g->gcse = XCNEW (struct target_gcse);
  g->bb_reorder = XCNEW (struct target_bb_reorder);
  g->lower_subreg = XCNEW (struct target_lower_subreg);
  restore_target_globals (g);
  init_reg_sets ();
  target_reinit ();
  return g;
}
Esempio n. 2
0
struct target_globals *
save_target_globals (void)
{
  struct target_globals *g;
  struct target_globals_extra {
    struct target_globals g;
    struct target_flag_state flag_state;
    struct target_optabs optabs;
    struct target_cfgloop cfgloop;
    struct target_builtins builtins;
    struct target_gcse gcse;
    struct target_bb_reorder bb_reorder;
    struct target_lower_subreg lower_subreg;
  } *p;
  p = (struct target_globals_extra *)
      ggc_internal_cleared_alloc (sizeof (struct target_globals_extra));
  g = (struct target_globals *) p;
  g->flag_state = &p->flag_state;
  g->regs = ggc_internal_cleared_alloc (sizeof (struct target_regs));
  g->rtl = ggc_cleared_alloc<target_rtl> ();
  g->recog = ggc_internal_cleared_alloc (sizeof (struct target_recog));
  g->hard_regs
    = ggc_internal_cleared_alloc (sizeof (struct target_hard_regs));
  g->reload = ggc_internal_cleared_alloc (sizeof (struct target_reload));
  g->expmed =  ggc_internal_cleared_alloc (sizeof (struct target_expmed));
  g->optabs = &p->optabs;
  g->libfuncs = ggc_cleared_alloc<target_libfuncs> ();
  g->cfgloop = &p->cfgloop;
  g->ira = ggc_internal_cleared_alloc (sizeof (struct target_ira));
  g->ira_int = ggc_internal_cleared_alloc (sizeof (struct target_ira_int));
  g->builtins = &p->builtins;
  g->gcse = &p->gcse;
  g->bb_reorder = &p->bb_reorder;
  g->lower_subreg = &p->lower_subreg;
  restore_target_globals (g);
  init_reg_sets ();
  target_reinit ();
  return g;
}
Esempio n. 3
0
void
general_init(const char *argv0)
{
  const char *p;

  p = argv0 + strlen(argv0);
  while(p != argv0 && !IS_DIR_SEPARATOR(p[-1]))
    --p;
  progname = p;

  xmalloc_set_program_name(progname);

  hex_init();

  /* Unlock the stdio streams.  */
  unlock_std_streams();

  gcc_init_libintl();

  /* Initialize the diagnostics reporting machinery, so option parsing
     can give warnings and errors.  */
  diagnostic_initialize(global_dc);
  /* Set a default printer.  Language specific initializations will
     override it later.  */
  pp_format_decoder(global_dc->printer) = &default_tree_printer;


  /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages.  */
#ifdef SIGSEGV
  signal(SIGSEGV, crash_signal);
#endif
#ifdef SIGILL
  signal(SIGILL, crash_signal);
#endif
#ifdef SIGBUS
  signal(SIGBUS, crash_signal);
#endif
#ifdef SIGABRT
  signal(SIGABRT, crash_signal);
#endif
#if defined SIGIOT &&(!defined SIGABRT || SIGABRT != SIGIOT)
  signal(SIGIOT, crash_signal);
#endif
#ifdef SIGFPE
  signal(SIGFPE, crash_signal);
#endif

  /* Other host-specific signal setup.  */
 (*host_hooks.extra_signals)();

  /* Initialize the garbage-collector, string pools and tree type hash
     table.  */
  init_ggc();
  init_stringpool();
  linemap_init(&line_table);
  init_ttree();

  /* Initialize register usage now so switches may override.  */
  init_reg_sets();

  /* Register the language-independent parameters.  */
  add_params(lang_independent_params, LAST_PARAM);

  /* This must be done after add_params but before argument processing.  */
  init_ggc_heuristics();
  init_optimization_passes();
}