Example #1
0
static struct addrmap *
addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
{
  struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
  struct addrmap_fixed *fixed;
  size_t num_transitions;

  /* Count the number of transitions in the tree.  */
  num_transitions = 0;
  splay_tree_foreach (mutable_obj->tree, splay_foreach_count, &num_transitions);

  /* Include an extra entry for the transition at zero (which fixed
     maps have, but mutable maps do not.)  */
  num_transitions++;

  fixed = obstack_alloc (obstack,
                         (sizeof (*fixed)
                          + (num_transitions
                             * sizeof (fixed->transitions[0]))));
  fixed->addrmap.funcs = &addrmap_fixed_funcs;
  fixed->num_transitions = 1;
  fixed->transitions[0].addr = 0;
  fixed->transitions[0].value = NULL;

  /* Copy all entries from the splay tree to the array, in order 
     of increasing address.  */
  splay_tree_foreach (mutable_obj->tree, splay_foreach_copy, fixed);

  /* We should have filled the array.  */
  gdb_assert (fixed->num_transitions == num_transitions);

  return (struct addrmap *) fixed;
}
Example #2
0
/* Call FN for every macro in TABLE.  */
void
macro_for_each (struct macro_table *table,
		gdb::function_view<macro_callback_fn> fn)
{
  struct macro_for_each_data datum;

  datum.fn = fn;
  datum.file = NULL;
  datum.line = 0;
  splay_tree_foreach (table->definitions, foreach_macro, &datum);
}
Example #3
0
static int
addrmap_mutable_foreach (struct addrmap *self, addrmap_foreach_fn fn,
			 void *data)
{
  struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
  struct mutable_foreach_data foreach_data;

  foreach_data.fn = fn;
  foreach_data.data = data;
  return splay_tree_foreach (mutable_obj->tree, addrmap_mutable_foreach_worker,
			     &foreach_data);
}
Example #4
0
/* Call FN for every macro in TABLE.  */
void
macro_for_each (struct macro_table *table, macro_callback_fn fn,
		void *user_data)
{
  struct macro_for_each_data datum;

  datum.fn = fn;
  datum.user_data = user_data;
  datum.file = NULL;
  datum.line = 0;
  splay_tree_foreach (table->definitions, foreach_macro, &datum);
}
Example #5
0
/* Call FN for every macro is visible in SCOPE.  */
void
macro_for_each_in_scope (struct macro_source_file *file, int line,
			 gdb::function_view<macro_callback_fn> fn)
{
  struct macro_for_each_data datum;

  datum.fn = fn;
  datum.file = file;
  datum.line = line;
  splay_tree_foreach (file->table->definitions,
		      foreach_macro_in_scope, &datum);
}
Example #6
0
gfc_constructor_base
gfc_constructor_copy (gfc_constructor_base base)
{
  gfc_constructor_base new_base;

  if (!base)
    return NULL;

  new_base = gfc_constructor_get_base ();
  splay_tree_foreach (base, node_copy_and_insert, &new_base);

  return new_base;
}
Example #7
0
/* Call FN for every macro is visible in SCOPE.  */
void
macro_for_each_in_scope (struct macro_source_file *file, int line,
			 macro_callback_fn fn, void *user_data)
{
  struct macro_for_each_data datum;

  datum.fn = fn;
  datum.user_data = user_data;
  datum.file = file;
  datum.line = line;
  splay_tree_foreach (file->table->definitions,
		      foreach_macro_in_scope, &datum);
}
Example #8
0
void
dump_time_statistics (void)
{
  struct c_fileinfo *file = get_fileinfo (input_filename);
  int this_time = get_run_time ();
  file->time += this_time - body_time;

  fprintf (stderr, "\n******\n");
  print_time ("header files (total)", header_time);
  print_time ("main file (total)", this_time - body_time);
  fprintf (stderr, "ratio = %g : 1\n",
	   (double) header_time / (double) (this_time - body_time));
  fprintf (stderr, "\n******\n");

  splay_tree_foreach (file_info_tree, dump_one_header, 0);
}
Example #9
0
void print_interval_tree(FILE * f, interval_tree tree)
{
	splay_tree_foreach(tree->splay, print_interval_tree_node, f);
}
Example #10
0
void interval_tree_sub(interval_tree tree1, interval_tree tree2)
{
	splay_tree_foreach(tree2->splay, interval_tree_sub_1, tree1);
}
Example #11
0
void interval_tree_add(interval_tree tree1, interval_tree tree2)
{
	splay_tree_foreach(tree2->splay, interval_tree_add_1, tree1);
}