This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH assembler preprocessor options


This patch adds some options to the assembler preprocessor.
DOUBLEBAR_PARALLEL handles parallel instruction syntax, e.g.

    add reg1, reg2 || load reg1, addr1
    sub reg1, reg2
||  store reg1, addr1

Also added is KEEP_WHITE_AROUND_COLON, which, if defined, keeps
whitespace around a colon instead of eliminating it, e.g.

label:x:   add reg1, reg2 // multiple white after label:x: becomes
single white
label:x: add reg1, reg2   // instead of being removed altogether.

       * gas/app.c (do_scrub_chars): Handle "||" for parallel
instructions
        when DOUBLEBAR_PARALLEL is defined.  Avoid stripping whitespace
        around colons when KEEP_WHITE_AROUND_COLON is defined.
        * doc/internals.texi (CPU backend): Document DOUBLEBAR_PARALLEL
        and KEEP_WHITE_AROUND_COLON.


Index: gas/app.c
===================================================================
RCS file: /cvs/src/src/gas/app.c,v
retrieving revision 1.4
diff -d -c -p -r1.4 app.c
*** app.c	1999/11/09 17:14:45	1.4
--- app.c	2000/02/08 16:45:30
*************** static const char symbol_chars[] =
*** 68,73 ****
--- 68,76 ----
  #define LEX_IS_DOUBLEDASH_1ST		12
  #endif
  #ifdef TC_M32R
+ #define DOUBLEBAR_PARALLEL
+ #endif
+ #ifdef DOUBLEBAR_PARALLEL
  #define LEX_IS_DOUBLEBAR_1ST		13
  #endif
  #define IS_SYMBOL_COMPONENT(c)		(lex[c] == LEX_IS_SYMBOL_COMPONENT)
*************** do_scrub_begin (m68k_mri)
*** 174,180 ****
  #ifdef TC_V850
    lex['-'] = LEX_IS_DOUBLEDASH_1ST;
  #endif
! #ifdef TC_M32R
    lex['|'] = LEX_IS_DOUBLEBAR_1ST;
  #endif
  #ifdef TC_D30V
--- 177,183 ----
  #ifdef TC_V850
    lex['-'] = LEX_IS_DOUBLEDASH_1ST;
  #endif
! #ifdef DOUBLEBAR_PARALLEL
    lex['|'] = LEX_IS_DOUBLEBAR_1ST;
  #endif
  #ifdef TC_D30V
*************** do_scrub_chars (get, tostart, tolen)
*** 351,357 ****
  #ifdef TC_V850
           12: After seeing a dash, looking for a second dash as a start of comment.
  #endif
! #ifdef TC_M32R
  	 13: After seeing a vertical bar, looking for a second vertical bar as a parallel expression seperator.
  #endif
  	  */
--- 354,360 ----
  #ifdef TC_V850
           12: After seeing a dash, looking for a second dash as a start of comment.
  #endif
! #ifdef DOUBLEBAR_PARALLEL
  	 13: After seeing a vertical bar, looking for a second vertical bar as a parallel expression seperator.
  #endif
  	  */
*************** do_scrub_chars (get, tostart, tolen)
*** 761,766 ****
--- 764,784 ----
  	      break;
  	    }
  
+ #ifdef KEEP_WHITE_AROUND_COLON
+           if (lex[ch] == LEX_IS_COLON)
+             {
+               /* only keep this white if there's no white *after* the colon */
+               ch2 = GET ();
+               UNGET (ch2);
+               if (!IS_WHITESPACE (ch2))
+                 {
+                   state = 9;
+                   UNGET (ch);
+                   PUT (' ');
+                   break;
+                 }
+             }
+ #endif
  	  if (IS_COMMENT (ch)
  	      || ch == '/'
  	      || IS_LINE_SEPARATOR (ch))
*************** do_scrub_chars (get, tostart, tolen)
*** 970,979 ****
--- 988,1001 ----
  #endif
  
  	case LEX_IS_COLON:
+ #ifdef KEEP_WHITE_AROUND_COLON
+           state = 9;
+ #else
  	  if (state == 9 || state == 10)
  	    state = 3;
  	  else if (state != 3)
  	    state = 1;
+ #endif
  	  PUT (ch);
  	  break;
  
*************** do_scrub_chars (get, tostart, tolen)
*** 1013,1019 ****
  	  PUT ('\n');
  	  break;
  #endif	    
! #ifdef TC_M32R
  	case LEX_IS_DOUBLEBAR_1ST:
  	  ch2 = GET();
  	  if (ch2 != '|')
--- 1035,1041 ----
  	  PUT ('\n');
  	  break;
  #endif	    
! #ifdef DOUBLEBAR_PARALLEL
  	case LEX_IS_DOUBLEBAR_1ST:
  	  ch2 = GET();
  	  if (ch2 != '|')
Index: gas/doc/internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.5
diff -d -c -p -r1.5 internals.texi
*** internals.texi	2000/02/08 14:21:53	1.5
--- internals.texi	2000/02/08 16:45:32
*************** If you define this macro, GAS will call 
*** 1224,1229 ****
--- 1224,1243 ----
  GAS will call this function for each section at the end of the assembly, to
  permit the CPU backend to adjust the alignment of a section.
  
+ @item DOUBLEBAR_PARALLEL
+ @cindex DOUBLEBAR_PARALLEL
+ Affects the preprocessor so that lines containing '||' don't have their
+ whitespace stripped following the double bar.  This is useful for targets that
+ implement parallel instructions.
+ 
+ @item KEEP_WHITE_AROUND_COLON
+ @cindex KEEP_WHITE_AROUND_COLON
+ Affects the preprocessor so that whitespace around colons is preserved.
+ Normally, whitespace is compressed and removed when, in the presence of the
+ colon, the adjoining tokens can be distinguished.  This is useful when
+ colons might be removed from the input after preprocessing but before
+ assembling.
+ 
  @item tc_frob_section
  @cindex tc_frob_section
  If you define this macro, a @code{BFD_ASSEMBLER} GAS will call it for each

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]