From patchwork Wed Sep 29 21:31:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 66098 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 C6026B70A6 for ; Thu, 30 Sep 2010 07:31:21 +1000 (EST) Received: (qmail 19590 invoked by alias); 29 Sep 2010 21:31:19 -0000 Received: (qmail 19576 invoked by uid 22791); 29 Sep 2010 21:31:18 -0000 X-SWARE-Spam-Status: No, hits=-1.7 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; Wed, 29 Sep 2010 21:31:13 +0000 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0029.austin.hp.com (Postfix) with ESMTP id 467DD38870 for ; Wed, 29 Sep 2010 21:31:12 +0000 (UTC) Received: from lucas.cup.hp.com (lucas.cup.hp.com [15.244.97.116]) by g1t0038.austin.hp.com (Postfix) with ESMTP id DEF58300B9 for ; Wed, 29 Sep 2010 21:31:11 +0000 (UTC) Received: (from sje@localhost) by lucas.cup.hp.com (8.11.1 (PHNE_35485)/8.11.1) id o8TLVB306679 for gcc-patches@gcc.gnu.org; Wed, 29 Sep 2010 14:31:11 -0700 (PDT) Date: Wed, 29 Sep 2010 14:31:11 -0700 (PDT) From: Steve Ellcey Message-Id: <201009292131.o8TLVB306679@lucas.cup.hp.com> To: gcc-patches@gcc.gnu.org Subject: [patch, committed, ia64] Patch to fix gimple bytecode error Reply-to: sje@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 I am checking in this patch to fix the error message I get on IA64 due to Richard Guenther's change to use a TRANSLATION_UNIT_DECL DECL_CONTEX for file-scope decls. Error: /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 Tested on IA64 HP-UX and Linux. Steve Ellcey sje@cup.hp.com 2010-09-29 Steve Ellcey * config/ia64/ia64.c (ia64_builtin_decl): New. (TARGET_BUILTIN_DECL): Define. (ia64_builtins): New. (ia64_init_builtins): Save decls in ia64_builtins. 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. */