aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@cygnus>1995-11-28 19:21:09 +0000
committerKen Raeburn <raeburn@cygnus>1995-11-28 19:21:09 +0000
commit6594d6b9c2069e288b56260776bcbceb43798667 (patch)
tree6cc18c631335ee2dd3972736c4afb1d454e2169d /gas/read.c
parentda954cd7b6deb1bc17f4cdb467d0cfac9a79bcb9 (diff)
downloadgdb-6594d6b9c2069e288b56260776bcbceb43798667.zip
gdb-6594d6b9c2069e288b56260776bcbceb43798667.tar.gz
gdb-6594d6b9c2069e288b56260776bcbceb43798667.tar.bz2
Clean up hash code, parameterize some actions, tweak some parameters. Hash
table entries, table allocation and control structure are larger now, but collisions are reduced and string compares even further reduced. Dump lots more statistics, especially hash code data, for --statistics. Dump statistics even in error cases. Details in ChangeLog.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/gas/read.c b/gas/read.c
index 4ae5dfb..33ad5af 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -90,12 +90,17 @@ die horribly;
#define LEX_QM 0
#endif
+#ifndef LEX_DOLLAR
+/* The a29k assembler does not permits labels to start with $. */
+#define LEX_DOLLAR 3
+#endif
+
/* used by is_... macros. our ctype[] */
char lex_type[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
- 0, 0, 0, 0, 3, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
+ 0, 0, 0, 0, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */
@@ -218,8 +223,8 @@ read_begin ()
/* Something close -- but not too close -- to a multiple of 1024.
The debugging malloc I'm using has 24 bytes of overhead. */
- obstack_begin (&notes, 5090);
- obstack_begin (&cond_obstack, 990);
+ obstack_begin (&notes, chunksize);
+ obstack_begin (&cond_obstack, chunksize);
/* Use machine dependent syntax */
for (p = line_separator_chars; *p; p++)
@@ -396,7 +401,8 @@ pop_insert (table)
{
errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop);
if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists")))
- as_fatal ("error constructing %s pseudo-op table", pop_table_name);
+ as_fatal ("error constructing %s pseudo-op table: %s", pop_table_name,
+ errtxt);
}
}
@@ -2716,32 +2722,19 @@ cons_worker (nbytes, rva)
c = 0;
do
{
- if (rva)
- {
- /* If this is an .rva pseudoop then stick
- an extra reloc in for this word. */
- int reloc;
- char *p = frag_more (0);
- exp.X_op = O_absent;
-
-#ifdef BFD_ASSEMBLER
- reloc = BFD_RELOC_RVA;
-#else
-#ifdef TC_RVA_RELOC
- reloc = TC_RVA_RELOC;
-#else
- abort();
-#endif
-#endif
- fix_new_exp (frag_now, p - frag_now->fr_literal,
- nbytes, &exp, 0, reloc);
-
- }
if (flag_mri)
parse_mri_cons (&exp, (unsigned int) nbytes);
else
TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
- emit_expr (&exp, (unsigned int) nbytes);
+
+ if (rva)
+ {
+ if (exp.X_op == O_symbol)
+ exp.X_op = O_symbol_rva;
+ else
+ as_fatal ("rva without symbol");
+ }
+ emit_expr (&exp, (unsigned int) nbytes);
++c;
}
while (*input_line_pointer++ == ',');
@@ -3733,9 +3726,7 @@ demand_copy_C_string (len_pointer)
{
register int len;
- for (len = *len_pointer;
- len > 0;
- len--)
+ for (len = *len_pointer; len > 0; len--)
{
if (*s == 0)
{
@@ -3746,7 +3737,7 @@ demand_copy_C_string (len_pointer)
}
}
}
- return (s);
+ return s;
}
/*
@@ -3934,4 +3925,11 @@ s_ignore (arg)
}
+void
+read_print_statistics (file)
+ FILE *file;
+{
+ hash_print_statistics (file, "pseudo-op table", po_hash);
+}
+
/* end of read.c */