[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 15 12:40:54 PDT 2019


craig.topper added a comment.

In D56571#1467333 <https://reviews.llvm.org/D56571#1467333>, @void wrote:

> This code:
>
>   ; ModuleID = 'arch_static_branch.bc'
>   source_filename = "arch/x86/entry/vsyscall/vsyscall_64.c"
>   target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
>   target triple = "x86_64-grtev4-linux-gnu"
>  
>   %struct.atomic_t = type { i32 }
>   %struct.jump_entry = type { i64, i64, i64 }
>   %struct.tracepoint_func = type { i8*, i8*, i32 }
>   %struct.static_key = type { %struct.atomic_t, %union.anon }
>   %union.anon = type { i64 }
>  
>   @__tracepoint_emulate_vsyscall = external hidden global { i8*, { %struct.atomic_t, { %struct.jump_entry* } }, i32 ()*, void ()*, %struct.tracepoint_func* }, section "__tracepoints", align 8
>  
>   ; Function Attrs: alwaysinline noredzone nounwind sspstrong
>   define zeroext i1 @arch_static_branch(%struct.static_key* nocapture readnone %key, i1 zeroext %branch) {
>   entry:
>     callbr void asm sideeffect "1:.byte 0x0f,0x1f,0x44,0x00,0\0A\09.pushsection __jump_table,  \22aw\22 \0A\09 .balign 8 \0A\09 .quad 1b, ${2:l}, ${0:c} + ${1:c} \0A\09.popsection \0A\09", "i,i,X,~{dirflag},~{fpsr},~{flags}"(%struct.static_key* bitcast (i32* getelementptr inbounds ({ i8*, { %struct.atomic_t, { %struct.jump_entry* } }, i32 ()*, void ()*, %struct.tracepoint_func* }, { i8*, { %struct.atomic_t, { %struct.j
>   ump_entry* } }, i32 ()*, void ()*, %struct.tracepoint_func* }* @__tracepoint_emulate_vsyscall, i64 0, i32 1, i32 0, i32 0) to %struct.static_key*), i1 false, i8* blockaddress(@arch_static_branch, %return))
>             to label %asm.fallthrough [label %return]
>  
>   asm.fallthrough:                                  ; preds = %entry
>     call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
>     br label %return
>  
>   return:                                           ; preds = %asm.fallthrough, %entry
>     %retval.0 = phi i1 [ false, %asm.fallthrough ], [ true, %entry ]
>     ret i1 %retval.0
>   }
>
>
> gives me this with the asm-goto patches:
>
>   $ clang -o /dev/null arch_static_branch.ll
>   warning: overriding the module target triple with x86_64-unknown-linux-gnu [-Woverride-module]
>   <inline asm>:4:15: error: expected a symbol reference in '.quad' directive
>            .quad 1b, "", __tracepoint_emulate_vsyscall+8 + 0 
>                        ^
>   error: cannot compile inline asm
>   1 warning and 1 error generated.
>


I think things don't work right unless you disable the integrated assembler. I'm not sure why though.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56571/new/

https://reviews.llvm.org/D56571





More information about the cfe-commits mailing list