From patchwork Wed Nov 19 13:40:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Bruel X-Patchwork-Id: 412394 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 3619F140172 for ; Thu, 20 Nov 2014 00:40:31 +1100 (AEDT) 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:cc:subject:content-type; q=dns; s=default; b=EYOD9sl0WRZMExR3zNsL1QTqIDYz8x8iL4s3s+2VDkT RvgfPc5U/umLImxBoqibtbNfsEOAH6a47pqIjy1d+dXEiRaFw8Wfu9UXP50w7l69 du3jxTmCnh4BrbaO1HhaH+YItDaEO6rhcos3Y3Ss7WLe+w0XeJ9YtewAhdXWLJrA = 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:cc:subject:content-type; s=default; bh=sZXdUZl9hrq+d7H2y1OGGLDNe4E=; b=lD1IisDD2V0xLuhQf GRL9iBsZzLUv4cnctNK8NzfTi3TlzPQY8GOzvv6mpuvRyEsU4OnKFC8ET7Je1EuP 0T8ZI1+bB+O0++x5J4SoHHl2M5mqmNDjCZSSI3+EVDFlGYt6l8YyQ79ba4amhAJ4 zm1ufiRbNq8HqQT+3ImhUkX8Qk= Received: (qmail 2949 invoked by alias); 19 Nov 2014 13:40:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 2940 invoked by uid 89); 19 Nov 2014 13:40:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham 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, 19 Nov 2014 13:40:22 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id sAJDcOjc029661; Wed, 19 Nov 2014 14:40:19 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 1qr7emd1k6-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 19 Nov 2014 14:40:19 +0100 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 A653738; Wed, 19 Nov 2014 13:39:46 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas4.st.com [10.75.90.69]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D57325A673; Wed, 19 Nov 2014 13:40:16 +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, 19 Nov 2014 14:40:16 +0100 Message-ID: <546C9DC0.3010101@st.com> Date: Wed, 19 Nov 2014 14:40:16 +0100 From: Christian Bruel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: ramana Radhakrishnan Cc: Richard Earnshaw , Terry Guo , "gcc-patches@gcc.gnu.org" Subject: [PATCH, ARM] attribute target (thumb,arm) [3/6] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.28, 0.0.0000 definitions=2014-11-19_04:2014-11-19, 2014-11-19, 1970-01-01 signatures=0 X-IsSubscribed: yes Re-implement ARM_DECLARE_FUNCTION_NAME as a function. That will make changed related to unified/divided and mode directives easier to insert. Thanks Christian 2014-09-23 Christian Bruel * config/arm/arm-protos.h (arm_declare_function_name): Declare. (is_called_in_ARM_mode): Remove. * config/arm/arm.c (is_called_in_ARM_mode): Declare static bool. (arm_declare_function_name): Moved from from ARM_DECLARE_FUNCTION_NAME. * config/arm/arm.h (ARM_DECLARE_FUNCTION_NAME): Call arm_declare_function_name. diff '--exclude=ChangeLog*' '--exclude=.svn' '--exclude=*~' '--exclude=#*#' -rupN c/gcc/gcc/config/arm/arm.c d/gcc/gcc/config/arm/arm.c --- c/gcc/gcc/config/arm/arm.c 2014-11-18 08:52:48.000000000 +0100 +++ d/gcc/gcc/config/arm/arm.c 2014-11-18 08:51:50.000000000 +0100 @@ -26422,6 +26422,23 @@ thumb_pop (FILE *f, unsigned long mask) fprintf (f, "}\n"); } +/* Return nonzero if FUNC must be entered in ARM mode. */ +static bool +is_called_in_ARM_mode (tree func) +{ + gcc_assert (TREE_CODE (func) == FUNCTION_DECL); + + /* Ignore the problem about functions whose address is taken. */ + if (TARGET_CALLEE_INTERWORKING && TREE_PUBLIC (func)) + return true; + +#ifdef ARM_PE + return lookup_attribute ("interfacearm", DECL_ATTRIBUTES (func)) != NULL_TREE; +#else + return false; +#endif +} + /* Generate code to return from a thumb function. If 'reg_containing_return_addr' is -1, then the return address is actually on the stack, at the stack pointer. */ @@ -26857,22 +26874,6 @@ thumb_far_jump_used_p (void) return 0; } -/* Return nonzero if FUNC must be entered in ARM mode. */ -int -is_called_in_ARM_mode (tree func) -{ - gcc_assert (TREE_CODE (func) == FUNCTION_DECL); - - /* Ignore the problem about functions whose address is taken. */ - if (TARGET_CALLEE_INTERWORKING && TREE_PUBLIC (func)) - return TRUE; - -#ifdef ARM_PE - return lookup_attribute ("interfacearm", DECL_ATTRIBUTES (func)) != NULL_TREE; -#else - return FALSE; -#endif -} /* Given the stack offsets and register mask in OFFSETS, decide how many additional registers to push instead of subtracting a constant @@ -32386,6 +32387,25 @@ arm_is_constant_pool_ref (rtx x) && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0))); } +void +arm_declare_function_name (FILE *stream, const char *name, tree decl) +{ + if (TARGET_THUMB) + { + if (is_called_in_ARM_mode (decl) + || (TARGET_THUMB1 && !TARGET_THUMB1_ONLY + && cfun->is_thunk)) + fprintf (stream, "\t.code 32\n"); + else if (TARGET_THUMB1) + fprintf (stream, "\t.code\t16\n\t.thumb_func\n"); + else + fprintf (stream, "\t.thumb\n\t.thumb_func\n"); + } + + if (TARGET_POKE_FUNCTION_NAME) + arm_poke_function_name (stream, (const char *) name); +} + /* If MEM is in the form of [base+offset], extract the two parts of address and set to BASE and OFFSET, otherwise return false after clearing BASE and OFFSET. */ @@ -32506,4 +32526,5 @@ arm_sched_fusion_priority (rtx_insn *ins *pri = tmp; return; } + #include "gt-arm.h" diff '--exclude=ChangeLog*' '--exclude=.svn' '--exclude=*~' '--exclude=#*#' -rupN c/gcc/gcc/config/arm/arm.h d/gcc/gcc/config/arm/arm.h --- c/gcc/gcc/config/arm/arm.h 2014-11-13 12:16:37.000000000 +0100 +++ d/gcc/gcc/config/arm/arm.h 2014-11-13 12:19:45.000000000 +0100 @@ -2184,23 +2184,7 @@ extern int making_const_table; ? 1 : 0) #define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ - do \ - { \ - if (TARGET_THUMB) \ - { \ - if (is_called_in_ARM_mode (DECL) \ - || (TARGET_THUMB1 && !TARGET_THUMB1_ONLY \ - && cfun->is_thunk)) \ - fprintf (STREAM, "\t.code 32\n") ; \ - else if (TARGET_THUMB1) \ - fprintf (STREAM, "\t.code\t16\n\t.thumb_func\n") ; \ - else \ - fprintf (STREAM, "\t.thumb\n\t.thumb_func\n") ; \ - } \ - if (TARGET_POKE_FUNCTION_NAME) \ - arm_poke_function_name (STREAM, (const char *) NAME); \ - } \ - while (0) + arm_declare_function_name ((STREAM), (NAME), (DECL)); /* For aliases of functions we use .thumb_set instead. */ #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL1, DECL2) \ diff '--exclude=ChangeLog*' '--exclude=.svn' '--exclude=*~' '--exclude=#*#' -rupN c/gcc/gcc/config/arm/arm-protos.h d/gcc/gcc/config/arm/arm-protos.h --- c/gcc/gcc/config/arm/arm-protos.h 2014-11-13 11:16:17.000000000 +0100 +++ d/gcc/gcc/config/arm/arm-protos.h 2014-11-13 12:21:36.000000000 +0100 @@ -30,6 +30,7 @@ extern void arm_load_pic_register (unsig extern int arm_volatile_func (void); extern void arm_expand_prologue (void); extern void arm_expand_epilogue (bool); +extern void arm_declare_function_name (FILE *, const char *, tree); extern void thumb2_expand_return (bool); extern const char *arm_strip_name_encoding (const char *); extern void arm_asm_output_labelref (FILE *, const char *); @@ -178,9 +179,6 @@ extern const char *thumb1_unexpanded_epi extern void thumb1_expand_prologue (void); extern void thumb1_expand_epilogue (void); extern const char *thumb1_output_interwork (void); -#ifdef TREE_CODE -extern int is_called_in_ARM_mode (tree); -#endif extern int thumb_shiftable_const (unsigned HOST_WIDE_INT); #ifdef RTX_CODE extern enum arm_cond_code maybe_get_arm_condition_code (rtx);