From patchwork Mon Feb 21 21:49:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 83882 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 3EAE5B6EF0 for ; Tue, 22 Feb 2011 08:49:25 +1100 (EST) Received: (qmail 15591 invoked by alias); 21 Feb 2011 21:49:23 -0000 Received: (qmail 15574 invoked by uid 22791); 21 Feb 2011 21:49:22 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RFC_ABUSE_POST, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from qmta10.westchester.pa.mail.comcast.net (HELO qmta10.westchester.pa.mail.comcast.net) (76.96.62.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 Feb 2011 21:49:17 +0000 Received: from omta24.westchester.pa.mail.comcast.net ([76.96.62.76]) by qmta10.westchester.pa.mail.comcast.net with comcast id AlHy1g0021ei1Bg5AlpGZe; Mon, 21 Feb 2011 21:49:16 +0000 Received: from up.mrs.kithrup.com ([24.4.193.8]) by omta24.westchester.pa.mail.comcast.net with comcast id AlpE1g0060BKwT43klpFLn; Mon, 21 Feb 2011 21:49:16 +0000 From: Mike Stump Subject: fix builtin types for CFString Date: Mon, 21 Feb 2011 13:49:12 -0800 Message-Id: <4121D567-6DE2-49C6-9B23-A46A6EA30721@comcast.net> To: gcc patches Mime-Version: 1.0 (Apple Message framework v1082) X-IsSubscribed: yes 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 The lto people were trying to get all the types for builtins to come out correctly in the debugging information, which is a nobel goal, and I would love to see that work, but there are a few ports that cause major problems with trying to do that. Darwin is one such port. This fixes the i386 issues, and fixes some of problems on ppc, but apparently not all of them. If someone can point out the remaining problem on ppc, I'll fix it, I just need a pointer on what data is being access, see the PR for details. Richard said it looked to to check in now (instead of waiting til stage1). PR target/47822 * config/darwin-protos.h (darwin_init_cfstring_builtins): Return a tree so we can get save the type. * config/i386/darwin.h (SUBTARGET_INIT_BUILTINS): Reserve builtin slot for CFString instead of trying to use past the end of the builtins. * config/i386/i386.c (IX86_BUILTIN_CFSTRING): Likewise. * config/rs6000/rs6000-builtin.def (RS6000_BUILTIN_CFSTRING): Likewise. * config/rs6000/darwin.h (SUBTARGET_INIT_BUILTINS): Likewise. * config/darwin.c (DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING): Rename to darwin_builtin_cfstring. (darwin_init_cfstring_builtins): Return the built type. 2011-02-21 Mike Stump PR target/47822 * config/darwin-protos.h (darwin_init_cfstring_builtins): Return a tree so we can get save the type. * config/i386/darwin.h (SUBTARGET_INIT_BUILTINS): Reserve builtin slot for CFString instead of trying to use past the end of the builtins. * config/i386/i386.c (IX86_BUILTIN_CFSTRING): Likewise. * config/rs6000/rs6000-builtin.def (RS6000_BUILTIN_CFSTRING): Likewise. * config/rs6000/darwin.h (SUBTARGET_INIT_BUILTINS): Likewise. * config/darwin.c (DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING): Rename to darwin_builtin_cfstring. (darwin_init_cfstring_builtins): Return the built type. Index: config/i386/darwin.h =================================================================== --- config/i386/darwin.h (revision 170340) +++ config/i386/darwin.h (working copy) @@ -308,7 +308,8 @@ #undef SUBTARGET_INIT_BUILTINS #define SUBTARGET_INIT_BUILTINS \ do { \ - darwin_init_cfstring_builtins ((unsigned) (IX86_BUILTIN_MAX));\ + ix86_builtins[(int) IX86_BUILTIN_CFSTRING] \ + = darwin_init_cfstring_builtins ((unsigned) (IX86_BUILTIN_CFSTRING)); \ darwin_rename_builtins (); \ } while(0) Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 170340) +++ config/i386/i386.c (working copy) @@ -24337,6 +24337,9 @@ IX86_BUILTIN_CVTPS2PH, IX86_BUILTIN_CVTPS2PH256, + /* CFString built-in for darwin */ + IX86_BUILTIN_CFSTRING, + IX86_BUILTIN_MAX }; Index: config/darwin-protos.h =================================================================== --- config/darwin-protos.h (revision 170335) +++ config/darwin-protos.h (working copy) @@ -110,7 +110,7 @@ extern bool darwin_binds_local_p (const_tree); extern void darwin_cpp_builtins (struct cpp_reader *); -extern void darwin_init_cfstring_builtins (unsigned); +extern tree darwin_init_cfstring_builtins (unsigned); extern tree darwin_fold_builtin (tree, int, tree *, bool); extern tree darwin_objc_construct_string (tree); extern bool darwin_cfstring_p (tree); Index: config/rs6000/rs6000-builtin.def =================================================================== --- config/rs6000/rs6000-builtin.def (revision 170335) +++ config/rs6000/rs6000-builtin.def (working copy) @@ -1015,3 +1015,6 @@ RS6000_BUILTIN(RS6000_BUILTIN_RSQRTF, RS6000_BTC_FP_PURE) RS6000_BUILTIN(RS6000_BUILTIN_RSQRT, RS6000_BTC_FP_PURE) RS6000_BUILTIN(RS6000_BUILTIN_BSWAP_HI, RS6000_BTC_CONST) + +/* Darwin CfString builtin. */ +RS6000_BUILTIN(RS6000_BUILTIN_CFSTRING, RS6000_BTC_MISC) Index: config/rs6000/darwin.h =================================================================== --- config/rs6000/darwin.h (revision 170335) +++ config/rs6000/darwin.h (working copy) @@ -433,5 +433,6 @@ #define SUBTARGET_INIT_BUILTINS \ do { \ darwin_patch_builtins (); \ - darwin_init_cfstring_builtins ((unsigned) (RS6000_BUILTIN_COUNT)); \ + rs6000_builtin_decls[(unsigned) (RS6000_BUILTIN_CFSTRING)] \ + = darwin_init_cfstring_builtins ((unsigned) (RS6000_BUILTIN_CFSTRING)); \ } while(0) Index: config/darwin.c =================================================================== --- config/darwin.c (revision 170335) +++ config/darwin.c (working copy) @@ -3001,7 +3001,7 @@ static GTY(()) tree pcint_type_node = NULL_TREE; static GTY(()) tree pcchar_type_node = NULL_TREE; -static enum built_in_function DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING; +static enum built_in_function darwin_builtin_cfstring; /* Store all constructed constant CFStrings in a hash table so that they get uniqued properly. */ @@ -3031,14 +3031,14 @@ return field; } -void -darwin_init_cfstring_builtins (unsigned first_avail) +tree +darwin_init_cfstring_builtins (unsigned builtin_cfstring) { tree cfsfun, fields, pccfstring_ftype_pcchar; tree *chain = NULL; - DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING = - (enum built_in_function) first_avail; + darwin_builtin_cfstring = + (enum built_in_function) builtin_cfstring; /* struct __builtin_CFString { const int *isa; (will point at @@ -3084,7 +3084,7 @@ DECL_LANG_SPECIFIC (cfsfun) = NULL; (*lang_hooks.dup_lang_specific_decl) (cfsfun); DECL_BUILT_IN_CLASS (cfsfun) = BUILT_IN_MD; - DECL_FUNCTION_CODE (cfsfun) = DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING; + DECL_FUNCTION_CODE (cfsfun) = darwin_builtin_cfstring; lang_hooks.builtin_function (cfsfun); /* extern int __CFConstantStringClassReference[]; */ @@ -3100,6 +3100,8 @@ /* Initialize the hash table used to hold the constant CFString objects. */ cfstring_htab = htab_create_ggc (31, cfstring_hash, cfstring_eq, NULL); + + return cfstring_type_node; } tree @@ -3108,7 +3110,7 @@ { unsigned int fcode = DECL_FUNCTION_CODE (fndecl); - if (fcode == DARWIN_BUILTIN_CFSTRINGMAKECONSTANTSTRING) + if (fcode == darwin_builtin_cfstring) { if (!darwin_constant_cfstrings) {