From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30756 invoked by alias); 20 Sep 2004 16:25:25 -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 30740 invoked from network); 20 Sep 2004 16:25:24 -0000 Received: from unknown (HELO boden.synopsys.com) (198.182.44.79) by sourceware.org with SMTP; 20 Sep 2004 16:25:24 -0000 Received: from maiden.synopsys.com (maiden.synopsys.com [146.225.100.170]) by boden.synopsys.com (Postfix) with ESMTP id 1F22DDA66; Mon, 20 Sep 2004 09:24:54 -0700 (PDT) Received: from piper.synopsys.com (localhost [127.0.0.1]) by maiden.synopsys.com (8.9.1/8.9.1) with ESMTP id JAA03919; Mon, 20 Sep 2004 09:25:23 -0700 (PDT) Received: (from jbuck@localhost) by piper.synopsys.com (8.11.6/8.11.6) id i8KGPM716790; Mon, 20 Sep 2004 09:25:22 -0700 X-Authentication-Warning: piper.synopsys.com: jbuck set sender to Joe.Buck@synopsys.com using -f Date: Mon, 20 Sep 2004 17:48:00 -0000 From: Joe Buck To: GCC Mailing List Cc: Fery , "crossgcc@sources.redhat.com" Subject: Re: number of vector template instances and pointers Message-ID: <20040920092522.A16665@synopsys.com> References: <414EAD5B.C7A34222@innomed.hu> <414EEF30.7030800@kegel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <414EEF30.7030800@kegel.com>; from dank@kegel.com on Mon, Sep 20, 2004 at 07:54:40AM -0700 X-SW-Source: 2004-09/txt/msg01174.txt.bz2 Fery wrote: > > When I create two vectors with different pointer types (e.g. > > vector and vector), gcc compiles in two instances of vector > > code. In SH architecture, it means cca. n * 10K of code, which is quite > > big in our project. > > > > The question is, can I somehow force the compiler to use the same code > > for the two template instances? The answer at the moment is no. On Mon, Sep 20, 2004 at 07:54:40AM -0700, Dan Kegel wrote: > If the object code generated for the two is really identical, > then if you really wanted to, you could write a whole-program > optimizer pass that combined them. It would be possible to refactor libstdc++ so that it uses the same code for those functions of Container whose code only depends on sizeof. Alternatively and more simply, there could be a specialization just for Container that would use common code. That work has not yet been done.