Browse Source

Add outputting_stabs_line_debug varaible and D10v code to use it

binutils-2_11-branch
Nick Clifton 26 years ago
parent
commit
bccba5f08c
  1. 24
      gas/ChangeLog
  2. 1
      gas/as.c
  3. 92
      gas/config/tc-d10v.c
  4. 7
      gas/doc/c-d10v.texi
  5. 11
      gas/dwarf2dbg.c
  6. 700
      gas/po/gas.pot
  7. 3
      gas/read.h
  8. 10
      gas/stabs.c

24
gas/ChangeLog

@ -1,3 +1,27 @@
2000-12-04 Matthew Hiller <hiller@redhat.com>
* config/tc-d10v.c (flag_allow_gstabs_packing): New variable.
(md_longopts): New options --gstabs-packing, --no-gstabs-packing.
(md_show_usage): Ditto.
(md_parse_option): Ditto.
(d10v_cleanup): Writes pending instruction only if
! outputting_stabs_line_debug || ! flag_allow_gstabs_packing.
Fix compile time warning messages.
* doc/c-d10v.texi: Documents new options.
2000-12-04 Matthew Hiller <hiller@redhat.com>
* stabs.c (outputting_stabs_line_debug): New variable.
(stabs_generate_asm_lineno): Set outputting_stabs_line_debug at
function entry and unset at function exit.
* read.h (outputting_stabs_line_debug): New extern declaration.
* as.c: Include dwarf2dbg.h for definition of dwarf2_finish.
* dwarf2dbg.c: Fix compile time warning messages.
2000-12-03 Kazu Hirata <kazu@hxi.com> 2000-12-03 Kazu Hirata <kazu@hxi.com>
* config/tc-a29k.c: Fix formatting. * config/tc-a29k.c: Fix formatting.

1
gas/as.c

@ -40,6 +40,7 @@
#include "output-file.h" #include "output-file.h"
#include "sb.h" #include "sb.h"
#include "macro.h" #include "macro.h"
#include "dwarf2dbg.h"
#ifdef HAVE_ITBL_CPU #ifdef HAVE_ITBL_CPU
#include "itbl-ops.h" #include "itbl-ops.h"

92
gas/config/tc-d10v.c

