r288093 - Use ${:uid} to generate unique MS asm labels, not {:uid}

Sean Silva via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 1 00:37:26 PST 2016


what is this ${:uid} thing? Could the comment
in Sema::GetOrCreateMSAsmLabel explain it?

-- Sean Silva

On Mon, Nov 28, 2016 at 4:39 PM, Reid Kleckner via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: rnk
> Date: Mon Nov 28 18:39:37 2016
> New Revision: 288093
>
> URL: http://llvm.org/viewvc/llvm-project?rev=288093&view=rev
> Log:
> Use ${:uid} to generate unique MS asm labels, not {:uid}
>
> Modified:
>     cfe/trunk/lib/Sema/SemaStmtAsm.cpp
>     cfe/trunk/test/CodeGen/mozilla-ms-inline-asm.c
>     cfe/trunk/test/CodeGen/ms-inline-asm.c
>     cfe/trunk/test/CodeGen/ms-inline-asm.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/
> SemaStmtAsm.cpp?rev=288093&r1=288092&r2=288093&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Mon Nov 28 18:39:37 2016
> @@ -753,7 +753,7 @@ LabelDecl *Sema::GetOrCreateMSAsmLabel(S
>      // Create an internal name for the label.  The name should not be a
> valid mangled
>      // name, and should be unique.  We use a dot to make the name an
> invalid mangled
>      // name.
> -    OS << "__MSASMLABEL_.{:uid}__";
> +    OS << "__MSASMLABEL_.${:uid}__";
>      for (char C : ExternalLabelName) {
>        OS << C;
>        // We escape '$' in asm strings by replacing it with "$$"
>
> Modified: cfe/trunk/test/CodeGen/mozilla-ms-inline-asm.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGen/mozilla-ms-inline-asm.c?rev=288093&r1=288092&r2=288093&view=diff
> ============================================================
> ==================
> --- cfe/trunk/test/CodeGen/mozilla-ms-inline-asm.c (original)
> +++ cfe/trunk/test/CodeGen/mozilla-ms-inline-asm.c Mon Nov 28 18:39:37
> 2016
> @@ -20,7 +20,7 @@ void invoke(void* that, unsigned methodI
>  // CHECK: call void asm sideeffect inteldialect
>  // CHECK: mov edx,dword ptr $1
>  // CHECK: test edx,edx
> -// CHECK: jz {{[^_]*}}__MSASMLABEL_.{:uid}__noparams
> +// CHECK: jz {{[^_]*}}__MSASMLABEL_.${:uid}__noparams
>  //             ^ Can't use {{.*}} here because the matching is greedy.
>  // CHECK: mov eax,edx
>  // CHECK: shl eax,$$3
> @@ -28,7 +28,7 @@ void invoke(void* that, unsigned methodI
>  // CHECK: mov ecx,esp
>  // CHECK: push dword ptr $0
>  // CHECK: call dword ptr $2
> -// CHECK: {{.*}}__MSASMLABEL_.{:uid}__noparams:
> +// CHECK: {{.*}}__MSASMLABEL_.${:uid}__noparams:
>  // CHECK: mov ecx,dword ptr $3
>  // CHECK: push ecx
>  // CHECK: mov edx,[ecx]
>
> Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGen/ms-inline-asm.c?rev=288093&r1=288092&r2=288093&view=diff
> ============================================================
> ==================
> --- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
> +++ cfe/trunk/test/CodeGen/ms-inline-asm.c Mon Nov 28 18:39:37 2016
> @@ -249,7 +249,7 @@ void t23() {
>    the_label:
>    }
>  // CHECK: t23
> -// CHECK: call void asm sideeffect inteldialect
> "{{.*}}__MSASMLABEL_.{:uid}__the_label:", "~{dirflag},~{fpsr},~{flags}"()
> +// CHECK: call void asm sideeffect inteldialect
> "{{.*}}__MSASMLABEL_.${:uid}__the_label:", "~{dirflag},~{fpsr},~{flags}"()
>  }
>
>  void t24_helper(void) {}
> @@ -595,7 +595,7 @@ void label1() {
>      jmp label
>    }
>    // CHECK-LABEL: define void @label1()
> -  // CHECK: call void asm sideeffect inteldialect
> "{{.*}}__MSASMLABEL_.{:uid}__label:\0A\09jmp {{.*}}__MSASMLABEL_.{:uid}__label",
> "~{dirflag},~{fpsr},~{flags}"() [[ATTR1:#[0-9]+]]
> +  // CHECK: call void asm sideeffect inteldialect
> "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09jmp
> {{.*}}__MSASMLABEL_.${:uid}__label", "~{dirflag},~{fpsr},~{flags}"()
> [[ATTR1:#[0-9]+]]
>  }
>
>  void label2() {
> @@ -604,7 +604,7 @@ void label2() {
>      label:
>    }
>    // CHECK-LABEL: define void @label2
> -  // CHECK: call void asm sideeffect inteldialect "jmp
> {{.*}}__MSASMLABEL_.{:uid}__label\0A\09{{.*}}__MSASMLABEL_.{:uid}__label:",
> "~{dirflag},~{fpsr},~{flags}"()
> +  // CHECK: call void asm sideeffect inteldialect "jmp
> {{.*}}__MSASMLABEL_.${:uid}__label\0A\09{{.*}}__MSASMLABEL_.${:uid}__label:",
> "~{dirflag},~{fpsr},~{flags}"()
>  }
>
>  void label3() {
> @@ -613,7 +613,7 @@ void label3() {
>      mov eax, label
>    }
>    // CHECK-LABEL: define void @label3
> -  // CHECK: call void asm sideeffect inteldialect
> "{{.*}}__MSASMLABEL_.{:uid}__label:\0A\09mov eax,
> {{.*}}__MSASMLABEL_.{:uid}__label", "~{eax},~{dirflag},~{fpsr},~{flags}"()
> +  // CHECK: call void asm sideeffect inteldialect
> "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09mov eax,
> {{.*}}__MSASMLABEL_.${:uid}__label", "~{eax},~{dirflag},~{fpsr},~{
> flags}"()
>  }
>
>  void label4() {
> @@ -622,7 +622,7 @@ void label4() {
>      mov eax, [label]
>    }
>    // CHECK-LABEL: define void @label4
> -  // CHECK: call void asm sideeffect inteldialect
> "{{.*}}__MSASMLABEL_.{:uid}__label:\0A\09mov eax,
> {{.*}}__MSASMLABEL_.{:uid}__label", "~{eax},~{dirflag},~{fpsr},~{flags}"()
> +  // CHECK: call void asm sideeffect inteldialect
> "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09mov eax,
> {{.*}}__MSASMLABEL_.${:uid}__label", "~{eax},~{dirflag},~{fpsr},~{
> flags}"()
>  }
>
>  void label5() {
> @@ -631,7 +631,7 @@ void label5() {
>      dollar_label$:
>    }
>    // CHECK-LABEL: define void @label5
> -  // CHECK: call void asm sideeffect inteldialect "jmp
> {{.*}}__MSASMLABEL_.{:uid}__dollar_label$$\0A\09{{.*}}__
> MSASMLABEL_.{:uid}__dollar_label$$:", "~{dirflag},~{fpsr},~{flags}"()
> +  // CHECK: call void asm sideeffect inteldialect "jmp
> {{.*}}__MSASMLABEL_.${:uid}__dollar_label$$\0A\09{{.*}}__
> MSASMLABEL_.${:uid}__dollar_label$$:", "~{dirflag},~{fpsr},~{flags}"()
>  }
>
>  void label6(){
> @@ -640,7 +640,7 @@ void label6(){
>      label:
>    }
>    // CHECK-LABEL: define void @label6
> -  // CHECK: call void asm sideeffect inteldialect "jmp
> {{.*}}__MSASMLABEL_.{:uid}__label\0A\09{{.*}}__MSASMLABEL_.{:uid}__label:",
> "~{dirflag},~{fpsr},~{flags}"()
> +  // CHECK: call void asm sideeffect inteldialect "jmp
> {{.*}}__MSASMLABEL_.${:uid}__label\0A\09{{.*}}__MSASMLABEL_.${:uid}__label:",
> "~{dirflag},~{fpsr},~{flags}"()
>  }
>
>  typedef union _LARGE_INTEGER {
>
> Modified: cfe/trunk/test/CodeGen/ms-inline-asm.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGen/ms-inline-asm.cpp?rev=288093&r1=288092&r2=288093&view=diff
> ============================================================
> ==================
> --- cfe/trunk/test/CodeGen/ms-inline-asm.cpp (original)
> +++ cfe/trunk/test/CodeGen/ms-inline-asm.cpp Mon Nov 28 18:39:37 2016
> @@ -126,14 +126,14 @@ void t7_using() {
>  void t8() {
>    __asm some_label:
>    // CHECK-LABEL: define void @_Z2t8v()
> -  // CHECK: call void asm sideeffect inteldialect
> "L__MSASMLABEL_.{:uid}__some_label:", "~{dirflag},~{fpsr},~{flags}"()
> +  // CHECK: call void asm sideeffect inteldialect
> "L__MSASMLABEL_.${:uid}__some_label:", "~{dirflag},~{fpsr},~{flags}"()
>    struct A {
>      static void g() {
>        __asm jmp some_label ; This should jump forwards
>        __asm some_label:
>        __asm nop
>        // CHECK-LABEL: define internal void @_ZZ2t8vEN1A1gEv()
> -      // CHECK: call void asm sideeffect inteldialect "jmp
> L__MSASMLABEL_.{:uid}__some_label\0A\09L__MSASMLABEL_.{:uid}__some_label:\0A\09nop",
> "~{dirflag},~{fpsr},~{flags}"()
> +      // CHECK: call void asm sideeffect inteldialect "jmp
> L__MSASMLABEL_.${:uid}__some_label\0A\09L__MSASMLABEL_.${:uid}__some_label:\0A\09nop",
> "~{dirflag},~{fpsr},~{flags}"()
>      }
>    };
>    A::g();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161201/a9d895ec/attachment-0001.html>


More information about the cfe-commits mailing list