[llvm-commits] [dragonegg] r104438 - /dragonegg/trunk/x86/llvm-target.h

Duncan Sands baldrick at free.fr
Sat May 22 04:31:52 PDT 2010


Author: baldrick
Date: Sat May 22 06:31:52 2010
New Revision: 104438

URL: http://llvm.org/viewvc/llvm-project?rev=104438&view=rev
Log:
Port commit 103445 (bwilson) from llvm-gcc:
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:
    dragonegg/trunk/x86/llvm-target.h

Modified: dragonegg/trunk/x86/llvm-target.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.h?rev=104438&r1=104437&r2=104438&view=diff
==============================================================================
--- dragonegg/trunk/x86/llvm-target.h (original)
+++ dragonegg/trunk/x86/llvm-target.h Sat May 22 06:31:52 2010
@@ -358,8 +358,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 */
 #define LLVM_SET_MACHINE_OPTIONS(argvec)           \





More information about the llvm-commits mailing list