From patchwork Tue Dec 20 08:46:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tristan Gingold X-Patchwork-Id: 132355 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 9E1CBB7034 for ; Tue, 20 Dec 2011 19:47:04 +1100 (EST) Received: (qmail 21359 invoked by alias); 20 Dec 2011 08:46:59 -0000 Received: (qmail 21345 invoked by uid 22791); 20 Dec 2011 08:46:58 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Dec 2011 08:46:45 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id BE54229002E; Tue, 20 Dec 2011 09:46:45 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b9uy4Ds0BEsJ; Tue, 20 Dec 2011 09:46:45 +0100 (CET) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id A72AC290009; Tue, 20 Dec 2011 09:46:45 +0100 (CET) From: Tristan Gingold Subject: [RFC]: use cgraph to emit alpha vas trampoline entry point Date: Tue, 20 Dec 2011 09:46:44 +0100 Message-Id: Cc: Richard Henderson , Eric Botcazou To: GCC Patches Mime-Version: 1.0 (Apple Message framework v1251.1) 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 Hi, currently alpha/vms backend emits a trampoline entry point for all nested functions. This is a waste of code space, as although nested functions are very common in Ada, address of nested functions are only seldom taken. The fact that the address of a function is taken seems only be available in cgraph. Is it OK to use cgraph in alpha.c ? Tristan. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index e3976ed..4f59fe8 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -7936,9 +7936,14 @@ alpha_start_function (FILE *file, const char *fnname, && !TYPE_P (DECL_CONTEXT (decl)) && TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL) { - fprintf (file, "%s..tr:\n", fnname); - fprintf (file, "\tldq $1,24($27)\n"); - fprintf (file, "\tldq $27,16($27)\n"); + struct cgraph_node *node = cgraph_get_node (decl); + + if (node == NULL || node->address_taken) + { + fprintf (file, "%s..tr:\n", fnname); + fprintf (file, "\tldq $1,24($27)\n"); + fprintf (file, "\tldq $27,16($27)\n"); + } } if (TARGET_ABI_OPEN_VMS)