This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: asm constraint rule change


On Sun, Oct 18, 1998 at 11:52:37AM -0600, Jeffrey A Law wrote:
>   > A warning will get it fixed, and the code will still compile, so lets
>   > do it that way.
> OK.  Sounds good to me.

To that end, I've committed the following patch.


r~


	* stmt.c (expand_asm_operands): Accept `=' or `+' at any position

Index: stmt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/stmt.c,v
retrieving revision 1.51
diff -c -p -d -r1.51 stmt.c
*** stmt.c	1998/10/25 23:56:23	1.51
--- stmt.c	1998/10/26 20:18:27
*************** expand_asm_operands (string, outputs, in
*** 1230,1235 ****
--- 1230,1236 ----
        tree val = TREE_VALUE (tail);
        tree type = TREE_TYPE (val);
        char *constraint;
+       char *p;
        int c_len;
        int j;
        int is_inout = 0;
*************** expand_asm_operands (string, outputs, in
*** 1247,1257 ****
        c_len = TREE_STRING_LENGTH (TREE_PURPOSE (tail)) - 1;
        constraint = TREE_STRING_POINTER (TREE_PURPOSE (tail));
  
!       if (c_len == 0
! 	  || (constraint[0] != '=' && constraint[0] != '+'))
  	{
  	  error ("output operand constraint lacks `='");
  	  return;
  	}
  
        is_inout = constraint[0] == '+';
--- 1248,1276 ----
        c_len = TREE_STRING_LENGTH (TREE_PURPOSE (tail)) - 1;
        constraint = TREE_STRING_POINTER (TREE_PURPOSE (tail));
  
!       /* Allow the `=' or `+' to not be at the beginning of the string,
! 	 since it wasn't explicitly documented that way, and there is a
! 	 large body of code that puts it last.  Swap the character to
! 	 the front, so as not to uglify any place else.  */
!       switch (c_len)
  	{
+ 	default:
+ 	  if ((p = strchr (constraint, '=')) != NULL)
+ 	    break;
+ 	  if ((p = strchr (constraint, '+')) != NULL)
+ 	    break;
+ 	case 0:
  	  error ("output operand constraint lacks `='");
  	  return;
+ 	}
+ 
+       if (p != constraint)
+ 	{
+ 	  j = *p;
+ 	  bcopy (constraint, constraint+1, p-constraint);
+ 	  *constraint = j;
+ 
+ 	  warning ("output constraint `%c' for operand %d is not at the beginning", j, i);
  	}
  
        is_inout = constraint[0] == '+';


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