From patchwork Mon Jun 16 10:56:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 360065 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4ED4B1400AA for ; Mon, 16 Jun 2014 20:56:59 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=u+pXsMXoljFx2gv5fSwjjiwz0MlybOC2oIktcQh7QHLIf5 81MgtC7wlXIM51eU/y398Zzhe53ARFLDbFH1b1qgLVe+jRdAGXnuolOJsK+Dujlx qE3gnF/Bdo7+kLA1v8pbqVrnqTbMNIW9pcxFRxRpz6YCb6Z0SPShtGwYHRQsU= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=A/U5Sn6AGzxIpB3X8y+QV/03eGQ=; b=Ypd36MdnfmNeaDDjJ5f/ FmHhYy6MczSZ+8oBZ/+AV9PodNLa1s+tpdXlRTh3Itov3GFJTFP0EUS0FKVhy9GM sa3pw0dpHAZpKXzcy2Dc8udwLgI5xuNzObKDMhvdTnxXWjx9+aVFIVrPsZEe7c+Q zREwe3h3qGUKdPXY2op0unk= Received: (qmail 17175 invoked by alias); 16 Jun 2014 10:56:52 -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 17154 invoked by uid 89); 16 Jun 2014 10:56:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Jun 2014 10:56:50 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WwUaj-0003OW-K3 from Bernd_Schmidt@mentor.com for gcc-patches@gcc.gnu.org; Mon, 16 Jun 2014 03:56:45 -0700 Received: from SVR-IES-FEM-03.mgc.mentorg.com ([137.202.0.108]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 16 Jun 2014 03:56:45 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-03.mgc.mentorg.com (137.202.0.108) with Microsoft SMTP Server id 14.2.247.3; Mon, 16 Jun 2014 11:56:44 +0100 Message-ID: <539ECD65.40405@codesourcery.com> Date: Mon, 16 Jun 2014 12:56:37 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: GCC Patches Subject: Regimplification enhancements 1/3 For the ptx port, I've needed to write a new pass which ensures all objects go into address spaces as required by the machine. This uses the regimplification code in gimplify-me.c, and that requires some fixes and upgrades. Here's the first. When address spaces change, an ADDR_EXPR may have to be changed to ADDR_SPACE_CONVERT_EXPR, and these two have different representations in gimple. This patch stops the regimplification code from creating invalid gimple in such a case. Bootstrapped and tested on x86_64-linux, ok? Bernd commit 00edd2d382d406b2f729885f08aa16928552d9d0 Author: Bernd Schmidt Date: Wed Jun 11 18:41:09 2014 +0200 Fix an issue with regimplification. This is in preparation for the lower-address-spaces pass for the ptx port. We need to teach the regimplifier how to handle the case when an ADDR_EXPR turns into something else, like an ADDR_SPACE_CONVERT_EXPR. gcc/ * gimplify-me.c (gimple_regimplify_operands): Handle case where a GIMPLE_SINGLE_RHS is turned into something else. diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c index 05e986a..467ec6c 100644 --- a/gcc/gimplify-me.c +++ b/gcc/gimplify-me.c @@ -248,6 +248,22 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) gimplify_expr (&op, &pre, NULL, is_gimple_val, fb_rvalue); gimple_set_op (stmt, i - 1, op); } + if (is_gimple_assign (stmt) + && num_ops == 2 + && (get_gimple_rhs_class (gimple_expr_code (stmt)) + == GIMPLE_SINGLE_RHS) + && (get_gimple_rhs_class (TREE_CODE (gimple_op (stmt, 1))) + != GIMPLE_SINGLE_RHS)) + { + tree rhs = gimple_assign_rhs1 (stmt); + tree temp = create_tmp_reg (TREE_TYPE (rhs), NULL); + if (gimple_in_ssa_p (cfun)) + temp = make_ssa_name (temp, NULL); + gimple_assign_set_rhs1 (stmt, temp); + gimple_assign_set_rhs_code (stmt, TREE_CODE (temp)); + gimple pre_stmt = gimple_build_assign (temp, rhs); + gimple_seq_add_stmt_without_update (&pre, pre_stmt); + } lhs = gimple_get_lhs (stmt); /* If the LHS changed it in a way that requires a simple RHS,