From patchwork Tue Oct 5 12:19:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Belevantsev X-Patchwork-Id: 66822 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 DD5F5B70CB for ; Tue, 5 Oct 2010 23:19:46 +1100 (EST) Received: (qmail 31307 invoked by alias); 5 Oct 2010 12:19:32 -0000 Received: (qmail 31269 invoked by uid 22791); 5 Oct 2010 12:19:21 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, TW_CP, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.198.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Oct 2010 12:19:14 +0000 Received: from [10.10.3.52] (winnie.ispras.ru [83.149.198.236]) by smtp.ispras.ru (Postfix) with ESMTP id 563DD5D40AD; Tue, 5 Oct 2010 16:18:09 +0400 (MSD) Message-ID: <4CAB17C0.6030601@ispras.ru> Date: Tue, 05 Oct 2010 16:19:12 +0400 From: Andrey Belevantsev User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0b7pre) Gecko/20101003 Thunderbird/3.3a1pre MIME-Version: 1.0 To: GCC Patches CC: "Vladimir N. Makarov" Subject: Do not move frame related insns in selective scheduling 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 Hello, This patch fixes the selective scheduler to make CANT_MOVE any RTX_FRAME_RELATED_P insns and the insn adjacent to NOTE_INSN_EPILOGUE_BEG, as explained in http://gcc.gnu.org/ml/gcc-patches/2010-09/msg02387.html and http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00013.html. I have also fixed sched-vis.c to allow printing NULL values in notes because I hit one in REG_CFA_REGISTER; this seems possible looking at ia64 and alpha backends. Bootstrapped and regtested on ia64-linux, ok for trunk? Andrey 2010-10-05 Andrey Belevantsev * sel-sched-ir.c (init_global_and_expr_for_insn): Set CANT_MOVE on RTX_FRAME_RELATED_P insns and the insn to which NOTE_INSN_EPILOGUE_BEG is attached. * sched-vis.c (print_value): Allow NULL value. * gcc.target/ia64/20101005.c: New test. Index: gcc/testsuite/gcc.target/ia64/20101005.c =================================================================== *** gcc/testsuite/gcc.target/ia64/20101005.c (revision 0) --- gcc/testsuite/gcc.target/ia64/20101005.c (revision 0) *************** *** 0 **** --- 1,66 ---- + /* { dg-do compile } */ + /* { dg-options "-O2 -g -fselective-scheduling2" } */ + + typedef long unsigned int size_t; + struct fileloc + { + const char *file; + }; + typedef struct type *type_p; + typedef const struct type *const_type_p; + enum typekind + { + TYPE_STRUCT, + TYPE_UNION, + TYPE_POINTER, + TYPE_LANG_STRUCT, + TYPE_PARAM_STRUCT + }; + struct type + { + enum typekind kind; + union + { + struct + { + struct fileloc line; + } s; + struct + { + struct fileloc line; + } param_struct; + } u; + }; + struct outf + { + size_t bufused; + char *buf; + }; + typedef struct outf *outf_p; + oprintf (outf_p o, const char *format, ...) + { + char *s; + size_t slength; + memcpy (o->buf + o->bufused, s, slength); + } + output_mangled_typename (outf_p of, const_type_p t) + { + switch (t->kind) + { + case TYPE_POINTER: (fancy_abort ("/gcc/gengtype.c", 1988, __FUNCTION__)); + } + } + output_type_enum (outf_p of, type_p s) + { + if (s->kind == TYPE_PARAM_STRUCT && s->u.param_struct.line.file != ((void *)0)) + { + oprintf (of, ", gt_e_"); + } + else if (((s)->kind == TYPE_UNION || (s)->kind == TYPE_STRUCT || (s)->kind == TYPE_LANG_STRUCT) && s->u.s.line.file != ((void *)0)) + { + oprintf (of, ", gt_ggc_e_"); + output_mangled_typename (of, s); + } + else + oprintf (of, ", gt_types_enum_last"); + } Index: gcc/sel-sched-ir.c =================================================================== *** gcc/sel-sched-ir.c (revision 164986) --- gcc/sel-sched-ir.c (working copy) *************** init_global_and_expr_for_insn (insn_t in *** 2861,2878 **** bool force_unique_p; ds_t spec_done_ds; ! /* Certain instructions cannot be cloned. */ ! if (CANT_MOVE (insn) ! || INSN_ASM_P (insn) ! || SCHED_GROUP_P (insn) ! || prologue_epilogue_contains (insn) ! /* Exception handling insns are always unique. */ ! || (cfun->can_throw_non_call_exceptions && can_throw_internal (insn)) ! /* TRAP_IF though have an INSN code is control_flow_insn_p (). */ ! || control_flow_insn_p (insn)) ! force_unique_p = true; else ! force_unique_p = false; if (targetm.sched.get_insn_spec_ds) { --- 2861,2898 ---- bool force_unique_p; ds_t spec_done_ds; ! /* Certain instructions cannot be cloned, and frame related insns and ! the insn adjacent to NOTE_INSN_EPILOGUE_BEG cannot be moved out of ! their block. */ ! if (prologue_epilogue_contains (insn)) ! { ! if (RTX_FRAME_RELATED_P (insn)) ! CANT_MOVE (insn) = 1; ! else ! { ! rtx note; ! for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) ! if (REG_NOTE_KIND (note) == REG_SAVE_NOTE ! && ((enum insn_note) INTVAL (XEXP (note, 0)) ! == NOTE_INSN_EPILOGUE_BEG)) ! { ! CANT_MOVE (insn) = 1; ! break; ! } ! } ! force_unique_p = true; ! } else ! if (CANT_MOVE (insn) ! || INSN_ASM_P (insn) ! || SCHED_GROUP_P (insn) ! /* Exception handling insns are always unique. */ ! || (cfun->can_throw_non_call_exceptions && can_throw_internal (insn)) ! /* TRAP_IF though have an INSN code is control_flow_insn_p (). */ ! || control_flow_insn_p (insn)) ! force_unique_p = true; ! else ! force_unique_p = false; if (targetm.sched.get_insn_spec_ds) { Index: gcc/sched-vis.c =================================================================== *** gcc/sched-vis.c (revision 164986) --- gcc/sched-vis.c (working copy) *************** print_value (char *buf, const_rtx x, int *** 428,433 **** --- 428,438 ---- char t[BUF_LEN]; char *cur = buf; + if (!x) + { + safe_concat (buf, buf, "(nil)"); + return; + } switch (GET_CODE (x)) { case CONST_INT: