public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH]  Additional TC_EQUAL_IN_INSN check
@ 2005-02-15 18:10 Catherine Moore
  0 siblings, 0 replies; 7+ messages in thread
From: Catherine Moore @ 2005-02-15 18:10 UTC (permalink / raw)
  To: binutils; +Cc: clm


This patch adds an argument to TC_EQUAL_IN_INSN so that the current string
can be checked.  It also adds an additional check for TC_EQUAL_IN_INSN in
read_a_source_file.  The gas tests passed on targets linux, hppa-elf and
v850-elf. 

Okay to apply?

Thanks,
Catherine

2005-02-15  Catherine Moore <clm@cm00re.com>

	* read.c (read_a_source_file): Pass s to TC_EQUAL_IN_INSN.
	Add additional check for TC_EQUAL_IN_INSN.
	* config/tc-hppa.h (TC_EQUAL_IN_INSN): Add argument.
	* doc/internals.texi (TC_EQUAL_IN_INSN): Document new argument.


Index: doc/internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.40
diff -p -r1.40 internals.texi
*** doc/internals.texi	17 Aug 2004 12:19:58 -0000	1.40
--- doc/internals.texi	15 Feb 2005 13:14:43 -0000
*************** If you define this macro, GAS will not r
*** 1027,1036 ****
  @item TC_EQUAL_IN_INSN
  @cindex TC_EQUAL_IN_INSN
  If you define this macro, it should return nonzero if the instruction is
! permitted to contain an @kbd{=} character.  GAS will call it with two
! arguments, the character before the @kbd{=} character, and the value of
! @code{input_line_pointer} at that point.  GAS uses this macro to decide if
a
! @kbd{=} is an assignment or an instruction.
  
  @item TC_EOL_IN_INSN
  @cindex TC_EOL_IN_INSN
--- 1027,1036 ----
  @item TC_EQUAL_IN_INSN
  @cindex TC_EQUAL_IN_INSN
  If you define this macro, it should return nonzero if the instruction is
! permitted to contain an @kbd{=} character.  GAS will call it with three
! arguments, the character before the @kbd{=} character, the current string
! @code{s}, and the value of @code{input_line_pointer} at that point.  GAS
! uses this macro to decide if a @kbd{=} is an assignment or an instruction.
  
  @item TC_EOL_IN_INSN
  @cindex TC_EOL_IN_INSN
Index: read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.88
diff -p -r1.88 read.c
*** read.c	31 Jan 2005 14:26:08 -0000	1.88
--- read.c	15 Feb 2005 13:14:46 -0000
*************** read_a_source_file (char *name)
*** 708,720 ****
  		  /* Input_line_pointer->after ':'.  */
  		  SKIP_WHITESPACE ();
  		}
! 	      else if (c == '='
  		       || ((c == ' ' || c == '\t')
  			   && input_line_pointer[1] == '='
  #ifdef TC_EQUAL_IN_INSN
! 			   && !TC_EQUAL_IN_INSN (c, input_line_pointer)
  #endif
  			   ))
  		{
  		  equals (s, 1);
  		  demand_empty_rest_of_line ();
--- 708,724 ----
  		  /* Input_line_pointer->after ':'.  */
  		  SKIP_WHITESPACE ();
  		}
