[PATCH] Optimize ESP retrieval

Samuel Thibault samuel.thibault@ens-lyon.org
Thu Nov 29 00:29:00 GMT 2007


GCC has a better way to retrieve registers.

Samuel

2007-11-29 Samuel Thibault <samuel.thibault@ens-lyon.org>

	* sysdeps/mach/i386/machine-sp.h (__thread_stack_pointer): Use
	asm("esp") to retrieve register esp.

Index: sysdeps/mach/i386/machine-sp.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mach/i386/machine-sp.h,v
retrieving revision 1.7
diff -u -p -r1.7 machine-sp.h
--- sysdeps/mach/i386/machine-sp.h	21 Aug 2001 20:32:26 -0000	1.7
+++ sysdeps/mach/i386/machine-sp.h	29 Nov 2007 00:23:44 -0000
@@ -23,8 +23,7 @@
 /* Return the current stack pointer.  */
 
 #define __thread_stack_pointer() ({					      \
-  void *__sp__;								      \
-  __asm__ ("movl %%esp, %0" : "=r" (__sp__));				      \
+  register void *__sp__ asm("esp");			      		      \
   __sp__;								      \
 })
 



More information about the Libc-alpha mailing list