From patchwork Thu Jul 13 09:05:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107662 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1947768qge; Thu, 13 Jul 2017 02:07:40 -0700 (PDT) X-Received: by 10.98.219.130 with SMTP id f124mr15757613pfg.168.1499936860528; Thu, 13 Jul 2017 02:07:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499936860; cv=none; d=google.com; s=arc-20160816; b=FM1yqYZ5Tw8nQ+CwAFORKp2HaVOe4GQ0mkzvFbGMAXlL+z/tjuG3V4uhQg+JqWZE7T DppL/H28ngdIYrKNz1x51S+0yUth9HVILaiBntbfx8DUWBriqlaKKQ60bUTld49fw8ts 6rKj/6+FVdCZMbQpSy09JmB/vyY4aD26A21vdleAqJGgzfatZYQg+sgsmLYq98LJI2Wf w3wrSWFKr0Q70zQhXIMUv0C4tKsyXF31xgIfeCuonOpnAKVt2hTa04ySQmHJfe8+39mi TpEUFZgatndM83PqppAv45vsXqUfZ+qwBnHsjZmBPkJ9hD8Ko74n/3p3t2snwUlEQBW/ Z56Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=VYyZDi0ygrkgbmdt/IvkI/CELCOhU6ocvJiiwTGTb1I=; b=a1MYb+seZUWd4wfjHI6dsfZLOsD8Ynl+fIb60mw51vpc4PoxsYCI3UBruM0p8plK8j qw0mduHSdd1ANyNVULE8V8WPHYNcEzJdUFCqYOYLfEpCovEovws4ixD9MDA+/XaWI7Pv Em8vMGJH1yh1D1ZsjJazu/M+a5LRe4y8zpe/++TU2fMVYmii4WE9lXnfYv9QKxqrrfZR Axy0IIRfdcpYB9HbiHF/4mCffJX8pRe4MsWCaSidpV7vNUPJENpBeGpBCUEOjW3VqKHE sIKcocoJhdeawSuCsbM9ezrFm+lXteDzfKXPQmKVCTXn6gG/eaKVYFG/cOYxS8IlQjaH F1jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=kDrNI5q0; spf=pass (google.com: domain of gcc-patches-return-458068-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458068-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id b4si3786403pfl.145.2017.07.13.02.07.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 02:07:40 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458068-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=kDrNI5q0; spf=pass (google.com: domain of gcc-patches-return-458068-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458068-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=nSTWp4nQxW2wsjZyz+6qgyplms3tH 5TBBhosMGxTeluIF/pgzUKqEk1ucpCq0B6kBAviK9V7FBhfu2HueJ/0Ly5+3pLo6 L4C9aDr+mOktlIaKTj7IJ2AIxLaGG/mXXFsiXK7YWDOVtdGekEe2/eAycbHk7TRu 2sGERcXS2sWP1g= 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:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=JEckDhW8k02uWYrSJjG7y+t++yI=; b=kDr NI5q0wVpcDyNQRFDl27OX2uOJdIhf2WB6BSlkEk/Dcqu3n7344Rc64B2xXYDvhKr VQahVuAe2hgqTpKr2yIVMdphIP0Or0XJMDlCBmb9gDrmZyj15XapMwyUDEXIJob0 U3MhP2kXlT9TKF7MluZTCJKfLsRTgkMW9smJiUUA= Received: (qmail 69632 invoked by alias); 13 Jul 2017 09:05:24 -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 67964 invoked by uid 89); 13 Jul 2017 09:05:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f173.google.com Received: from mail-wr0-f173.google.com (HELO mail-wr0-f173.google.com) (209.85.128.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 09:05:20 +0000 Received: by mail-wr0-f173.google.com with SMTP id r103so49728390wrb.0 for ; Thu, 13 Jul 2017 02:05:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=VYyZDi0ygrkgbmdt/IvkI/CELCOhU6ocvJiiwTGTb1I=; b=nZQJciLHtvhyxkS/tUOVeDLDh6W8rKKsj80YxTf0PCJLAAC/3mxbSsoNnKxt+gpP47 vmak3EvR02wXDWxm05RbhvJwMXoDGPfo4H9azER4RHObjc/jtBkpEFIUieA8BmIGSSZT Dr8OgWqumldsu9QP5MNhcCfDKbs1/mvC4IY+LjPQw4h1zcNynNOOKLc4kNGmdI2SzfhI ntxnds1Y9vPs+GqHZedmIBlDsJbXvoG6NKqgvKhcMAngwGHcKEjaVzXHoCvOyZoLQ4Nx zqpoj3z7+4q8nROis9I7+VOw5g7iomQ2hyz/4q+G3bTnLpA3tOgLwtgLw+RUa5ETyYEZ C/7w== X-Gm-Message-State: AIVw112NJwWvg50N1K6QRRucDw1DRIYQ3bs5KLYwjrKbxVSbehBF8g69 6Y7Il5gl7h4FdE1OgKdBjA== X-Received: by 10.223.149.33 with SMTP id 30mr1098862wrs.186.1499936717853; Thu, 13 Jul 2017 02:05:17 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id w96sm4136521wrc.33.2017.07.13.02.05.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 02:05:17 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [76/77] Add a scalar_mode_pod class References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 10:05:15 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <871spkbtbo.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch adds a scalar_mode_pod class and uses it to replace the machine_mode in fixed_value. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * coretypes.h (scalar_mode_pod): New typedef. * gdbhooks.py (build_pretty_printer): Handle it. * machmode.h (gt_ggc_mx, gt_pch_nx): New functions. * fixed-value.h (fixed_value::mode): Change type to scalar_mode_pod. * fold-const.c (fold_convert_const_int_from_fixed): Use scalar_mode. * tree-streamer-in.c (unpack_ts_fixed_cst_value_fields): Use as_a . Index: gcc/coretypes.h =================================================================== --- gcc/coretypes.h 2017-07-13 09:18:56.810392248 +0100 +++ gcc/coretypes.h 2017-07-13 09:19:00.088160188 +0100 @@ -63,6 +63,7 @@ typedef opt_mode opt_scalar typedef opt_mode opt_scalar_int_mode; typedef opt_mode opt_scalar_float_mode; template class pod_mode; +typedef pod_mode scalar_mode_pod; typedef pod_mode scalar_int_mode_pod; /* Subclasses of rtx_def, using indentation to show the class Index: gcc/gdbhooks.py =================================================================== --- gcc/gdbhooks.py 2017-07-13 09:18:56.812392104 +0100 +++ gcc/gdbhooks.py 2017-07-13 09:19:00.090160049 +0100 @@ -548,7 +548,8 @@ def build_pretty_printer(): 'opt_mode', OptMachineModePrinter) pp.add_printer_for_regex(r'pod_mode<(\S+)>', 'pod_mode', MachineModePrinter) - pp.add_printer_for_types(['scalar_int_mode_pod'], + pp.add_printer_for_types(['scalar_int_mode_pod', + 'scalar_mode_pod'], 'pod_mode', MachineModePrinter) for mode in 'scalar_mode', 'scalar_int_mode', 'scalar_float_mode': pp.add_printer_for_types([mode], mode, MachineModePrinter) Index: gcc/machmode.h =================================================================== --- gcc/machmode.h 2017-07-13 09:18:59.187223319 +0100 +++ gcc/machmode.h 2017-07-13 09:19:00.090160049 +0100 @@ -894,4 +894,22 @@ #define FOR_EACH_2XWIDER_MODE(ITERATOR, mode_iterator::iterate_p (&(ITERATOR)); \ mode_iterator::get_2xwider (&(ITERATOR))) +template +void +gt_ggc_mx (pod_mode *) +{ +} + +template +void +gt_pch_nx (pod_mode *) +{ +} + +template +void +gt_pch_nx (pod_mode *, void (*) (void *, void *), void *) +{ +} + #endif /* not HAVE_MACHINE_MODES */ Index: gcc/fixed-value.h =================================================================== --- gcc/fixed-value.h 2017-07-13 09:18:55.158511776 +0100 +++ gcc/fixed-value.h 2017-07-13 09:19:00.088160188 +0100 @@ -22,8 +22,8 @@ #define GCC_FIXED_VALUE_H struct GTY(()) fixed_value { - double_int data; /* Store data up to 2 wide integers. */ - machine_mode mode; /* Use machine mode to know IBIT and FBIT. */ + double_int data; /* Store data up to 2 wide integers. */ + scalar_mode_pod mode; /* Use machine mode to know IBIT and FBIT. */ }; #define FIXED_VALUE_TYPE struct fixed_value Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c 2017-07-13 09:18:53.998596742 +0100 +++ gcc/fold-const.c 2017-07-13 09:19:00.090160049 +0100 @@ -1952,7 +1952,7 @@ fold_convert_const_int_from_fixed (tree { tree t; double_int temp, temp_trunc; - machine_mode mode; + scalar_mode mode; /* Right shift FIXED_CST to temp by fbit. */ temp = TREE_FIXED_CST (arg1).data; Index: gcc/tree-streamer-in.c =================================================================== --- gcc/tree-streamer-in.c 2017-05-03 08:46:32.776861592 +0100 +++ gcc/tree-streamer-in.c 2017-07-13 09:19:00.090160049 +0100 @@ -208,7 +208,7 @@ unpack_ts_real_cst_value_fields (struct unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { FIXED_VALUE_TYPE *fp = ggc_alloc (); - fp->mode = bp_unpack_machine_mode (bp); + fp->mode = as_a (bp_unpack_machine_mode (bp)); fp->data.low = bp_unpack_var_len_int (bp); fp->data.high = bp_unpack_var_len_int (bp); TREE_FIXED_CST_PTR (expr) = fp;