This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[vms/committed]: Remove alpha_evax_proc_hash in gas/config/tc-alpha.c
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils Development <binutils at sourceware dot org>
- Date: Tue, 28 Jun 2011 09:39:55 +0200
- Subject: [vms/committed]: Remove alpha_evax_proc_hash in gas/config/tc-alpha.c
Hi,
the linkage data were stored in an hash table. This was simply a waste of time and memory as functions cannot be nested and thus there is only one linkage structure being built.
This patch thus simplify the code.
Applied on trunk.
Tristan.
gas/
2011-06-28 Tristan Gingold <gingold@adacore.com>
* config/tc-alpha.c (alpha_evax_proc_hash): Remove.
(alpha_evax_proc_data): New variable.
(s_alpha_ent): Prevent nested function. Remove has_insert call.
(s_alpha_pdesc): Do not call demand_empty_rest_of_line in case of
error. Do not search in the hash table. Check if match with .ent.
(s_alpha_name): Remove unused variable.
(md_begin): Remove initialization of alpha_evax_proc_hash.
Index: tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.92
diff -c -r1.92 tc-alpha.c
*** tc-alpha.c 27 Jun 2011 14:08:15 -0000 1.92
--- tc-alpha.c 28 Jun 2011 07:27:45 -0000
***************
*** 293,300 ****
#undef AXP_REG_GP
#define AXP_REG_GP AXP_REG_PV
- static struct hash_control *alpha_evax_proc_hash;
-
#endif /* OBJ_EVAX */
/* The cpu for which we are generating code. */
--- 293,298 ----
***************
*** 429,434 ****
--- 427,433 ----
/* Current procedure descriptor. */
static struct alpha_evax_procs *alpha_evax_proc;
+ static struct alpha_evax_procs alpha_evax_proc_data;
static int alpha_flag_hash_long_names = 0; /* -+ */
static int alpha_flag_show_after_trunc = 0; /* -H */
***************
*** 4356,4363 ****
symbolS *symbol;
expressionS symexpr;
! alpha_evax_proc
! = (struct alpha_evax_procs *) xmalloc (sizeof (struct alpha_evax_procs));
alpha_evax_proc->pdsckind = 0;
alpha_evax_proc->framereg = -1;
--- 4355,4364 ----
symbolS *symbol;
expressionS symexpr;
! if (alpha_evax_proc != NULL)
! as_bad (_("previous .ent not closed by a .end"));
!
! alpha_evax_proc = &alpha_evax_proc_data;
alpha_evax_proc->pdsckind = 0;
alpha_evax_proc->framereg = -1;
***************
*** 4385,4394 ****
symbol_get_bfdsym (symbol)->flags |= BSF_FUNCTION;
alpha_evax_proc->symbol = symbol;
- (void) hash_insert
- (alpha_evax_proc_hash,
- symbol_get_bfdsym (alpha_evax_proc->symbol)->name, (PTR)alpha_evax_proc);
-
demand_empty_rest_of_line ();
}
--- 4386,4391 ----
***************
*** 4476,4523 ****
register char *p;
expressionS exp;
symbolS *entry_sym;
- fixS *fixp;
- segment_info_type *seginfo = seg_info (alpha_link_section);
const char *entry_sym_name;
! char *sym_name;
! int len;
if (now_seg != alpha_link_section)
{
as_bad (_(".pdesc directive not in link (.link) section"));
- demand_empty_rest_of_line ();
return;
}
expression (&exp);
if (exp.X_op != O_symbol)
{
! as_warn (_(".pdesc directive has no entry symbol"));
! demand_empty_rest_of_line ();
return;
}
entry_sym = make_expr_symbol (&exp);
! entry_sym_name = symbol_get_bfdsym (entry_sym)->name;
/* Strip "..en". */
len = strlen (entry_sym_name);
! sym_name = (char *) xmalloc (len - 4 + 1);
! strncpy (sym_name, entry_sym_name, len - 4);
! sym_name [len - 4] = 0;
!
! alpha_evax_proc = (struct alpha_evax_procs *)
! hash_find (alpha_evax_proc_hash, sym_name);
!
! if (!alpha_evax_proc || !S_IS_DEFINED (alpha_evax_proc->symbol))
{
! as_fatal (_(".pdesc has no matching .ent"));
! demand_empty_rest_of_line ();
return;
}
/* Define pdesc symbol. */
! define_sym_at_dot (alpha_evax_proc->symbol);
/* Save bfd symbol of proc entry in function symbol. */
((struct evax_private_udata_struct *)
--- 4473,4520 ----
register char *p;
expressionS exp;
symbolS *entry_sym;
const char *entry_sym_name;
! const char *pdesc_sym_name;
! fixS *fixp;
! size_t len;
if (now_seg != alpha_link_section)
{
as_bad (_(".pdesc directive not in link (.link) section"));
return;
}
expression (&exp);
if (exp.X_op != O_symbol)
{
! as_bad (_(".pdesc directive has no entry symbol"));
return;
}
entry_sym = make_expr_symbol (&exp);
! entry_sym_name = S_GET_NAME (entry_sym);
/* Strip "..en". */
len = strlen (entry_sym_name);
! if (len < 4 || strcmp (entry_sym_name + len - 4, "..en") != 0)
{
! as_bad (_(".pdesc has a bad entry symbol"));
! return;
! }
! len -= 4;
! pdesc_sym_name = S_GET_NAME (alpha_evax_proc->symbol);
!
! if (!alpha_evax_proc
! || !S_IS_DEFINED (alpha_evax_proc->symbol)
! || strlen (pdesc_sym_name) != len
! || memcmp (entry_sym_name, pdesc_sym_name, len) != 0)
! {
! as_fatal (_(".pdesc doesn't match with last .ent"));
return;
}
/* Define pdesc symbol. */
! symbol_set_value_now (alpha_evax_proc->symbol);
/* Save bfd symbol of proc entry in function symbol. */
((struct evax_private_udata_struct *)
***************
*** 4651,4657 ****
{
char *p;
expressionS exp;
- segment_info_type *seginfo = seg_info (alpha_link_section);
if (now_seg != alpha_link_section)
{
--- 4648,4653 ----
***************
*** 5518,5524 ****
#ifdef OBJ_EVAX
create_literal_section (".link", &alpha_link_section, &alpha_link_symbol);
- alpha_evax_proc_hash = hash_new ();
#endif
#ifdef OBJ_ELF
--- 5514,5519 ----