[cfe-commits] r133486 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp test/CodeGen/arm-asm-variable.c
Eric Christopher
echristo at apple.com
Mon Jun 20 17:07:10 PDT 2011
Author: echristo
Date: Mon Jun 20 19:07:10 2011
New Revision: 133486
URL: http://llvm.org/viewvc/llvm-project?rev=133486&view=rev
Log:
Canonicalize register names properly.
Fixes rdar://9425559
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/test/CodeGen/arm-asm-variable.c
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=133486&r1=133485&r2=133486&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Jun 20 19:07:10 2011
@@ -1286,6 +1286,8 @@
CGM.ErrorUnsupported(&Stmt, "__asm__");
return Constraint;
}
+ // Canonicalize the register here before returning it.
+ Register = Target.getNormalizedGCCRegisterName(Register);
return "{" + Register.str() + "}";
}
Modified: cfe/trunk/test/CodeGen/arm-asm-variable.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-asm-variable.c?rev=133486&r1=133485&r2=133486&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/arm-asm-variable.c (original)
+++ cfe/trunk/test/CodeGen/arm-asm-variable.c Mon Jun 20 19:07:10 2011
@@ -20,3 +20,12 @@
return r;
}
+
+// Make sure we translate register names properly.
+void bar (void) {
+ register unsigned int rn asm("r14");
+ register unsigned int d asm("r2");
+
+ // CHECK: call i32 asm sideeffect "sub $1, $1, #32", "={r2},{lr}"
+ asm volatile ("sub %1, %1, #32" : "=r"(d) : "r"(rn));
+}
More information about the cfe-commits
mailing list