From patchwork Thu Jun 17 12:26:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 56028 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8E8051007D2 for ; Thu, 17 Jun 2010 22:26:34 +1000 (EST) Received: (qmail 4640 invoked by alias); 17 Jun 2010 12:26:30 -0000 Received: (qmail 4613 invoked by uid 22791); 17 Jun 2010 12:26:28 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Jun 2010 12:26:23 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 1B82CCB02A9; Thu, 17 Jun 2010 14:26:27 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1cFp4Gcb4EHZ; Thu, 17 Jun 2010 14:26:27 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 007D2CB02A7; Thu, 17 Jun 2010 14:26:27 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 09BE3D9AB0; Thu, 17 Jun 2010 14:26:37 +0200 (CEST) Date: Thu, 17 Jun 2010 14:26:37 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Use Make_Temporary (5) Message-ID: <20100617122637.GA9144@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch is another of several that replaces calls to Make_Defining_Identifier, with calls to Make_Temporary where possible, setting Node where possible. This is an internal cleanup that does not affect compiler functionality in any way, so no test needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-17 Robert Dewar * exp_ch3.adb, exp_ch6.adb, exp_smem.adb, exp_util.adb: Use Ekind_In. * layout.adb, freeze.adb: Use Make_Temporary. Index: freeze.adb =================================================================== --- freeze.adb (revision 160892) +++ freeze.adb (working copy) @@ -1145,10 +1145,7 @@ package body Freeze is if Nkind_In (Par, N_Object_Declaration, N_Assignment_Statement) and then Comes_From_Source (Par) then - Temp := - Make_Defining_Identifier (Loc, - New_Internal_Name ('T')); - + Temp := Make_Temporary (Loc, 'T', E); New_N := Make_Object_Declaration (Loc, Defining_Identifier => Temp, @@ -5419,8 +5416,7 @@ package body Freeze is -- involve secondary stack expansion. else - Dnam := - Make_Defining_Identifier (Loc, New_Internal_Name ('D')); + Dnam := Make_Temporary (Loc, 'D'); Dbody := Make_Subprogram_Body (Loc, Index: layout.adb =================================================================== --- layout.adb (revision 160887) +++ layout.adb (working copy) @@ -3119,11 +3119,7 @@ package body Layout is Make_Func : Boolean := False) return Dynamic_SO_Ref is Loc : constant Source_Ptr := Sloc (Ins_Type); - - K : constant Entity_Id := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('K')); - + K : constant Entity_Id := Make_Temporary (Loc, 'K'); Decl : Node_Id; Vtype_Primary_View : Entity_Id; Index: exp_util.adb =================================================================== --- exp_util.adb (revision 160897) +++ exp_util.adb (working copy) @@ -2107,9 +2107,7 @@ package body Exp_Util is begin -- Only consider record types - if Ekind (Typ) /= E_Record_Type - and then Ekind (Typ) /= E_Record_Subtype - then + if not Ekind_In (Typ, E_Record_Type, E_Record_Subtype) then return False; end if; @@ -4406,9 +4404,7 @@ package body Exp_Util is -- already rewritten a variable node with a constant as -- a result of an earlier Force_Evaluation call. - if Ekind (Entity (N)) = E_Constant - or else Ekind (Entity (N)) = E_In_Parameter - then + if Ekind_In (Entity (N), E_Constant, E_In_Parameter) then return True; -- Functions are not side effect free Index: exp_smem.adb =================================================================== --- exp_smem.adb (revision 160834) +++ exp_smem.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2010, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -270,10 +270,7 @@ package body Exp_Smem is return False; else - if Ekind (Formal) = E_Out_Parameter - or else - Ekind (Formal) = E_In_Out_Parameter - then + if Ekind_In (Formal, E_Out_Parameter, E_In_Out_Parameter) then Insert_Node := Call; return True; else Index: exp_ch6.adb =================================================================== --- exp_ch6.adb (revision 160894) +++ exp_ch6.adb (working copy) @@ -2941,9 +2941,8 @@ package body Exp_Ch6 is return; end if; - if Ekind (Subp) = E_Function - or else Ekind (Subp) = E_Procedure - then + if Ekind_In (Subp, E_Function, E_Procedure) then + -- We perform two simple optimization on calls: -- a) replace calls to null procedures unconditionally; @@ -4338,9 +4337,7 @@ package body Exp_Ch6 is -- For a procedure, we add a return for all possible syntactic ends of -- the subprogram. - if Ekind (Spec_Id) = E_Procedure - or else Ekind (Spec_Id) = E_Generic_Procedure - then + if Ekind_In (Spec_Id, E_Procedure, E_Generic_Procedure) then Add_Return (Statements (H)); if Present (Exception_Handlers (H)) then @@ -4707,8 +4704,7 @@ package body Exp_Ch6 is -- foreign convention or whose result type has a foreign convention -- never qualify. - if Ekind (E) = E_Function - or else Ekind (E) = E_Generic_Function + if Ekind_In (E, E_Function, E_Generic_Function) or else (Ekind (E) = E_Subprogram_Type and then Etype (E) /= Standard_Void_Type) then Index: exp_ch3.adb =================================================================== --- exp_ch3.adb (revision 160893) +++ exp_ch3.adb (working copy) @@ -6221,9 +6221,7 @@ package body Exp_Ch3 is -- See GNAT Pool packages in the Run-Time for more details - elsif Ekind (Def_Id) = E_Access_Type - or else Ekind (Def_Id) = E_General_Access_Type - then + elsif Ekind_In (Def_Id, E_Access_Type, E_General_Access_Type) then declare Loc : constant Source_Ptr := Sloc (N); Desig_Type : constant Entity_Id := Designated_Type (Def_Id);