MAX_CONSTRAINT VALUE

2008-04-14 Thread Balaji V. Iyer
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.5 -0400
+++ gcc.new/recog.c 2008-04-14 20:08:31.34375 -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.5 -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.h2008-04-14 19:58:00.46875 -0400
+++ gcc.new/target-def.h2008-04-14 19:54:45.71875 -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.




Re: MAX_CONSTRAINT VALUE

2008-04-14 Thread Ben Elliston
Hi there Balaji,

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.

Thanks for the patch.  You should send your patch to gcc-patches,
though, not the main GCC list.

Cheers, Ben