@ -24,6 +24,7 @@
#include "subsegs.h" #include "subsegs.h"
#include "opcode/d10v.h" #include "opcode/d10v.h"
#include "elf/ppc.h" #include "elf/ppc.h"
//#include "read.h"
const char comment_chars[] = ";"; const char comment_chars[] = ";";
const char line_comment_chars[] = "#"; const char line_comment_chars[] = "#";
@ -70,8 +71,13 @@ typedef int packing_type;
#define PACK_RIGHT_LEFT (3) /* "<-" */ #define PACK_RIGHT_LEFT (3) /* "<-" */
static packing_type etype = PACK_UNSPEC; /* Used by d10v_cleanup. */ static packing_type etype = PACK_UNSPEC; /* Used by d10v_cleanup. */
/* True if instruction swapping warnings should be inhibited. */ /* True if instruction swapping warnings should be inhibited.
static unsigned char flag_warn_suppress_instructionswap; /* --nowarnswap */ --nowarnswap. */
static boolean flag_warn_suppress_instructionswap;
/* True if instruction packing should be performed when --gstabs is specified.
--gstabs-packing, --no-gstabs-packing. */
static boolean flag_allow_gstabs_packing = 1;
/* Local functions. */ /* Local functions. */
static int reg_name_search PARAMS ((char *name)); static int reg_name_search PARAMS ((char *name));
@ -82,7 +88,7 @@ static bfd_reloc_code_real_type get_reloc PARAMS ((struct d10v_operand *op));
static int get_operands PARAMS ((expressionS exp[])); static int get_operands PARAMS ((expressionS exp[]));
static struct d10v_opcode *find_opcode PARAMS ((struct d10v_opcode *opcode, expressionS ops[])); static struct d10v_opcode *find_opcode PARAMS ((struct d10v_opcode *opcode, expressionS ops[]));
static unsigned long build_insn PARAMS ((struct d10v_opcode *opcode, expressionS *opers, unsigned long insn)); static unsigned long build_insn PARAMS ((struct d10v_opcode *opcode, expressionS *opers, unsigned long insn));
static void write_long PARAMS ((struct d10v_opcode *opcode, unsigned long insn, Fixups *fx)); static void write_long PARAMS ((unsigned long insn, Fixups *fx));
static void write_1_short PARAMS ((struct d10v_opcode *opcode, unsigned long insn, Fixups *fx)); static void write_1_short PARAMS ((struct d10v_opcode *opcode, unsigned long insn, Fixups *fx));
static int write_2_short PARAMS ((struct d10v_opcode *opcode1, unsigned long insn1, static int write_2_short PARAMS ((struct d10v_opcode *opcode1, unsigned long insn1,
struct d10v_opcode *opcode2, unsigned long insn2, packing_type exec_type, Fixups *fx)); struct d10v_opcode *opcode2, unsigned long insn2, packing_type exec_type, Fixups *fx));
@ -98,6 +104,12 @@ struct option md_longopts[] =
{ {
#define OPTION_NOWARNSWAP (OPTION_MD_BASE) #define OPTION_NOWARNSWAP (OPTION_MD_BASE)
{"nowarnswap", no_argument, NULL, OPTION_NOWARNSWAP}, {"nowarnswap", no_argument, NULL, OPTION_NOWARNSWAP},
#define OPTION_GSTABSPACKING (OPTION_MD_BASE + 1)
{"gstabspacking", no_argument, NULL, OPTION_GSTABSPACKING},
{"gstabs-packing", no_argument, NULL, OPTION_GSTABSPACKING},
#define OPTION_NOGSTABSPACKING (OPTION_MD_BASE + 2)
{"nogstabspacking", no_argument, NULL, OPTION_NOGSTABSPACKING},
{"no-gstabs-packing", no_argument, NULL, OPTION_NOGSTABSPACKING},
{NULL, no_argument, NULL, 0} {NULL, no_argument, NULL, 0}
}; };
@ -184,7 +196,7 @@ check_range (num, bits, flags)
int bits; int bits;
int flags; int flags;
{ {
long min, max, bit1; long min, max;
int retval = 0; int retval = 0;
/* Don't bother checking 16-bit values. */ /* Don't bother checking 16-bit values. */
@ -221,7 +233,7 @@ check_range (num, bits, flags)
{ {
max = (1 << bits) - 1; max = (1 << bits) - 1;
min = 0; min = 0;
if ((num > max) || (num < min)) if (((long) num > max) || ((long) num < min))
retval = 1; retval = 1;
} }
return retval; return retval;
@ -232,13 +244,17 @@ md_show_usage (stream)
FILE *stream; FILE *stream;
{ {
fprintf (stream, _("D10V options:\n\ fprintf (stream, _("D10V options:\n\
-O optimize. Will do some operations in parallel.\n")); -O Optimize. Will do some operations in parallel.\n\
--gstabs-packing Pack adjacent short instructions together even\n\
when --gstabs is specified. On by default.\n\
--no-gstabs-packing If --gstabs is specified, do not pack adjacent\n\
instructions together.\n"));
} }
int int
md_parse_option (c, arg) md_parse_option (c, arg)
int c; int c;
char *arg; char *arg ATTRIBUTE_UNUSED;
{ {
switch (c) switch (c)
{ {
@ -249,6 +265,12 @@ md_parse_option (c, arg)
case OPTION_NOWARNSWAP: case OPTION_NOWARNSWAP:
flag_warn_suppress_instructionswap = 1; flag_warn_suppress_instructionswap = 1;
break; break;
case OPTION_GSTABSPACKING:
flag_allow_gstabs_packing = 1;
break;
case OPTION_NOGSTABSPACKING:
flag_allow_gstabs_packing = 0;
break;
default: default:
return 0; return 0;
} }
@ -257,7 +279,7 @@ md_parse_option (c, arg)
symbolS * symbolS *
md_undefined_symbol (name) md_undefined_symbol (name)
char *name; char *name ATTRIBUTE_UNUSED;
{ {
return 0; return 0;
} }
@ -307,9 +329,9 @@ md_atof (type, litP, sizeP)
void void
md_convert_frag (abfd, sec, fragP) md_convert_frag (abfd, sec, fragP)
bfd *abfd; bfd *abfd ATTRIBUTE_UNUSED;
asection *sec; asection *sec ATTRIBUTE_UNUSED;
fragS *fragP; fragS *fragP ATTRIBUTE_UNUSED;
{ {
abort (); abort ();
} }
@ -485,7 +507,6 @@ get_operands (exp)
/* Check for identifier@word+constant. */ /* Check for identifier@word+constant. */
if (*input_line_pointer == '-' || *input_line_pointer == '+') if (*input_line_pointer == '-' || *input_line_pointer == '+')
{ {
char *orig_line = input_line_pointer;
expressionS new_exp; expressionS new_exp;
expression (&new_exp); expression (&new_exp);
exp[numops].X_add_number = new_exp.X_add_number; exp[numops].X_add_number = new_exp.X_add_number;
@ -648,8 +669,7 @@ build_insn (opcode, opers, insn)
/* Write out a long form instruction. */ /* Write out a long form instruction. */
static void static void
write_long (opcode, insn, fx) write_long (insn, fx)
struct d10v_opcode *opcode;
unsigned long insn; unsigned long insn;
Fixups *fx; Fixups *fx;
{ {
@ -1076,7 +1096,7 @@ md_assemble (str)
/* Assemble first instruction and save it. */ /* Assemble first instruction and save it. */
prev_insn = do_assemble (str, &prev_opcode); prev_insn = do_assemble (str, &prev_opcode);
if (prev_insn == -1) if (prev_insn == (unsigned long) -1)
as_fatal (_("can't find opcode ")); as_fatal (_("can't find opcode "));
fixups = fixups->next; fixups = fixups->next;
str = str2 + 2; str = str2 + 2;
@ -1084,7 +1104,7 @@ md_assemble (str)
} }
insn = do_assemble (str, &opcode); insn = do_assemble (str, &opcode);
if (insn == -1) if (insn == (unsigned long) -1)
{ {
if (extype != PACK_UNSPEC) if (extype != PACK_UNSPEC)
{ {
@ -1107,7 +1127,7 @@ md_assemble (str)
if (extype != PACK_UNSPEC) if (extype != PACK_UNSPEC)
as_fatal (_("Unable to mix instructions as specified")); as_fatal (_("Unable to mix instructions as specified"));
d10v_cleanup (); d10v_cleanup ();
write_long (opcode, insn, fixups); write_long (insn, fixups);
prev_opcode = NULL; prev_opcode = NULL;
return; return;
} }
@ -1218,7 +1238,7 @@ find_opcode (opcode, myops)
struct d10v_opcode *opcode; struct d10v_opcode *opcode;
expressionS myops[]; expressionS myops[];
{ {
int i, match, done; int i, match;
struct d10v_opcode *next_opcode; struct d10v_opcode *next_opcode;
/* Get all the operands and save them as expressions. */ /* Get all the operands and save them as expressions. */
@ -1458,7 +1478,7 @@ find_opcode (opcode, myops)
arelent * arelent *
tc_gen_reloc (seg, fixp) tc_gen_reloc (seg, fixp)
asection *seg; asection *seg ATTRIBUTE_UNUSED;
fixS *fixp; fixS *fixp;
{ {
arelent *reloc; arelent *reloc;
@ -1486,8 +1506,8 @@ tc_gen_reloc (seg, fixp)
int int
md_estimate_size_before_relax (fragp, seg) md_estimate_size_before_relax (fragp, seg)
fragS *fragp; fragS *fragp ATTRIBUTE_UNUSED;
asection *seg; asection *seg ATTRIBUTE_UNUSED;
{ {
abort (); abort ();
return 0; return 0;
@ -1509,7 +1529,7 @@ int
md_apply_fix3 (fixp, valuep, seg) md_apply_fix3 (fixp, valuep, seg)
fixS *fixp; fixS *fixp;
valueT *valuep; valueT *valuep;
segT seg; segT seg ATTRIBUTE_UNUSED;
{ {
char *where; char *where;
unsigned long insn; unsigned long insn;
@ -1582,8 +1602,8 @@ md_apply_fix3 (fixp, valuep, seg)
rep = (struct d10v_opcode *) hash_find (d10v_hash, "rep"); rep = (struct d10v_opcode *) hash_find (d10v_hash, "rep");
repi = (struct d10v_opcode *) hash_find (d10v_hash, "repi"); repi = (struct d10v_opcode *) hash_find (d10v_hash, "repi");
if ((insn & FM11) == FM11 if ((insn & FM11) == FM11
&& ((repi != NULL && (insn & repi->mask) == repi->opcode) && ( (repi != NULL && (insn & repi->mask) == (unsigned) repi->opcode)
|| (rep != NULL && (insn & rep->mask) == rep->opcode)) || (rep != NULL && (insn & rep->mask) == (unsigned) rep->opcode))
&& value < 4) && value < 4)
as_fatal as_fatal
(_("line %d: rep or repi must include at least 4 instructions"), (_("line %d: rep or repi must include at least 4 instructions"),
@ -1612,8 +1632,9 @@ md_apply_fix3 (fixp, valuep, seg)
return 0; return 0;
} }
/* Called after the assembler has finished parsing the input file or /* d10v_cleanup() is called after the assembler has finished parsing
after a label is defined. Because the D10V assembler sometimes the input file, when a label is read from the input file, or when a
stab directive is output. Because the D10V assembler sometimes
saves short instructions to see if it can package them with the saves short instructions to see if it can package them with the
next instruction, there may be a short instruction that still needs next instruction, there may be a short instruction that still needs
to be written. to be written.
@ -1627,13 +1648,24 @@ d10v_cleanup ()
segT seg; segT seg;
subsegT subseg; subsegT subseg;
if (prev_opcode && etype == PACK_UNSPEC) /* If cleanup was invoked because the assembler encountered, e.g., a
user label, we write out the pending instruction, if any. If it
was invoked because the assembler is outputting a piece of line
debugging information, though, we write out the pending
instruction only if the --no-gstabs-packing command line switch
has been specified. */
if (prev_opcode
&& etype == PACK_UNSPEC
&& (! outputting_stabs_line_debug || ! flag_allow_gstabs_packing))
{ {
seg = now_seg; seg = now_seg;
subseg = now_subseg; subseg = now_subseg;
if (prev_seg) if (prev_seg)
subseg_set (prev_seg, prev_subseg); subseg_set (prev_seg, prev_subseg);
write_1_short (prev_opcode, prev_insn, fixups->next); write_1_short (prev_opcode, prev_insn, fixups->next);
subseg_set (seg, subseg); subseg_set (seg, subseg);
prev_opcode = NULL; prev_opcode = NULL;
} }
@ -1644,13 +1676,11 @@ d10v_cleanup ()
/* Clobbers input_line_pointer, checks end-of-line. */ /* Clobbers input_line_pointer, checks end-of-line. */
static void static void
d10v_dot_word (nbytes) d10v_dot_word (dummy)
register int nbytes; /* 1=.byte, 2=.word, 4=.long */ int dummy ATTRIBUTE_UNUSED;
{ {
expressionS exp; expressionS exp;
bfd_reloc_code_real_type reloc;
char *p; char *p;
int offset;
if (is_it_end_of_statement ()) if (is_it_end_of_statement ())
{ {

7
gas/doc/c-d10v.texi

@ -35,6 +35,13 @@ instructions can be executed in parallel.
To optimize execution performance, @code{@value{AS}} will sometimes swap the To optimize execution performance, @code{@value{AS}} will sometimes swap the
order of instructions. Normally this generates a warning. When this option order of instructions. Normally this generates a warning. When this option
is used, no warning will be generated when instructions are swapped. is used, no warning will be generated when instructions are swapped.
@item --gstabs-packing
@item --no-gstabs-packing
@code{@value{AS}} packs adjacent short instructions into a single packed
instruction. @samp{--no-gstabs-packing} turns instruction packing off if
@samp{--gstabs} is specified as well; @samp{--gstabs-packing} (the
default) turns instruction packing on even when @samp{--gstabs} is
specified.
@end table @end table
@node D10V-Syntax @node D10V-Syntax

11
gas/dwarf2dbg.c

@ -339,7 +339,7 @@ dwarf2_directive_file (dummy)
return; return;
} }
if (num >= user_filenum_allocated) if (num >= (int) user_filenum_allocated)
{ {
unsigned int old = user_filenum_allocated; unsigned int old = user_filenum_allocated;
@ -372,7 +372,7 @@ dwarf2_directive_loc (dummy)
as_bad (_("File number less than zero")); as_bad (_("File number less than zero"));
return; return;
} }
if (filenum >= user_filenum_allocated if (filenum >= (int) user_filenum_allocated
|| user_filenum[filenum] == 0) || user_filenum[filenum] == 0)
{ {
as_bad (_("Unassigned file number %ld"), (long) filenum); as_bad (_("Unassigned file number %ld"), (long) filenum);
@ -558,8 +558,10 @@ size_inc_line_addr (line_delta, addr_delta)
int len = 0; int len = 0;
/* Scale the address delta by the minimum instruction length. */ /* Scale the address delta by the minimum instruction length. */
#if DWARF2_LINE_MIN_INSN_LENGTH > 1
assert (addr_delta % DWARF2_LINE_MIN_INSN_LENGTH == 0); assert (addr_delta % DWARF2_LINE_MIN_INSN_LENGTH == 0);
addr_delta /= DWARF2_LINE_MIN_INSN_LENGTH; addr_delta /= DWARF2_LINE_MIN_INSN_LENGTH;
#endif
/* INT_MAX is a signal that this is actually a DW_LNE_end_sequence. /* INT_MAX is a signal that this is actually a DW_LNE_end_sequence.
We cannot use special opcodes here, since we want the end_sequence We cannot use special opcodes here, since we want the end_sequence
@ -622,10 +624,11 @@ emit_inc_line_addr (line_delta, addr_delta, p, len)
int need_copy = 0; int need_copy = 0;
char *end = p + len; char *end = p + len;
#if DWARF2_LINE_MIN_INSN_LENGTH > 1
/* Scale the address delta by the minimum instruction length. */ /* Scale the address delta by the minimum instruction length. */
assert (addr_delta % DWARF2_LINE_MIN_INSN_LENGTH == 0); assert (addr_delta % DWARF2_LINE_MIN_INSN_LENGTH == 0);
addr_delta /= DWARF2_LINE_MIN_INSN_LENGTH; addr_delta /= DWARF2_LINE_MIN_INSN_LENGTH;
#endif
/* INT_MAX is a signal that this is actually a DW_LNE_end_sequence. /* INT_MAX is a signal that this is actually a DW_LNE_end_sequence.
We cannot use special opcodes here, since we want the end_sequence We cannot use special opcodes here, since we want the end_sequence
to emit the matrix entry. */ to emit the matrix entry. */
@ -796,7 +799,7 @@ dwarf2dbg_convert_frag (frag)
/* fr_var carries the max_chars that we created the fragment with. /* fr_var carries the max_chars that we created the fragment with.
fr_subtype carries the current expected length. We must, of fr_subtype carries the current expected length. We must, of
course, have allocated enough memory earlier. */ course, have allocated enough memory earlier. */
assert (frag->fr_var >= frag->fr_subtype); assert (frag->fr_var >= (int) frag->fr_subtype);
emit_inc_line_addr (frag->fr_offset, addr_diff, emit_inc_line_addr (frag->fr_offset, addr_diff,
frag->fr_literal + frag->fr_fix, frag->fr_subtype); frag->fr_literal + frag->fr_fix, frag->fr_subtype);

700
gas/po/gas.pot

File diff suppressed because it is too large

3
gas/read.h

@ -75,6 +75,9 @@ extern symbolS *line_label;
/* This is used to support MRI common sections. */ /* This is used to support MRI common sections. */
extern symbolS *mri_common_symbol; extern symbolS *mri_common_symbol;
/* True if a stabs line debug statement is currently being emitted. */
extern boolean outputting_stabs_line_debug;
/* Possible arguments to .linkonce. */ /* Possible arguments to .linkonce. */
enum linkonce_type enum linkonce_type
{ {

10
gas/stabs.c

@ -29,6 +29,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "aout/stab_gnu.h" #include "aout/stab_gnu.h"
/* Holds whether the assembler is generating stabs line debugging
information or not. Potentially used by md_cleanup function. */
boolean outputting_stabs_line_debug = 0;
static void s_stab_generic PARAMS ((int, char *, char *)); static void s_stab_generic PARAMS ((int, char *, char *));
static void generate_asm_file PARAMS ((int, char *)); static void generate_asm_file PARAMS ((int, char *));
@ -568,6 +573,10 @@ stabs_generate_asm_lineno ()
char *buf; char *buf;
char sym[30]; char sym[30];
/* Let the world know that we are in the middle of generating a
piece of stabs line debugging information. */
outputting_stabs_line_debug = 1;
/* Rather than try to do this in some efficient fashion, we just /* Rather than try to do this in some efficient fashion, we just
generate a string and then parse it again. That lets us use the generate a string and then parse it again. That lets us use the
existing stabs hook, which expect to see a string, rather than existing stabs hook, which expect to see a string, rather than
@ -598,6 +607,7 @@ stabs_generate_asm_lineno ()
colon (sym); colon (sym);
input_line_pointer = hold; input_line_pointer = hold;
outputting_stabs_line_debug = 0;
} }
/* Emit a function stab. /* Emit a function stab.

Loading…
Cancel
Save