From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6431 invoked by alias); 14 Feb 2011 05:00:55 -0000 Received: (qmail 6422 invoked by uid 22791); 14 Feb 2011 05:00:53 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Feb 2011 05:00:47 +0000 Received: from wpaz5.hot.corp.google.com (wpaz5.hot.corp.google.com [172.24.198.69]) by smtp-out.google.com with ESMTP id p1E50ijS008866 for ; Sun, 13 Feb 2011 21:00:44 -0800 Received: from iyi20 (iyi20.prod.google.com [10.241.51.20]) by wpaz5.hot.corp.google.com with ESMTP id p1E501iX028677 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sun, 13 Feb 2011 21:00:43 -0800 Received: by iyi20 with SMTP id 20so4900957iyi.0 for ; Sun, 13 Feb 2011 21:00:43 -0800 (PST) Received: by 10.42.223.6 with SMTP id ii6mr4294666icb.485.1297659642796; Sun, 13 Feb 2011 21:00:42 -0800 (PST) Received: from coign.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id u5sm2046508ics.18.2011.02.13.21.00.41 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 13 Feb 2011 21:00:42 -0800 (PST) From: Ian Lance Taylor To: kevin diggs Cc: gcc-help@gcc.gnu.org Subject: Re: code gen for C string literals References: Date: Mon, 14 Feb 2011 05:10:00 -0000 In-Reply-To: (kevin diggs's message of "Sat, 12 Feb 2011 13:41:13 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true 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/msg00201.txt.bz2 kevin diggs writes: > I would like to play with the code gcc generates for string literals. > Can someone point me to the relevant files and/or to some > documentation that describes the inner workings? The preprocessor turns a string literal into a CPP_STRING token. The parser turns that into a STRING_CST node in GENERIC. The 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. Search for CPP_STRING and STRING_CST to see the kinds of things that gcc does. Ian