From patchwork Wed May 13 08:49:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Bruel X-Patchwork-Id: 471755 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 ACD63140758 for ; Wed, 13 May 2015 18:49:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=DL/cIFfC; dkim-atps=neutral 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:references :in-reply-to:content-type; q=dns; s=default; b=W95lKkMyCO/CPw9E8 T+CySCJSqKI/6D0+53W0b2E08LHM7Yw1aHK6jCvXWw7cdNOxE5bCO+KQK3e03oj1 ZhHlKLmR8PMBYcQDQKIv6FknJ+aCjbbOWLo0PSeOAPtAnWA/apivgcCkSz3Ks6aI kiqOo9l86wOgEyXHFPkIlWTPvw= 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:references :in-reply-to:content-type; s=default; bh=kO21obbEZsYoMy+fLtE2Bsu MON0=; b=DL/cIFfCMQB4zDXGG4c9R/qmQDoeKd17Wq8kD+gxN1uK4dfoMX77lFw SxkAE40IPtgjTHCeMLjjfA1WvMx2PPBjhMkee+zPtqkRcUI8c7DhmH5P5PMcN80j RPnXcxf4ct+Kukc3BLil6LWI22R4vuEEXOapxpDVruUh4ZcG0Z5E= Received: (qmail 114858 invoked by alias); 13 May 2015 08:49:50 -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 114849 invoked by uid 89); 13 May 2015 08:49:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mx08-00178001.pphosted.com Received: from mx08-00178001.pphosted.com (HELO mx08-00178001.pphosted.com) (91.207.212.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 13 May 2015 08:49:47 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id t4D8dLjb004223; Wed, 13 May 2015 10:49:41 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 1ubhhed1u6-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 13 May 2015 10:49:41 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D523731; Wed, 13 May 2015 08:49:39 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas3.st.com [10.75.90.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B0CA92B48; Wed, 13 May 2015 08:49:39 +0000 (GMT) Received: from [164.129.122.197] (164.129.122.197) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.342.0; Wed, 13 May 2015 10:49:39 +0200 Message-ID: <55531022.20801@st.com> Date: Wed, 13 May 2015 10:49:38 +0200 From: Christian Bruel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: , Ramana Radhakrishnan , Richard Earnshaw , Nicholas Clifton Subject: [PATCH, ARM] attribute target (thumb,arm) [2.1/6] respin (5th) References: <554A2348.6040205@st.com> <554B2706.9010005@arm.com> <55530DB8.40104@st.com> In-Reply-To: <55530DB8.40104@st.com> X-No-Archive: yes X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-05-13_02:2015-05-12, 2015-05-13, 1970-01-01 signatures=0 X-IsSubscribed: yes 2 parts for maintainers - c-family: machine descriptions export macro definitions into c implementation : need to export 'builtin_define_with_int_value' and ' builtin_define_type_sizeof' Could a global reviewer check this ? - ARM: Move the CPP builtins from arm.h to arm-c.c many thanks Christian 2015-05-12 Christian Bruel * c-common.h (builtin_define_with_int_value) (builtin_define_type_sizeof): Declare. * c-cppbuiltin.c (builtin_define_with_int_value) (builtin_define_type_sizeof): Externalize. (builtin_define_std): Cleanup declaration. 2015-05-13 Christian Bruel * config/arm/arm-protos.h (arm_cpu_cpp_builtins): Declare. * config/arm/arm.h (TARGET_CPU_CPP_BUILTINS): Move macro defines into... * config/arm/arm-c.c (arm_cpu_cpp_builtins): New function. (builtin_define, builtin_assert): New macros. diff '--exclude=.svn' -ruN gnu_trunk.p1/gcc/gcc/c-family/c-common.h gnu_trunk.ref/gcc/gcc/c-family/c-common.h --- gnu_trunk.p1/gcc/gcc/c-family/c-common.h 2015-05-13 09:27:08.049196052 +0200 +++ gnu_trunk.ref/gcc/gcc/c-family/c-common.h 2015-05-13 09:07:31.355106264 +0200 @@ -1085,6 +1085,8 @@ /* In c-cppbuiltin.c */ extern void builtin_define_std (const char *macro); extern void builtin_define_with_value (const char *, const char *, int); +extern void builtin_define_with_int_value (const char *, HOST_WIDE_INT); +extern void builtin_define_type_sizeof (const char *, tree); extern void c_stddef_cpp_builtins (void); extern void fe_file_change (const struct line_map *); extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char); diff '--exclude=.svn' -ruN gnu_trunk.p1/gcc/gcc/c-family/c-cppbuiltin.c gnu_trunk.ref/gcc/gcc/c-family/c-cppbuiltin.c --- gnu_trunk.p1/gcc/gcc/c-family/c-cppbuiltin.c 2015-03-25 15:14:13.132366687 +0100 +++ gnu_trunk.ref/gcc/gcc/c-family/c-cppbuiltin.c 2015-05-11 18:05:41.009176614 +0200 @@ -58,8 +58,6 @@ #endif /* Non-static as some targets don't use it. */ -void builtin_define_std (const char *) ATTRIBUTE_UNUSED; -static void builtin_define_with_int_value (const char *, HOST_WIDE_INT); static void builtin_define_with_hex_fp_value (const char *, tree, int, const char *, const char *, @@ -68,7 +66,6 @@ static void builtin_define_constants (const char *, tree); static void builtin_define_type_max (const char *, tree); static void builtin_define_type_minmax (const char *, const char *, tree); -static void builtin_define_type_sizeof (const char *, tree); static void builtin_define_float_constants (const char *, const char *, const char *, @@ -113,7 +110,7 @@ } /* Define NAME with value TYPE size_unit. */ -static void +void builtin_define_type_sizeof (const char *name, tree type) { builtin_define_with_int_value (name, @@ -1372,7 +1369,7 @@ /* Pass an object-like macro and an integer value to define it to. */ -static void +void builtin_define_with_int_value (const char *macro, HOST_WIDE_INT value) { char *buf; diff '--exclude=.svn' -ruN gnu_trunk.p1/gcc/gcc/config/arm/arm-c.c gnu_trunk.ref/gcc/gcc/config/arm/arm-c.c --- gnu_trunk.p1/gcc/gcc/config/arm/arm-c.c 2015-05-06 14:06:27.508142998 +0200 +++ gnu_trunk.ref/gcc/gcc/config/arm/arm-c.c 2015-05-13 10:29:41.160088869 +0200 @@ -51,3 +51,126 @@ { arm_lang_output_object_attributes_hook = arm_output_c_attributes; } + +#define builtin_define(TXT) cpp_define (pfile, TXT) +#define builtin_assert(TXT) cpp_assert (pfile, TXT) + +void +arm_cpu_cpp_builtins (struct cpp_reader * pfile) +{ + if (TARGET_DSP_MULTIPLY) + builtin_define ("__ARM_FEATURE_DSP"); + if (TARGET_ARM_QBIT) + builtin_define ("__ARM_FEATURE_QBIT"); + if (TARGET_ARM_SAT) + builtin_define ("__ARM_FEATURE_SAT"); + if (TARGET_CRYPTO) + builtin_define ("__ARM_FEATURE_CRYPTO"); + if (unaligned_access) + builtin_define ("__ARM_FEATURE_UNALIGNED"); + if (TARGET_CRC32) + builtin_define ("__ARM_FEATURE_CRC32"); + if (TARGET_32BIT) + builtin_define ("__ARM_32BIT_STATE"); + if (TARGET_ARM_FEATURE_LDREX) + builtin_define_with_int_value ("__ARM_FEATURE_LDREX", + TARGET_ARM_FEATURE_LDREX); + if ((TARGET_ARM_ARCH >= 5 && !TARGET_THUMB) + || TARGET_ARM_ARCH_ISA_THUMB >=2) + builtin_define ("__ARM_FEATURE_CLZ"); + if (TARGET_INT_SIMD) + builtin_define ("__ARM_FEATURE_SIMD32"); + + builtin_define_with_int_value ("__ARM_SIZEOF_MINIMAL_ENUM", + flag_short_enums ? 1 : 4); + builtin_define_type_sizeof ("__ARM_SIZEOF_WCHAR_T", wchar_type_node); + if (TARGET_ARM_ARCH_PROFILE) + builtin_define_with_int_value ("__ARM_ARCH_PROFILE", + TARGET_ARM_ARCH_PROFILE); + + /* Define __arm__ even when in thumb mode, for + consistency with armcc. */ + builtin_define ("__arm__"); + if (TARGET_ARM_ARCH) + builtin_define_with_int_value ("__ARM_ARCH", TARGET_ARM_ARCH); + if (arm_arch_notm) + builtin_define ("__ARM_ARCH_ISA_ARM"); + builtin_define ("__APCS_32__"); + if (TARGET_THUMB) + builtin_define ("__thumb__"); + if (TARGET_THUMB2) + builtin_define ("__thumb2__"); + if (TARGET_ARM_ARCH_ISA_THUMB) + builtin_define_with_int_value ("__ARM_ARCH_ISA_THUMB", + TARGET_ARM_ARCH_ISA_THUMB); + + if (TARGET_BIG_END) + { + builtin_define ("__ARMEB__"); + builtin_define ("__ARM_BIG_ENDIAN"); + if (TARGET_THUMB) + builtin_define ("__THUMBEB__"); + } + else + { + builtin_define ("__ARMEL__"); + if (TARGET_THUMB) + builtin_define ("__THUMBEL__"); + } + + if (TARGET_SOFT_FLOAT) + builtin_define ("__SOFTFP__"); + + if (TARGET_VFP) + builtin_define ("__VFP_FP__"); + + if (TARGET_ARM_FP) + builtin_define_with_int_value ("__ARM_FP", TARGET_ARM_FP); + if (arm_fp16_format == ARM_FP16_FORMAT_IEEE) + builtin_define ("__ARM_FP16_FORMAT_IEEE"); + if (arm_fp16_format == ARM_FP16_FORMAT_ALTERNATIVE) + builtin_define ("__ARM_FP16_FORMAT_ALTERNATIVE"); + if (TARGET_FMA) + builtin_define ("__ARM_FEATURE_FMA"); + + if (TARGET_NEON) + { + builtin_define ("__ARM_NEON__"); + builtin_define ("__ARM_NEON"); + } + if (TARGET_NEON_FP) + builtin_define_with_int_value ("__ARM_NEON_FP", TARGET_NEON_FP); + + /* Add a define for interworking. Needed when building libgcc.a. */ + if (arm_cpp_interwork) + builtin_define ("__THUMB_INTERWORK__"); + + builtin_assert ("cpu=arm"); + builtin_assert ("machine=arm"); + + builtin_define (arm_arch_name); + if (arm_arch_xscale) + builtin_define ("__XSCALE__"); + if (arm_arch_iwmmxt) + { + builtin_define ("__IWMMXT__"); + builtin_define ("__ARM_WMMX"); + } + if (arm_arch_iwmmxt2) + builtin_define ("__IWMMXT2__"); + if (TARGET_AAPCS_BASED) + { + if (arm_pcs_default == ARM_PCS_AAPCS_VFP) + builtin_define ("__ARM_PCS_VFP"); + else if (arm_pcs_default == ARM_PCS_AAPCS) + builtin_define ("__ARM_PCS"); + builtin_define ("__ARM_EABI__"); + } + if (TARGET_IDIV) + { + builtin_define ("__ARM_ARCH_EXT_IDIV__"); + builtin_define ("__ARM_FEATURE_IDIV"); + } + if (inline_asm_unified) + builtin_define ("__ARM_ASM_SYNTAX_UNIFIED__"); +} diff '--exclude=.svn' -ruN gnu_trunk.p1/gcc/gcc/config/arm/arm.h gnu_trunk.ref/gcc/gcc/config/arm/arm.h --- gnu_trunk.p1/gcc/gcc/config/arm/arm.h 2015-05-13 09:27:10.761200864 +0200 +++ gnu_trunk.ref/gcc/gcc/config/arm/arm.h 2015-05-13 10:29:33.460074402 +0200 @@ -45,132 +45,7 @@ extern char arm_arch_name[]; /* Target CPU builtins. */ -#define TARGET_CPU_CPP_BUILTINS() \ - do \ - { \ - if (TARGET_DSP_MULTIPLY) \ - builtin_define ("__ARM_FEATURE_DSP"); \ - if (TARGET_ARM_QBIT) \ - builtin_define ("__ARM_FEATURE_QBIT"); \ - if (TARGET_ARM_SAT) \ - builtin_define ("__ARM_FEATURE_SAT"); \ - if (TARGET_CRYPTO) \ - builtin_define ("__ARM_FEATURE_CRYPTO"); \ - if (unaligned_access) \ - builtin_define ("__ARM_FEATURE_UNALIGNED"); \ - if (TARGET_CRC32) \ - builtin_define ("__ARM_FEATURE_CRC32"); \ - if (TARGET_32BIT) \ - builtin_define ("__ARM_32BIT_STATE"); \ - if (TARGET_ARM_FEATURE_LDREX) \ - builtin_define_with_int_value ( \ - "__ARM_FEATURE_LDREX", TARGET_ARM_FEATURE_LDREX); \ - if ((TARGET_ARM_ARCH >= 5 && !TARGET_THUMB) \ - || TARGET_ARM_ARCH_ISA_THUMB >=2) \ - builtin_define ("__ARM_FEATURE_CLZ"); \ - if (TARGET_INT_SIMD) \ - builtin_define ("__ARM_FEATURE_SIMD32"); \ - \ - builtin_define_with_int_value ( \ - "__ARM_SIZEOF_MINIMAL_ENUM", \ - flag_short_enums ? 1 : 4); \ - builtin_define_type_sizeof ("__ARM_SIZEOF_WCHAR_T", \ - wchar_type_node); \ - if (TARGET_ARM_ARCH_PROFILE) \ - builtin_define_with_int_value ( \ - "__ARM_ARCH_PROFILE", TARGET_ARM_ARCH_PROFILE); \ - \ - /* Define __arm__ even when in thumb mode, for \ - consistency with armcc. */ \ - builtin_define ("__arm__"); \ - if (TARGET_ARM_ARCH) \ - builtin_define_with_int_value ( \ - "__ARM_ARCH", TARGET_ARM_ARCH); \ - if (arm_arch_notm) \ - builtin_define ("__ARM_ARCH_ISA_ARM"); \ - builtin_define ("__APCS_32__"); \ - if (TARGET_THUMB) \ - builtin_define ("__thumb__"); \ - if (TARGET_THUMB2) \ - builtin_define ("__thumb2__"); \ - if (TARGET_ARM_ARCH_ISA_THUMB) \ - builtin_define_with_int_value ( \ - "__ARM_ARCH_ISA_THUMB", \ - TARGET_ARM_ARCH_ISA_THUMB); \ - \ - if (TARGET_BIG_END) \ - { \ - builtin_define ("__ARMEB__"); \ - builtin_define ("__ARM_BIG_ENDIAN"); \ - if (TARGET_THUMB) \ - builtin_define ("__THUMBEB__"); \ - } \ - else \ - { \ - builtin_define ("__ARMEL__"); \ - if (TARGET_THUMB) \ - builtin_define ("__THUMBEL__"); \ - } \ - \ - if (TARGET_SOFT_FLOAT) \ - builtin_define ("__SOFTFP__"); \ - \ - if (TARGET_VFP) \ - builtin_define ("__VFP_FP__"); \ - \ - if (TARGET_ARM_FP) \ - builtin_define_with_int_value ( \ - "__ARM_FP", TARGET_ARM_FP); \ - if (arm_fp16_format == ARM_FP16_FORMAT_IEEE) \ - builtin_define ("__ARM_FP16_FORMAT_IEEE"); \ - if (arm_fp16_format == ARM_FP16_FORMAT_ALTERNATIVE) \ - builtin_define ("__ARM_FP16_FORMAT_ALTERNATIVE"); \ - if (TARGET_FMA) \ - builtin_define ("__ARM_FEATURE_FMA"); \ - \ - if (TARGET_NEON) \ - { \ - builtin_define ("__ARM_NEON__"); \ - builtin_define ("__ARM_NEON"); \ - } \ - if (TARGET_NEON_FP) \ - builtin_define_with_int_value ( \ - "__ARM_NEON_FP", TARGET_NEON_FP); \ - \ - /* Add a define for interworking. \ - Needed when building libgcc.a. */ \ - if (arm_cpp_interwork) \ - builtin_define ("__THUMB_INTERWORK__"); \ - \ - builtin_assert ("cpu=arm"); \ - builtin_assert ("machine=arm"); \ - \ - builtin_define (arm_arch_name); \ - if (arm_arch_xscale) \ - builtin_define ("__XSCALE__"); \ - if (arm_arch_iwmmxt) \ - { \ - builtin_define ("__IWMMXT__"); \ - builtin_define ("__ARM_WMMX"); \ - } \ - if (arm_arch_iwmmxt2) \ - builtin_define ("__IWMMXT2__"); \ - if (TARGET_AAPCS_BASED) \ - { \ - if (arm_pcs_default == ARM_PCS_AAPCS_VFP) \ - builtin_define ("__ARM_PCS_VFP"); \ - else if (arm_pcs_default == ARM_PCS_AAPCS) \ - builtin_define ("__ARM_PCS"); \ - builtin_define ("__ARM_EABI__"); \ - } \ - if (TARGET_IDIV) \ - { \ - builtin_define ("__ARM_ARCH_EXT_IDIV__"); \ - builtin_define ("__ARM_FEATURE_IDIV"); \ - } \ - if (inline_asm_unified) \ - builtin_define ("__ARM_ASM_SYNTAX_UNIFIED__");\ - } while (0) +#define TARGET_CPU_CPP_BUILTINS() arm_cpu_cpp_builtins (pfile) #include "config/arm/arm-opts.h" diff '--exclude=.svn' -ruN gnu_trunk.p1/gcc/gcc/config/arm/arm-protos.h gnu_trunk.ref/gcc/gcc/config/arm/arm-protos.h --- gnu_trunk.p1/gcc/gcc/config/arm/arm-protos.h 2015-05-13 09:27:10.761200864 +0200 +++ gnu_trunk.ref/gcc/gcc/config/arm/arm-protos.h 2015-05-13 10:29:45.956097880 +0200 @@ -216,8 +216,6 @@ extern void arm_pr_no_long_calls (struct cpp_reader *); extern void arm_pr_long_calls_off (struct cpp_reader *); -extern void arm_lang_object_attributes_init(void); - extern const char *arm_mangle_type (const_tree); extern const char *arm_mangle_builtin_type (const_tree); @@ -331,6 +329,10 @@ /* Defined in gcc/common/config/arm-common.c. */ extern const char *arm_rewrite_selected_cpu (const char *name); +/* Defined in gcc/common/config/arm-c.c. */ +extern void arm_lang_object_attributes_init (void); +extern void arm_cpu_cpp_builtins (struct cpp_reader *); + extern bool arm_is_constant_pool_ref (rtx); /* Flags used to identify the presence of processor capabilities. */