<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>Le 5 nov. 2013 à 19:00, Behan Webster <<a href="mailto:behanw@converseincode.com">behanw@converseincode.com</a>> a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On 11/05/13 09:26, Konstantin Tokarev wrote:<br><blockquote type="cite"><br>11.10.2013, 01:39, "Jakob Stoklund Olesen" <<a href="mailto:stoklund@2pi.dk">stoklund@2pi.dk</a>>:<br><blockquote type="cite">On Oct 10, 2013, at 12:32 PM, Behan Webster <<a href="mailto:behanw@converseincode.com">behanw@converseincode.com</a>> wrote:<br><br><blockquote type="cite">One of the issues the LLVMLinux project is having is with the use of<br>named registers in the Linux kernel code. The kernel uses something like<br>this in order to assign a C variable name to a register (one for each<br>kernel arch).<br><br>   register unsigned long current_stack_pointer asm("esp");<br><br>clang doesn't allow this kind of thing which required a patch which less<br>efficient:<br><br>#define current_stack_pointer ({ \<br>      unsigned long esp; \<br>      asm("mov %%esp, %0" : "=r"(esp)); \<br>      esp; \<br>})<br><br>This works for both gcc and clang, but often adds in 3 extra<br>instructions since you need to copy the stack pointer to another<br>register, but first that register needs to be saved to the stack and<br>then restored after the stackpointer has been used; inefficient.<br></blockquote>#define current_stack_pointer ({ \<br>       register unsigned long esp asm("esp"); \<br>       asm("" : "=r"(esp)); \<br>       esp; \<br>   })<br></blockquote>And #ifdef it for each arch? Builtin would be much more handy.<br></blockquote>Actually no #ifdef is required with Jakob's suggestion (works the same<br>in both clang and gcc).<br><br></div></blockquote><div><br></div><div>It may works for both GCC and clang, it does not means it will works with every arch linux supports (ARM, PPC, AArch, …)</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">However the builtin is indeed nicer, easier to read and much more in<br>keeping with the other builtins...<br><br>Behan</div></blockquote><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="orphans: 2; widows: 2;">- Jean-Daniel</span></div></blockquote></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><div><br></div><div><br></div></span><br class="Apple-interchange-newline">

</div>
<br></body></html>