! 	      else if ((c == '='
  		       || ((c == ' ' || c == '\t')
  			   && input_line_pointer[1] == '='
  #ifdef TC_EQUAL_IN_INSN
! 			   && !TC_EQUAL_IN_INSN (c, s, input_line_pointer)
  #endif
  			   ))
+ #ifdef TC_EQUAL_IN_INSN
+ 		      && !TC_EQUAL_IN_INSN (c, s, input_line_pointer)
+ #endif
+ 		      )
  		{
  		  equals (s, 1);
  		  demand_empty_rest_of_line ();
Index: config/tc-hppa.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.h,v
retrieving revision 1.26
diff -p -r1.26 tc-hppa.h
*** config/tc-hppa.h	27 Jul 2004 22:30:25 -0000	1.26
--- config/tc-hppa.h	15 Feb 2005 13:14:46 -0000
*************** extern const char	hppa_symbol_chars[];
*** 123,129 ****
     completer in an instruction.  This can be detected by checking the
     previous character, if the character is a comma, then the equal is
     being used as part of an instruction.  */
! #define TC_EQUAL_IN_INSN(C, PTR)	((C) == ',')
  
  /* Similarly for an exclamation point.  It is used in FP comparison
     instructions and as an end of line marker.  When used in an instruction
--- 123,129 ----
     completer in an instruction.  This can be detected by checking the
     previous character, if the character is a comma, then the equal is
     being used as part of an instruction.  */
! #define TC_EQUAL_IN_INSN(C, NAME, PTR)	((C) == ',')
  
  /* Similarly for an exclamation point.  It is used in FP comparison
     instructions and as an end of line marker.  When used in an instruction




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]  Additional TC_EQUAL_IN_INSN check
       [not found] <200502181605.j1IG5t7e028779@mx1.redhat.com>
@ 2005-02-18 22:14 ` Nick Clifton
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Clifton @ 2005-02-18 22:14 UTC (permalink / raw)
  To: clm; +Cc: binutils

Hi Catherine,

> :>   permitted to contain an @kbd{=} character.  GAS will call it with two
> :>   arguments, the character before the @kbd{=} character, and the value of
> :> ! @code{s} at that point.  GAS uses this macro to decide if a
> :>   @kbd{=} is an assignment or an instruction.
> :
> :How about "and the string that follows after the equals sign" ?

> It is the string before the equals sign that needs to be examined.
> How about "and the string that precedes the equals sign"?

Sorry - I was confused.  Please go with you suggestion for the amended 
sentence.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH]  Additional TC_EQUAL_IN_INSN check
  2005-02-18 21:41 ` Nick Clifton
@ 2005-02-18 21:43   ` Catherine Moore
  0 siblings, 0 replies; 7+ messages in thread
From: Catherine Moore @ 2005-02-18 21:43 UTC (permalink / raw)
  To: 'Nick Clifton'; +Cc: binutils

:
:>   If you define this macro, it should return nonzero if the instruction
is
:>   permitted to contain an @kbd{=} character.  GAS will call it with two
:>   arguments, the character before the @kbd{=} character, and the value of
:> ! @code{s} at that point.  GAS uses this macro to decide if a
:>   @kbd{=} is an assignment or an instruction.
:
:How about "and the string that follows after the equals sign" ?
:

It is the string before the equals sign that needs to be examined.
How about "and the string that precedes the equals sign"?
Thanks,
Catherine



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]  Additional TC_EQUAL_IN_INSN check
       [not found] <200502171836.j1HIaXgg006973@mx1.redhat.com>
@ 2005-02-18 21:41 ` Nick Clifton
  2005-02-18 21:43   ` Catherine Moore
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Clifton @ 2005-02-18 21:41 UTC (permalink / raw)
  To: clm; +Cc: binutils

Hi Catherine,

> I don't think passing an extra argument is a big deal.  If s is available,
> why not use it instead of deducing it?

Well my point was: "why make an unnecessary change ?"

>  It turns out that the only port
> (other than the one I'm working on) which uses this macro is the hppa and
> the hppa port doesn't look at the string.  I've reworked the patch to pass s
> and not input_line_pointer to the TC_EQUAL_IN_INSN macro and also to use
> only one invocation of the macro as you suggested.  Okay to install, now?

Yes, with the proviso that you fix the documentation as Alan suggested.

> * read.c (read_a_source_file):  Check TC_EQUAL_IN_INSN if c is '='. 
> * doc/internals.texi (TC_EQUAL_IN_INSN):  Pass current string instead of
> input_line_pointer.

Approved.

>   If you define this macro, it should return nonzero if the instruction is
>   permitted to contain an @kbd{=} character.  GAS will call it with two
>   arguments, the character before the @kbd{=} character, and the value of
> ! @code{s} at that point.  GAS uses this macro to decide if a
>   @kbd{=} is an assignment or an instruction.

How about "and the string that follows after the equals sign" ?

Cheers
   Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]  Additional TC_EQUAL_IN_INSN check
       [not found]   ` <20050217183642.EVRM13037.imta01ps.mx.bigpond.com@psmam02.bigpond.com>
@ 2005-02-18 12:36     ` Alan Modra
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Modra @ 2005-02-18 12:36 UTC (permalink / raw)
  To: Catherine Moore; +Cc: 'Nick Clifton', binutils

On Thu, Feb 17, 2005 at 12:33:16PM -0600, Catherine Moore wrote:
> It turns out that the only port
> (other than the one I'm working on) which uses this macro is the hppa and
> the hppa port doesn't look at the string.

Actually, the hppa port definition does exactly nothing, since
TC_EQUAL_IN_INSN is only invoked with c == ' ' or c == '\t'.  I'm
removing the macro and its documentation.  This should make it easier
for you to add back a macro that does what you need.

>   If you define this macro, it should return nonzero if the instruction is
>   permitted to contain an @kbd{=} character.  GAS will call it with two
>   arguments, the character before the @kbd{=} character, and the value of
> ! @code{s} at that point.  GAS uses this macro to decide if a
>   @kbd{=} is an assignment or an instruction.

BTW, this isn't acceptable.  "The value of `s'" doesn't mean a thing to
anyone who is reading this documentation.

	* config/tc-hppa.h (TC_EQUAL_IN_INSN): Delete.
	* read.c (read_a_source_file): Remove TC_EQUAL_IN_INSN test.
	* doc/internals.texi (TC_EQUAL_IN_INSN): Delete.

Index: gas/config/tc-hppa.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.h,v
retrieving revision 1.26
diff -u -p -r1.26 tc-hppa.h
--- gas/config/tc-hppa.h	27 Jul 2004 22:30:25 -0000	1.26
+++ gas/config/tc-hppa.h	18 Feb 2005 02:51:20 -0000
@@ -1,6 +1,6 @@
 /* tc-hppa.h -- Header file for the PA
    Copyright 1989, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003 Free Software Foundation, Inc.
+   2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -119,15 +119,9 @@ extern const char	hppa_symbol_chars[];
   parse_cons_expression_hppa (EXP)
 #define TC_CONS_FIX_NEW cons_fix_new_hppa
 
-/* On the PA, an equal sign often appears as a condition or nullification
-   completer in an instruction.  This can be detected by checking the
-   previous character, if the character is a comma, then the equal is
-   being used as part of an instruction.  */
-#define TC_EQUAL_IN_INSN(C, PTR)	((C) == ',')
-
-/* Similarly for an exclamation point.  It is used in FP comparison
-   instructions and as an end of line marker.  When used in an instruction
-   it will always follow a comma.  */
+/* On the PA, an exclamation point can appear in an instruction.  It is
+   used in FP comparison instructions and as an end of line marker.
+   When used in an instruction it will always follow a comma.  */
 #define TC_EOL_IN_INSN(PTR)	(*(PTR) == '!' && (PTR)[-1] == ',')
 
 int hppa_fix_adjustable PARAMS((struct fix *));
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.89
diff -u -p -r1.89 read.c
--- gas/read.c	17 Feb 2005 13:46:00 -0000	1.89
+++ gas/read.c	18 Feb 2005 02:47:13 -0000
@@ -710,11 +710,7 @@ read_a_source_file (char *name)
 		}
 	      else if (c == '='
 		       || ((c == ' ' || c == '\t')
-			   && input_line_pointer[1] == '='
-#ifdef TC_EQUAL_IN_INSN
-			   && !TC_EQUAL_IN_INSN (c, input_line_pointer)
-#endif
-			   ))
+			   && input_line_pointer[1] == '='))
 		{
 		  equals (s, 1);
 		  demand_empty_rest_of_line ();
Index: gas/doc/internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.40
diff -u -p -r1.40 internals.texi
--- gas/doc/internals.texi	17 Aug 2004 12:19:58 -0000	1.40
+++ gas/doc/internals.texi	18 Feb 2005 02:47:14 -0000
@@ -1024,14 +1024,6 @@ LABELS_WITHOUT_COLONS is defined.
 If you define this macro, GAS will not require pseudo-ops to start with a
 @kbd{.} character.
 
-@item TC_EQUAL_IN_INSN
-@cindex TC_EQUAL_IN_INSN
-If you define this macro, it should return nonzero if the instruction is
-permitted to contain an @kbd{=} character.  GAS will call it with two
-arguments, the character before the @kbd{=} character, and the value of
-@code{input_line_pointer} at that point.  GAS uses this macro to decide if a
-@kbd{=} is an assignment or an instruction.
-
 @item TC_EOL_IN_INSN
 @cindex TC_EOL_IN_INSN
 If you define this macro, it should return nonzero if the current input line

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH]  Additional TC_EQUAL_IN_INSN check
  2005-02-16 17:54 ` Nick Clifton
@ 2005-02-17 21:34   ` Catherine Moore
       [not found]   ` <20050217183642.EVRM13037.imta01ps.mx.bigpond.com@psmam02.bigpond.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Catherine Moore @ 2005-02-17 21:34 UTC (permalink / raw)
  To: 'Nick Clifton'; +Cc: binutils, Catherine Moore




:-----Original Message-----
:From: Nick Clifton [mailto:nickc@redhat.com]
:
:> This patch adds an argument to TC_EQUAL_IN_INSN so that the current
string
:> can be checked.
:
:Why is this needed ?  Do you have a port where the current semantics for
:TC_EQUAL_IN_INSN are insufficient ?  [The string 's' can be deduced from
:  input_line_pointer, so why pass it as an extra argument ?] 

:
:> It also adds an additional check for TC_EQUAL_IN_INSN in
:> read_a_source_file.
:
:Again - why is is this necessary ?  Couldn't the if-statement be
:rearranged so that there was only one invocation of TC_EQUAL_IN_INSN ?
:

I don't think passing an extra argument is a big deal.  If s is available,
why not use it instead of deducing it??  It turns out that the only port
(other than the one I'm working on) which uses this macro is the hppa and
the hppa port doesn't look at the string.  I've reworked the patch to pass s
and not input_line_pointer to the TC_EQUAL_IN_INSN macro and also to use
only one invocation of the macro as you suggested.  Okay to install, now?

Catherine

* read.c (read_a_source_file):  Check TC_EQUAL_IN_INSN if c is '='. 
* doc/internals.texi (TC_EQUAL_IN_INSN):  Pass current string instead of
input_line_pointer.

Index: read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.89
diff -p -r1.89 read.c
*** read.c	17 Feb 2005 13:46:00 -0000	1.89
--- read.c	17 Feb 2005 18:23:14 -0000
*************** read_a_source_file (char *name)
*** 708,720 ****
  		  /* Input_line_pointer->after ':'.  */
  		  SKIP_WHITESPACE ();
  		}
! 	      else if (c == '='
! 		       || ((c == ' ' || c == '\t')
! 			   && input_line_pointer[1] == '='
  #ifdef TC_EQUAL_IN_INSN
! 			   && !TC_EQUAL_IN_INSN (c, input_line_pointer)
  #endif
! 			   ))
  		{
  		  equals (s, 1);
  		  demand_empty_rest_of_line ();
--- 708,720 ----
  		  /* Input_line_pointer->after ':'.  */
  		  SKIP_WHITESPACE ();
  		}
!               else if ((c == '='
!                        || ((c == ' ' || c == '\t')
!                             && input_line_pointer[1] == '='))
  #ifdef TC_EQUAL_IN_INSN
!                            && !TC_EQUAL_IN_INSN (c, s)
  #endif
!                            )
  		{
  		  equals (s, 1);
  		  demand_empty_rest_of_line ();
Index: doc/internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.40
diff -p -r1.40 internals.texi
*** doc/internals.texi	17 Aug 2004 12:19:58 -0000	1.40
--- doc/internals.texi	17 Feb 2005 18:23:15 -0000
*************** If you define this macro, GAS will not r
*** 1029,1035 ****
  If you define this macro, it should return nonzero if the instruction is
  permitted to contain an @kbd{=} character.  GAS will call it with two
  arguments, the character before the @kbd{=} character, and the value of
! @code{input_line_pointer} at that point.  GAS uses this macro to decide if
a
  @kbd{=} is an assignment or an instruction.
  
  @item TC_EOL_IN_INSN
--- 1029,1035 ----
  If you define this macro, it should return nonzero if the instruction is
  permitted to contain an @kbd{=} character.  GAS will call it with two
  arguments, the character before the @kbd{=} character, and the value of
! @code{s} at that point.  GAS uses this macro to decide if a
  @kbd{=} is an assignment or an instruction.
  
  @item TC_EOL_IN_INSN





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]  Additional TC_EQUAL_IN_INSN check
       [not found] <200502151337.j1FDb4u2012330@mx3.redhat.com>
@ 2005-02-16 17:54 ` Nick Clifton
  2005-02-17 21:34   ` Catherine Moore
       [not found]   ` <20050217183642.EVRM13037.imta01ps.mx.bigpond.com@psmam02.bigpond.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Nick Clifton @ 2005-02-16 17:54 UTC (permalink / raw)
  To: clm; +Cc: binutils

