From patchwork Wed Jul 7 21:10:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 58181 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 64371B6EEF for ; Thu, 8 Jul 2010 07:11:31 +1000 (EST) Received: (qmail 3860 invoked by alias); 7 Jul 2010 21:11:29 -0000 Received: (qmail 3774 invoked by uid 22791); 7 Jul 2010 21:11:28 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_NEUTRAL, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (140.186.70.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Jul 2010 21:11:22 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWbtn-0001Lv-Gt for gcc-patches@gcc.gnu.org; Wed, 07 Jul 2010 17:11:20 -0400 Received: from mail-ww0-f51.google.com ([74.125.82.51]:37545) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWbtn-0001Lk-BX for gcc-patches@gcc.gnu.org; Wed, 07 Jul 2010 17:11:19 -0400 Received: by wwb18 with SMTP id 18so1263019wwb.8 for ; Wed, 07 Jul 2010 14:10:18 -0700 (PDT) Received: by 10.227.147.206 with SMTP id m14mr5586861wbv.130.1278537016926; Wed, 07 Jul 2010 14:10:16 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id a1sm45599401wbb.20.2010.07.07.14.10.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 07 Jul 2010 14:10:16 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [16/27] Use target structures for init_expr_target References: <87d3v2oqyt.fsf@firetop.home> Date: Wed, 07 Jul 2010 22:10:14 +0100 In-Reply-To: <87d3v2oqyt.fsf@firetop.home> (Richard Sandiford's message of "Sun, 04 Jul 2010 22:51:54 +0100") Message-ID: <87630rt2vd.fsf@firetop.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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 Third from last: /* The following initialization functions need to generate rtl, so provide a dummy function context for them. */ init_dummy_function_start (); /* Do the target-specific parts of expr initialization. */ ==> init_expr_target (); /* Although the actions of these functions are language-independent, they use optabs, so we cannot call them from backend_init. */ init_set_costs (); ira_init (); This is another case where the cached information seems generally useful, so I've exposed it in regs.h rather than keep it private to expr.c. Richard gcc/ * regs.h (target_regs): Add x_direct_load, x_direct_store and x_float_extend_from_mem. (direct_load, direct_store, float_extend_from_mem): New macros. * expr.c (direct_load, direct_store, float_extend_from_mem): Delete. Index: gcc/regs.h =================================================================== --- gcc/regs.h 2010-07-07 21:52:27.000000000 +0100 +++ gcc/regs.h 2010-07-07 22:08:03.000000000 +0100 @@ -280,6 +280,15 @@ struct target_regs { /* Keep track of the last mode we initialized move costs for. */ int x_last_mode_for_init_move_cost; + + /* Record for each mode whether we can move a register directly to or + from an object of that mode in memory. If we can't, we won't try + to use that mode directly when accessing a field of that mode. */ + char x_direct_load[NUM_MACHINE_MODES]; + char x_direct_store[NUM_MACHINE_MODES]; + + /* Record for each mode whether we can float-extend from memory. */ + bool x_float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES]; }; extern struct target_regs default_target_regs; @@ -303,6 +312,12 @@ #define may_move_in_cost \ (this_target_regs->x_may_move_in_cost) #define may_move_out_cost \ (this_target_regs->x_may_move_out_cost) +#define direct_load \ + (this_target_regs->x_direct_load) +#define direct_store \ + (this_target_regs->x_direct_store) +#define float_extend_from_mem \ + (this_target_regs->x_float_extend_from_mem) /* Return an exclusive upper bound on the registers occupied by hard register (reg:MODE REGNO). */ Index: gcc/expr.c =================================================================== --- gcc/expr.c 2010-07-07 21:30:42.000000000 +0100 +++ gcc/expr.c 2010-07-07 22:08:03.000000000 +0100 @@ -53,6 +53,7 @@ Software Foundation; either version 3, o #include "df.h" #include "diagnostic.h" #include "ssaexpand.h" +#include "target-globals.h" /* Decide whether a function's arguments should be processed from first to last or from last to first. @@ -158,17 +159,6 @@ static void do_tablejump (rtx, enum mach static rtx const_vector_from_tree (tree); static void write_complex_part (rtx, rtx, bool); -/* Record for each mode whether we can move a register directly to or - from an object of that mode in memory. If we can't, we won't try - to use that mode directly when accessing a field of that mode. */ - -static char direct_load[NUM_MACHINE_MODES]; -static char direct_store[NUM_MACHINE_MODES]; - -/* Record for each mode whether we can float-extend from memory. */ - -static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES]; - /* This macro is used to determine whether move_by_pieces should be called to perform a structure copy. */ #ifndef MOVE_BY_PIECES_P