<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 11/05/13 11:30, Jean-Daniel Dupas
      wrote:<br>
    </div>
    <blockquote
      cite="mid:A1E7CDDE-ED39-4BB2-933C-89B6944F9792@shadowlab.org"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <br>
      <div>
        <div>Le 5 nov. 2013 à 19:00, Behan Webster <<a
            moz-do-not-send="true"
            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
                moz-do-not-send="true" href="mailto:stoklund@2pi.dk">stoklund@2pi.dk</a>>:<br>
              <blockquote type="cite">On Oct 10, 2013, at 12:32 PM,
                Behan Webster <<a moz-do-not-send="true"
                  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>
      </div>
    </blockquote>
    True enough. Which is indeed another argument for
    __builtin_stack_pointer().<br>
    <br>
    That point is precisely one of the reasons that we're pushing for
    this addition.<br>
    <br>
    Behan<br>
    <pre class="moz-signature" cols="72">-- 
Behan Webster
<a class="moz-txt-link-abbreviated" href="mailto:behanw@converseincode.com">behanw@converseincode.com</a></pre>
  </body>
</html>