[llvm-commits] [dragonegg] r104456 - in /dragonegg/trunk: llvm-convert.cpp x86/llvm-target.h

Duncan Sands baldrick at free.fr
Sun May 23 00:23:08 PDT 2010


Author: baldrick
Date: Sun May 23 02:23:08 2010
New Revision: 104456

URL: http://llvm.org/viewvc/llvm-project?rev=104456&view=rev
Log:
Replace the last remaining direct use of reg_names with LLVM_GET_REG_NAME.
Patch by Bob Wilson.

Modified:
    dragonegg/trunk/llvm-convert.cpp
    dragonegg/trunk/x86/llvm-target.h

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=104456&r1=104455&r2=104456&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Sun May 23 02:23:08 2010
@@ -2932,7 +2932,8 @@
 //===----------------------------------------------------------------------===//
 
 // LLVM_GET_REG_NAME - Default to use GCC's register names.  Targets may
-// override this to use different names for some registers.
+// override this to use different names for some registers.  The REG_NAME is
+// the name before it was decoded; it may be null in some contexts.
 #ifndef LLVM_GET_REG_NAME
 #define LLVM_GET_REG_NAME(REG_NAME, REG_NUM) reg_names[REG_NUM]
 #endif
@@ -3171,7 +3172,7 @@
     // If we found a single register register class, return the register.
     if (RegMember != -1) {
       Result += '{';
-      Result += reg_names[RegMember];
+      Result += LLVM_GET_REG_NAME(0, RegMember);
       Result += '}';
     } else {
       Result += ConstraintChar;

Modified: dragonegg/trunk/x86/llvm-target.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.h?rev=104456&r1=104455&r2=104456&view=diff
==============================================================================
--- dragonegg/trunk/x86/llvm-target.h (original)
+++ dragonegg/trunk/x86/llvm-target.h Sun May 23 02:23:08 2010
@@ -360,8 +360,8 @@
    means we can't distinguish them. */
 #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); })
+     if (nm && (*nm == '%' || *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