This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
force_const_mem patch for unspecs
- To: gcc-patches at gcc dot gnu dot org
- Subject: force_const_mem patch for unspecs
- From: HPENNER at de dot ibm dot com
- Date: Tue, 26 Jun 2001 13:14:55 +0200
- cc: Ulrich dot Weigand at de dot ibm dot com
We would like to propose a change of some details of the implementation of
decode_rtx_const. This changes are essential for the integration of s390
backend into the gcc-3.1.
Problem:
The s390 backend forces (const (unspec (symbol_ref))) and (const (plus
(unspec (symbol_ref)) const_int)) into the
constant pool. The unspec index is used to distinguish between the
extenstions of the symbols (@plt, @got, ...).
decode_rtx_const sets value->un.addr.base to rtx expression (unspec
(symbol_ref)). Since each expression
is unique, the hash-value of such expression will be different, leading to
duplicate entries in the constant pool.
Proposed solution:
decode_rtx_const checks, if the expression is a simple umspec
expression. The address of the string is then used for
value->un.addr.base, the unspec index is coded into value->kind. This will
inhibit dublicate entries in the constant pool
and distinguish between same symbol_refs and different unspec indexes
(a@got and a@PLT could be both in the same constant pool)
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.176
diff -r1.176 varasm.c
2227c2227
< enum kind { RTX_DOUBLE, RTX_INT };
---
> enum kind { RTX_DOUBLE, RTX_INT, RTX_UNSPEC };
3433c3433,3445
< if (value->kind == RTX_INT && value->un.addr.base != 0)
---
> if (value->kind == RTX_INT && value->un.addr.base != 0
> && GET_CODE (value->un.addr.base) == UNSPEC)
> {
> /* For a simple UNSPEC, compare index and,
> if available the string's address of SYMBOL_REF */
> if (XVECLEN (value->un.addr.base, 0) == 1)
> {
> value->kind = RTX_UNSPEC + XINT (value->un.addr.base, 1);
> value->un.addr.base = XVECEXP (value->un.addr.base, 0, 0);
> }
> }
>
> if (value->kind != RTX_DOUBLE && value->un.addr.base != 0)
3435a3448
>
3445c3458
<
---
>
3463c3476,3477
< if (val0.un.addr.base == val1.un.addr.base)
---
> if (val0.kind != RTX_DOUBLE && val0.kind == val1.kind
> && val0.un.addr.base == val1.un.addr.base)
Mit freundlichem Gruß / Best regards,
Hartmut Penner
Internet Mail Address : hpenner@de.ibm.com
Tel: (49)-7031-16-4364