CONST fixes

Geoff Keating geoffk@cygnus.com
Tue Aug 1 10:18:00 GMT 2000


Jan Hubicka <jh@suse.cz> writes:

> Const is Pmode.
> 
> Tue Aug  1 00:35:49 CEST 2000  Jan Hubicka  <jh@suse.cz>
> 	* i386.c (legitimize_pic_address): CONST is Pmode.
> 	(print_operand_address): Likewise.
> 	* i386.md (casei): Likewise.
> 
> *** i386.c.old	Mon Jul 10 15:51:23 2000
> --- i386.c	Mon Jul 31 23:58:48 2000
> *************** legitimize_pic_address (orig, reg)
> *** 2581,2587 ****
>   
>         current_function_uses_pic_offset_table = 1;
>         new = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, addr), 7);
> !       new = gen_rtx_CONST (VOIDmode, new);
>         new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
>   
>         if (reg != 0)
> --- 2673,2679 ----
>   
>         current_function_uses_pic_offset_table = 1;
>         new = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, addr), 7);
> !       new = gen_rtx_CONST (Pmode, new);
>         new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);

That's a RTL type error.  CONST has the mode of the thing inside it.
You want to make the UNSPEC Pmode too.
... and in all the other places you patched.

>   	      new = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, op0), 7);
>   	      new = gen_rtx_PLUS (VOIDmode, new, op1);

... and likewise it doesn't make sense to add two VOIDmode things.

> ! 	      new = gen_rtx_CONST (Pmode, new);
>   	      new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);


>   
>   	      if (reg != 0)
> *************** print_operand_address (file, addr)
> *** 3465,3471 ****
>   		  && GET_CODE (XEXP (XEXP (disp, 0), 1)) == CONST_INT)
>   		{
>   		  offset = XEXP (XEXP (disp, 0), 1);
> ! 		  disp = gen_rtx_CONST (VOIDmode,
>   					XEXP (XEXP (disp, 0), 0));
>   		}
>   
> --- 3561,3567 ----
>   		  && GET_CODE (XEXP (XEXP (disp, 0), 1)) == CONST_INT)
>   		{
>   		  offset = XEXP (XEXP (disp, 0), 1);
> ! 		  disp = gen_rtx_CONST (Pmode,
>   					XEXP (XEXP (disp, 0), 0));
>   		}

> *** i386.md.can	Mon Jul 31 20:41:56 2000
> --- i386.md	Tue Aug  1 00:30:38 2000
> ***************
> *** 8325,8331 ****
>   	   (minus:SI (match_dup 8)
>   	     (mem:SI (plus:SI (plus:SI (mult:SI (match_dup 6) (const_int 4))
>   			      (match_dup 8))
> ! 		     (const (unspec [(label_ref (match_operand 3 "" ""))] 7))))))
>         (clobber (reg:CC 17))])
>      (parallel [(set (pc) (match_dup 7))
>   	      (use (label_ref (match_dup 3)))])]
> --- 8299,8305 ----
>   	   (minus:SI (match_dup 8)
>   	     (mem:SI (plus:SI (plus:SI (mult:SI (match_dup 6) (const_int 4))
>   			      (match_dup 8))
> ! 		     (const:SI (unspec [(label_ref (match_operand 3 "" ""))] 7))))))
>         (clobber (reg:CC 17))])
>      (parallel [(set (pc) (match_dup 7))
>   	      (use (label_ref (match_dup 3)))])]

Don't forget to fix the MD file!

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Gcc-patches mailing list