comparison gcc/function.c @ 38:27e6f95b2c21

mearge hgtags
author e075725
date Tue, 05 Jan 2010 17:33:06 +0900
parents 9de9dad105d4 855418dad1a3
children 9907f3135723
comparison
equal deleted inserted replaced
35:3f5886e153cb 38:27e6f95b2c21
130 130
131 /* Array of INSN_UIDs to hold the INSN_UIDs for each sibcall epilogue 131 /* Array of INSN_UIDs to hold the INSN_UIDs for each sibcall epilogue
132 in this function. */ 132 in this function. */
133 static VEC(int,heap) *sibcall_epilogue; 133 static VEC(int,heap) *sibcall_epilogue;
134 134
135
136 htab_t types_used_by_vars_hash = NULL;
137 tree types_used_by_cur_var_decl = NULL;
138
135 /* Forward declarations. */ 139 /* Forward declarations. */
136 140
137 static struct temp_slot *find_temp_slot_from_address (rtx); 141 static struct temp_slot *find_temp_slot_from_address (rtx);
138 static void pad_to_arg_alignment (struct args_size *, int, struct args_size *); 142 static void pad_to_arg_alignment (struct args_size *, int, struct args_size *);
139 static void pad_below (struct args_size *, enum machine_mode, tree); 143 static void pad_below (struct args_size *, enum machine_mode, tree);
5375 #endif 5379 #endif
5376 return 0; 5380 return 0;
5377 } 5381 }
5378 5382
5379 /* Insert a TYPE into the used types hash table of CFUN. */ 5383 /* Insert a TYPE into the used types hash table of CFUN. */
5384
5380 static void 5385 static void
5381 used_types_insert_helper (tree type, struct function *func) 5386 used_types_insert_helper (tree type, struct function *func)
5382 { 5387 {
5383 if (type != NULL && func != NULL) 5388 if (type != NULL && func != NULL)
5384 { 5389 {
5399 { 5404 {
5400 while (POINTER_TYPE_P (t) || TREE_CODE (t) == ARRAY_TYPE) 5405 while (POINTER_TYPE_P (t) || TREE_CODE (t) == ARRAY_TYPE)
5401 t = TREE_TYPE (t); 5406 t = TREE_TYPE (t);
5402 t = TYPE_MAIN_VARIANT (t); 5407 t = TYPE_MAIN_VARIANT (t);
5403 if (debug_info_level > DINFO_LEVEL_NONE) 5408 if (debug_info_level > DINFO_LEVEL_NONE)
5404 used_types_insert_helper (t, cfun); 5409 {
5410 if (cfun)
5411 used_types_insert_helper (t, cfun);
5412 else
5413 /* So this might be a type referenced by a global variable.
5414 Record that type so that we can later decide to emit its debug
5415 information. */
5416 types_used_by_cur_var_decl =
5417 tree_cons (t, NULL, types_used_by_cur_var_decl);
5418
5419 }
5420 }
5421
5422 /* Helper to Hash a struct types_used_by_vars_entry. */
5423
5424 static hashval_t
5425 hash_types_used_by_vars_entry (const struct types_used_by_vars_entry *entry)
5426 {
5427 gcc_assert (entry && entry->var_decl && entry->type);
5428
5429 return iterative_hash_object (entry->type,
5430 iterative_hash_object (entry->var_decl, 0));
5431 }
5432
5433 /* Hash function of the types_used_by_vars_entry hash table. */
5434
5435 hashval_t
5436 types_used_by_vars_do_hash (const void *x)
5437 {
5438 const struct types_used_by_vars_entry *entry =
5439 (const struct types_used_by_vars_entry *) x;
5440
5441 return hash_types_used_by_vars_entry (entry);
5442 }
5443
5444 /*Equality function of the types_used_by_vars_entry hash table. */
5445
5446 int
5447 types_used_by_vars_eq (const void *x1, const void *x2)
5448 {
5449 const struct types_used_by_vars_entry *e1 =
5450 (const struct types_used_by_vars_entry *) x1;
5451 const struct types_used_by_vars_entry *e2 =
5452 (const struct types_used_by_vars_entry *)x2;
5453
5454 return (e1->var_decl == e2->var_decl && e1->type == e2->type);
5455 }
5456
5457 /* Inserts an entry into the types_used_by_vars_hash hash table. */
5458
5459 void
5460 types_used_by_var_decl_insert (tree type, tree var_decl)
5461 {
5462 if (type != NULL && var_decl != NULL)
5463 {
5464 void **slot;
5465 struct types_used_by_vars_entry e;
5466 e.var_decl = var_decl;
5467 e.type = type;
5468 if (types_used_by_vars_hash == NULL)
5469 types_used_by_vars_hash =
5470 htab_create_ggc (37, types_used_by_vars_do_hash,
5471 types_used_by_vars_eq, NULL);
5472 slot = htab_find_slot_with_hash (types_used_by_vars_hash, &e,
5473 hash_types_used_by_vars_entry (&e), INSERT);
5474 if (*slot == NULL)
5475 {
5476 struct types_used_by_vars_entry *entry;
5477 entry = (struct types_used_by_vars_entry*) ggc_alloc
5478 (sizeof (struct types_used_by_vars_entry));
5479 entry->type = type;
5480 entry->var_decl = var_decl;
5481 *slot = entry;
5482 }
5483 }
5405 } 5484 }
5406 5485
5407 struct rtl_opt_pass pass_leaf_regs = 5486 struct rtl_opt_pass pass_leaf_regs =
5408 { 5487 {
5409 { 5488 {