This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] use movstr in strcat


On Thu, Aug 25, 2005 at 01:12:18PM +0200, Adrian Straetling wrote:
> 	* builtins.c: (expand_builtin_strcat): Add support for
> 	expand_movstr.

You're duplicating a lot of code here.  It seems to me the best
way to approach this is to start a sequence, build the strlen
addition, and then defer to expand_builtin_strcpy.  If the
expansion of the strcpy fails, abort the sequence.  You may have
to play games like in expand_builtin_mathfn_2 in order to reliably
stabilize the arguments.

I'll also note for the record that it would seem like strchr(p, '\0')
would be a better expansion that p+strlen(p).  But we don't appear
to have specific backend support for strchr.  Or in more specific
terms, the glibc routine __rawmemchr which doesn't search for both
C and 0 simultaneously.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]