This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: MAX_CONSTRAINT VALUE


 
Hello Everyone,
    I am currently working on OpenRISC port of GCC and I am trying to
add more constraints to the machine-dependent part and the default
number of constrant seem to be only 30 (and obviously I have more than
30 constraints, and thus it was failing). I tried making this a #define
value and moved this to the machine dependent part. This is advantageous
because now the backend designer has more flexibility.

   Here is the patch for it (if a value is not provided, then the
default value of 30 is assumed). I tried to build this for x86 and arm
and they seem to work fine with no problems.

Here is the patch for it (I am working on GCC 4.0.2):

======================================================================
diff -Naur gcc.old/recog.c gcc.new/recog.c
--- gcc.old/recog.c	2008-04-14 19:57:58.500000000 -0400
+++ gcc.new/recog.c	2008-04-14 20:08:31.343750000 -0400
@@ -2039,7 +2039,7 @@
       = (recog_data.constraints[i][0] == '=' ? OP_OUT
 	 : recog_data.constraints[i][0] == '+' ? OP_INOUT
 	 : OP_IN);
-
+   
   gcc_assert (recog_data.n_alternatives <= MAX_RECOG_ALTERNATIVES);  }
 
diff -Naur gcc.old/recog.h gcc.new/recog.h
--- gcc.old/recog.h	2008-04-14 19:57:58.500000000 -0400
+++ gcc.new/recog.h	2008-04-14 19:54:44.828125000 -0400
@@ -20,7 +20,12 @@
 02111-1307, USA.  */
 
 /* Random number that should be large enough for all purposes.  */
-#define MAX_RECOG_ALTERNATIVES 30
+
+#ifdef TARGET_MAX_RECOG_ALTERNATIVES
+#define MAX_RECOG_ALTERNATIVES TARGET_MAX_RECOG_ALTERNATIVES #else 
+#define MAX_RECOG_ALTERNATIVES 30 #endif
 
 /* Types of operands.  */
 enum op_type {
diff -Naur gcc.old/target-def.h gcc.new/target-def.h
--- gcc.old/target-def.h	2008-04-14 19:58:00.468750000 -0400
+++ gcc.new/target-def.h	2008-04-14 19:54:45.718750000 -0400
@@ -187,6 +187,11 @@
 #define TARGET_ASM_MARK_DECL_PRESERVED hook_void_constcharptr  #endif
 
+#ifndef TARGET_MAX_RECOG_ALTERNATIVES
+#define TARGET_MAX_RECOG_ALTERNATIVES 32 #endif
+
+
 #define TARGET_ASM_ALIGNED_INT_OP				\
 		       {TARGET_ASM_ALIGNED_HI_OP,		\
 			TARGET_ASM_ALIGNED_SI_OP,		\


======================================================================

Thanks,

Balaji V. Iyer.

 
-- 
 
Balaji V. Iyer
PhD Student, 
Center for Efficient, Scalable and Reliable Computing,
Department of Electrical and Computer Engineering,
North Carolina State University.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]