From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2453 invoked by alias); 14 Feb 2011 15:48:58 -0000 Received: (qmail 2432 invoked by uid 22791); 14 Feb 2011 15:48:57 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iw0-f175.google.com (HELO mail-iw0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Feb 2011 15:48:53 +0000 Received: by iwn8 with SMTP id 8so5081781iwn.20 for ; Mon, 14 Feb 2011 07:48:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.222.138 with SMTP id ig10mr4113854icb.179.1297698532164; Mon, 14 Feb 2011 07:48:52 -0800 (PST) Received: by 10.231.19.130 with HTTP; Mon, 14 Feb 2011 07:48:52 -0800 (PST) In-Reply-To: References: Date: Mon, 14 Feb 2011 16:43:00 -0000 Message-ID: Subject: Re: code gen for C string literals From: kevin diggs To: Ian Lance Taylor Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00204.txt.bz2 Hi, Thanks for the reply. I did manage to stumble across the gcc internals doc. "in GENERIC"??? Is this the initial RTL output? Assuming the size does not bust through a processors offset addressing capabilities, something similar should be doable for accessing things in any section (clustered section access optimization). I just figure that string literals are far more common. Off the top of your head do you know what I would search for for something like: int im_a_global_int; which would be treated similarly to a string literal (at least as far as how it is accessed), right? kevin On Sun, Feb 13, 2011 at 11:00 PM, Ian Lance Taylor wrote: > > The preprocessor turns a string literal into a CPP_STRING token. =A0The > parser turns that into a STRING_CST node in GENERIC. =A0The RTL expander > stores the string constant into the constant pool and works with a > symbol pointing to the address. > > This and the various string literal optimizations are scattered across > various files. =A0Search for CPP_STRING and STRING_CST to see the kinds of > things that gcc does. > > Ian >