Instruction packing with --gstabs for d10v assembler

Matthew Hiller hiller@redhat.com
Mon Nov 6 18:34:00 GMT 2000


	Okay; take three.

2000-11-06  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_line_debug_p || !flag_allow_gstabs_packing.
	* doc/c-d10v.texi: Documents new options.

Index: config/tc-d10v.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-d10v.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 tc-d10v.c
*** tc-d10v.c	2000/08/04 01:01:32	1.13
--- tc-d10v.c	2000/11/07 02:04:49
*************** typedef int packing_type;
*** 71,77 ****
  static packing_type etype = PACK_UNSPEC; /* Used by d10v_cleanup.  */
  
  /* True if instruction swapping warnings should be inhibited.  */
! static unsigned char flag_warn_suppress_instructionswap; /* --nowarnswap  */
  
  /* Local functions.  */
  static int reg_name_search PARAMS ((char *name));
--- 71,80 ----
  static packing_type etype = PACK_UNSPEC; /* Used by d10v_cleanup.  */
  
  /* True if instruction swapping warnings should be inhibited.  */
! static unsigned char flag_warn_suppress_instructionswap; /* --nowarnswap.  */
! /* True if instruction packing should be performed when --gstabs is specified.
!    --gstabs-packing, --no-gstabs-packing.  */
! static unsigned char flag_allow_gstabs_packing = 1;
  
  /* Local functions.  */
  static int reg_name_search PARAMS ((char *name));
*************** struct option md_longopts[] =
*** 98,103 ****
--- 101,112 ----
  {
  #define OPTION_NOWARNSWAP (OPTION_MD_BASE)
    {"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}
  };
  
*************** md_show_usage (stream)
*** 232,238 ****
       FILE *stream;
  {
    fprintf (stream, _("D10V options:\n\
! -O                      optimize.  Will do some operations in parallel.\n"));
  }
  
  int
--- 241,252 ----
       FILE *stream;
  {
    fprintf (stream, _("D10V options:\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
*************** md_parse_option (c, arg)
*** 249,254 ****
--- 263,274 ----
      case OPTION_NOWARNSWAP:
        flag_warn_suppress_instructionswap = 1;
        break;
+     case OPTION_GSTABSPACKING:
+       flag_allow_gstabs_packing = 1;
+       break;
+     case OPTION_NOGSTABSPACKING:
+       flag_allow_gstabs_packing = 0;
+       break;
      default:
        return 0;
      }
*************** md_apply_fix3 (fixp, valuep, seg)
*** 1612,1619 ****
    return 0;
  }
  
! /* Called after the assembler has finished parsing the input file or
!    after a label is defined.  Because the D10V assembler sometimes
     saves short instructions to see if it can package them with the
     next instruction, there may be a short instruction that still needs
     to be written.
--- 1632,1640 ----
    return 0;
  }
  
! /* d10v_cleanup() is called after the assembler has finished parsing
!    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
     next instruction, there may be a short instruction that still needs
     to be written.
*************** d10v_cleanup ()
*** 1627,1633 ****
    segT seg;
    subsegT subseg;
  
!   if (prev_opcode && etype == PACK_UNSPEC)
      {
        seg = now_seg;
        subseg = now_subseg;
--- 1648,1661 ----
    segT seg;
    subsegT subseg;
  
!   /* 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;
        subseg = now_subseg;
Index: doc/c-d10v.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-d10v.texi,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 c-d10v.texi
*** c-d10v.texi	1999/05/03 07:28:44	1.1.1.1
--- c-d10v.texi	2000/11/07 02:04:49
*************** instructions can be executed in parallel
*** 35,40 ****
--- 35,47 ----
  To optimize execution performance, @code{@value{AS}} will sometimes swap the
  order of instructions. Normally this generates a warning. When this option 
  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
  
  @node D10V-Syntax



More information about the Binutils mailing list