From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121223 invoked by alias); 22 May 2017 21:09:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 121147 invoked by uid 89); 22 May 2017 21:09:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=essential X-HELO: mail-lf0-f67.google.com Received: from mail-lf0-f67.google.com (HELO mail-lf0-f67.google.com) (209.85.215.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 May 2017 21:09:42 +0000 Received: by mail-lf0-f67.google.com with SMTP id q24so6431997lfb.1 for ; Mon, 22 May 2017 14:09:45 -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:cc:subject:date:message-id:in-reply-to :references; bh=tYyO9T3pxH/9JbIdeGKFc5xoLEUtXj3p7KSUgQNOXlo=; b=HK2x4jRB7aoN7w+/mHOBXkxDGqXrJBLut0dzm6C0aGDMzQqj6uYEineOaU0TUYmUYu nQaedacXbI3UWgr06vGwm36ai8SwlDgFUXUpxvdASbO7c0BL0DC6tIzutOSm0ONL7/MR SNZXVyuy77sbxfJ1eG2v1z3j+z5d9vJjmVSh3KVjNzOglnzgZbFnDpVrc7SJdtJxRIdy 6Jgn8MOyblGViOfx5003mU6jhniG73WmedlMI0/J56wh9KTEK+k7MXpsgxhtFQW/GwRa atazaV8cv+SZw1kibQZoyQfOfUduqO+VHp9epSVxzdV5N7HtBq2Vs/OFqRPnmdveC1/G +sNA== X-Gm-Message-State: AODbwcBQEB5WbxMTDXSi9KpNz48G+UvstuiG3k+nIdY3axwJ0FPiCuxQ LTd9paTXrruQLg== X-Received: by 10.25.145.75 with SMTP id y11mr6778893lfj.68.1495487384110; Mon, 22 May 2017 14:09:44 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by smtp.gmail.com with ESMTPSA id 95sm3447374lja.49.2017.05.22.14.09.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 May 2017 14:09:43 -0700 (PDT) From: Max Filippov To: gcc-patches@gcc.gnu.org Cc: linux-xtensa@linux-xtensa.org, Sterling Augustine , Max Filippov Subject: [RFC 4/5] gcc: xtensa: add __XCHAL_* builtins Date: Mon, 22 May 2017 21:09:00 -0000 Message-Id: <1495487362-18969-5-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1495487362-18969-1-git-send-email-jcmvbkbc@gmail.com> References: <1495487362-18969-1-git-send-email-jcmvbkbc@gmail.com> X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg01712.txt.bz2 Provide essential XCHAL_* configuration parameters as __XCHAL_* built-in macros. This way it will be possible to use them in libgcc and libc without need to patch libgcc or libc source for the specific xtensa core configuration. 2017-05-22 Max Filippov gcc/ * config/xtensa/xtensa-config.c (_STRINGIFY, STRINGIFY, XTENSA_CONFIG_ENTRY): New definitions. (xtensa_config_strings): New array with default __XCHAL_* macros. (xtensa_get_config_strings): New function. * config/xtensa/xtensa-protos.h (xtensa_get_config_strings): New declaration. * gcc/config/xtensa/xtensa.h (TARGET_CPU_CPP_BUILTINS): Add new 'builtin' variable and loop through string array returned by the xtensa_get_config_strings function call. --- gcc/config/xtensa/xtensa-config.c | 22 ++++++++++++++++++++++ gcc/config/xtensa/xtensa-protos.h | 1 + gcc/config/xtensa/xtensa.h | 3 +++ 3 files changed, 26 insertions(+) diff --git a/gcc/config/xtensa/xtensa-config.c b/gcc/config/xtensa/xtensa-config.c index 3259867..3d242d1 100644 --- a/gcc/config/xtensa/xtensa-config.c +++ b/gcc/config/xtensa/xtensa-config.c @@ -13,6 +13,17 @@ static struct xtensa_config xtensa_defconfig = XTENSA_CONFIG_INITIALIZER; +#define _STRINGIFY(a) #a +#define STRINGIFY(a) _STRINGIFY(a) + +#undef XTENSA_CONFIG_ENTRY +#define XTENSA_CONFIG_ENTRY(a) "__" #a "=" STRINGIFY(a) + +static const char *xtensa_config_strings[] = { + XTENSA_CONFIG_ENTRY_LIST, + NULL, +}; + #if !defined (HAVE_DLFCN_H) && defined (_WIN32) #define RTLD_LAZY 0 /* Dummy value. */ @@ -115,3 +126,14 @@ struct xtensa_config *xtensa_get_config (void) } return config; } + +const char **xtensa_get_config_strings (void) +{ + static const char **config_strings; + + if (!config_strings) + config_strings = (const char **) xtensa_load_config ("xtensa_config_strings", + &xtensa_config_strings); + + return config_strings; +} diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h index 38901b7..d8eba73 100644 --- a/gcc/config/xtensa/xtensa-protos.h +++ b/gcc/config/xtensa/xtensa-protos.h @@ -73,5 +73,6 @@ extern void xtensa_expand_prologue (void); extern void xtensa_expand_epilogue (void); extern void order_regs_for_local_alloc (void); extern enum reg_class xtensa_regno_to_class (int regno); +extern const char **xtensa_get_config_strings (void); #endif /* !__XTENSA_PROTOS_H__ */ diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 7852f44..e1d2e74 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see /* Target CPU builtins. */ #define TARGET_CPU_CPP_BUILTINS() \ do { \ + const char **builtin; \ builtin_assert ("cpu=xtensa"); \ builtin_assert ("machine=xtensa"); \ builtin_define ("__xtensa__"); \ @@ -72,6 +73,8 @@ along with GCC; see the file COPYING3. If not see builtin_define (TARGET_BIG_ENDIAN ? "__XTENSA_EB__" : "__XTENSA_EL__"); \ if (!TARGET_HARD_FLOAT) \ builtin_define ("__XTENSA_SOFT_FLOAT__"); \ + for (builtin = xtensa_get_config_strings (); *builtin; ++builtin) \ + builtin_define (*builtin); \ } while (0) #define CPP_SPEC " %(subtarget_cpp_spec) " -- 2.1.4