This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What is ccp_fold_builtin() for vs. fold_builtin_1() ?
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 31 Mar 2005 18:01:14 -0500
- Subject: Re: What is ccp_fold_builtin() for vs. fold_builtin_1() ?
- References: <200503312246.j2VMkeG4006877@caip.rutgers.edu>
On Mar 31, 2005, at 5:46 PM, Kaveh R. Ghazi wrote:
I'm wondering what ccp_fold_builtin() is for, and particularly why it
only handles BUILT_IN_STRLEN, BUILT_IN_FPUTS, BUILT_IN_FPUTS_UNLOCKED,
BUILT_IN_STRCPY and BUILT_IN_STRNCPY.
Why were these builtins chosen to live in this function and not
others?
And what is the place of fold_builtin_1() given we have
ccp_fold_builtin() ?
Would someone please enlighten me?
ccp_fold_builtin handles converting some of the string builtins to
other builtins if the string length are the same for two strings
for an example:
#include <stdio.h>
void f(int i)
{
const char *a;
if (i)
a = "aa";
else
a = "bb";
__builtin_fputs(a,stdout);
}
We convert it to:
#include <stdio.h>
void f(int i)
{
const char *a;
if (i)
a = "aa";
else
a = "bb";
__builtin_fwrite(a,1,2,stdout);
}
-- Pinski