r308867 - [X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides

Coby Tayree via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 00:06:37 PDT 2017


Author: coby
Date: Mon Jul 24 00:06:37 2017
New Revision: 308867

URL: http://llvm.org/viewvc/llvm-project?rev=308867&view=rev
Log:
[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides

On MS-style, the following snippet:

int eax;
__asm mov eax, ebx

should yield loading of ebx, into the location pointed by the variable eax

This patch sees to it.

Currently, a reg-to-reg move would have been invoked.

llvm: D34739

Differential Revision: https://reviews.llvm.org/D34740

Added:
    cfe/trunk/test/CodeGen/ms-inline-asm-var-name.c   (with props)

Added: cfe/trunk/test/CodeGen/ms-inline-asm-var-name.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm-var-name.c?rev=308867&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm-var-name.c (added)
+++ cfe/trunk/test/CodeGen/ms-inline-asm-var-name.c Mon Jul 24 00:06:37 2017
@@ -0,0 +1,12 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s
+
+void t() {
+  int eax;
+  int Ecx;
+  __asm mov eax, ebx
+  // CHECK: mov $0, ebx
+  __asm add ecx, Ecx
+  // CHECK: add ecx, $1
+}
+

Propchange: cfe/trunk/test/CodeGen/ms-inline-asm-var-name.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/CodeGen/ms-inline-asm-var-name.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: cfe/trunk/test/CodeGen/ms-inline-asm-var-name.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the cfe-commits mailing list