Hi Catherine,

> This patch adds an argument to TC_EQUAL_IN_INSN so that the current string
> can be checked.

Why is this needed ?  Do you have a port where the current semantics for 
TC_EQUAL_IN_INSN are insufficient ?  [The string 's' can be deduced from 
  input_line_pointer, so why pass it as an extra argument ?]

> It also adds an additional check for TC_EQUAL_IN_INSN in
> read_a_source_file.  

Again - why is is this necessary ?  Couldn't the if-statement be 
rearranged so that there was only one invocation of TC_EQUAL_IN_INSN ?

Cheers
   Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-02-18 16:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-15 18:10 [PATCH] Additional TC_EQUAL_IN_INSN check Catherine Moore
     [not found] <200502151337.j1FDb4u2012330@mx3.redhat.com>
2005-02-16 17:54 ` Nick Clifton
2005-02-17 21:34   ` Catherine Moore
     [not found]   ` <20050217183642.EVRM13037.imta01ps.mx.bigpond.com@psmam02.bigpond.com>
2005-02-18 12:36     ` Alan Modra
     [not found] <200502171836.j1HIaXgg006973@mx1.redhat.com>
2005-02-18 21:41 ` Nick Clifton
2005-02-18 21:43   ` Catherine Moore
     [not found] <200502181605.j1IG5t7e028779@mx1.redhat.com>
2005-02-18 22:14 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).