From patchwork Fri Nov 5 18:19:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 70276 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 7AA141007D2 for ; Sat, 6 Nov 2010 05:19:59 +1100 (EST) Received: (qmail 5331 invoked by alias); 5 Nov 2010 18:19:51 -0000 Received: (qmail 5311 invoked by uid 22791); 5 Nov 2010 18:19:49 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, MIME_QP_LONG_LINE, RCVD_IN_DNSWL_LOW, TW_CP X-Spam-Check-By: sourceware.org Received: from c60.cesmail.net (HELO c60.cesmail.net) (216.154.195.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Nov 2010 18:19:44 +0000 Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c60.cesmail.net with ESMTP; 05 Nov 2010 14:19:41 -0400 Received: from 89.241.157.248 ([89.241.157.248]) by webmail.spamcop.net (Horde MIME library) with HTTP; Fri, 05 Nov 2010 14:19:41 -0400 Message-ID: <20101105141941.thrlgs15sk0sggw4-nzlynne@webmail.spamcop.net> Date: Fri, 05 Nov 2010 14:19:41 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Subject: RFA: Fix PR middle-end/46314 MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) 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 This instroduces a new target hook as a wrapper around ASM_GENERATE_INTERNAL_LABEL, and makes the C++ and java front ends use it. bootstrapped / regtested on i686-pc-linux-gnu. 2010-11-05 Joern Rennecke PR middle-end/46314 gcc: * target.def (generate_internal_label): New asm_out hook. * output.h (default_generate_internal_label): Declare. * varasm.c (default_generate_internal_label): Define. gcc/cp: * method.c (make_alias_for_thunk): Use targetm.asm_out.generate_internal_label. gcc/java: * class.c: Include target.h. (make_local_function_alias): Use targetm.asm_out.generate_internal_label. * expr.c (lookup_label, generate_name): Likewise. Index: target.def =================================================================== --- target.def (revision 166360) +++ target.def (working copy) @@ -200,6 +200,14 @@ DEFHOOKPOD be called afterward.", bool, true) +/* Generate an internal label. + For now this is just a wrapper for ASM_GENERATE_INTERNAL_LABEL. */ +DEFHOOK_UNDOC +(generate_internal_label, + "", + void, (char *buf, const char *prefix, unsigned long labelno), + default_generate_internal_label) + /* Output an internal label. */ DEFHOOK (internal_label, Index: output.h =================================================================== --- output.h (revision 166360) +++ output.h (working copy) @@ -627,6 +627,8 @@ extern void default_globalize_label (FIL extern void default_globalize_decl_name (FILE *, tree); extern void default_emit_unwind_label (FILE *, tree, int, int); extern void default_emit_except_table_label (FILE *); +extern void default_generate_internal_label (char *, const char *, + unsigned long); extern void default_internal_label (FILE *, const char *, unsigned long); extern void default_asm_declare_constant_name (FILE *, const char *, const_tree, HOST_WIDE_INT); Index: varasm.c =================================================================== --- varasm.c (revision 166360) +++ varasm.c (working copy) @@ -6611,6 +6611,16 @@ default_emit_except_table_label (FILE * the class of label and LABELNO is the number within the class. */ void +default_generate_internal_label (char *buf, const char *prefix, + unsigned long labelno) +{ + ASM_GENERATE_INTERNAL_LABEL (buf, prefix, labelno); +} + +/* This is how to output an internal numbered label where PREFIX is + the class of label and LABELNO is the number within the class. */ + +void default_internal_label (FILE *stream, const char *prefix, unsigned long labelno) { Index: cp/method.c =================================================================== --- cp/method.c (revision 166360) +++ cp/method.c (working copy) @@ -252,7 +252,7 @@ make_alias_for_thunk (tree function) tree alias; char buf[256]; - ASM_GENERATE_INTERNAL_LABEL (buf, "LTHUNK", thunk_labelno); + targetm.asm_out.generate_internal_label (buf, "LTHUNK", thunk_labelno); thunk_labelno++; alias = make_alias_for (function, get_identifier (buf)); Index: java/class.c =================================================================== --- java/class.c (revision 166360) +++ java/class.c (working copy) @@ -43,6 +43,7 @@ The Free Software Foundation is independ #include "tree-iterator.h" #include "vecprim.h" #include "tm.h" /* FIXME: For gcc_obstack_init from defaults.h. */ +#include "target.h" /* DOS brain-damage */ #ifndef O_BINARY @@ -1399,7 +1400,7 @@ make_local_function_alias (tree method) *name = 'L'; strcpy (name + 1, method_name); - ASM_GENERATE_INTERNAL_LABEL (buf, name, alias_labelno++); + targetm.asm_out.generate_internal_label (buf, name, alias_labelno++); alias = build_decl (input_location, FUNCTION_DECL, get_identifier (buf), TREE_TYPE (method)); Index: java/expr.c =================================================================== --- java/expr.c (revision 166360) +++ java/expr.c (working copy) @@ -1763,7 +1763,8 @@ lookup_label (int pc) char buf[32]; if (pc > highest_label_pc_this_method) highest_label_pc_this_method = pc; - ASM_GENERATE_INTERNAL_LABEL(buf, "LJpc=", start_label_pc_this_method + pc); + targetm.asm_out.generate_internal_label (buf, "LJpc=", + start_label_pc_this_method + pc); name = get_identifier (buf); if (IDENTIFIER_LOCAL_VALUE (name)) return IDENTIFIER_LOCAL_VALUE (name); @@ -1783,7 +1784,7 @@ generate_name (void) { static int l_number = 0; char buff [32]; - ASM_GENERATE_INTERNAL_LABEL(buff, "LJv", l_number); + targetm.asm_out.generate_internal_label (buff, "LJv", l_number); l_number++; return get_identifier (buff); }