From patchwork Tue Sep 28 20:07:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 66024 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]) by ozlabs.org (Postfix) with SMTP id 533A1B7126 for ; Wed, 29 Sep 2010 06:07:47 +1000 (EST) Received: (qmail 6683 invoked by alias); 28 Sep 2010 20:07:45 -0000 Received: (qmail 6664 invoked by uid 22791); 28 Sep 2010 20:07:42 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from g1t0029.austin.hp.com (HELO g1t0029.austin.hp.com) (15.216.28.36) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Sep 2010 20:07:37 +0000 Received: from g1t0039.austin.hp.com (g1t0039.austin.hp.com [16.236.32.45]) by g1t0029.austin.hp.com (Postfix) with ESMTP id 5CD983802F; Tue, 28 Sep 2010 20:07:35 +0000 (UTC) Received: from [16.89.92.85] (hpsje.cup.hp.com [16.89.92.85]) by g1t0039.austin.hp.com (Postfix) with ESMTP id 48326341B3; Tue, 28 Sep 2010 20:07:34 +0000 (UTC) Subject: Re: [PATCH][C] Always use TRANSLATION_UNIT_DECL as context From: Steve Ellcey Reply-To: sje@cup.hp.com To: Richard Guenther Cc: Jie Zhang , gcc-patches@gcc.gnu.org, "Joseph S. Myers" , Richard Henderson In-Reply-To: References: <201009271935.o8RJZaQ16016@lucas.cup.hp.com> Date: Tue, 28 Sep 2010 13:07:33 -0700 Message-Id: <1285704453.29933.46.camel@hpsje.cup.hp.com> Mime-Version: 1.0 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 On Tue, 2010-09-28 at 10:36 +0200, Richard Guenther wrote: > On Mon, 27 Sep 2010, Steve Ellcey wrote: > > > FYI: I am getting the gimple bytecode messages on my IA64 Linux and > > HP-UX platforms as well when running the testsuite. > > > > /proj/opensrc_nobackup/nightly2/src/trunk/gcc/testsuite/gcc.c-torture/compile/20000105-1.c:25:1: sorry, unimplemented: gimple bytecode streams do not support machine specific builtin functions on this target > > Yep, that's a known issue now. Really all targets with builtins > need to implement targetm.builtin_decl for LTO to work for them. > > Richard. OK, I am testing the attached patch for IA64 to fix the builtin problem. Steve Ellcey sje@cup.hp.com Index: config/ia64/ia64.c =================================================================== --- config/ia64/ia64.c (revision 164675) +++ config/ia64/ia64.c (working copy) @@ -319,6 +319,7 @@ static void ia64_trampoline_init (rtx, t static void ia64_override_options_after_change (void); static void ia64_dwarf_handle_frame_unspec (const char *, rtx, int); +static tree ia64_builtin_decl (unsigned, bool); /* Table of valid machine attributes. */ static const struct attribute_spec ia64_attribute_table[] = @@ -344,6 +345,9 @@ static const struct attribute_spec ia64_ #undef TARGET_EXPAND_BUILTIN #define TARGET_EXPAND_BUILTIN ia64_expand_builtin +#undef TARGET_BUILTIN_DECL +#define TARGET_BUILTIN_DECL ia64_builtin_decl + #undef TARGET_ASM_BYTE_OP #define TARGET_ASM_BYTE_OP "\tdata1\t" #undef TARGET_ASM_ALIGNED_HI_OP @@ -9999,14 +10003,18 @@ enum ia64_builtins IA64_BUILTIN_FABSQ, IA64_BUILTIN_FLUSHRS, IA64_BUILTIN_INFQ, - IA64_BUILTIN_HUGE_VALQ + IA64_BUILTIN_HUGE_VALQ, + IA64_BUILTIN_max }; +static GTY(()) tree ia64_builtins[(int) IA64_BUILTIN_max]; + void ia64_init_builtins (void) { tree fpreg_type; tree float80_type; + tree decl; /* The __fpreg type. */ fpreg_type = make_node (REAL_TYPE); @@ -10023,7 +10031,7 @@ ia64_init_builtins (void) /* The __float128 type. */ if (!TARGET_HPUX) { - tree ftype, decl; + tree ftype; tree float128_type = make_node (REAL_TYPE); TYPE_PRECISION (float128_type) = 128; @@ -10032,13 +10040,15 @@ ia64_init_builtins (void) /* TFmode support builtins. */ ftype = build_function_type (float128_type, void_list_node); - add_builtin_function ("__builtin_infq", ftype, - IA64_BUILTIN_INFQ, BUILT_IN_MD, - NULL, NULL_TREE); - - add_builtin_function ("__builtin_huge_valq", ftype, - IA64_BUILTIN_HUGE_VALQ, BUILT_IN_MD, - NULL, NULL_TREE); + decl = add_builtin_function ("__builtin_infq", ftype, + IA64_BUILTIN_INFQ, BUILT_IN_MD, + NULL, NULL_TREE); + ia64_builtins[IA64_BUILTIN_INFQ] = decl; + + decl = add_builtin_function ("__builtin_huge_valq", ftype, + IA64_BUILTIN_HUGE_VALQ, BUILT_IN_MD, + NULL, NULL_TREE); + ia64_builtins[IA64_BUILTIN_HUGE_VALQ] = decl; ftype = build_function_type_list (float128_type, float128_type, @@ -10047,6 +10057,7 @@ ia64_init_builtins (void) IA64_BUILTIN_FABSQ, BUILT_IN_MD, "__fabstf2", NULL_TREE); TREE_READONLY (decl) = 1; + ia64_builtins[IA64_BUILTIN_FABSQ] = decl; ftype = build_function_type_list (float128_type, float128_type, @@ -10056,6 +10067,7 @@ ia64_init_builtins (void) IA64_BUILTIN_COPYSIGNQ, BUILT_IN_MD, "__copysigntf3", NULL_TREE); TREE_READONLY (decl) = 1; + ia64_builtins[IA64_BUILTIN_COPYSIGNQ] = decl; } else /* Under HPUX, this is a synonym for "long double". */ @@ -10073,13 +10085,15 @@ ia64_init_builtins (void) add_builtin_function ((name), (type), (code), BUILT_IN_MD, \ NULL, NULL_TREE) - def_builtin ("__builtin_ia64_bsp", + decl = def_builtin ("__builtin_ia64_bsp", build_function_type (ptr_type_node, void_list_node), IA64_BUILTIN_BSP); + ia64_builtins[IA64_BUILTIN_BSP] = decl; - def_builtin ("__builtin_ia64_flushrs", + decl = def_builtin ("__builtin_ia64_flushrs", build_function_type (void_type_node, void_list_node), IA64_BUILTIN_FLUSHRS); + ia64_builtins[IA64_BUILTIN_FLUSHRS] = decl; #undef def_builtin @@ -10149,6 +10163,17 @@ ia64_expand_builtin (tree exp, rtx targe return NULL_RTX; } +/* Return the ia64 builtin for CODE. */ + +static tree +ia64_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) +{ + if (code >= IA64_BUILTIN_max) + return error_mark_node; + + return ia64_builtins[code]; +} + /* For the HP-UX IA64 aggregate parameters are passed stored in the most significant bits of the stack slot. */