From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21257 invoked by alias); 22 Jul 2002 00:18:57 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 21250 invoked from network); 22 Jul 2002 00:18:57 -0000 Received: from unknown (HELO localhost.localdomain) (66.60.148.227) by sources.redhat.com with SMTP; 22 Jul 2002 00:18:57 -0000 Received: from warlock.codesourcery.com (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.11.6/8.11.6) with ESMTP id g6M0HKC28243; Sun, 21 Jul 2002 17:17:20 -0700 Date: Sun, 21 Jul 2002 23:53:00 -0000 From: Mark Mitchell To: Jason Merrill cc: Richard Henderson , Per Bothner , Diego Novillo , "gcc@gcc.gnu.org" Subject: Re: Language-independent functions-as-trees representation Message-ID: <68260000.1027297038@warlock.codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-SW-Source: 2002-07/txt/msg00992.txt.bz2 >> I was implicitly (sorry!) in SSA form. > > I remain unenlightened. Can you give an example of where such sharing > would be useful? You mean, I assume, other than the obvious memory savings. (In practice, those savings can be rather substantial, and since we are trying to avoid making compile-time any worse than it already is, something that substantially reduces memory use may be worthwhile for that reason if for no other.) Consider that you want to do value-numbering to find places where you compute the same value multiple times. (Perhaps so as to move computations to some point that dominates all of the uses, for example.) Without sharing, you must recursively examine each new expression to see to which existing expressions is identical. (You can use hashing to speed this up, but you must ultimately do a recursive walk.) With sharing, you just do a pointer comparison. However, with sharing, you must do work as you build the structure so that you make sure that you really are sharing. But that is not so hard; you just keep tables of the things built from nodes you already have and check to see if the node you are building uses the same operation to combine the arguments as the one you already have. -- Mark Mitchell mark@codesourcery.com CodeSourcery, LLC http://www.codesourcery.com