From patchwork Tue Nov 6 16:07:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 197496 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 D812B2C0097 for ; Wed, 7 Nov 2012 03:08:36 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352822917; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=YUwjzGL 1BezcQhOTKewRO0/GDto=; b=k+IFgsJeDK1f+1i+w9HjkdxBRiitf5nNF+z3San pxZDHO0HRba8NH9ywUPCqyn/KaOX/aDIn7icGYo7+Q59YcJL+bVx8DDHIcpY8rIL BKUSUgOJXs/kKutItJ+3YYe773M7IjtBO5/XPjr42YlDB+CTLxwOFOvA2ab3C+PZ E7Sg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=RxcVXyEJKKTywMRoonx5pi+q6+VZd9IsGtI9iacMuAmiiHRxEftguTDMMAtw1H IevoqodSDMOVeg8mNXlCbp8Btsw/p6VMVh1pcwgjC4anC8fxMPVg0IAYa79iB5nH 4MZy7Gp9hSRnsgwx8eG9lsBlhasqTZmcHqA7LJ6l+n/VU=; Received: (qmail 11937 invoked by alias); 6 Nov 2012 16:08:12 -0000 Received: (qmail 11904 invoked by uid 22791); 6 Nov 2012 16:08:08 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Nov 2012 16:08:00 +0000 Received: by mail-pb0-f47.google.com with SMTP id ro12so464955pbb.20 for ; Tue, 06 Nov 2012 08:07:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.225.34 with SMTP id rh2mr4666467pbc.78.1352218079425; Tue, 06 Nov 2012 08:07:59 -0800 (PST) Received: by 10.66.246.232 with HTTP; Tue, 6 Nov 2012 08:07:59 -0800 (PST) Date: Tue, 6 Nov 2012 17:07:59 +0100 Message-ID: Subject: [PATCH, i386]: Remove SLOT_VIRTUAL from enum ix86_stack_slot From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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! Attached patch removes SLOT_VIRTUAL and introduces TARGET_INSTANTIATE_DECLS that takes care of instantiating registers in ix86_stack_locals array. The patch enables some more stack slot sharing. 2012-11-06 Uros Bizjak * config/i386/i386.c (TARGET_INSTANTIATE_DECLS): New define. (ix86_instantiate_decls): New function. (ix86_expand_builtin) : Use SLOT_TEMP stack slot instead of SLOT_VIRTUAL. : Ditto. (assign_386_stack_local): Do not assert when virtual slot is valid. * config/i386/i386.h (enum ix86_stack_slot): Remove SLOT_VIRTUAL. * config/i386/i386.md (truncdfsf2): Do not use SLOT_VIRTUAL stack slot. (truncxf2): Ditto. (floatunssi2): Ditto. (isinf2): Ditto. * config/i386/sync.md (atomic_load): Ditto. (atomic_store): Ditto. Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 193180) +++ config/i386/i386.c (working copy) @@ -23751,9 +23751,6 @@ assign_386_stack_local (enum machine_mode mode, en gcc_assert (n < MAX_386_STACK_LOCALS); - /* Virtual slot is valid only before vregs are instantiated. */ - gcc_assert ((n == SLOT_VIRTUAL) == !virtuals_instantiated); - for (s = ix86_stack_locals; s; s = s->next) if (s->mode == mode && s->n == n) return validize_mem (copy_rtx (s->rtl)); @@ -23767,6 +23764,16 @@ assign_386_stack_local (enum machine_mode mode, en ix86_stack_locals = s; return validize_mem (s->rtl); } + +static void +ix86_instantiate_decls (void) +{ + struct stack_local_entry *s; + + for (s = ix86_stack_locals; s; s = s->next) + if (s->rtl != NULL_RTX) + instantiate_decl_rtl (s->rtl); +} /* Calculate the length of the memory address in the instruction encoding. Includes addr32 prefix, does not include the one-byte modrm, opcode, @@ -30586,13 +30593,13 @@ ix86_expand_builtin (tree exp, rtx target, rtx sub case IX86_BUILTIN_LDMXCSR: op0 = expand_normal (CALL_EXPR_ARG (exp, 0)); - target = assign_386_stack_local (SImode, SLOT_VIRTUAL); + target = assign_386_stack_local (SImode, SLOT_TEMP); emit_move_insn (target, op0); emit_insn (gen_sse_ldmxcsr (target)); return 0; case IX86_BUILTIN_STMXCSR: - target = assign_386_stack_local (SImode, SLOT_VIRTUAL); + target = assign_386_stack_local (SImode, SLOT_TEMP); emit_insn (gen_sse_stmxcsr (target)); return copy_to_mode_reg (SImode, target); @@ -41402,6 +41409,9 @@ ix86_memmodel_check (unsigned HOST_WIDE_INT val) #undef TARGET_MEMBER_TYPE_FORCES_BLK #define TARGET_MEMBER_TYPE_FORCES_BLK ix86_member_type_forces_blk +#undef TARGET_INSTANTIATE_DECLS +#define TARGET_INSTANTIATE_DECLS ix86_instantiate_decls + #undef TARGET_SECONDARY_RELOAD #define TARGET_SECONDARY_RELOAD ix86_secondary_reload Index: config/i386/i386.h =================================================================== --- config/i386/i386.h (revision 193180) +++ config/i386/i386.h (working copy) @@ -2150,8 +2150,7 @@ enum ix86_entity enum ix86_stack_slot { - SLOT_VIRTUAL = 0, - SLOT_TEMP, + SLOT_TEMP = 0, SLOT_CW_STORED, SLOT_CW_TRUNC, SLOT_CW_FLOOR, Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 193180) +++ config/i386/i386.md (working copy) @@ -4071,10 +4071,7 @@ ; else { - enum ix86_stack_slot slot = (virtuals_instantiated - ? SLOT_TEMP - : SLOT_VIRTUAL); - rtx temp = assign_386_stack_local (SFmode, slot); + rtx temp = assign_386_stack_local (SFmode, SLOT_TEMP); emit_insn (gen_truncdfsf2_with_temp (operands[0], operands[1], temp)); DONE; } @@ -4255,12 +4252,7 @@ DONE; } else - { - enum ix86_stack_slot slot = (virtuals_instantiated - ? SLOT_TEMP - : SLOT_VIRTUAL); - operands[2] = assign_386_stack_local (mode, slot); - } + operands[2] = assign_386_stack_local (mode, SLOT_TEMP); }) (define_insn "*truncxfsf2_mixed" @@ -5468,12 +5460,7 @@ DONE; } else - { - enum ix86_stack_slot slot = (virtuals_instantiated - ? SLOT_TEMP - : SLOT_VIRTUAL); - operands[2] = assign_386_stack_local (DImode, slot); - } + operands[2] = assign_386_stack_local (DImode, SLOT_TEMP); }) (define_expand "floatunsdisf2" @@ -15563,10 +15550,7 @@ emit_insn (gen_fxam2_i387_with_temp (scratch, operands[1])); else { - enum ix86_stack_slot slot = (virtuals_instantiated - ? SLOT_TEMP - : SLOT_VIRTUAL); - rtx temp = assign_386_stack_local (mode, slot); + rtx temp = assign_386_stack_local (mode, SLOT_TEMP); emit_move_insn (temp, operands[1]); emit_insn (gen_fxam2_i387_with_temp (scratch, temp)); Index: config/i386/sync.md =================================================================== --- config/i386/sync.md (revision 193180) +++ config/i386/sync.md (working copy) @@ -149,9 +149,7 @@ if (mode == DImode && !TARGET_64BIT) emit_insn (gen_atomic_loaddi_fpu (operands[0], operands[1], - assign_386_stack_local (DImode, - (virtuals_instantiated - ? SLOT_TEMP : SLOT_VIRTUAL)))); + assign_386_stack_local (DImode, SLOT_TEMP))); else emit_move_insn (operands[0], operands[1]); DONE; @@ -212,9 +210,7 @@ out to be significantly larger than this plus a barrier. */ emit_insn (gen_atomic_storedi_fpu (operands[0], operands[1], - assign_386_stack_local (DImode, - (virtuals_instantiated - ? SLOT_TEMP : SLOT_VIRTUAL)))); + assign_386_stack_local (DImode, SLOT_TEMP))); } else {