From patchwork Tue Apr 30 23:10:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 240701 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 40DF02C00CB for ; Wed, 1 May 2013 09:11:10 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=Es5l3hNS0s1oZP+gAh0iZR2NJ8/DPV3FWw8gJU8uDnm bkkBa+Kmcm3cpOdLxj3hOijdhh1LPrxJ1J7goq8gq6aELH41jCtpgqSGwjPXecNr uii7jAhBhnc9790pzW8y0v3lcA4mvKjMXiJKtKQrR3+1YnqDf/ArsbHZ2PyVEXLY = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=oiyzS1wI3u+SkloCM7LgJJMOZnM=; b=p2NjB6wnP2V58BcEV EJDqN3iA2jBgfR+NZpk4e2rMp78NY20KTBCL+1FuqbkWi8xGR/ViMahyDMMsS5I5 gaoIK5aK9Z4uthpNjvT/I6mAH/18j+SwsvqBJpXEoRGWth9uy2dZoilnMYsHP3CZ VB/FsdvZJwuA6eWuL1oO9aM9ho= Received: (qmail 7454 invoked by alias); 30 Apr 2013 23:11:03 -0000 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 Received: (qmail 7441 invoked by uid 89); 30 Apr 2013 23:11:02 -0000 X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ea0-f181.google.com (HELO mail-ea0-f181.google.com) (209.85.215.181) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 30 Apr 2013 23:11:02 +0000 Received: by mail-ea0-f181.google.com with SMTP id a11so494648eae.40 for ; Tue, 30 Apr 2013 16:10:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type:x-gm-message-state; bh=EuQ/pS4ie3llkfcqm0ZOXI/baRSBQiHMYdDox9jYWEI=; b=fVUFhCxHsnRUFvGYxqwz/oOnCsYsBm0BKpLBAU6hvpcqQJ48bR/u/rbvh1cIPGn9Ob Wl3Fjdx7KT5cNUPV+6Djxi3oQERyLiF54n1RL9g53L1j4HKc4pOAhx8TE2LRGHswFXVt G8Hd5dz3f6DQTXU2pLD9dwf28vZ8MDYGhQqcqoESYXm1A9hpc28RJR88F+Mm/hwBgFoy 4rdnawchI5KLudUNbk/gISbROoQ8YI455vdUjXx0Ysk9u/xLFiyfibm0p74KCOAYc1eg T/jJlPLCoov/vW69tRIv3SoQfVXp2eC6Keief0+PwaSOlSP9nTLX3fv2g2qJYhuARCxI I42w== MIME-Version: 1.0 X-Received: by 10.15.35.71 with SMTP id f47mr1168747eev.15.1367363459786; Tue, 30 Apr 2013 16:10:59 -0700 (PDT) Received: by 10.14.69.198 with HTTP; Tue, 30 Apr 2013 16:10:59 -0700 (PDT) Date: Tue, 30 Apr 2013 16:10:59 -0700 Message-ID: Subject: [GOOGLE] Change function naming to use context function assembler name to replace function id From: Dehao Chen To: GCC Patches Cc: David Li X-Gm-Message-State: ALoCoQmul6QxDdaYtXR8Q2T682nFDVEPwM0o5/iAhyeRjNgiHgY72cHmEH4h1nz+gKnJVcgoirsXikqwUT039bfVXGde/uiARzOoXtb6Y8+HYjSr7jgaD1BdLh2HUJX/yNn/sxdO+Qy3XFtK0AJQpMHsPVObSLOvrVDNKsaCMXYko205/ua13iUsaKXbwlGKCp8QiBlz7mLu This patch changes to use context function name to replace function id, which is not available in AutoFDO builds. Bootstrapped and passed regression tests. OK for google branches? Thanks, Dehao Index: gcc/l-ipo.c =================================================================== --- gcc/l-ipo.c (revision 198469) +++ gcc/l-ipo.c (working copy) @@ -1714,9 +1714,10 @@ create_unique_name (tree decl, unsigned module_id) { tree id, assemb_id; char *assembler_name; + const char *context = NULL; const char *name; - struct function *context = NULL; int seq = 0; + int len; if (TREE_CODE (decl) == FUNCTION_DECL) { @@ -1740,7 +1741,8 @@ create_unique_name (tree decl, unsigned module_id) else if (TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL) { id = DECL_NAME (decl); - context = DECL_STRUCT_FUNCTION (DECL_CONTEXT (decl)); + context = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME ( + DECL_CONTEXT (decl))); } else /* file scope context */ @@ -1748,17 +1750,12 @@ create_unique_name (tree decl, unsigned module_id) } name = IDENTIFIER_POINTER (id); + len = strlen (name) + context ? strlen (context) : 0; + assembler_name = (char*) alloca (len + 30); if (context) - { - char *n; - unsigned fno = FUNC_DECL_FUNC_ID (context); - n = (char *)alloca (strlen (name) + 15); - sprintf (n, "%s.%u", name, fno); - name = n; - } - - assembler_name = (char*) alloca (strlen (name) + 30); - sprintf (assembler_name, "%s.cmo.%u", name, module_id); + sprintf (assembler_name, "%s.%s.cmo.%u", context, name, module_id); + else + sprintf (assembler_name, "%s.cmo.%u", name, module_id); seq = get_name_seq_num (assembler_name); if (seq) sprintf (assembler_name, "%s.%d", assembler_name, seq);