This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fortran aliasing in tree-ssa-alias.c (may_alias_p).
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: Diego Novillo <dnovillo at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 20 Mar 2006 20:20:38 +0100
- Subject: Re: Fortran aliasing in tree-ssa-alias.c (may_alias_p).
- References: <4412C7C6.3020504@moene.indiv.nluug.nl> <16728322.1142087744409.JavaMail.root@dtm1eusosrv72.dtm.ops.eu.uu.net> <441D3CF1.2070704@moene.indiv.nluug.nl> <31693913.1142881632447.JavaMail.root@dtm1eusosrv72.dtm.ops.eu.uu.net>
Diego Novillo wrote:
On 03/19/06 06:13, Toon Moene wrote:
* gcc/fortran/options.c (gfc_init_options): Set flag_argument_noalias
to 3.
* gcc/tree-ssa-alias.c (may_alias_p): For flag_argument_noalias
> 2 (Fortran), an argument pointer cannot alias any other storage.
* gcc/common.opts: Document flag_argument_noalias value 3.
* gcc/tree-ssa-structalias.c (intra_create_variable_infos):
Change test where flag_argument_noalias is actually assumed to be 3.
OK, though you will also need to update the -fargument-alias* switch and
related documentation. There's no way of specifying
flag_argument_noalias == 3 from the command line.
Dang ! I hoped you wouldn't have noticed. Now I have to come up with a
name for this flag.
OTOH, it might be useful to compile (at least part of) the Fortran
run-time library with this flag ...
Attached is a new attempt at this patch ... I will bootstrap / check
overnight, all languages, on x86_64-unknown-linux-gnu.
Cheers,
--
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/
My next laptop will have a crank
2006-03-20 Toon Moene <toon@moene.indiv.nluug.nl>
* fortran/options.c (gfc_init_options): Initialize
flag_argument_noalias to 3.
* doc/invoke.texi: Document new flag -fargument-noalias-anything.
* tree-ssa-alias.c (may_alias_p): If flag_argument_noalias > 2,
argument pointers may not alias any other storage.
* common.opt: Define option -fargument-noalias-anything.
* tree-ssa-structalias.c (intra_create_variable_infos): Fortran
alias semantics is specified by flag_argument_noalias > 2.
Index: doc/invoke.texi
===================================================================
*** doc/invoke.texi (revision 112225)
--- doc/invoke.texi (working copy)
*************** See S/390 and zSeries Options.
*** 773,780 ****
-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
-fargument-alias -fargument-noalias @gol
! -fargument-noalias-global -fleading-underscore @gol
! -ftls-model=@var{model} @gol
-ftrapv -fwrapv -fbounds-check @gol
-fvisibility -fopenmp}
@end table
--- 773,780 ----
-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
-fargument-alias -fargument-noalias @gol
! -fargument-noalias-global -fargument-noalias-anything
! -fleading-underscore -ftls-model=@var{model} @gol
-ftrapv -fwrapv -fbounds-check @gol
-fvisibility -fopenmp}
@end table
*************** of 128KB@. Note that this may only work
*** 13332,13340 ****
--- 13332,13342 ----
@item -fargument-alias
@itemx -fargument-noalias
@itemx -fargument-noalias-global
+ @itemx -fargument-noalias-anything
@opindex fargument-alias
@opindex fargument-noalias
@opindex fargument-noalias-global
+ @opindex fargument-noalias-anything
Specify the possible relationships among parameters and between
parameters and global data.
*************** alias each other and may alias global st
*** 13344,13349 ****
--- 13346,13353 ----
each other, but may alias global storage.@*
@option{-fargument-noalias-global} specifies that arguments do not
alias each other and do not alias global storage.
+ @option{-fargument-noalias-anything} specifies that arguments do not
+ alias any other storage.
Each language will automatically use whatever option is required by
the language standard. You should not need to use these options yourself.
Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c (revision 112225)
--- tree-ssa-alias.c (working copy)
*************** may_alias_p (tree ptr, HOST_WIDE_INT mem
*** 1804,1811 ****
alias_stats.simple_resolved++;
return false;
}
!
! /* If -fargument-noalias-global is >1, pointer arguments may
not point to global variables. */
if (flag_argument_noalias > 1 && is_global_var (var)
&& TREE_CODE (ptr) == PARM_DECL)
--- 1804,1820 ----
alias_stats.simple_resolved++;
return false;
}
!
! /* If -fargument-noalias-global is > 2, pointer arguments may
! not point to anything else. */
! if (flag_argument_noalias > 2 && TREE_CODE (ptr) == PARM_DECL)
! {
! alias_stats.alias_noalias++;
! alias_stats.simple_resolved++;
! return false;
! }
!
! /* If -fargument-noalias-global is > 1, pointer arguments may
not point to global variables. */
if (flag_argument_noalias > 1 && is_global_var (var)
&& TREE_CODE (ptr) == PARM_DECL)
Index: fortran/options.c
===================================================================
*** fortran/options.c (revision 112225)
--- fortran/options.c (working copy)
*************** gfc_init_options (unsigned int argc ATTR
*** 85,91 ****
gfc_option.fpe = 0;
! flag_argument_noalias = 2;
flag_errno_math = 0;
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
--- 85,94 ----
gfc_option.fpe = 0;
! /* Argument pointers cannot point to anything
! but their argument. */
! flag_argument_noalias = 3;
!
flag_errno_math = 0;
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
Index: common.opt
===================================================================
*** common.opt (revision 112225)
--- common.opt (working copy)
*************** Common RejectNegative Joined UInteger
*** 257,263 ****
; 1 if pointer arguments may not alias each other but may alias
; global variables.
; 2 if pointer arguments may not alias each other and may not
! ; alias global variables. True in Fortran.
fargument-alias
Common Report Var(flag_argument_noalias,0)
Specify that arguments may alias each other and globals
--- 257,265 ----
; 1 if pointer arguments may not alias each other but may alias
; global variables.
; 2 if pointer arguments may not alias each other and may not
! ; alias global variables.
! ; 3 if pointer arguments may not alias anything. True in Fortran.
! ; Set by the front end.
fargument-alias
Common Report Var(flag_argument_noalias,0)
Specify that arguments may alias each other and globals
*************** fargument-noalias-global
*** 270,275 ****
--- 272,281 ----
Common Report Var(flag_argument_noalias,2) VarExists
Assume arguments alias neither each other nor globals
+ fargument-noalias-anything
+ Common Report Var(flag_argument_noalias,3) VarExists
+ Assume arguments alias no other storage
+
fasynchronous-unwind-tables
Common Report Var(flag_asynchronous_unwind_tables)
Generate unwind tables that are exact at each instruction boundary
Index: tree-ssa-structalias.c
===================================================================
*** tree-ssa-structalias.c (revision 112225)
--- tree-ssa-structalias.c (working copy)
*************** intra_create_variable_infos (void)
*** 4041,4047 ****
tree t;
/* For each incoming argument arg, ARG = &ANYTHING or a dummy variable if
! flag_argument_noalias > 1. */
for (t = DECL_ARGUMENTS (current_function_decl); t; t = TREE_CHAIN (t))
{
struct constraint_expr lhs;
--- 4041,4047 ----
tree t;
/* For each incoming argument arg, ARG = &ANYTHING or a dummy variable if
! flag_argument_noalias > 2. */
for (t = DECL_ARGUMENTS (current_function_decl); t; t = TREE_CHAIN (t))
{
struct constraint_expr lhs;
*************** intra_create_variable_infos (void)
*** 4051,4061 ****
lhs.type = SCALAR;
lhs.var = create_variable_info_for (t, alias_get_name (t));
! /* With flag_argument_noalias greater than one means that the incoming
argument cannot alias anything except for itself so create a HEAP
variable. */
if (POINTER_TYPE_P (TREE_TYPE (t))
! && flag_argument_noalias > 1)
{
varinfo_t vi;
struct constraint_expr rhs;
--- 4051,4061 ----
lhs.type = SCALAR;
lhs.var = create_variable_info_for (t, alias_get_name (t));
! /* With flag_argument_noalias greater than two means that the incoming
argument cannot alias anything except for itself so create a HEAP
variable. */
if (POINTER_TYPE_P (TREE_TYPE (t))
! && flag_argument_noalias > 2)
{
varinfo_t vi;
struct constraint_expr rhs;