This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

[PATCH] Optimize ESP retrieval


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__;								      \
 })
 


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