[LLVMbugs] [Bug 4151] [Linux kernel] "__label__" support

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 17 20:44:21 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=4151

Chris Lattner <clattner at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #9 from Chris Lattner <clattner at apple.com> 2011-02-17 22:44:20 CST ---
As of r125829, clang now implements __label__ and the optimizer does a good job
of preserving these sorts of labels.  For example, we now compile:


#define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })

void foo() {
  printf("%p\n", _THIS_IP_);
  printf("%p\n", _THIS_IP_);
  printf("%p\n", _THIS_IP_);
}

into:

$ clang t.c -S -o - -mkernel -O3 -fomit-frame-pointer
...
_foo:                                   ## @foo
## BB#0:                                ## %entry
    pushq    %rax
Ltmp0:                                  ## Block address taken
## BB#1:                                ## %__here
    leaq    L_.str(%rip), %rdi
    leaq    Ltmp0(%rip), %rsi
    xorb    %al, %al
    callq    _printf
Ltmp1:                                  ## Block address taken
## BB#2:                                ## %__here1
    leaq    L_.str(%rip), %rdi
    leaq    Ltmp1(%rip), %rsi
    xorb    %al, %al
    callq    _printf
Ltmp2:                                  ## Block address taken
## BB#3:                                ## %__here3
    leaq    L_.str(%rip), %rdi
    leaq    Ltmp2(%rip), %rsi
    xorb    %al, %al
    callq    _printf
    popq    %rax
    ret


which seems reasonable.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list