http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54760



             Bug #: 54760

           Summary: [SH] Add __builtin_thread_pointer,

                    __builtin_set_thread_pointer

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: target

        AssignedTo: olege...@gcc.gnu.org

        ReportedBy: olege...@gcc.gnu.org

            Target: sh*-*-*





SH normally uses GBR to store the address of the thread control block (TCB). 

Other targets have __builtin_thread_pointer and __builtin_set_thread_pointer to

modify such registers.  It has been proposed to make these machine independent

builtins:

http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00428.html



but so far this has not made it into mainline.  In any case the builtin

functions should be added for SH to get/set the GBR.  Moreover, code that

accesses variables in the TCB like



struct tcb

{

  int a, b, c, d;

};



int test (void)

{

  return ((tcb*)__builtin_thread_pointer ())->c;

}



ideally would result in:



  rts

  mov.l  @(8,gbr),r0

Reply via email to