From patchwork Sun Apr 14 14:20:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 236446 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 037122C00DB for ; Mon, 15 Apr 2013 00:21:09 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; q=dns; s=default; b=I92DOrhxDMCjCqJ+A8t/KU3FjWa8pTd8dAeAXcQWnK9 Qsz6XFBa5kqaI/VtUqZcgk5h+KxmuVKRS2xxxzjGqzeRHyN3yQAhb8C8QE0S8urx GtJoI2E93XlGx59MnoUcqwrpp95E3rjS7pNXDgvwBW8JeHJ4VGwylvTduF0jXjZM = 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 :mime-version:from:date:message-id:subject:to:cc:content-type; s=default; bh=yXVED3srsTiApvkZksFmhTOMGps=; b=QW94QBABMa4QEWz2a 05+Hm++vcih57JewFF74nQYJxYPMxOMJr6g0dNJ0vV/1xSmkullf1+b9dgMRWZEH CespGgogfyMF3hCu6gzckiZwK6a4e2CcgttuQcFLmciAktnhoWf8MnrXBQqpRFEk pfaZkbvj4lzAvxgvFcmnPqmoVU= Received: (qmail 22545 invoked by alias); 14 Apr 2013 14:21:03 -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 22532 invoked by uid 89); 14 Apr 2013 14:21:02 -0000 X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 Received: from mail-vb0-f46.google.com (HELO mail-vb0-f46.google.com) (209.85.212.46) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 14 Apr 2013 14:20:42 +0000 Received: by mail-vb0-f46.google.com with SMTP id 11so3151884vbe.5 for ; Sun, 14 Apr 2013 07:20:41 -0700 (PDT) X-Received: by 10.58.214.231 with SMTP id od7mr13645743vec.44.1365949240843; Sun, 14 Apr 2013 07:20:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.240.13 with HTTP; Sun, 14 Apr 2013 07:20:00 -0700 (PDT) From: Steven Bosscher Date: Sun, 14 Apr 2013 16:20:00 +0200 Message-ID: Subject: [patch][mips] split mips_reorg in pre- and post-dbr_schedule parts To: GCC Patches Cc: rsandiford@googlemail.com X-Virus-Found: No Hello, This patch splits mips_reorg.c in a pre-dbr_schedule part and a new, machine specific post-dbr_schedule pass. With this patch, cleanup_barriers and dbr_schedule can be static functions again. Cross-built&tested mips-sim. OK for trunk? Ciao! Steven * config/mips/mips.c: Include tree-pass.h. (mips_reorg): Split in pre- and post-dbr_schedule parts. (mips_machine_reorg2): Move mips_reorg post-dbr_schedule parts here. (pass_mips_machine_reorg2): New machine specific pass. (insert_pass_mips_machine_reorg2): New pass plugin definition. (mips_option_override): Register the new pass. * rtl.h (cleanup_barriers): Remove prototype. (dbr_schedule): Likewise. * jump.c (cleanup_barriers): Make static. * reorg.c (dbr_schedule): Likewise. Index: config/mips/mips.c =================================================================== --- config/mips/mips.c (revision 197944) +++ config/mips/mips.c (working copy) @@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic.h" #include "target-globals.h" #include "opts.h" +#include "tree-pass.h" /* True if X is an UNSPEC wrapper around a SYMBOL_REF or LABEL_REF. */ #define UNSPEC_ADDRESS_P(X) \ @@ -16356,12 +16357,14 @@ mips_reorg (void) mips_df_reorg (); free_bb_for_insn (); } +} - if (optimize > 0 && flag_delayed_branch) - { - cleanup_barriers (); - dbr_schedule (get_insns ()); - } +/* We use a machine specific pass to do a second machine dependent reorg + pass after delay branch scheduling. */ + +static unsigned int +mips_machine_reorg2 (void) +{ mips_reorg_process_insns (); if (!TARGET_MIPS16 && TARGET_EXPLICIT_RELOCS @@ -16374,6 +16377,34 @@ mips_reorg (void) mips_reorg_process_insns (); mips16_split_long_branches (); } + +struct rtl_opt_pass pass_mips_machine_reorg2 = +{ + { + RTL_PASS, + "mach2", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + NULL, /* gate */ + mips_machine_reorg2, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_MACH_DEP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_verify_rtl_sharing, /* todo_flags_finish */ + } +}; + +struct register_pass_info insert_pass_mips_machine_reorg2 = +{ + &pass_mips_machine_reorg2.pass, /* pass */ + "dbr", /* reference_pass_name */ + 1, /* ref_pass_instance_number */ + PASS_POS_INSERT_AFTER /* po_op */ +}; /* Implement TARGET_ASM_OUTPUT_MI_THUNK. Generate rtl rather than asm text in order to avoid duplicating too much logic from elsewhere. */ @@ -17149,6 +17180,11 @@ mips_option_override (void) Do all CPP-sensitive stuff in uncompressed mode; we'll switch modes later if required. */ mips_set_compression_mode (0); + + /* We register a second machine specific reorg pass after delay slot + filling. Registering the pass must be done at start up. It's + convenient to do it here. */ + register_pass (&insert_pass_mips_machine_reorg2); } /* Swap the register information for registers I and I + 1, which Index: rtl.h =================================================================== --- rtl.h (revision 197944) +++ rtl.h (working copy) @@ -1924,7 +1924,6 @@ extern enum rtx_code swap_condition (enum rtx_code extern enum rtx_code unsigned_condition (enum rtx_code); extern enum rtx_code signed_condition (enum rtx_code); extern void mark_jump_label (rtx, rtx, int); -extern unsigned int cleanup_barriers (void); /* In jump.c */ extern rtx delete_related_insns (rtx); @@ -2668,9 +2667,6 @@ extern void reg_scan (rtx, unsigned int); extern void fix_register (const char *, int, int); extern bool invalid_mode_change_p (unsigned int, enum reg_class); -/* In reorg.c */ -extern void dbr_schedule (rtx); - /* In reload1.c */ extern int function_invariant_p (const_rtx); Index: jump.c =================================================================== --- jump.c (revision 197944) +++ jump.c (working copy) @@ -118,7 +118,7 @@ rebuild_jump_labels_chain (rtx chain) This simple pass moves barriers and removes duplicates so that the old code is happy. */ -unsigned int +static unsigned int cleanup_barriers (void) { rtx insn, next, prev; Index: reorg.c =================================================================== --- reorg.c (revision 197944) +++ reorg.c (working copy) @@ -3641,7 +3641,7 @@ make_return_insns (rtx first) /* Try to find insns to place in delay slots. */ -void +static void dbr_schedule (rtx first) { rtx insn, next, epilogue_insn = 0;