[llvm-commits] [llvm-gcc-4.2] r103445 - /llvm-gcc-4.2/trunk/gcc/config/i386/i386.h

Bob Wilson bob.wilson at apple.com
Mon May 10 16:30:59 PDT 2010


Author: bwilson
Date: Mon May 10 18:30:59 2010
New Revision: 103445

URL: http://llvm.org/viewvc/llvm-project?rev=103445&view=rev
Log:
Fix a regression reported by Duncan for a test from a more recent version
of GCC.  Register names are allowed to be decimal values that are treated
as indices into the table of register names.  That doesn't make much sense
on x86 but llvm-gcc was crashing on the test because it had a variable in
register "1".  Preserve the old behavior to avoid crashing.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/i386.h

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=103445&r1=103444&r2=103445&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Mon May 10 18:30:59 2010
@@ -3927,8 +3927,10 @@
    the string extracted from the magic symbol built for that register, rather
    than reg_names.  The latter maps both AH and AL to the same thing, which
    means we can't distinguish them. */
-#define LLVM_GET_REG_NAME(REG_NAME, REG_NUM) \
-  ((REG_NAME) + (*(REG_NAME) == '%' ? 1 : 0))
+#define LLVM_GET_REG_NAME(REG_NAME, REG_NUM) __extension__ \
+  ({ const char *nm = (REG_NAME); \
+     if (*nm == '%' || *nm == '#') ++nm; \
+     (ISDIGIT (*nm) ? reg_names[REG_NUM] : nm); })
 
 /* Propagate code model setting to backend */
 /*





More information about the llvm-commits mailing list