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