[PATCH] D69876: Allow output constraints on "asm goto"

Bill Wendling via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 19 12:43:09 PST 2019


void added a comment.

I'm not getting the `Undefined temporary symbol` in your example (even with optimizations):

  [morbo at fawn:llvm-project] cat ../bug.c
  void baz(void) {
      int y;
      asm volatile goto ("mov 42, %0; ja %1": "=d"(y) ::: quux);
      asm volatile goto ("mov 42, %0; ja %1": "=c"(y) ::: quux);
      return;
  quux:
      return;
  }
  [morbo at fawn:llvm-project] clang -o - -S ../bug.c
  	.text
  	.file	"bug.c"
  	.globl	baz                     # -- Begin function baz
  	.p2align	4, 0x90
  	.type	baz, at function
  baz:                                    # @baz
  	.cfi_startproc
  # %bb.0:                                # %entry
  	pushq	%rbp
  	.cfi_def_cfa_offset 16
  	.cfi_offset %rbp, -16
  	movq	%rsp, %rbp
  	.cfi_def_cfa_register %rbp
  	#APP
  	movl	42, %edx
  	ja	.Ltmp00
  	#NO_APP
  	movl	%edx, -8(%rbp)          # 4-byte Spill
  	jmp	.LBB0_1
  .LBB0_1:                                # %asm.fallthrough
  	movl	-8(%rbp), %eax          # 4-byte Reload
  	movl	%eax, -4(%rbp)
  	#APP
  	movl	42, %ecx
  	ja	.Ltmp00
  	#NO_APP
  	movl	%ecx, -12(%rbp)         # 4-byte Spill
  	jmp	.LBB0_2
  .LBB0_2:                                # %asm.fallthrough1
  	movl	-12(%rbp), %eax         # 4-byte Reload
  	movl	%eax, -4(%rbp)
  	jmp	.LBB0_4
  .Ltmp0:                                 # Block address taken
  .LBB0_3:                                # %quux
  	jmp	.LBB0_4
  .LBB0_4:                                # %return
  	popq	%rbp
  	.cfi_def_cfa %rsp, 8
  	retq
  .Lfunc_end0:
  	.size	baz, .Lfunc_end0-baz
  	.cfi_endproc
                                          # -- End function
  	.ident	"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 5b71b09a54edbb20900e6d13de35d2592f788330)"
  	.section	".note.GNU-stack","", at progbits
  	.addrsig
  	.addrsig_sym baz


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69876





More information about the cfe-commits mailing list