From patchwork Tue May 7 19:45:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 242452 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 953A02C016D for ; Wed, 8 May 2013 05:46:20 +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:content-type; q= dns; s=default; b=AhKAw0xItaYZVx/JhCH25/d5vR+hWP1LzqrTwUhbZNqMwV L0B6Y3Fc6jiZ/TphC6R/gRDRops0iyCNYr/hjxXexckVcPAW0tgZfVXYCX6lCGeV YKRg3/0374xqJ5itReVcBnck0d/UyaXDjPub+sFxwkegEsX43WQP8gGGKQm9Q= 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:content-type; s= default; bh=uMW5/tSdcqySQ80j0jGhrkU2UsI=; b=YTHUKklXAK9rzmob6IBG g1lW0d+MWBx5VvW+cXWlLceX51l+ONNAUk0TQeOd/1nq2HK4HJgnLz6DhTtpqG+i cwBSGMH30Pez7Ya2S98wJi0Ers/0VGFd6PjY90UYlAzAPH3kaO6XYEUyvw8VYjYl ZR/6nvy+Koq4zoKe7OeBKrM= Received: (qmail 24664 invoked by alias); 7 May 2013 19:46:14 -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 24654 invoked by uid 89); 7 May 2013 19:46:14 -0000 X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-vc0-f178.google.com (HELO mail-vc0-f178.google.com) (209.85.220.178) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 07 May 2013 19:46:13 +0000 Received: by mail-vc0-f178.google.com with SMTP id kw10so925144vcb.23 for ; Tue, 07 May 2013 12:46:11 -0700 (PDT) X-Received: by 10.52.117.147 with SMTP id ke19mr1958398vdb.24.1367955971720; Tue, 07 May 2013 12:46:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.240.13 with HTTP; Tue, 7 May 2013 12:45:31 -0700 (PDT) From: Steven Bosscher Date: Tue, 7 May 2013 21:45:31 +0200 Message-ID: Subject: [patch][DF] Remove DF_REF_SUBREG, add DF_REF_CALL_FUNCTION_USAGE To: GCC Patches X-Virus-Found: No Hello, For my delay-slot filler, I need to be able to see if a ref is in CALL_INSN_FUNCTION_USAGE to see if a REG is a valid candidate to fill a CALL_INSN delay slot. If a ref is a real use in the pattern of the call insn then the insn can't be delayed, but if it's only a use in CALL_INSN_FUNCTION_USAGE then it can be safely delayed. To see if a ref comes from CALL_INSN_FUNCTION_USAGE is much harder, you have to walk the whole list to find the location, or scan the call insn pattern to make sure the USE or CLOBBER of the ref location does not appear there. To make this task a lot easier, this patch marks refs in CALL_INSN_FUNCTION_USAGE with a new ref flag DF_REF_CALL_FUNCTION_USAGE. DF_REF_SUBREG is almost unused and it's easy enough to see if a ref is to a REG in a SUBREG by looking at the code of the ref location. So I removed DF_REF_SUBREG and hi-jacked its bit for DF_REF_CALL_FUNCTION_USAGE. Bootstrapped&tested on powerpc64-unknown-linux-gnu unix{,-m32). OK for trunk? Ciao! Steven * ira.c (build_insn_chain): Look at the rtx code of the use to see if it is a subreg. * df.h (enum df_ref_flags): Remove DF_REF_SUBREG. Add DF_REF_CALL_FUNCTION_USAGE. * df-scan.c (df_def_record_1): Do not pass DF_REF_SUBREG. (df_uses_record): Likewise. (df_get_call_refs): Pass DF_REF_CALL_FUNCTION_USAGE for refs found in the CALL_INSN_FUNCTION_USAGE of a call insn. Index: ira.c =================================================================== --- ira.c (revision 198639) +++ ira.c (working copy) @@ -3673,7 +3673,7 @@ build_insn_chain (void) fabricated use. */ if (DF_REF_FLAGS_IS_SET (use, DF_REF_READ_WRITE) && !DF_REF_FLAGS_IS_SET (use, DF_REF_ZERO_EXTRACT) - && DF_REF_FLAGS_IS_SET (use, DF_REF_SUBREG)) + && GET_CODE (DF_REF_REG (use)) == SUBREG) continue; /* Add the last use of each var to dead_or_set. */ Index: df.h =================================================================== --- df.h (revision 198639) +++ df.h (working copy) @@ -136,10 +136,10 @@ enum df_ref_flags /* This flag is set if the ref contains a STRICT_LOW_PART. */ DF_REF_STRICT_LOW_PART = 1 << 10, - /* This flag is set if the ref contains a SUBREG. */ - DF_REF_SUBREG = 1 << 11, + /* This flag is set if this ref is in the CALL_INSN_FUNCTION_USAGE + chain of a CALL_INSN. It may be overloaded for other insn types. */ + DF_REF_CALL_FUNCTION_USAGE = 1 << 11, - /* This bit is true if this ref is part of a multiword hardreg. */ DF_REF_MW_HARDREG = 1 << 12, Index: df-scan.c =================================================================== --- df-scan.c (revision 198639) +++ df-scan.c (working copy) @@ -2991,9 +2991,6 @@ df_def_record_1 (struct df_collection_rec *collect { if (df_read_modify_subreg_p (dst)) flags |= DF_REF_READ_WRITE | DF_REF_PARTIAL; - - flags |= DF_REF_SUBREG; - df_ref_record (DF_REF_REGULAR, collection_rec, dst, loc, bb, insn_info, DF_REF_REG_DEF, flags); } @@ -3207,7 +3204,7 @@ df_uses_record (struct df_collection_rec *collecti { df_uses_record (collection_rec, &SUBREG_REG (dst), DF_REF_REG_USE, bb, insn_info, - flags | DF_REF_READ_WRITE | DF_REF_SUBREG); + flags | DF_REF_READ_WRITE); break; } /* Fall through. */ @@ -3443,7 +3440,8 @@ df_get_call_refs (struct df_collection_rec *collec { if (GET_CODE (XEXP (note, 0)) == USE) df_uses_record (collection_rec, &XEXP (XEXP (note, 0), 0), - DF_REF_REG_USE, bb, insn_info, flags); + DF_REF_REG_USE, bb, insn_info, + flags | DF_REF_CALL_FUNCTION_USAGE); else if (GET_CODE (XEXP (note, 0)) == CLOBBER) { if (REG_P (XEXP (XEXP (note, 0), 0))) @@ -3451,11 +3449,12 @@ df_get_call_refs (struct df_collection_rec *collec unsigned int regno = REGNO (XEXP (XEXP (note, 0), 0)); if (!TEST_HARD_REG_BIT (defs_generated, regno)) df_defs_record (collection_rec, XEXP (note, 0), bb, - insn_info, flags); + insn_info, flags | DF_REF_CALL_FUNCTION_USAGE); } else df_uses_record (collection_rec, &XEXP (note, 0), - DF_REF_REG_USE, bb, insn_info, flags); + DF_REF_REG_USE, bb, insn_info, + flags | DF_REF_CALL_FUNCTION_USAGE); } }