From patchwork Mon Jul 13 22:32:55 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: 11661119 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 5DECC913 for ; Mon, 13 Jul 2020 22:33:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 45CCD2089D for ; Mon, 13 Jul 2020 22:33:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mLSpV1tL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726352AbgGMWdM (ORCPT ); Mon, 13 Jul 2020 18:33:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgGMWdK (ORCPT ); Mon, 13 Jul 2020 18:33:10 -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 7DCBEC061794 for ; Mon, 13 Jul 2020 15:33:10 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id dr13so19293510ejc.3 for ; Mon, 13 Jul 2020 15:33:10 -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=QMQe2tqOpAVUKTveFHXq9bnPleopodnl0hV+CX/mlnw=; b=mLSpV1tLl1zylf7256kUiFrtqeSIrLCTAMzgyGfjEYcrl1EOuTVD1owyfis1aXppry 0BM4squmNA95JFckJz7WQ6ts3R61UnG+O3i+qztFuohPpJB4k+BuIBd438JcZAep5BJF W5SaCjAasgHEpXCImthJA2NA9nm69TlpMYdystA3X1Eretz3LdWV421VGYb0vVPT7uXV ra2zPDSkFLzSwcnAaxEHDJpZyPHW64pUNzGpG0sM6W3GHLsu4GP50L7viyp4jJ9A5zpF O+tO+KaDFTQRdD31+4r+gAh9F4/L54TO9rVhh7rmeUhE01ocXI79xajr+5dpFmHAsgTb RVnA== 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=QMQe2tqOpAVUKTveFHXq9bnPleopodnl0hV+CX/mlnw=; b=o7CA7l1I/eWzvC0IHBhyfQqX+wvDIqeeVoHlu7gHb8Kct4P33nBX+S4i2bSCGiK23x 7seyZdg/dboW/WCo6wBMtI1n8RJmbuastCHwXCxCYNapQU6cLgtD3G446Ag1ZsyPVXb0 nhVxN3S0Y6ONWDHohW1wQvk+cZQlk0q0for97jBkwkGep/d/y0NUh4ZxkzWADLEgluYs jkxVu9HuWOyP2d2pmQcSP763vC3qox62c/exUOwNfVlS0BaovT256teZQ9Y6WnZG8HV9 o1htCUCJR4jOjj6LsMPqw0MaHJp7YP1Hnq3D1DShxjA+WviZq1hZj9jOSOuZTU3bSjtc RZvw== X-Gm-Message-State: AOAM530V3v153H2WCiIixTIEdJ7OJ/anH6O2FIraC0DFjtUssBxEHVyp P0oegCKr07jO1MfkSkC4RgQy+anQ X-Google-Smtp-Source: ABdhPJwjTfniHZ6Z20gtjQypyFp3J5qHftXPJkLOmGVJ4eQ5yKZYszWKR3YABzJkpWFDvjKV9vnr7w== X-Received: by 2002:a17:906:40d7:: with SMTP id a23mr1720819ejk.421.1594679589011; Mon, 13 Jul 2020 15:33:09 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:08 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 1/9] sparc: add 'sparcv8' predefines for sparc32 Date: Tue, 14 Jul 2020 00:32:55 +0200 Message-Id: <20200713223304.83666-2-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 By default, the architecture version is 'v8' for sparc32 and 'v9' for sparc64. The predefines were added for sparc64 but not for sparc32. Fix this by adding a generic 'sparcv%d' together with a variable to hold the architecture version and initialize this one accordingly. Signed-off-by: Luc Van Oostenryck --- target-sparc.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/target-sparc.c b/target-sparc.c index 865dbc8a2180..be4e968ec604 100644 --- a/target-sparc.c +++ b/target-sparc.c @@ -3,16 +3,25 @@ #include "machine.h" +static int sparc_version; + static void predefine_sparc(const struct target *self) { predefine("__sparc__", 1, "1"); predefine("__sparc", 1, "1"); predefine_nostd("sparc"); + + predefine_weak("__sparc_v%d__", sparc_version); + predefine_weak("__sparcv%d__", sparc_version); + predefine_weak("__sparcv%d", sparc_version); } static void init_sparc32(const struct target *target) { + if (!sparc_version) + sparc_version = 8; + if (arch_os == OS_SUNOS) { wint_ctype = &long_ctype; wchar_ctype = &long_ctype; @@ -45,11 +54,14 @@ const struct target target_sparc32 = { }; +static void init_sparc64(const struct target *target) +{ + if (!sparc_version) + sparc_version = 9; +} + static void predefine_sparc64(const struct target *self) { - predefine("__sparc_v9__", 1, "1"); - predefine("__sparcv9__", 1, "1"); - predefine("__sparcv9", 1, "1"); predefine("__sparc64__", 1, "1"); predefine("__arch64__", 1, "1"); @@ -65,5 +77,6 @@ const struct target target_sparc64 = { .target_32bit = &target_sparc32, + .init = init_sparc64, .predefine = predefine_sparc64, }; From patchwork Mon Jul 13 22:32:56 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: 11661121 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 4A6D6913 for ; Mon, 13 Jul 2020 22:33:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B5E420B80 for ; Mon, 13 Jul 2020 22:33:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d1GRHqiU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726376AbgGMWdN (ORCPT ); Mon, 13 Jul 2020 18:33:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbgGMWdL (ORCPT ); Mon, 13 Jul 2020 18:33:11 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D8F3C061755 for ; Mon, 13 Jul 2020 15:33:11 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id f12so19266973eja.9 for ; Mon, 13 Jul 2020 15:33:11 -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=YqptpQoyUU0nrCtw/BWlXLGY0AcY1EzlZpqEzaO1DR8=; b=d1GRHqiUpfx+ffLRlwRYqpP2ToTg7jf+jKM5SPaB0YtC7e0SM4qOp7sUzuxzLyXlKG X7/usQ1u8DidGA63IVF/s/eRusEecBoLPYzVOf1gaHu6Zu/DxWxpRsuSUNrdSM3VEqqR dB+zIOvtLl74WK1LIp1TYvBb3OzjDAySV2N7Gqim5XJ6kHuBHwCg4E3KCdcZtkn4TaUL oainAPnaPySXkiyrfB9vyIEGpu8J96YfZ60XSk3x2ldSZ0LpmKpaPQJKqV1SXGCLoN/R hA54zcd7ris/PJ9wuWeWyG95kolDy18kNaA51l70Yyuv+X6mifGMSWapt2TYSwCutRWq uAbw== 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=YqptpQoyUU0nrCtw/BWlXLGY0AcY1EzlZpqEzaO1DR8=; b=mjbQnqRMHlyNuttFymeo9yucVpiSHi0GwceTt7DZpipDQm6dy7MEPw6hh2NMO/noyc KMlvN1SMDfydT7vFs/SblE0vhCDlphytSCji5fuer5rpwLwDqET2mFT+LLGqCAzX+wAE tCbj0hIcIZ2t3PhlmxfaUMBZHmcGBf1D/eZizgBhSa4SKea0l3mS6pHdm9jZG7ab2iS6 Prb4ol5uekqiJe6YuQA+vWBleQ03/9OtzrksMvByNm2Fpb9sdodBmm4j3ZPK8r43UAok Hq5GDcaq8vxHE4A5mKozDqT5GsqXe7yYgVt8/mxkERbzYXEcAivDs341HstkRZi277as vJYw== X-Gm-Message-State: AOAM533N75mh26l981JOwJlHhKQatsjVLax/Cb0OB0vn83+JVPY0u6SA fcerAs1xI6FMbQqv4mTNrkW7g2gx X-Google-Smtp-Source: ABdhPJyisr4G+UAkqpwESZsyMWVHA8V5ECbLIaBDHIq0EDrufSs+ZCg0cVSpI3mSspB+paiopJJ8YQ== X-Received: by 2002:a17:906:700f:: with SMTP id n15mr1890788ejj.390.1594679589792; Mon, 13 Jul 2020 15:33:09 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:09 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 2/9] alpha: has 64-bit long double & int128 Date: Tue, 14 Jul 2020 00:32:56 +0200 Message-Id: <20200713223304.83666-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 Support for alpha was added in order to move the specific builtins away from the common list without changing the defaults. Improve the support for this arch by fixing a few specificities: * support of 128-bit integers * long doubles are 64-bit. Signed-off-by: Luc Van Oostenryck --- target-alpha.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target-alpha.c b/target-alpha.c index 3f582997eb96..4c622aec194f 100644 --- a/target-alpha.c +++ b/target-alpha.c @@ -24,6 +24,9 @@ static const struct builtin_fn builtins_alpha[] = { const struct target target_alpha = { .mach = MACH_ALPHA, .bitness = ARCH_LP64, + .has_int128 = 1, + + .bits_in_longdouble = 64, .predefine = predefine_alpha, .builtins = builtins_alpha, From patchwork Mon Jul 13 22:32:57 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: 11661123 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 E536113B6 for ; Mon, 13 Jul 2020 22:33:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB81320B80 for ; Mon, 13 Jul 2020 22:33:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z1EJVXk6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726396AbgGMWdO (ORCPT ); Mon, 13 Jul 2020 18:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbgGMWdM (ORCPT ); Mon, 13 Jul 2020 18:33:12 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0557FC061794 for ; Mon, 13 Jul 2020 15:33:12 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id e22so15182778edq.8 for ; Mon, 13 Jul 2020 15:33:11 -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=jQiz0ASjsBVuIOoE0wH4IpqkK54hYmwGtI5sZyqcPy8=; b=Z1EJVXk6HhFwGKlR2IdfQKtnXm9NwEolTvYn+qGFg/pxS0iT477GPwiIINEScZTDSh n9IoIjCsyt0fhSLWxlFrR/d60htp4pOrWFyIgQFgrCfo/1SkmeD7wvuNSHrTi+t2CO31 iVC/YDFUSsVxYtX0ejhrb0tXMvk9SLo9upMMij5ZcdL+mRhyE1voR2N0/n/BZanEJPlt q2dfLN9+XRu7hHPrIxiw52jH8BykvBQvdob/U5VwXl1f5BxS0Qzn/KDpFLVlIykLdhxr 0ML1umzd+JGTKltYseNGYCorMZw4ryhSKMUGyPe7uEu7nDS+bu7Q8EmyzFNSyKpIe5ev LCPw== 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=jQiz0ASjsBVuIOoE0wH4IpqkK54hYmwGtI5sZyqcPy8=; b=ms1nHnc2Czs6TIBAGYioBbYABlWKtIGAmOpB6dUqhy1olYJQjnc0mQtWokwqWJ93ft 3vJ95glEqFh3C3J+WEuq2gHGAPylXFYPcVHkAyXAJGaJeFL7RmJSJYcaCWH724TIrD5p WyuCyC/EN7BsBF3SARcWOLVkD625IAls8dh8xITCCpXvndlQCGxICXIv5eEFSD2ILTKH E5ENovklw1AfSLRD65i5XB4ENQu0xC8I1vmIlAbR9uyy4L7domugS1WH4TAhRiZ/afOD mgtyLM3VcvirDFjrnxM3I54zAphLNFXRYUKAgFZhC4O5vyDhOeOykktI4STutLuYNvCq ACiA== X-Gm-Message-State: AOAM533FE+0x03sl7dhaLltZkY632F1pV5kUYqiPOhhcCZGpajqsUhZ0 dLCEQTJPX49cu6KQFtqEL7ukEebP X-Google-Smtp-Source: ABdhPJzjXPJbEwxKhRIJgprMc5oul4wcUyUl43CVh0NzMEVot7ECEsUpKkQwJMleBSDPzGCIaKrcfw== X-Received: by 2002:aa7:c80f:: with SMTP id a15mr1466258edt.299.1594679590542; Mon, 13 Jul 2020 15:33:10 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:10 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 3/9] ppc: add predefines __LONGDOUBLE128 & __LONG_DOUBLE_128__ Date: Tue, 14 Jul 2020 00:32:57 +0200 Message-Id: <20200713223304.83666-4-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 On powerpc, if long double is 128-bit width, then '__LONGDOUBLE128' & '__LONG_DOUBLE_128__' should be defined. So do this in the target specific file. Signed-off-by: Luc Van Oostenryck --- target-ppc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-ppc.c b/target-ppc.c index c0d6068f436a..dede8917cbd6 100644 --- a/target-ppc.c +++ b/target-ppc.c @@ -14,6 +14,10 @@ static void predefine_ppc(const struct target *self) predefine("_ARCH_PPC", 1, "1"); if (arch_big_endian) predefine("_BIG_ENDIAN", 1, "1"); + if (ldouble_ctype.bit_size == 128) { + predefine("__LONGDOUBLE128", 1, "1"); + predefine("__LONG_DOUBLE_128__", 1, "1"); + } } static const char *asm_constraint_ppc(struct asm_operand *op, int c, const char *str) From patchwork Mon Jul 13 22:32:58 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: 11661125 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 153EC913 for ; Mon, 13 Jul 2020 22:33:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F180720C56 for ; Mon, 13 Jul 2020 22:33:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fXki18Sp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726356AbgGMWdO (ORCPT ); Mon, 13 Jul 2020 18:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgGMWdN (ORCPT ); Mon, 13 Jul 2020 18:33:13 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA49C08C5DB for ; Mon, 13 Jul 2020 15:33:12 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id lx13so19279247ejb.4 for ; Mon, 13 Jul 2020 15:33:12 -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=ed2f4eQC2SRxZ6Ku5kjy8XqTvSZ3aaiQyf2+FyCFRSA=; b=fXki18SpczAdpVLyVqF8inOJsIPoiS0LCKKLsc8t6SAl2UEntA+P1jNnDWaFqxME9c t8Otc3l/fAkfBsPE3+GVRtp50UuKhLeOUrHIl2SWOSCRmY9EaFs+VBlAro0zPfSvbC4e 6XP0D44q6sfp0kUzcE4qd0tm/a/N+YCZxAGhgdM+Bz1u+VTQ+8fs7bnsVGOiHYN422mz 0YJF6FGF2gRFubzRlgofsHr4XrY3Z8fTHLsrQ04qj+MvQ4t9a02MXX8ts0McbIFhuBnM fOmBZd9NFtraJ3T1nzmfAqp6v2A44mpTdXwqQWfWSZboZRijOAWImc+Ws0ap4YyR8cUa nTAQ== 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=ed2f4eQC2SRxZ6Ku5kjy8XqTvSZ3aaiQyf2+FyCFRSA=; b=X/5a2Kga1+y6hup58Id76LJkrJATMelVi2ZtPiJanJhJ2aZQcA+W6W+eGc1mFd/ZRw 5qRogTtvwlva1DnUJSEtygl345GIDk5q3Xd2zL/BG9TTJzAeOOQmfBK/ac/d6LXMOXYf Q3RvaNuvdILgmzNRNZuhqDsvzmMTJ9Zs6xHYhPIFK0vIOjv31LjARTSCmF5N8+U5W6Bg fPcIPKXq+pdB+/yrZ186TAbbht9ovtUTgbvVEMC0yocuw+aoHSPYNEDyjcrAqzsw3xBC PXnP9ZrWd5/s2dXRwRCZtUU3qZ78DK21238RZN6p5HDVywpFueeZYuPzcqd4APDDE8+N ZroA== X-Gm-Message-State: AOAM533c5zZRv9cLQK1Cmz1YiWq7n6gF4xjyrvpHXvmdD0H8IVpgiXSk nZyLl0VzrpnkZPD/lF/51ulyVSHS X-Google-Smtp-Source: ABdhPJxNH/kAQ4MwjpFXGzI03zT+Vx4Myj7iTqQ9k1QlTHx4drQ/cR0qjKFWbeBN7tWvqwgWqVTIOA== X-Received: by 2002:a17:906:3850:: with SMTP id w16mr1884781ejc.205.1594679591243; Mon, 13 Jul 2020 15:33:11 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:10 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 4/9] arch: add predefines __INT_LEAST${N}_TYPE__ Date: Tue, 14 Jul 2020 00:32:58 +0200 Message-Id: <20200713223304.83666-5-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 These are used by some system headers (neon on arm64). Signed-off-by: Luc Van Oostenryck --- predefine.c | 9 +++++++++ target-x86.c | 2 ++ target.c | 8 ++++++++ target.h | 8 ++++++++ 4 files changed, 27 insertions(+) diff --git a/predefine.c b/predefine.c index 94952e81d1df..062e754bf20f 100644 --- a/predefine.c +++ b/predefine.c @@ -145,6 +145,15 @@ void predefined_macros(void) predefined_ctype("INT64", int64_ctype, PTYPE_MAX|PTYPE_TYPE); predefined_ctype("UINT64", uint64_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_LEAST8", &schar_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_LEAST8", &uchar_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_LEAST16", &short_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_LEAST16",&ushort_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_LEAST32", int32_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_LEAST32", uint32_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_LEAST64", int64_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_LEAST64", uint64_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INTMAX", intmax_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); predefined_ctype("UINTMAX", uintmax_ctype, PTYPE_MAX|PTYPE_TYPE); predefined_ctype("INTPTR", ssize_t_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); diff --git a/target-x86.c b/target-x86.c index 62323aecc52b..956af92efe4e 100644 --- a/target-x86.c +++ b/target-x86.c @@ -82,6 +82,8 @@ static void init_x86_64(const struct target *target) uint64_ctype = &ullong_ctype; intmax_ctype = &llong_ctype; uintmax_ctype = &ullong_ctype; + least64_ctype = &long_ctype; + uleast64_ctype = &ulong_ctype; break; } } diff --git a/target.c b/target.c index cbb25724ae09..e2eb78e25328 100644 --- a/target.c +++ b/target.c @@ -15,6 +15,14 @@ struct symbol *int32_ctype = &int_ctype; struct symbol *uint32_ctype = &uint_ctype; struct symbol *wchar_ctype = &int_ctype; struct symbol *wint_ctype = &uint_ctype; +struct symbol *least8_ctype = &schar_ctype; +struct symbol *uleast8_ctype = &uchar_ctype; +struct symbol *least16_ctype = &short_ctype; +struct symbol *uleast16_ctype = &ushort_ctype; +struct symbol *least32_ctype = &int_ctype; +struct symbol *uleast32_ctype = &uint_ctype; +struct symbol *least64_ctype = &llong_ctype; +struct symbol *uleast64_ctype = &ullong_ctype; /* * For "__attribute__((aligned))" diff --git a/target.h b/target.h index fdf311297237..4140b77c4beb 100644 --- a/target.h +++ b/target.h @@ -13,6 +13,14 @@ extern struct symbol *int32_ctype; extern struct symbol *uint32_ctype; extern struct symbol *wchar_ctype; extern struct symbol *wint_ctype; +extern struct symbol *least8_ctype; +extern struct symbol *uleast8_ctype; +extern struct symbol *least16_ctype; +extern struct symbol *uleast16_ctype; +extern struct symbol *least32_ctype; +extern struct symbol *uleast32_ctype; +extern struct symbol *least64_ctype; +extern struct symbol *uleast64_ctype; /* * For "__attribute__((aligned))" From patchwork Mon Jul 13 22:32:59 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: 11661127 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 3CA8B913 for ; Mon, 13 Jul 2020 22:33:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1921520B80 for ; Mon, 13 Jul 2020 22:33:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hRdfn6W6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726435AbgGMWdQ (ORCPT ); Mon, 13 Jul 2020 18:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbgGMWdO (ORCPT ); Mon, 13 Jul 2020 18:33:14 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABD3DC061755 for ; Mon, 13 Jul 2020 15:33:13 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id a1so9734523edt.10 for ; Mon, 13 Jul 2020 15:33:13 -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=q8Cj8uzm2lCmU75JNXVMP2iSdX56eMTSRXo6qQ0daRU=; b=hRdfn6W6N6xH9it58fsOJR644M1dGBX4Q1l1gM7kC9ilqq6nch01dWp6LKHBjtqcW7 HMmcdNaIgcOcJoBCny5w7ySOD6tGHAR+9YGVlWaOkHsQOw2fF0Lb10t7AJeUSCCtWprR AzF753DoKXsgg9U2EQgduhkQQIQDYnCIcckggqxbtdPGcyzmRn9ebkxVFeE6GtauX62p picvmSVBfgVnhH2e28u/ZYj4u6kVTgDlS+8VOnVU81anetYBfqeqG6o2cV4UkvU3U/Ae XjB0B/+qxRHllvhb1Uegk75RXkWPD3VwcSOxf1DThzZOmQPnSxaFBMv4NHhBGu5gWJkX KLFw== 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=q8Cj8uzm2lCmU75JNXVMP2iSdX56eMTSRXo6qQ0daRU=; b=GOk6GA+HdcJ1OfjteBzKeRzNetpNECVarv5s7Zl1tBd/TPncHcOokHFFJ0BWr41kvu lt0Xj9ibygFgPsLVY71pU2FSOvNjz4sqDnpY4QGqrjDA9fNKbu+bggAi34/EOHUE1EAw 4MaW+jh6cQL4HDdV4xHeuvJdgJCrqS7tRcX2cU6U1ix1M1s2WsQXg93vIMtjF0/0NNtE rj9Ip8CwlPqtiTOcYDyvS91PxbGwZ2aK9fFKwsYCAlbnZzLojlG0mvL565RfruSrlTGD HAWWVyX436NbLSXXoxKwlViqumZDY8Q0vMwKZkn0p9N8B1IT1amb8BGjM8qkuA85FDYM g+qA== X-Gm-Message-State: AOAM5336OzbvOXOe+4CqpOBCwfLgU2Y15et2pT75mDNzXKJY5eb32RrO T9FShLgblW0HlgK/ng660gsrhRHN X-Google-Smtp-Source: ABdhPJwIW2ZvdN7+ficcHQJjDs1yHhz1ImjhJRTJpVmIt4jU7pkinCt4VCLIIeDQ/3apTBPdzZARbw== X-Received: by 2002:aa7:c808:: with SMTP id a8mr1588339edt.259.1594679592062; Mon, 13 Jul 2020 15:33:12 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:11 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 5/9] arch: add predefines __INT_FAST${N}_TYPE__ Date: Tue, 14 Jul 2020 00:32:59 +0200 Message-Id: <20200713223304.83666-6-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 We just added __INT_LEAST${N}_TYPE__, so add these ones too as they looks slightly more useful. Signed-off-by: Luc Van Oostenryck --- predefine.c | 9 +++++++++ target-arm.c | 7 +++++++ target-h8300.c | 5 +++++ target-m68k.c | 9 +++++++++ target-microblaze.c | 9 +++++++++ target-nds32.c | 5 +++++ target-nios2.c | 9 +++++++++ target-openrisc.c | 5 +++++ target-ppc.c | 9 +++++++++ target-riscv.c | 12 +++++++++++- target-s390.c | 9 +++++++++ target-sh.c | 6 ++++++ target-sparc.c | 5 +++++ target-x86.c | 25 +++++++++++++++++++++++++ target-xtensa.c | 5 +++++ target.c | 10 ++++++++++ target.h | 8 ++++++++ 17 files changed, 146 insertions(+), 1 deletion(-) diff --git a/predefine.c b/predefine.c index 062e754bf20f..2e9913d5c0bc 100644 --- a/predefine.c +++ b/predefine.c @@ -154,6 +154,15 @@ void predefined_macros(void) predefined_ctype("INT_LEAST64", int64_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); predefined_ctype("UINT_LEAST64", uint64_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_FAST8", fast8_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_FAST8", ufast8_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_FAST16", fast16_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_FAST16",ufast16_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_FAST32", fast32_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_FAST32",ufast32_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT_FAST64", fast64_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINT_FAST64",ufast64_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INTMAX", intmax_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); predefined_ctype("UINTMAX", uintmax_ctype, PTYPE_MAX|PTYPE_TYPE); predefined_ctype("INTPTR", ssize_t_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); diff --git a/target-arm.c b/target-arm.c index 5fc15c511e1a..104c319b23dd 100644 --- a/target-arm.c +++ b/target-arm.c @@ -5,9 +5,16 @@ static void init_arm(const struct target *self) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + if (arch_os == OS_NONE) { int32_ctype = &long_ctype; uint32_ctype = &ulong_ctype; + fast8_ctype = &int_ctype; + ufast8_ctype = &uint_ctype; } } diff --git a/target-h8300.c b/target-h8300.c index 47872b38a1ad..84d168b7410a 100644 --- a/target-h8300.c +++ b/target-h8300.c @@ -8,6 +8,11 @@ static void init_h8300(const struct target *self) ssize_t_ctype = &long_ctype; size_t_ctype = &ulong_ctype; wchar_ctype = &ushort_ctype; + + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; } static void predefine_h8300(const struct target *self) diff --git a/target-m68k.c b/target-m68k.c index ed4a92733efe..0aed2eb362eb 100644 --- a/target-m68k.c +++ b/target-m68k.c @@ -3,6 +3,14 @@ #include "machine.h" +static void init_m68k(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_m68k(const struct target *self) { predefine("__m68k__", 1, "1"); @@ -19,5 +27,6 @@ const struct target target_m68k = { .bits_in_longdouble = 96, .max_fp_alignment = 4, + .init = init_m68k, .predefine = predefine_m68k, }; diff --git a/target-microblaze.c b/target-microblaze.c index 1fbeef3c168d..3a4c3d58d77f 100644 --- a/target-microblaze.c +++ b/target-microblaze.c @@ -3,6 +3,14 @@ #include "machine.h" +static void init_microblaze(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_microblaze(const struct target *self) { predefine("__MICROBLAZE__", 1, "1"); @@ -21,5 +29,6 @@ const struct target target_microblaze = { .bits_in_longdouble = 64, + .init = init_microblaze, .predefine = predefine_microblaze, }; diff --git a/target-nds32.c b/target-nds32.c index 0dc483b26396..e3ed2e520883 100644 --- a/target-nds32.c +++ b/target-nds32.c @@ -5,6 +5,11 @@ static void init_nds32(const struct target *self) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &uint_ctype; } diff --git a/target-nios2.c b/target-nios2.c index a478fff51e18..c57b171984a4 100644 --- a/target-nios2.c +++ b/target-nios2.c @@ -4,6 +4,14 @@ #include "builtin.h" +static void init_nios2(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_nios2(const struct target *self) { predefine("__NIOS2", 1, "1"); @@ -33,6 +41,7 @@ const struct target target_nios2 = { .bits_in_longdouble = 64, + .init = init_nios2, .predefine = predefine_nios2, .builtins = builtins_nios2, }; diff --git a/target-openrisc.c b/target-openrisc.c index 553963c069ae..ad25ff2791d3 100644 --- a/target-openrisc.c +++ b/target-openrisc.c @@ -5,6 +5,11 @@ static void init_openrisc(const struct target *self) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &uint_ctype; } diff --git a/target-ppc.c b/target-ppc.c index dede8917cbd6..6c0c0737482c 100644 --- a/target-ppc.c +++ b/target-ppc.c @@ -31,6 +31,14 @@ static const char *asm_constraint_ppc(struct asm_operand *op, int c, const char } +static void init_ppc32(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_ppc32(const struct target *self) { predefine_ppc(self); @@ -46,6 +54,7 @@ const struct target target_ppc32 = { .target_64bit = &target_ppc64, + .init = init_ppc32, .predefine = predefine_ppc32, .asm_constraint = asm_constraint_ppc, }; diff --git a/target-riscv.c b/target-riscv.c index e7f2b03b821b..6d9113c125ee 100644 --- a/target-riscv.c +++ b/target-riscv.c @@ -87,6 +87,16 @@ static void init_riscv(const struct target *self) riscv_flags = self->flags; } +static void init_riscv32(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + + init_riscv(self); +} + static void predefine_riscv(const struct target *self) { static const char *cmodels[CMODEL_LAST] = { @@ -131,7 +141,7 @@ const struct target target_riscv32 = { .target_64bit = &target_riscv64, - .init = init_riscv, + .init = init_riscv32, .predefine = predefine_riscv, .parse_march = parse_march_riscv, }; diff --git a/target-s390.c b/target-s390.c index 9dbc810e507c..cdbd685a2099 100644 --- a/target-s390.c +++ b/target-s390.c @@ -4,6 +4,14 @@ #include "expression.h" +static void init_s390(const struct target *self) +{ + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; +} + static void predefine_s390(const struct target *self) { predefine("__s390__", 1, "1"); @@ -31,6 +39,7 @@ const struct target target_s390 = { .target_64bit = &target_s390x, + .init = init_s390, .predefine = predefine_s390, .asm_constraint = asm_constraint_s390, }; diff --git a/target-sh.c b/target-sh.c index db517ccb0f5c..d4ddf45504cf 100644 --- a/target-sh.c +++ b/target-sh.c @@ -7,6 +7,12 @@ static void init_sh(const struct target *self) { int64_ctype = &llong_ctype; uint64_ctype = &ullong_ctype; + + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &long_ctype; } diff --git a/target-sparc.c b/target-sparc.c index be4e968ec604..d830f6cbe828 100644 --- a/target-sparc.c +++ b/target-sparc.c @@ -19,6 +19,11 @@ static void predefine_sparc(const struct target *self) static void init_sparc32(const struct target *target) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + if (!sparc_version) sparc_version = 8; diff --git a/target-x86.c b/target-x86.c index 956af92efe4e..e69594edac0e 100644 --- a/target-x86.c +++ b/target-x86.c @@ -33,6 +33,8 @@ static void init_x86_common(const struct target *target) ssize_t_ctype = &long_ctype; wchar_ctype = &int_ctype; wint_ctype = &int_ctype; + fast16_ctype = &short_ctype; + ufast16_ctype = &ushort_ctype; break; } } @@ -40,6 +42,11 @@ static void init_x86_common(const struct target *target) static void init_i386(const struct target *target) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + init_x86_common(target); } @@ -71,13 +78,31 @@ static void init_x86_64(const struct target *target) int64_ctype = &llong_ctype; uint64_ctype = &ullong_ctype; wint_ctype = &int_ctype; + fast16_ctype = &short_ctype; + ufast16_ctype = &ushort_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + fast64_ctype = &llong_ctype; + ufast64_ctype = &ullong_ctype; break; case OS_FREEBSD: + fast16_ctype = &short_ctype; + ufast16_ctype = &ushort_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; break; case OS_NETBSD: + fast8_ctype = &int_ctype; + ufast8_ctype = &uint_ctype; + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; wint_ctype = &int_ctype; break; case OS_OPENBSD: + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; int64_ctype = &llong_ctype; uint64_ctype = &ullong_ctype; intmax_ctype = &llong_ctype; diff --git a/target-xtensa.c b/target-xtensa.c index 3e5781c86d82..26bda47f02f0 100644 --- a/target-xtensa.c +++ b/target-xtensa.c @@ -5,6 +5,11 @@ static void init_xtensa(const struct target *self) { + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &long_ctype; } diff --git a/target.c b/target.c index e2eb78e25328..655a1527f93f 100644 --- a/target.c +++ b/target.c @@ -23,6 +23,14 @@ struct symbol *least32_ctype = &int_ctype; struct symbol *uleast32_ctype = &uint_ctype; struct symbol *least64_ctype = &llong_ctype; struct symbol *uleast64_ctype = &ullong_ctype; +struct symbol *fast8_ctype = &schar_ctype; +struct symbol *ufast8_ctype = &uchar_ctype; +struct symbol *fast16_ctype = &long_ctype; +struct symbol *ufast16_ctype = &ulong_ctype; +struct symbol *fast32_ctype = &long_ctype; +struct symbol *ufast32_ctype = &ulong_ctype; +struct symbol *fast64_ctype = &long_ctype; +struct symbol *ufast64_ctype = &ulong_ctype; /* * For "__attribute__((aligned))" @@ -214,6 +222,8 @@ void target_init(void) uint64_ctype = &ullong_ctype; intmax_ctype = &llong_ctype; uintmax_ctype = &ullong_ctype; + fast64_ctype = &llong_ctype; + ufast64_ctype = &ullong_ctype; if (target->target_32bit) target = target->target_32bit; break; diff --git a/target.h b/target.h index 4140b77c4beb..3fdfc1e69339 100644 --- a/target.h +++ b/target.h @@ -21,6 +21,14 @@ extern struct symbol *least32_ctype; extern struct symbol *uleast32_ctype; extern struct symbol *least64_ctype; extern struct symbol *uleast64_ctype; +extern struct symbol *fast8_ctype; +extern struct symbol *ufast8_ctype; +extern struct symbol *fast16_ctype; +extern struct symbol *ufast16_ctype; +extern struct symbol *fast32_ctype; +extern struct symbol *ufast32_ctype; +extern struct symbol *fast64_ctype; +extern struct symbol *ufast64_ctype; /* * For "__attribute__((aligned))" From patchwork Mon Jul 13 22:33:00 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: 11661129 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 B95F914E3 for ; Mon, 13 Jul 2020 22:33:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A155E20C56 for ; Mon, 13 Jul 2020 22:33:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SEBkbUcs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726150AbgGMWdR (ORCPT ); Mon, 13 Jul 2020 18:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726374AbgGMWdO (ORCPT ); Mon, 13 Jul 2020 18:33:14 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6039FC061794 for ; Mon, 13 Jul 2020 15:33:14 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id l12so19261656ejn.10 for ; Mon, 13 Jul 2020 15:33:14 -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=OJxKW6Q+ZX0US0dhycJWTO0SaPn/we8YRmxl2e76kxc=; b=SEBkbUcs5eyTnSCiDqx9Sq53vGCkQJXTc2fdwn8E84dXgxw7etJD7Xjl7E30FFsiDa uEISVhpkh4Cd2fNqplo8bQ75C/Ow1WJGyELQn3LpKPWglXD6mCJHQ4eJy3waBIWtOt5w 2q+1PiLBbx9NJHpfh0Mjnso2KYTe0k9Bqk/HnsAsP3GRiBU9QhBc3T831EqJcWvooqof u/Xw+mVfrz7Tw+CwyLdC1xOszGP+jTRDPfN+9mltsZis8wn49ypb0+6ViEWZZjxVIjY8 EE+xD51M2fg1pkEgpepUMs0qeAs35+nC5WAHezvR7WhU+jzZKEBM/BbAjLZLYrt8mbbh Z0yw== 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=OJxKW6Q+ZX0US0dhycJWTO0SaPn/we8YRmxl2e76kxc=; b=fKny6J9xY0tTtaEztRJ5FUcQoTi6iElt6s9hCbLefIL4T46hJ47mrZrJIauWGhTwks 7Y6i+VX7f3jrhDUJ8ofvX4XPQKubO9QGp1CBwcJEeOOtnwzBQis9YMS2knfR/9d5hw+P AmSYRHO6AYniyogn0OnqMA5mdVxLP4tithuE+gGzWVYz1jirbYcM6yyb9AN03AusGiFf /IK8N4fqJs8joRM6Y5pK/jljvri5AfgRIK6XATt5fje1Xr1TPvR0nDK2nDKIvgsGJgH8 Qcpt5npipWs34enapLXYKx0miFLFue14LzYkl0x7zga5lzPnG1v31EPH12r7KEI79ZDe 7AKg== X-Gm-Message-State: AOAM530DMISSvHBoJlUXPnVX5bn7UvVYicP99IZV1k/yjiq/ci1ktheO aYdyf2YtzBzfvbjLjUfOayK3TsXT X-Google-Smtp-Source: ABdhPJzLaWKxDzqQl6f62IDvZBM4TiOerdFwkE2V/7Aoux9vfYOobuzcqw3CC5qMxINRvDJ19ZFglg== X-Received: by 2002:a17:906:1747:: with SMTP id d7mr1803713eje.39.1594679592910; Mon, 13 Jul 2020 15:33:12 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:12 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 6/9] predefine: teach sparse about __SIG_ATOMIC_TYPE__ Date: Tue, 14 Jul 2020 00:33:00 +0200 Message-Id: <20200713223304.83666-7-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 This type is predefined by GCC so add it to sparse too. Signed-off-by: Luc Van Oostenryck --- predefine.c | 1 + target.c | 1 + target.h | 1 + 3 files changed, 3 insertions(+) diff --git a/predefine.c b/predefine.c index 2e9913d5c0bc..60ecc7070045 100644 --- a/predefine.c +++ b/predefine.c @@ -170,6 +170,7 @@ void predefined_macros(void) predefined_ctype("PTRDIFF", ssize_t_ctype, PTYPE_ALL_T|PTYPE_TYPE); predefined_ctype("SIZE", size_t_ctype, PTYPE_ALL_T|PTYPE_TYPE); predefined_ctype("POINTER", &ptr_ctype, PTYPE_SIZEOF); + predefined_ctype("SIG_ATOMIC", sig_atomic_ctype, PTYPE_MAX|PTYPE_MIN|PTYPE_TYPE|PTYPE_WIDTH); predefined_sizeof("FLOAT", "", bits_in_float); predefined_sizeof("DOUBLE", "", bits_in_double); diff --git a/target.c b/target.c index 655a1527f93f..f320ab525dfb 100644 --- a/target.c +++ b/target.c @@ -31,6 +31,7 @@ struct symbol *fast32_ctype = &long_ctype; struct symbol *ufast32_ctype = &ulong_ctype; struct symbol *fast64_ctype = &long_ctype; struct symbol *ufast64_ctype = &ulong_ctype; +struct symbol *sig_atomic_ctype = &int_ctype; /* * For "__attribute__((aligned))" diff --git a/target.h b/target.h index 3fdfc1e69339..5bbce397bba5 100644 --- a/target.h +++ b/target.h @@ -29,6 +29,7 @@ extern struct symbol *fast32_ctype; extern struct symbol *ufast32_ctype; extern struct symbol *fast64_ctype; extern struct symbol *ufast64_ctype; +extern struct symbol *sig_atomic_ctype; /* * For "__attribute__((aligned))" From patchwork Mon Jul 13 22:33:01 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: 11661131 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 DA8D617C5 for ; Mon, 13 Jul 2020 22:33:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C313E20DD4 for ; Mon, 13 Jul 2020 22:33:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MGZ1AO5x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726374AbgGMWdR (ORCPT ); Mon, 13 Jul 2020 18:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgGMWdP (ORCPT ); Mon, 13 Jul 2020 18:33:15 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 342D0C08C5DB for ; Mon, 13 Jul 2020 15:33:15 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id d18so15178870edv.6 for ; Mon, 13 Jul 2020 15:33:15 -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=juJkRHEXgBeQsv7FfiIuEkhutk94RaoUqgXWqpQkuxU=; b=MGZ1AO5xal1850TAoLFF7ZWXM9Pq+GBTB/YaM3tViGhQYlJyHMFGpanEmip39g54KL 7v2+XuZNn2XJ59G0QXx6nQOoB2DOxJWELCtUernD2pLycePBuxb/q1pxpPJRcTE1GWHx DTYp40KegY/19V6TdHNGYRPfqB/dg85SzlRkeCaY0l5H0Q/9k9KPrDfJTitxuLM9pXFx km4cAcjNthwiAm6On+S6ZHhZaAzc1zmOuJpmAhHLrjWoJFQr66gjPsNVijHt7IVwPWpl rdAjlYG+BGCg06mc/kkl0Rf+7JiUQTz5dV2U5s6+dfQAwsvJ516n0DA7kijBo6NQv1XY +zOA== 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=juJkRHEXgBeQsv7FfiIuEkhutk94RaoUqgXWqpQkuxU=; b=LI9fjAaHEzBpGstZN2OnarAvyUoONBBRjjMWkcKphcXKq5pz3pJffeD1BJkl4zRLRo 3dmDfdJQmpoi36LNKkWk+9EnsMwXBX6KzfXd0NeaAY/4TD2+nOb7oT1NLSxAQYkBF85j +F/vK3zAFiloji7O0UE2Fwlrq+NafNHlejuVGiEPtaphmogYgoJT+7DY9G3dM6UoL4By Dv9llVTUqFLutFS5LZYJEy/+Wb5xeWoDKE+u5b8YCt06+4ZN7iolRUcp7tCPoDIcgQcg djEIfKjGH0Grdualq2rNnm4beXerBEwLRx4YSDGXyrQ6evMMGx+l1coXKiAdAXtxFLZf NTmQ== X-Gm-Message-State: AOAM532LtOzRcvVYek8G2uR4XP6XPO6jzrgywrB/NGf8+V3oW4Set/UC AwcLOB0YZhMKLEQCKlU2Ag1YJWfs X-Google-Smtp-Source: ABdhPJxEj6rMu+8mWArTtU15CdJ0HgSRv7nSCc1qeEVtErrfxGqMl5n5Dkq/uo5Pzj1xwvgEpWzydw== X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr1567531edy.198.1594679593711; Mon, 13 Jul 2020 15:33:13 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:13 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 7/9] arch: allow target specific [u]intptr_t & ptrdiff_t Date: Tue, 14 Jul 2020 00:33:01 +0200 Message-Id: <20200713223304.83666-8-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 These types are aliased to size_t & ssize_t but this is not correct for all architectures. So, add a variable for them so that target files can adjust them. Signed-off-by: Luc Van Oostenryck --- predefine.c | 6 +++--- symbol.c | 7 +++++++ symbol.h | 3 --- target-h8300.c | 2 ++ target-s390.c | 3 +++ target-sh.c | 2 ++ target.c | 3 +++ target.h | 3 +++ 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/predefine.c b/predefine.c index 60ecc7070045..7120d4381f16 100644 --- a/predefine.c +++ b/predefine.c @@ -165,9 +165,9 @@ void predefined_macros(void) predefined_ctype("INTMAX", intmax_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); predefined_ctype("UINTMAX", uintmax_ctype, PTYPE_MAX|PTYPE_TYPE); - predefined_ctype("INTPTR", ssize_t_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); - predefined_ctype("UINTPTR", size_t_ctype, PTYPE_MAX|PTYPE_TYPE); - predefined_ctype("PTRDIFF", ssize_t_ctype, PTYPE_ALL_T|PTYPE_TYPE); + predefined_ctype("INTPTR", intptr_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH); + predefined_ctype("UINTPTR", uintptr_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("PTRDIFF", ptrdiff_ctype, PTYPE_ALL_T|PTYPE_TYPE); predefined_ctype("SIZE", size_t_ctype, PTYPE_ALL_T|PTYPE_TYPE); predefined_ctype("POINTER", &ptr_ctype, PTYPE_SIZEOF); predefined_ctype("SIG_ATOMIC", sig_atomic_ctype, PTYPE_MAX|PTYPE_MIN|PTYPE_TYPE|PTYPE_WIDTH); diff --git a/symbol.c b/symbol.c index 6ee521ba48d8..c0ca79e42e96 100644 --- a/symbol.c +++ b/symbol.c @@ -899,4 +899,11 @@ void init_ctype(void) char_ctype.ctype.modifiers |= MOD_UNSIGNED; char_ctype.ctype.modifiers &= ~MOD_SIGNED; } + + if (!ptrdiff_ctype) + ptrdiff_ctype = ssize_t_ctype; + if (!intptr_ctype) + intptr_ctype = ssize_t_ctype; + if (!uintptr_ctype) + uintptr_ctype = size_t_ctype; } diff --git a/symbol.h b/symbol.h index 67464d659cc2..c2b60ce91c27 100644 --- a/symbol.h +++ b/symbol.h @@ -304,9 +304,6 @@ extern struct symbol float128_ctype; extern struct symbol const_void_ctype, const_char_ctype; extern struct symbol const_ptr_ctype, const_string_ctype; -#define uintptr_ctype size_t_ctype -#define intptr_ctype ssize_t_ctype - /* Special internal symbols */ extern struct symbol zero_int; diff --git a/target-h8300.c b/target-h8300.c index 84d168b7410a..c3652350bac7 100644 --- a/target-h8300.c +++ b/target-h8300.c @@ -5,6 +5,8 @@ static void init_h8300(const struct target *self) { + intptr_ctype = &int_ctype; + uintptr_ctype = &uint_ctype; ssize_t_ctype = &long_ctype; size_t_ctype = &ulong_ctype; wchar_ctype = &ushort_ctype; diff --git a/target-s390.c b/target-s390.c index cdbd685a2099..84889c0aa7ad 100644 --- a/target-s390.c +++ b/target-s390.c @@ -6,6 +6,9 @@ static void init_s390(const struct target *self) { + intptr_ctype = &int_ctype; + uintptr_ctype = &uint_ctype; + fast16_ctype = &int_ctype; ufast16_ctype = &uint_ctype; fast32_ctype = &int_ctype; diff --git a/target-sh.c b/target-sh.c index d4ddf45504cf..d3a66180a0aa 100644 --- a/target-sh.c +++ b/target-sh.c @@ -7,6 +7,8 @@ static void init_sh(const struct target *self) { int64_ctype = &llong_ctype; uint64_ctype = &ullong_ctype; + intptr_ctype = &int_ctype; + uintptr_ctype = &uint_ctype; fast16_ctype = &int_ctype; ufast16_ctype = &uint_ctype; diff --git a/target.c b/target.c index f320ab525dfb..308386b8fa7d 100644 --- a/target.c +++ b/target.c @@ -5,6 +5,9 @@ #include "target.h" #include "machine.h" +struct symbol *ptrdiff_ctype; +struct symbol *intptr_ctype; +struct symbol *uintptr_ctype; struct symbol *size_t_ctype = &ulong_ctype; struct symbol *ssize_t_ctype = &long_ctype; struct symbol *intmax_ctype = &long_ctype; diff --git a/target.h b/target.h index 5bbce397bba5..8ffd8e882906 100644 --- a/target.h +++ b/target.h @@ -5,6 +5,9 @@ extern struct symbol *size_t_ctype; extern struct symbol *ssize_t_ctype; +extern struct symbol *ptrdiff_ctype; +extern struct symbol *intptr_ctype; +extern struct symbol *uintptr_ctype; extern struct symbol *intmax_ctype; extern struct symbol *uintmax_ctype; extern struct symbol *int64_ctype; From patchwork Mon Jul 13 22:33:02 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: 11661133 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 734AD913 for ; Mon, 13 Jul 2020 22:33:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59E3620C56 for ; Mon, 13 Jul 2020 22:33:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="t2o/TEJM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726345AbgGMWdS (ORCPT ); Mon, 13 Jul 2020 18:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbgGMWdQ (ORCPT ); Mon, 13 Jul 2020 18:33:16 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09622C08C5DD for ; Mon, 13 Jul 2020 15:33:16 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id a1so9734619edt.10 for ; Mon, 13 Jul 2020 15:33:15 -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=g5VuQJWO6epFKSIA5jo6jeiqlwweo8XLjawSGp92FRM=; b=t2o/TEJMfvweG07+cUxpWtv+QEvz5qoCXu62SpoQXnotfYwd5n3jepP78i7X8/wi/r MGAA9WgUdgG7ztl+jTdyPjYcFCQVNjvwwZRMQ/YZgfBNddhh2wSK3c0uqerJufqkjxpF rIhxjUR1wzyrWScnMciQ46ytjcr1Q547XxoGlvQKy+z4W6os4W5yaP8VQeFepqKHkgsU gnR5CWIIBCIL8mzOBpEvCAbu/8MTZd9/TvZMdTdQqikJzfbl0mcUNCgC+sK8kejph5Ve JQ1FPSgoKTA2aQuSepKIZR7MlxH6VX4RL6pXZ6+SGOmrwpkNo6ArH+Pf6lxO2BjQZ+/7 3z5A== 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=g5VuQJWO6epFKSIA5jo6jeiqlwweo8XLjawSGp92FRM=; b=CTTuH6Uj0RuGkKlpd1uUpxfG4RMHf290U4a98PMQas0ba1RU++oT7o3HRv4r+HNJkR QODGSm0EimyyNnVeLB90Q5GQyb8X1xEN4UK2c2oNmG0QsryNFdMx0UsIQcXRO8uIZPXC iGBawzAgjlzqMR7Nc2vCJdaRgZCn25WxY+EC62fIIa2ied3eJj1dYZCd4tcmHiEP+i5p 723RY+K4Y83ggk3P1uWbqzjUXl4Wd+1Fo7pRXIzbi3nzjaYwpUZjs3YgCQJ6iD7PdGUG IuTUDZlC3W7J1Cwb3NDvf9X57lox4R4sgNdacpNRBBPh/4PzkvRMcIR6tj5/o7II/Oty pOZQ== X-Gm-Message-State: AOAM532y6QzgX+Ww94P1Nr8499kJCa98VlTihiL5vITWhtCBRF4xb2sm RUTuSRwLjIPEThQpMehqPvZfW/9B X-Google-Smtp-Source: ABdhPJz5YzKqp1+OtiyNPpCpGUusMMxOE5tUGGe3U7s58xfYhQuPJ88P8ekrvovtnRngaPtIZiZxkA== X-Received: by 2002:a50:ee8d:: with SMTP id f13mr1496587edr.302.1594679594548; Mon, 13 Jul 2020 15:33:14 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:13 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 8/9] x86-x32: fix it by defining a separate target for it Date: Tue, 14 Jul 2020 00:33:02 +0200 Message-Id: <20200713223304.83666-9-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 On x86-64, the x32 ABI was processed as a kind of special case of the usual 32-bit variant. But this doesn't work very well. Fix it and help avoiding possible future problems by defining a separate target for it. Signed-off-by: Luc Van Oostenryck --- target-x86.c | 32 ++++++++++++++++++++++++++++++++ target.c | 11 ++++++++--- target.h | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/target-x86.c b/target-x86.c index e69594edac0e..b7ff8f2ab4ed 100644 --- a/target-x86.c +++ b/target-x86.c @@ -67,6 +67,37 @@ const struct target target_i386 = { }; +static void init_x86_x32(const struct target *target) +{ + init_x86_common(target); + + max_int_alignment = 8; + + fast16_ctype = &int_ctype; + ufast16_ctype = &uint_ctype; + fast32_ctype = &int_ctype; + ufast32_ctype = &uint_ctype; + wchar_ctype = &long_ctype; +} + +static const struct target target_x86_x32 = { + .mach = MACH_X86_64, + .bitness = ARCH_X32, + .big_endian = 0, + .unsigned_char = 0, + .has_int128 = 1, + + .bits_in_longdouble = 128, + .max_fp_alignment = 16, + + .target_32bit = &target_i386, + .target_64bit = &target_x86_64, + + .init = init_x86_x32, + .predefine = predefine_x86_64, +}; + + static void init_x86_64(const struct target *target) { init_x86_common(target); @@ -124,6 +155,7 @@ const struct target target_x86_64 = { .max_fp_alignment = 16, .target_32bit = &target_i386, + .target_x32bit = &target_x86_x32, .init = init_x86_64, .predefine = predefine_x86_64, diff --git a/target.c b/target.c index 308386b8fa7d..8ae22d744f40 100644 --- a/target.c +++ b/target.c @@ -213,10 +213,17 @@ void target_init(void) const struct target *target = arch_target; switch (arch_m64) { + case ARCH_X32: + if (target->target_x32bit) + target = target->target_x32bit; + goto case_32bit; + case ARCH_LP32: max_int_alignment = 4; + if (target->target_32bit) + target = target->target_32bit; /* fallthrough */ - case ARCH_X32: + case_32bit: bits_in_long = 32; bits_in_pointer = 32; pointer_alignment = 4; @@ -228,8 +235,6 @@ void target_init(void) uintmax_ctype = &ullong_ctype; fast64_ctype = &llong_ctype; ufast64_ctype = &ullong_ctype; - if (target->target_32bit) - target = target->target_32bit; break; case ARCH_LLP64: diff --git a/target.h b/target.h index 8ffd8e882906..92b8af9169d7 100644 --- a/target.h +++ b/target.h @@ -92,6 +92,7 @@ struct target { unsigned int max_fp_alignment; const struct target *target_32bit; + const struct target *target_x32bit; const struct target *target_64bit; const struct builtin_fn *builtins; From patchwork Mon Jul 13 22:33:03 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: 11661135 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 9D11914E3 for ; Mon, 13 Jul 2020 22:33:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77E1D20C56 for ; Mon, 13 Jul 2020 22:33:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JhI2L/Fn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726432AbgGMWdS (ORCPT ); Mon, 13 Jul 2020 18:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbgGMWdR (ORCPT ); Mon, 13 Jul 2020 18:33:17 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7C8C061755 for ; Mon, 13 Jul 2020 15:33:16 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id a1so9734646edt.10 for ; Mon, 13 Jul 2020 15:33:16 -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=PYeNADQPBpM9u+rFh8J9FhNBQ2UpyHrJlgeDfOKAop0=; b=JhI2L/FnD3kgqupuoP4xkAKCahRkdCJ5uf+ht0cnEKmbs4rUIBMOOQgGehcZgnzLAb YmJikv2iruL/3inzCmWExNs47I5cYQKXyXDCl0EDJ/X+HyCFnrUiJL7knDxrBvgYY2Y+ 55120aGKPnKmICl/YVEdoR9rE1zgGcaPvqqK9kJ3oDCIqBsMBnO+KFjyLBIbqtZyniI+ x3r2DdkgcjSmRXZoBNishgGJhinJ5+7zMr1N+WKm7viZMVTVbgPKoDtjjpKT3d2RtcPS XrASkcXrpc+oR5hvrvXtPEVzxF9kWKAcfD7ISgZC+aktM7eh/SI3g7E76K8HiHJfYgZH g97w== 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=PYeNADQPBpM9u+rFh8J9FhNBQ2UpyHrJlgeDfOKAop0=; b=ZLoNlSp0SUkumr2/+l+wlx/TwXBXIaiU6hFNiOQibas0LjDLbveij0i8x5sxvk1Q7Q ImO4b+wa7ouqME5iwJB9axiLXxvDrdVrbk528J0j8WWlnaN4xk4oNIC4NT8DOLrUziSM 8ctixKEsJSW1CFwaLyu/mHrHnQilu/Nnf8qeu5stHufTO0Vmw+dPucSXdW03XeFWNFyw 3W5ZLOcKitliXhq6VL6xvC2v8fHhQ+j4CbSCcQhk6Ft8VEgZaIS7Q00scNyVZy04hYWs K/FGbhZ7dx/ptyS+lKTwLtm35xkppUKvAmC1T6ZbKXD/vhmjtWZ1LayBtJI2zDocZu34 FvPA== X-Gm-Message-State: AOAM532ilFTIdCFlqeJiTez9BjiWjO3+bKd265LT4HbYGIaPejqcAAJy je+5U9nHN+93tEZX+HwJRDv/Tps/ X-Google-Smtp-Source: ABdhPJwl9VQqsDdhuBxEpeLLKL8wjs56r3hzlXl8HcvlHbf2JLuPQoit20FFT9R6l2C1T8hYDyGTXA== X-Received: by 2002:a50:e60d:: with SMTP id y13mr1495693edm.225.1594679595339; Mon, 13 Jul 2020 15:33:15 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7f9:7600:64:f40c:5c10:8e2d]) by smtp.gmail.com with ESMTPSA id y7sm10792431ejd.73.2020.07.13.15.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 15:33:14 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 9/9] predefine: let predefine_width() take the usual interface Date: Tue, 14 Jul 2020 00:33:03 +0200 Message-Id: <20200713223304.83666-10-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713223304.83666-1-luc.vanoostenryck@gmail.com> References: <20200713223304.83666-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 All the helpers for type-related predefines directly take in argument the pointer to the type. All but predefine_width(). This must be an historical relic. So, let predefine_width() to also take the pointer to the type in argument. Signed-off-by: Luc Van Oostenryck --- predefine.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/predefine.c b/predefine.c index 7120d4381f16..f898cdfa39b8 100644 --- a/predefine.c +++ b/predefine.c @@ -25,12 +25,12 @@ static void predefined_sizeof(const char *name, const char *suffix, unsigned bit predefine(buf, 1, "%d", bits/8); } -static void predefined_width(const char *name, unsigned bits) +static void predefined_width(const char *name, struct symbol *type) { char buf[32]; snprintf(buf, sizeof(buf), "__%s_WIDTH__", name); - predefine(buf, 1, "%d", bits); + predefine(buf, 1, "%d", type->bit_size); } static void predefined_max(const char *name, struct symbol *type) @@ -78,7 +78,7 @@ static void predefined_ctype(const char *name, struct symbol *type, int flags) if (flags & PTYPE_TYPE) predefined_type(name, type); if (flags & PTYPE_WIDTH) - predefined_width(name, bits); + predefined_width(name, type); } void predefined_macros(void)