From patchwork Tue May 10 15:23:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 95070 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 CBC10B6EEB for ; Wed, 11 May 2011 17:24:44 +1000 (EST) Received: (qmail 29517 invoked by alias); 10 May 2011 15:24:40 -0000 Received: (qmail 29505 invoked by uid 22791); 10 May 2011 15:24:38 -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 mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 May 2011 15:24:23 +0000 Received: (qmail 27615 invoked from network); 10 May 2011 15:24:23 -0000 Received: from unknown (HELO ?84.152.158.68?) (bernds@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 May 2011 15:24:23 -0000 Message-ID: <4DC95885.1040801@codesourcery.com> Date: Tue, 10 May 2011 17:23:49 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110505 Lightning/1.0b3pre Thunderbird/3.1.10 MIME-Version: 1.0 To: GCC Patches Subject: C6X port 2/11: Use a structure for schedule_block variables References: <4DC956D0.3040306@codesourcery.com> In-Reply-To: <4DC956D0.3040306@codesourcery.com> 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 moves some local variables into a structure, in preparation for a later patch which adds the capability to save/restore scheduler state. Bernd * haifa-sched.c (struct sched_block_state): New. (schedule_block): Move some local variables into such a structure. Index: gcc/haifa-sched.c =================================================================== --- gcc.orig/haifa-sched.c +++ gcc/haifa-sched.c @@ -1635,6 +1635,16 @@ sched_setup_bb_reg_pressure_info (basic_ initiate_bb_reg_pressure_info (bb); setup_insn_max_reg_pressure (after, false); } + +/* A structure that holds local state for the loop in schedule_block. */ +struct sched_block_state +{ + /* True if no real insns have been scheduled in the current cycle. */ + bool first_cycle_insn_p; + /* Initialized with the machine's issue rate every cycle, and updated + by calls to the variable_issue hook. */ + int can_issue_more; +}; /* INSN is the "currently executing insn". Launch each insn which was waiting on INSN. READY is the ready list which contains the insns @@ -2920,8 +2930,7 @@ void schedule_block (basic_block *target_bb) { int i; - bool first_cycle_insn_p; - int can_issue_more; + struct sched_block_state ls; state_t temp_state = NULL; /* It is used for multipass scheduling. */ int sort_p, advance, start_clock_var; @@ -3071,9 +3080,9 @@ schedule_block (basic_block *target_bb) if (ready.n_ready == 0) continue; - first_cycle_insn_p = true; + ls.first_cycle_insn_p = true; cycle_issued_insns = 0; - can_issue_more = issue_rate; + ls.can_issue_more = issue_rate; for (;;) { rtx insn; @@ -3114,7 +3123,7 @@ schedule_block (basic_block *target_bb) } } - if (first_cycle_insn_p && !ready.n_ready) + if (ls.first_cycle_insn_p && !ready.n_ready) break; /* Allow the target to reorder the list, typically for @@ -3123,13 +3132,13 @@ schedule_block (basic_block *target_bb) && (ready.n_ready == 0 || !SCHED_GROUP_P (ready_element (&ready, 0)))) { - if (first_cycle_insn_p && targetm.sched.reorder) - can_issue_more + if (ls.first_cycle_insn_p && targetm.sched.reorder) + ls.can_issue_more = targetm.sched.reorder (sched_dump, sched_verbose, ready_lastpos (&ready), &ready.n_ready, clock_var); - else if (!first_cycle_insn_p && targetm.sched.reorder2) - can_issue_more + else if (!ls.first_cycle_insn_p && targetm.sched.reorder2) + ls.can_issue_more = targetm.sched.reorder2 (sched_dump, sched_verbose, ready.n_ready ? ready_lastpos (&ready) : NULL, @@ -3147,7 +3156,7 @@ schedule_block (basic_block *target_bb) } if (ready.n_ready == 0 - && can_issue_more + && ls.can_issue_more && reload_completed) { /* Allow scheduling insns directly from the queue in case @@ -3161,7 +3170,7 @@ schedule_block (basic_block *target_bb) } if (ready.n_ready == 0 - || !can_issue_more + || !ls.can_issue_more || state_dead_lock_p (curr_state) || !(*current_sched_info->schedule_more_p) ()) break; @@ -3172,7 +3181,7 @@ schedule_block (basic_block *target_bb) int res; insn = NULL_RTX; - res = choose_ready (&ready, first_cycle_insn_p, &insn); + res = choose_ready (&ready, ls.first_cycle_insn_p, &insn); if (res < 0) /* Finish cycle. */ @@ -3252,14 +3261,14 @@ schedule_block (basic_block *target_bb) || asm_noperands (PATTERN (insn)) >= 0); if (targetm.sched.variable_issue) - can_issue_more = + ls.can_issue_more = targetm.sched.variable_issue (sched_dump, sched_verbose, - insn, can_issue_more); + insn, ls.can_issue_more); /* A naked CLOBBER or USE generates no instruction, so do not count them against the issue rate. */ else if (GET_CODE (PATTERN (insn)) != USE && GET_CODE (PATTERN (insn)) != CLOBBER) - can_issue_more--; + ls.can_issue_more--; advance = schedule_insn (insn); /* After issuing an asm insn we should start a new cycle. */ @@ -3268,7 +3277,7 @@ schedule_block (basic_block *target_bb) if (advance != 0) break; - first_cycle_insn_p = false; + ls.first_cycle_insn_p = false; if (ready.n_ready > 0) prune_ready_list (temp_state, false); }