From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122255 invoked by alias); 8 Oct 2019 08:52:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 121920 invoked by uid 89); 8 Oct 2019 08:52:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=streaming, exclusively, greedy X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2019 08:52:40 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x988lIK1036936 for ; Tue, 8 Oct 2019 04:52:38 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vgk40rdbv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 08 Oct 2019 04:52:38 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Oct 2019 09:52:36 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 8 Oct 2019 09:52:32 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x988qVEb57606202 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 8 Oct 2019 08:52:31 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7DC64203F; Tue, 8 Oct 2019 08:52:31 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BF71042041; Tue, 8 Oct 2019 08:52:28 +0000 (GMT) Received: from luoxhus-MacBook-Pro.local (unknown [9.200.155.113]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 8 Oct 2019 08:52:28 +0000 (GMT) Subject: Re: [PATCH] Come up with ipa passes introduction in gccint documentation To: Martin Jambor , Xiong Hu Luo , gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org, wschmidt@linux.ibm.com, hubicka@ucw.cz, mliska@suse.cz References: <20190929075637.79741-1-luoxhu@linux.vnet.ibm.com> From: luoxhu Date: Tue, 08 Oct 2019 08:52:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit x-cbid: 19100808-4275-0000-0000-00000370017E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19100808-4276-0000-0000-000038830196 Message-Id: <88f0b3e3-edd6-4a1f-c632-f71950803b9b@linux.ibm.com> X-SW-Source: 2019-10/txt/msg00516.txt.bz2 Hi, This is the formal documentation patch for IPA passes. Thanks. None of the IPA passes are documented in passes.texi. This patch adds a section IPA passes just before GIMPLE passes and RTL passes in Chapter 9 "Passes and Files of the Compiler". Also, a short description for each IPA pass is provided. gccint.pdf can be produced without errors. ChangeLog: PR middle-end/26241 * doc/lto.texi (IPA): Reference to the IPA passes. * doc/passes.texi (Pass manager): Add node IPA passes and description for each IPA pass. --- gcc/doc/lto.texi | 7 +- gcc/doc/passes.texi | 241 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 245 insertions(+), 3 deletions(-) diff --git a/gcc/doc/lto.texi b/gcc/doc/lto.texi index 771e8278e50..1afb6eb4a98 100644 --- a/gcc/doc/lto.texi +++ b/gcc/doc/lto.texi @@ -350,8 +350,10 @@ while the @emph{Read summary}, @emph{Execute}, and @end itemize To simplify development, the GCC pass manager differentiates -between normal inter-procedural passes and small inter-procedural -passes. A @emph{small inter-procedural pass} +between normal inter-procedural passes (@pxref{All regular IPA passes}), +small inter-procedural passes (@pxref{All small IPA passes}) +and late inter-procedural passes (@pxref{All late IPA passes}). +A @emph{small inter-procedural pass} (@code{SIMPLE_IPA_PASS}) is a pass that does everything at once and thus it cannot be executed during WPA in WHOPR mode. It defines only the @emph{Execute} stage and during @@ -362,7 +364,6 @@ object files. The simple inter-procedural passes can also be used for easier prototyping and development of a new inter-procedural pass. - @subsection Virtual clones One of the main challenges of introducing the WHOPR compilation diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi index 6edb9a0bfb7..3f9106d60c3 100644 --- a/gcc/doc/passes.texi +++ b/gcc/doc/passes.texi @@ -20,6 +20,7 @@ where near complete. * Parsing pass:: The language front end turns text into bits. * Gimplification pass:: The bits are turned into something we can optimize. * Pass manager:: Sequencing the optimization passes. +* IPA passes:: Inter-procedural optimizations. * Tree SSA passes:: Optimizations on a high-level representation. * RTL passes:: Optimizations on a low-level representation. * Optimization info:: Dumping optimization information from passes. @@ -178,6 +179,246 @@ TODO: describe the global variables set up by the pass manager, and a brief description of how a new pass should use it. I need to look at what info RTL passes use first@enddots{} +@node IPA passes +@section IPA passes +@cindex IPA passes +The following briefly describes the IPA optimization passes including +all small IPA passes, all regular IPA passes and all late IPA passes. + +@node All small IPA passes +@subsection All small IPA passes +@cindex all small ipa passes +A small IPA pass is a pass derived from @code{simple_ipa_opt_pass} +that does everything at once and thus it cannot be executed during WPA +in WHOPR mode. It defines only the @emph{Execute} stage and during this +stage it accesses and modifies the function bodies. No @code{generate_summary} +@code{read_summary} or @code{write_summary} hooks defined. + +@itemize @bullet +@item IPA free lang data + +This pass free resources that are used by FE but are not needed once +they are done. It is located in @file{tree.c} and is described by +@code{pass_ipa_free_lang_data}. + +@item IPA function and variable visibility + +This is a local function pass handling visibilities of all symbols. This +happens before LTO streaming so in particular -fwhole-program should be ignored +at this level. It is located in @file{ipa-visibility.c} and is described by +@code{pass_ipa_function_and_variable_visibility}. + +@item IPA remove symbols + +This pass performs reachability analysis and reclaim all unreachable nodes. +It is located in @file{passes.c} and is described by +@code{pass_ipa_remove_symbols}. + +@item IPA oacc + +It is located in @file{tree-ssa-loop.c} and is described by +@code{pass_ipa_oacc}. + +@item IPA pta + +This is a tree based points-to analysis pass. The idea behind this analyzer +is to generate set constraints from the program, then solve the resulting +constraints in order to generate the points-to sets. It is located in +@file{tree-ssa-structalias.c} and is described by @code{pass_ipa_pta}. + +@item IPA oacc kernels + +This pass is for processing oacc kernels. It is located in @file{tree-ssa-loop.c} +and is described by @code{pass_ipa_oacc_kernels}. + +@item Target clone + +This is a pass for parsing functions with multiple target attributes. +It is located in @file{multiple_target.c} and is described by +@code{pass_target_clone}. + +@item IPA auto profile + +This pass uses AutoFDO profile to annotate the control flow graph. +It is located in @file{auto-profile.c} and is described by +@code{pass_ipa_auto_profile}. + +@item IPA tree profile + +This pass do profiling for all functions in the callgraph. It calculates branch +probabilities and basic block execution counts. It is located +in @file{tree-profile.c} and is described by @code{pass_ipa_tree_profile}. + +@item IPA free fn summary + +This pass is a small ipa pass when argument @code{small_p} is true. +It releases inline function summaries and call summaries. +It is located in @file{ipa-fnsummary.c} and is described by +@code{pass_ipa_free_free_fn_summary}. + +@item IPA increase alignment + +This pass could increase the alignment of all global arrays +for vectorization. It is located in @file{tree-vectorizer.c} +and is described by @code{pass_ipa_increase_alignment}. + +@item IPA tm + +This pass is for transactional memory support. +It is located in @file{trans-mem.c} and is described by +@code{pass_ipa_tm}. + +@item IPA lower emutls + +This pass could lower thread-local storage (TLS) operations +to emulation functions with some run-time support in libgcc. +It is located in @file{tree-emutls.c} and is described by +@code{pass_ipa_lower_emutls}. + +@end itemize + +@node All regular IPA passes +@subsection All regular IPA passes +@cindex All regular ipa passes +A regular IPA pass is a pass derived from @code{ipa_opt_pass_d} +that is executed in WHOPR compilation. They may have summary hooks +implemented in any LGEN, WPA or LTRANS stage(@pxref{IPA}). + +@itemize @bullet +@item IPA whole program visiblity + +This pass brings functions local at LTO time with -fwhole-program. +It is located in @file{ipa-visibility.c} and is described by +@code{pass_ipa_whole_program_visibility}. + +@item IPA profile + +The IPA profile pass propagates frequencies across the call graph +based on profile. It is located in @file{ipa-profile.c} and is described by +@code{pass_ipa_profile}. + +@item IPA icf + +This is the inter-procedural identical code folding pass for functions and +read-only variables. The goal of this transformation is to discover functions +and read-only variables which do have exactly the same semantics. It is +located in @file{ipa-icf.c} and is described by @code{pass_ipa_icf}. + +@item IPA devirt + +This pass do the devirtualization based on type inheritance graph. +When polymorphic call has only one likely target in the unit, +turn it into a speculative call. It is located in @file{ipa-devirt.c} +and is described by @code{pass_ipa_devirt}. + +@item IPA cp + +This is the inter-procedural constant propagation pass. The goal of this +transformation is to discover functions which are always invoked with some +arguments with the same known constant values and modify the functions, do +partial specialization and propagates types. It is located in @file{ipa-cp.c} +and is described by @code{pass_ipa_cp}. + +@item IPA sra + +This is the inter-procedural scalar replacement of aggregates pass. IPA-SRA is +an inter-procedural pass that removes unused function return values, removes +unused function parameters. It can also replace an aggregate parameter by a +set of other parameters representing part of the original, turning those passed +by reference into new ones which pass the value directly. It is located in +@file{ipa-sra.c} and is described by @code{pass_ipa_sra}. + +@item IPA cdtor merge + +This pass looks for constructors and destructors and produce function calling +them. This is needed for targets not supporting ctors or dtors. +It is located in @file{ipa.c} and is described by @code{pass_ipa_cdtor_merge}. + +@item IPA hsa + +Inter-procedural HSA pass is responsible for creation of HSA clones. +For all these HSA clones, emit HSAIL instructions and pass processing +is terminated. It is located in @file{ipa-hsa.c} and is described by +@code{pass_ipa_hsa}. + +@item IPA fn summary + +This is function summary pass for analysis of function bodies. Each function +will collect body size, function execution time function frame size data and +call statement size, time and how often the parameters change for each call. +It is located in @file{ipa-fnsummary.c} and is described by +@code{pass_ipa_fn_summary}. + +@item IPA inline + +IPA inline pass is the real inliner able to handle inlining with whole program +knowledge. Small functions are inlined by greedy algorithm ordering all +inlinable cgraph edges by their badness; Unreachable functions are removed +from callgraph; Functions called once and not exported from the unit are +inlined. It is located in @file{ipa-inline.c} and is described by +@code{pass_ipa_inline}. + +@item IPA pure const + +This pass marks functions as being either const (TREE_READONLY) or +pure (DECL_PURE_P). It produces the global information and computes +pure/const attributes by performing a transitive closure on the callgraph +information that was produced by generate_summary. It is located in +@file{ipa-pure-const.c} and is described by @code{pass_ipa_pure_const}. + +@item IPA free fn summary + +This pass is a regular ipa pass when argument @code{small_p} is false. +It releases inline function summaries and call summaries. +It is located in @file{ipa-fnsummary.c} and is described by +@code{pass_ipa_free_fn_summary}. + +@item IPA reference + +This pass gathers information about how variables whose scope is +confined to the compilation unit are used. It is located in +@file{ipa-reference.c} and is described by @code{pass_ipa_reference}. + +@item IPA single use + +This pass checks whether variable is used by single function. +It is located in @file{ipa.c} and is described by +@code{pass_ipa_single_use}. + +@item IPA comdats + +This is a simple pass that looks for static symbols that are used +exclusively by symbol within one comdat group. It is located in +@file{ipa-comdats.c} and is described by @code{pass_ipa_comdats}. + +@end itemize + +@node All late IPA passes +@subsection All late IPA passes +@cindex all late ipa passes +All late IPA passes are also simple IPA passes executed after +the regular passes. In WHOPR mode the passes are executed after +partitioning and thus see just parts of the compiled unit. + +@itemize @bullet +@item Materialize all clones + +Once all functions from compilation unit are in memory, produce all clones +and update all calls. It is located in @file{ipa.c} and is described by +@code{pass_materialize_all_clones}. + +@item IPA pta +Same as pta in small IPA passes. + +@item OpenMP simd clone + +This is the OpenMP constructs' SIMD clone pass. If the function in NODE +is tagged as an elemental SIMD function, create the appropriate SIMD clones. +It is located in @file{omp-simd-clone.c} and is described by +@code{pass_omp_simd_clone}. + +@end itemize + @node Tree SSA passes @section Tree SSA passes -- 2.21.0.777.g83232e3864