From patchwork Mon Oct 10 13:36:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 680405 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3st1Pc027Gz9s65 for ; Tue, 11 Oct 2016 00:36:51 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=dzXAFKoO; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=eRRopWZM6PzhAGsMNjjYkEBvErDvylrYf8r/y3QskHJ6ePgVjl bB37VhCsVoFfxvzECQkKDaS/dNspUNgqUiUc9W/M6mTIed0VEMWQTCdfv7UKLVpF uoucYdxH9hKapQJzsBHFgE5UhiVHQJpEinleHMUhTKQkgRbb24fR8h0WA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=uCbcnMSwIqu3tRBMA3l7eRJ4Hzs=; b=dzXAFKoOO2noS/eTacyb fCjtwVDovG1QjdnUgayFIKzPwQwrJl8+ar+pOR5+leMBVQRq4w0E706WpfcwCjSO hnjiBIB54rpEKZdA9IelQbXTsi8stWhxdHTJ+pxsQWIo4GPBMzA3yGOzGZEaYUSL rO6jsQFs7bfaG2i+m+Qf37k= Received: (qmail 54121 invoked by alias); 10 Oct 2016 13:36:44 -0000 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 Received: (qmail 54035 invoked by uid 89); 10 Oct 2016 13:36:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=johann, pass_data, ctxt, coretypes.h X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.216) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Oct 2016 13:36:33 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwTPLBCxG2PwtgsgUwIw== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (ip5f581faf.dynamic.kabel-deutschland.de [95.88.31.175]) by smtp.strato.de (RZmta 39.5 DYNA|AUTH) with ESMTPSA id j00d8ds9ADaUNuZ (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Mon, 10 Oct 2016 15:36:30 +0200 (CEST) To: GCC Patches Cc: Denis Chertykov , Senthil Kumar Selvaraj From: Georg-Johann Lay Subject: [patch,avr] Use avr-passes.def to register passes. Message-ID: Date: Mon, 10 Oct 2016 15:36:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes This is a code clean-up using the new -passes.def feature in order to register avr target passes and to get -fdump-xxx etc. to work for such passes. Ok for trunk? Johann * config/avr/avr-passes.def: New file. * config/avr/t-avr (PASSES_EXTRA): Add avr-passes.def. * config/avr/avr-protos.h (gcc::context, rtl_opt_pass): Declare. (make_avr_pass_recompute_note): New proto. * config/avr/avr.c (make_avr_pass_recompute_notes): New function. (avr_pass_recompute_notes): Use anonymous namespace. (avr_register_passes): Remove function... (avr_option_override): ...and its call. Index: config/avr/avr-passes.def =================================================================== --- config/avr/avr-passes.def (nonexistent) +++ config/avr/avr-passes.def (working copy) @@ -0,0 +1,28 @@ +/* Description of target passes for AVR. + Copyright (C) 2016 Free Software Foundation, Inc. */ + +/* This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +/* This avr-specific pass (re)computes insn notes, in particular REG_DEAD + notes which are used by `avr.c::reg_unused_after' and branch offset + computations. These notes must be correct, i.e. there must be no + dangling REG_DEAD notes; otherwise wrong code might result, cf. PR64331. + + DF needs (correct) CFG, hence right before free_cfg is the last + opportunity to rectify notes. */ + +INSERT_PASS_BEFORE (pass_free_cfg, 1, avr_pass_recompute_notes); Index: config/avr/avr-protos.h =================================================================== --- config/avr/avr-protos.h (revision 240915) +++ config/avr/avr-protos.h (working copy) @@ -154,6 +154,11 @@ extern void asm_output_float (FILE *file extern bool avr_have_dimode; +namespace gcc { class context; } +class rtl_opt_pass; + +extern rtl_opt_pass *make_avr_pass_recompute_notes (gcc::context *); + /* From avr-log.c */ #define avr_dump(...) avr_vdump (NULL, __FUNCTION__, __VA_ARGS__) Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 240915) +++ config/avr/avr.c (working copy) @@ -295,6 +295,7 @@ avr_to_int_mode (rtx x) : simplify_gen_subreg (int_mode_for_mode (mode), x, mode, 0); } +namespace { static const pass_data avr_pass_data_recompute_notes = { @@ -328,20 +329,12 @@ public: } }; // avr_pass_recompute_notes +} // anon namespace -static void -avr_register_passes (void) +rtl_opt_pass* +make_avr_pass_recompute_notes (gcc::context *ctxt) { - /* This avr-specific pass (re)computes insn notes, in particular REG_DEAD - notes which are used by `avr.c::reg_unused_after' and branch offset - computations. These notes must be correct, i.e. there must be no - dangling REG_DEAD notes; otherwise wrong code might result, cf. PR64331. - - DF needs (correct) CFG, hence right before free_cfg is the last - opportunity to rectify notes. */ - - register_pass (new avr_pass_recompute_notes (g, "avr-notes-free-cfg"), - PASS_POS_INSERT_BEFORE, "*free_cfg", 1); + return new avr_pass_recompute_notes (ctxt, "avr-notes-free-cfg"); } @@ -464,11 +457,6 @@ avr_option_override (void) init_machine_status = avr_init_machine_status; avr_log_set_avr_log(); - - /* Register some avr-specific pass(es). There is no canonical place for - pass registration. This function is convenient. */ - - avr_register_passes (); } /* Function to set up the backend function structure. */ Index: config/avr/t-avr =================================================================== --- config/avr/t-avr (revision 240915) +++ config/avr/t-avr (working copy) @@ -16,6 +16,8 @@ # along with GCC; see the file COPYING3. If not see # . +PASSES_EXTRA += $(srcdir)/config/avr/avr-passes.def + driver-avr.o: $(srcdir)/config/avr/driver-avr.c \ $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(srcdir)/config/avr/avr-arch.h $(TM_H)