From patchwork Sat Jul 4 13:57:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 11643637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D8846C1 for ; Sat, 4 Jul 2020 13:57:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64F9A208E4 for ; Sat, 4 Jul 2020 13:57:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Li5dPY79" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbgGDN5y (ORCPT ); Sat, 4 Jul 2020 09:57:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbgGDN5x (ORCPT ); Sat, 4 Jul 2020 09:57:53 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6101BC061794 for ; Sat, 4 Jul 2020 06:57:53 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id w6so37383318ejq.6 for ; Sat, 04 Jul 2020 06:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=COXeAUL18hdrSXD+At7C4xdndPcfAFyxiVsz37xMwc8=; b=Li5dPY79OKarHWfSp05g37TMdd1TqA8Vot1TPE4fk9NPurmhs5ME1VxA5oTWF5Av4i w05xSGQv6xOrbvDGF+B0iG7OgISLNZKDkjKFTG3MCKfLyi3lGFb0Ok0iKy/zQoTKkdSV CRBHob+hQpeypy95JqN4wRPoweaooKxagzhvq6ciuHDnulua1/4DBW99mBnf3Y+VXn74 qZ+u04QAkec9Ccf04zumXP3mjLv1VvGyDrCZeXHu4XlZjY4UVPWCtwtST6/15Al+g6P1 CaNsF6qgmBbj+jbWR21d6eHoXOoauNFj/skID/2woPTmfFgGdKPTlsgAVeJmVZQVcrE7 Wpqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=COXeAUL18hdrSXD+At7C4xdndPcfAFyxiVsz37xMwc8=; b=PIa+FaxJBqlmWBIu2Goer5VzKpmn6uX97ePsC+fPeGPq6+ErV8QFXq7kCk/zNA8luM 0Ch8adZ2xguYIVCUdoRrC4C5wrO4QgFXpwNNNbjL/TPe/yxDBYmOx/g5BMKXAAK0bes+ P1Z8sdRU8b3J2eC7XluWANNDxGYAOwbmCSae8C4T0zF2o05Q6SQ8RUWdeMHbFqcyKKkK vgV9rZKvs1z7eyf2cxPd+lM5QwPZcqjnEq3uhl2ChuWVbHEzB7/fzIhD62TAduwJyVbL x/MAzpX4vliQqgyS4ftFYTLv3SVKmv2Apv4S9tRtTfptScev0I49/EnpF14pdjJvbIzV dAyA== X-Gm-Message-State: AOAM5328LLSQWcOvachlSJfG7qdgxemz/Sk6Y1caqGqMh7uOyt33jdjV IE5dfRvRSGulEI2FFBu/S+HflLqc X-Google-Smtp-Source: ABdhPJxFsC9qGwstmFa7O3LpH90tP+JRDpGNKYIo0gNiYqnhtr9h6FaIrCPcNJSv5vQYOLclHxjavg== X-Received: by 2002:a17:906:1187:: with SMTP id n7mr31075163eja.161.1593871071785; Sat, 04 Jul 2020 06:57:51 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:41c2:9e8d:5955:8578]) by smtp.gmail.com with ESMTPSA id w18sm16348297edv.11.2020.07.04.06.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 06:57:51 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 1/3] add support for arch specific asm constraints Date: Sat, 4 Jul 2020 15:57:45 +0200 Message-Id: <20200704135747.87752-2-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200704135747.87752-1-luc.vanoostenryck@gmail.com> References: <20200704135747.87752-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org When evaluating asm operands it must be known if they correspond to a memory operand or not in order to process/ignore the 'noderef' attribute. This is done for operands specified with the common constraints but not for the machine specific constraints. So, add support for processing machine specific constraints. Signed-off-by: Luc Van Oostenryck --- evaluate.c | 5 ++++- target.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/evaluate.c b/evaluate.c index 3b9aec3c13c0..f515ce6f2de6 100644 --- a/evaluate.c +++ b/evaluate.c @@ -3642,7 +3642,10 @@ static void parse_asm_constraint(struct asm_operand *op) return; default: - // FIXME: arch-specific (and multi-letter) constraints + if (arch_target->asm_constraint) + str = arch_target->asm_constraint(op, c, str); + + // FIXME: multi-letter constraints break; } } diff --git a/target.h b/target.h index 8640026cc6d4..3ef0d520f83c 100644 --- a/target.h +++ b/target.h @@ -53,7 +53,7 @@ extern int pointer_alignment; extern int bits_in_enum; extern int enum_alignment; - +struct asm_operand; struct builtin_fn; struct target { @@ -77,6 +77,7 @@ struct target { void (*init)(const struct target *self); void (*predefine)(const struct target *self); + const char *(*asm_constraint)(struct asm_operand *op, int c, const char *str); }; extern const struct target target_default; From patchwork Sat Jul 4 13:57:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 11643639 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F1F5739 for ; Sat, 4 Jul 2020 13:57:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6283E208E4 for ; Sat, 4 Jul 2020 13:57:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZNG8NWrX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbgGDN5z (ORCPT ); Sat, 4 Jul 2020 09:57:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbgGDN5y (ORCPT ); Sat, 4 Jul 2020 09:57:54 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E74EC061794 for ; Sat, 4 Jul 2020 06:57:54 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id n26so23419583ejx.0 for ; Sat, 04 Jul 2020 06:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ADSa1pDDmZGimTkVuohMELwRvAP1HXLo1yWwDLJeRxY=; b=ZNG8NWrXQUhjIDBJWQcAUz58iMY0AkiUXrzj4h+1spCWp79nvkKlGj+2Xf+6dePlCS y0jU80ngonUt3RMxEogq1hv+fvwwPUpABENuXuL3pOt0AihwX5OIJctB9gLwWVUzrsoh zSGMyaNdsEEyksSczZieqRpKOBGlMMp3ob4UUhtSsSH4H1QiIEAh/l5pU3FpNwTtmdVJ smDePM+nlxrYphrvYxxgnB+zHQQsUzlQ/+O/3/+59laEqLULB4M74CLfSTMP4A2GLBQg 1j8DpBZr9k8GsmDQ49eoR3J5t/aVhuRdpirYXMn8wQreIWG210+c6egTcSboAhGXAuAu Mb5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ADSa1pDDmZGimTkVuohMELwRvAP1HXLo1yWwDLJeRxY=; b=sHk5dsv4d65AKQIJbaD0XPZrDQD7KNsxQZA6+WN9qsHLi7W+tYGVroXUS3byqUBX81 soXfpCKNutfJyrtmrS8LGQViQuhS/537j8Vx82NWX6jAIENzTC7RyIjwVM1t3CdY0/Tc loqwFafcS3hDFw1gH3E0jhc34CQ4EM7JtTfHBctKjDOjhdGuycrstCDP8x42njIefIHX V5pJM3PHYMcXwzrko7HLR/HS3qQPMmiMG/zXOtx9dSBKTtdcp0Qj1tKLgBQZX0EMxKfI /6ZtdqPzAfW6AedBV8b4HG6knnGCe06dY32PtUH3RdAdWc7WXBPRyNcGUCMC2zyXZs4X Q9nQ== X-Gm-Message-State: AOAM530kgXNojZPzv4qYoC0HWk5Vs5eMVs/b7kUX5JHOKU/H9kPBHdMz 5mqtjXVNMD25+hh5cR+KgolTqcFQ X-Google-Smtp-Source: ABdhPJz4ob9CH7aj/ErBpCQVy5WkH6ubGSZJ40G9NY1DWIjgNSVCvUz6K9H0FPpPczvazKxO/v49GA== X-Received: by 2002:a17:906:7247:: with SMTP id n7mr36651140ejk.105.1593871073135; Sat, 04 Jul 2020 06:57:53 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:41c2:9e8d:5955:8578]) by smtp.gmail.com with ESMTPSA id w18sm16348297edv.11.2020.07.04.06.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 06:57:52 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 2/3] add memory asm constraint for PPC Date: Sat, 4 Jul 2020 15:57:46 +0200 Message-Id: <20200704135747.87752-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200704135747.87752-1-luc.vanoostenryck@gmail.com> References: <20200704135747.87752-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org The 'Z' asm constraint is used for doing IO accessors on PPC but isn't part of the 'common constraints'. It's responsible for more than half of all warnings (with defconfig + allyesconfig). Fix this by handling this constraint in a specific method for PPC. Signed-off-by: Luc Van Oostenryck --- target-ppc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target-ppc.c b/target-ppc.c index b138635b9103..c0d6068f436a 100644 --- a/target-ppc.c +++ b/target-ppc.c @@ -1,6 +1,7 @@ #include "symbol.h" #include "target.h" #include "machine.h" +#include "expression.h" static void predefine_ppc(const struct target *self) @@ -15,6 +16,16 @@ static void predefine_ppc(const struct target *self) predefine("_BIG_ENDIAN", 1, "1"); } +static const char *asm_constraint_ppc(struct asm_operand *op, int c, const char *str) +{ + switch (c) { + case 'Z': + op->is_memory = true; + break; + } + return str; +} + static void predefine_ppc32(const struct target *self) { @@ -32,6 +43,7 @@ const struct target target_ppc32 = { .target_64bit = &target_ppc64, .predefine = predefine_ppc32, + .asm_constraint = asm_constraint_ppc, }; @@ -55,4 +67,5 @@ const struct target target_ppc64 = { .target_32bit = &target_ppc32, .predefine = predefine_ppc64, + .asm_constraint = asm_constraint_ppc, }; From patchwork Sat Jul 4 13:57:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 11643641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 786F1739 for ; Sat, 4 Jul 2020 13:57:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60345208E4 for ; Sat, 4 Jul 2020 13:57:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eRxmIkVE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbgGDN54 (ORCPT ); Sat, 4 Jul 2020 09:57:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbgGDN5z (ORCPT ); Sat, 4 Jul 2020 09:57:55 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E749C061794 for ; Sat, 4 Jul 2020 06:57:55 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id dm19so24073258edb.13 for ; Sat, 04 Jul 2020 06:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aDf21opjaB64NtBqL5FyDGgbhaj69BfusJf0QVbF/Is=; b=eRxmIkVE9cZfaEBvIO7ks4GRguXkT50qeH0WOOjzupPcs0OJzVmagAnm1HyYNvpKCV /fdmHSDDrHf+AmRyPb6+MROOVudSNc+YD5eOXX44PVfwefofDYe+f6IcgOhNZeSEG7Ln K5zN1EJ7MRZfdyjVaQk1tYuYonf0GPoUjHxBklPLMBhY24TiYSn14+iCq2vO9oZenMZI 9GiMHuMqHCD7BfWiVnVuzmdiVPyZ921Z+dqFirMIa/AvUg7w/yPSnVWnsocwyKYaACGk kah/O4LgDE4dP5uP+/y8R2rVAx70yl8zRYBdEFkkyOkhiaQikWpD4/8t1JOxPoW3sTBa 7Plg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aDf21opjaB64NtBqL5FyDGgbhaj69BfusJf0QVbF/Is=; b=XSdrTkHC9nTJRpb/3DmlEXBuvlh+1SxMo0iTGrhFr+/OM5nlSw60f4POqk4z/Pe68P Zgdg+T6ns/2LpDmHxqWlQWJPEqpc1hlsS0e6IXwS8wt7XJ4f7qsIzqoAm2Ositchc57S d8O3KFLVjdHoVUGtZ1vLLGZ8aqqHhet6JCZ8Voy2aSCzo94e69dJ/Bv0dkzFu9RO42/W Sb3pitfG07bMu/ZoVIKF2BwaAO6P6kGZEUvPt4prl09if3sVQtwwknc2o1O37oxYRizb 8nfHHMKuJnIR4KdDNOI3Lm6NcwGFKieZOJFk+jn3B2bflWn2A6FoBz9TEVa2+Cxvxxct e3Eg== X-Gm-Message-State: AOAM533vKsd2vCk4UaH/pD9aonvF1XLTO1hkUObX78ocA6N4zZtlZVGT As2z0YMxRg16eypqUhTSRStQd8Hw X-Google-Smtp-Source: ABdhPJz7ZWCyg/QGFwokK+K+WWzh9FS25LC6ylH32WZ3qGS2YGkW0/6wKQRFBoEwT30iuB0d8glPlA== X-Received: by 2002:a50:c219:: with SMTP id n25mr46555942edf.306.1593871074101; Sat, 04 Jul 2020 06:57:54 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:41c2:9e8d:5955:8578]) by smtp.gmail.com with ESMTPSA id w18sm16348297edv.11.2020.07.04.06.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 06:57:53 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 3/3] add memory asm constraint for S390 Date: Sat, 4 Jul 2020 15:57:47 +0200 Message-Id: <20200704135747.87752-4-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200704135747.87752-1-luc.vanoostenryck@gmail.com> References: <20200704135747.87752-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org The 'Q', 'R', 'S' & 'T'' asm constraint are used for for memory operands on S390 but only 'Q' belong to the 'common constraints'. Fix this by handling the 3 others with an arch-specific method. Signed-off-by: Luc Van Oostenryck --- target-s390.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target-s390.c b/target-s390.c index 8fe7d93677b2..9dbc810e507c 100644 --- a/target-s390.c +++ b/target-s390.c @@ -1,6 +1,7 @@ #include "symbol.h" #include "target.h" #include "machine.h" +#include "expression.h" static void predefine_s390(const struct target *self) @@ -8,6 +9,16 @@ static void predefine_s390(const struct target *self) predefine("__s390__", 1, "1"); } +static const char *asm_constraint_s390(struct asm_operand *op, int c, const char *str) +{ + switch (c) { + case 'R': case 'S': case 'T': + op->is_memory = true; + break; + } + return str; +} + const struct target target_s390 = { .mach = MACH_S390, .bitness = ARCH_LP32, @@ -21,6 +32,7 @@ const struct target target_s390 = { .target_64bit = &target_s390x, .predefine = predefine_s390, + .asm_constraint = asm_constraint_s390, }; @@ -45,4 +57,5 @@ const struct target target_s390x = { .target_32bit = &target_s390, .predefine = predefine_s390x, + .asm_constraint = asm_constraint_s390, };