From patchwork Mon May 30 08:32:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1636827 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=vFYdhXWh; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LBTTn622gz9s07 for ; Mon, 30 May 2022 18:43:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 675183815FFC for ; Mon, 30 May 2022 08:43:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 675183815FFC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653900235; bh=/1RE475lNa0LrvHKtosqAjuPQDzp8M3FwPzjz0WBJ9E=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=vFYdhXWh1nRjszLfExECGOSub7CcMM1Xp3u+GdSXepCMf5g72ugTJ/6RqBvrj/5Ap 1izP3eOGTw8ZD7YZVU63I0CmTTEEwMcuzvuhh4WCfObkGkulU7PDh+HXyHWcUP+tBC 2NMwv3GPFOLmWrpZ760YDC45yRayPqh/WyyfI9ns= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 55B423815FD9 for ; Mon, 30 May 2022 08:32:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 55B423815FD9 Received: by mail-wr1-x42e.google.com with SMTP id q7so2641209wrg.5 for ; Mon, 30 May 2022 01:32:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=/1RE475lNa0LrvHKtosqAjuPQDzp8M3FwPzjz0WBJ9E=; b=m8SrLBgUQC4wmoWvbrJz5eaq3xmYNsCt0ku0KDtW8DiXSISlQnZK6kfe5QeaGAdSF8 z3F5aB0a+hIXe+NiZUt0kPdw/4SstnJQH8tMTXyZKZ1MFyrg6gvEOFpxJ6k9NuHhO//M mXNnPic82DLaKsD5hfLFi1x/btgBoVdEjT6JNl3qPoG6EUdS99arPr6wTGYLJCDefypy Gsobcaae+WGXS/WPov9cTsd0VNLCIsjud1gXbO+jcOev8Sf/gATAYqd4K2UCTh7Cr2hC 05RnxAQNh/cO4/kIZ785/UUBDgOsVzuzgCnbWhWsv1v0XOeRjSM5lsmaqLfy6tgBPyBJ 5tXA== X-Gm-Message-State: AOAM532iB+JOFGyxgbDdLhy3OwVxHxdEm70tFV2YA9exvXboLMCtMqfC JiZ0X0lgvL1dr/lJT1Tvw0PGGSYZARZaqw== X-Google-Smtp-Source: ABdhPJwzrzqoxtcpyKncLfJduRdP7ocb0QQhUZW/uOt8PTUyIc19BVS9Zmz14+rib7cp4bbkZ8601Q== X-Received: by 2002:a5d:64ad:0:b0:20e:5947:7cbf with SMTP id m13-20020a5d64ad000000b0020e59477cbfmr45772962wrp.278.1653899565130; Mon, 30 May 2022 01:32:45 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id j17-20020a05600c191100b00397393419e3sm10313143wmq.28.2022.05.30.01.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 01:32:44 -0700 (PDT) Date: Mon, 30 May 2022 08:32:44 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Introduce Opt.CCG_Mode Message-ID: <20220530083244.GA210747@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" To handle code common to the old and the new CCG code generator. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gnat1drv.adb, opt.ads, sem_ch7.adb: Introduce CCG_Mode. diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -180,6 +180,7 @@ procedure Gnat1drv is -- Set all flags required when generating C code if Generate_C_Code then + CCG_Mode := True; Modify_Tree_For_C := True; Transform_Function_Array := True; Unnest_Subprogram_Mode := True; diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -262,6 +262,9 @@ package Opt is -- Set to True to build, bind and link all the sources of a project file -- (switch -B) + CCG_Mode : Boolean := False; + -- Set to True when running as CCG (either via -gnatceg or via -emit-c) + Check_Aliasing_Of_Parameters : Boolean := False; -- GNAT -- Set to True to detect whether subprogram parameters and function results diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -409,7 +409,7 @@ package body Sem_Ch7 is -- should occur, so we need to catch all cases where the -- subprogram may be inlined by the client. - if not Generate_C_Code + if not CCG_Mode and then (Is_Inlined (Decl_Id) or else Has_Pragma_Inline (Decl_Id)) then @@ -431,7 +431,7 @@ package body Sem_Ch7 is -- unless we generate C code since inlining is then -- handled by the C compiler. - if not Generate_C_Code + if not CCG_Mode and then (Is_Inlined (Decl_Id) or else Has_Pragma_Inline (Decl_Id)) then