public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Unbreak m68k bootstrap
@ 2007-10-14 10:06 Maxim Kuvyrkov
  2007-10-14 10:08 ` [PATCH][1/3] " Maxim Kuvyrkov
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Maxim Kuvyrkov @ 2007-10-14 10:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: Roman Zippel

Hi,

Here are three patches aimed to unbreak m68k bootstrap.

m68k-v1.patch - Enable use of autogenerated enums for instruction 
attributes in <arch>-protos.h files.

m68k-v2.patch - Make a use of previous patch in m68k backend.

m68k-v3.patch - Tame INSN_SCHEDULING.

The cumulative patch was bootstrapped on {x86_64, m68k, ia64, 
ppc64}-unknown-linux-gnu.

Roman, can you, please, bootstrap cumulative patch on m68k to double check?

--
Maxim

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH][1/3] Unbreak m68k bootstrap
  2007-10-14 10:06 Unbreak m68k bootstrap Maxim Kuvyrkov
@ 2007-10-14 10:08 ` Maxim Kuvyrkov
  2007-10-17 17:46   ` Ian Lance Taylor
  2007-10-14 10:11 ` [PATCH][2/3] " Maxim Kuvyrkov
  2007-10-14 10:16 ` [PATCH][3/3] " Maxim Kuvyrkov
  2 siblings, 1 reply; 7+ messages in thread
From: Maxim Kuvyrkov @ 2007-10-14 10:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: Roman Zippel

[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]

Hi,

This patch provides means to fix bootstrap failure on m68k.  Bootstrap 
fails due to warnings 'ansi C forbids forward declaration of enum types' 
on enum attr_* used in m68k.h.  In other words, this says that enums 
generated for instruction attributes  can't be used in <arch>.h files. 
Though there are no design reasons for this resctriction, all ports 
workaround it by declaring mirroring enum with the same values:

E.g.
(define_attr "cpu" "p1,p2,unknown" (const (symbol_ref "tune_cpu")))
expands into
enum attr_cpu { CPU_P1, CPU_P2, CPU_UNKNOWN };

then in <arch>.h:
enum processor { PROCESSOR_P1, PROCESSOR_P2, PROCESSOR_MAX };

And now CPU_Pn and PROCESSOR_Pn are interchangeable.

When using the above scheme there is a risk of going out of sync.

This patch rearranges headers of insn-attrtab.c to fix the issue.  With 
this patch applied it is ok to use autogenerated enums in <arch>-protos.h .

The patch was bootstrapped on {x86_64, m68k, ia64, ppc64}-unknown-linux-gnu.

OK for trunk?

:ADDPATCH middle-end:

Thanks,

Maxim

[-- Attachment #2: m68k-v1.ChangeLog --]
[-- Type: text/plain, Size: 122 bytes --]

2007-10-12  Maxim Kuvyrkov  <maxim@codesourcery.com>

	* genattrtab.c (main): Rearrange output of insn-attrtab.c headers.

[-- Attachment #3: m68k-v1.patch --]
[-- Type: text/plain, Size: 767 bytes --]

Index: genattrtab.c
===================================================================
--- genattrtab.c	(revision 184625)
+++ genattrtab.c	(working copy)
@@ -4530,13 +4530,13 @@ from the machine description file `md'. 
   printf ("#include \"coretypes.h\"\n");
   printf ("#include \"tm.h\"\n");
   printf ("#include \"rtl.h\"\n");
+  printf ("#include \"insn-attr.h\"\n");
   printf ("#include \"tm_p.h\"\n");
   printf ("#include \"insn-config.h\"\n");
   printf ("#include \"recog.h\"\n");
   printf ("#include \"regs.h\"\n");
   printf ("#include \"real.h\"\n");
   printf ("#include \"output.h\"\n");
-  printf ("#include \"insn-attr.h\"\n");
   printf ("#include \"toplev.h\"\n");
   printf ("#include \"flags.h\"\n");
   printf ("#include \"function.h\"\n");

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH][2/3] Unbreak m68k bootstrap
  2007-10-14 10:06 Unbreak m68k bootstrap Maxim Kuvyrkov
  2007-10-14 10:08 ` [PATCH][1/3] " Maxim Kuvyrkov
@ 2007-10-14 10:11 ` Maxim Kuvyrkov
  2007-10-16 14:25   ` Andreas Schwab
  2007-10-14 10:16 ` [PATCH][3/3] " Maxim Kuvyrkov
  2 siblings, 1 reply; 7+ messages in thread
From: Maxim Kuvyrkov @ 2007-10-14 10:11 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Roman Zippel, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

Hello Andreas,

This patch fixes one of bootstrap failure issues on m68k.

The patch in neighboring thread (1/3) enables use of autogenerated enums 
for instruction attributes in <arch>-protos.h header.  This patch 
applies that to fix bootstrap-time warning.

The patch was bootstrapped on m68k-unknown-linux-gnu with 
enable-languages=c.

OK for trunk?

:ADDPATCH m68k:


Thanks,

Maxim


[-- Attachment #2: m68k-v2.ChangeLog --]
[-- Type: text/plain, Size: 282 bytes --]

2007-10-12  Maxim Kuvyrkov  <maxim@codesourcery.com>

	* config/m68k/m68k.h (m68k_sched_cpu, m68k_sched_attr_opx_type,
	m68k_sched_attr_opy_type, m68k_sched_attr_size, m68k_sched_attr_op_mem,
	m68k_sched_branch_type): Move declarations to ...
	* config/m68/m68k-protos.h: ... here.

[-- Attachment #3: m68k-v2.patch --]
[-- Type: text/plain, Size: 1450 bytes --]

Index: config/m68k/m68k.h
===================================================================
--- config/m68k/m68k.h	(revision 184625)
+++ config/m68k/m68k.h	(working copy)
@@ -1148,10 +1148,3 @@ extern M68K_CONST_METHOD m68k_const_meth
 
 extern void m68k_emit_move_double (rtx [2]);
 
-extern enum attr_cpu m68k_sched_cpu;
-
-extern enum attr_opx_type m68k_sched_attr_opx_type (rtx, int);
-extern enum attr_opy_type m68k_sched_attr_opy_type (rtx, int);
-extern int m68k_sched_attr_size (rtx);
-extern enum attr_op_mem m68k_sched_attr_op_mem (rtx);
-extern enum attr_type m68k_sched_branch_type (rtx);
Index: config/m68k/m68k-protos.h
===================================================================
--- config/m68k/m68k-protos.h	(revision 184625)
+++ config/m68k/m68k-protos.h	(working copy)
@@ -65,6 +65,16 @@ extern int emit_move_sequence (rtx *, en
 extern bool m68k_movem_pattern_p (rtx, rtx, HOST_WIDE_INT, bool);
 extern const char *m68k_output_movem (rtx *, rtx, HOST_WIDE_INT, bool);
 
+#ifdef HAVE_ATTR_cpu
+extern enum attr_cpu m68k_sched_cpu;
+
+extern enum attr_opx_type m68k_sched_attr_opx_type (rtx, int);
+extern enum attr_opy_type m68k_sched_attr_opy_type (rtx, int);
+extern int m68k_sched_attr_size (rtx);
+extern enum attr_op_mem m68k_sched_attr_op_mem (rtx);
+extern enum attr_type m68k_sched_branch_type (rtx);
+#endif /* HAVE_ATTR_cpu */
+
 #endif /* RTX_CODE */
 
 extern bool m68k_regno_mode_ok (int, enum machine_mode);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH][3/3] Unbreak m68k bootstrap
  2007-10-14 10:06 Unbreak m68k bootstrap Maxim Kuvyrkov
  2007-10-14 10:08 ` [PATCH][1/3] " Maxim Kuvyrkov
  2007-10-14 10:11 ` [PATCH][2/3] " Maxim Kuvyrkov
@ 2007-10-14 10:16 ` Maxim Kuvyrkov
  2007-10-17 17:21   ` Ian Lance Taylor
  2 siblings, 1 reply; 7+ messages in thread
From: Maxim Kuvyrkov @ 2007-10-14 10:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Vladimir Makarov, James E Wilson, Roman Zippel

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

Hi,

This patch makes scheduler files to be predicated on INSN_SCHEDULING, 
which fixes bootstrap-time warnings on targets without scheduling support.

I suspect fine-grain use of INSN_SCHEDULING was provoked by some 
historical reasons, but at current point I don't see any justification 
for that.

The patch was bootstrapped both on targets that don't have scheduling 
(m68k) and on those which do (x86_64, ia64 and ppc64).

OK for trunk?

:ADDPATCH scheduler:


Thanks,

Maxim


[-- Attachment #2: m68k-v3.ChangeLog --]
[-- Type: text/plain, Size: 338 bytes --]

2007-10-12  Maxim Kuvyrkov  <maxim@codesourcery.com>

	* sched-ebb.c: Surround code with '#ifdef INSN_SCHEDULING'.
	* ddg.c: Ditto.
	* sched-deps.c: Ditto.  Remove nested #ifdef's INSN_SCHEDULING.
	* sched-int.h: Surround declarations with '#ifdef INSN_SCHEDULING'.
	(print_insn): Move declaration to ...
	* rtl.h (print_insn): ... here.

[-- Attachment #3: m68k-v3.patch --]
[-- Type: text/plain, Size: 6439 bytes --]

Index: sched-ebb.c
===================================================================
--- sched-ebb.c	(revision 184625)
+++ sched-ebb.c	(working copy)
@@ -44,6 +44,8 @@ along with GCC; see the file COPYING3.  
 #include "output.h"
 
 \f
+#ifdef INSN_SCHEDULING
+
 /* The number of insns scheduled so far.  */
 static int sched_n_insns;
 
@@ -696,3 +698,5 @@ fix_recovery_cfg (int bbi ATTRIBUTE_UNUS
   if (jump_bb_nexti == last_bb->index)
     last_bb = BASIC_BLOCK (jump_bbi);
 }
+
+#endif /* INSN_SCHEDULING */
Index: ddg.c
===================================================================
--- ddg.c	(revision 184625)
+++ ddg.c	(working copy)
@@ -44,6 +44,8 @@ along with GCC; see the file COPYING3.  
 #include "bitmap.h"
 #include "ddg.h"
 
+#ifdef INSN_SCHEDULING
+
 /* A flag indicating that a ddg edge belongs to an SCC or not.  */
 enum edge_flag {NOT_IN_SCC = 0, IN_SCC};
 
@@ -1104,3 +1106,5 @@ longest_simple_path (struct ddg * g, int
   sbitmap_free (tmp);
   return result;
 }
+
+#endif /* INSN_SCHEDULING */
Index: sched-deps.c
===================================================================
--- sched-deps.c	(revision 184625)
+++ sched-deps.c	(working copy)
@@ -42,6 +42,8 @@ along with GCC; see the file COPYING3.  
 #include "params.h"
 #include "cselib.h"
 
+#ifdef INSN_SCHEDULING
+
 #ifdef ENABLE_CHECKING
 #define CHECK (true)
 #else
@@ -437,11 +439,9 @@ static enum DEPS_ADJUST_RESULT maybe_add
 static enum DEPS_ADJUST_RESULT add_or_update_dep_1 (dep_t, bool, rtx, rtx);
 
 static dw_t estimate_dep_weak (rtx, rtx);
-#ifdef INSN_SCHEDULING
 #ifdef ENABLE_CHECKING
 static void check_dep (dep_t, bool);
 #endif
-#endif
 \f
 /* Return nonzero if a load of the memory reference MEM can cause a trap.  */
 
@@ -752,11 +752,9 @@ maybe_add_or_update_dep_1 (dep_t dep, bo
   /* Don't depend an insn on itself.  */
   if (insn == elem)
     {
-#ifdef INSN_SCHEDULING
       if (current_sched_info->flags & DO_SPECULATION)
         /* INSN has an internal dependence, which we can't overcome.  */
         HAS_INTERNAL_DEP (insn) = 1;
-#endif
 
       return DEP_NODEP;
     }
@@ -764,7 +762,6 @@ maybe_add_or_update_dep_1 (dep_t dep, bo
   return add_or_update_dep_1 (dep, resolved_p, mem1, mem2);
 }
 
-#ifdef INSN_SCHEDULING
 /* Ask dependency caches what needs to be done for dependence DEP.
    Return DEP_CREATED if new dependence should be created and there is no
    need to try to find one searching the dependencies lists.
@@ -935,7 +932,6 @@ change_spec_dep_to_hard (sd_iterator_def
     bitmap_clear_bit (&spec_dependency_cache[INSN_LUID (insn)],
 		      INSN_LUID (elem));
 }
-#endif
 
 /* Update DEP to incorporate information from NEW_DEP.
    SD_IT points to DEP in case it should be moved to another list.
@@ -959,7 +955,6 @@ update_dep (dep_t dep, dep_t new_dep,
       res = DEP_CHANGED;
     }
 
-#ifdef INSN_SCHEDULING
   if (current_sched_info->flags & USE_DEPS_LIST)
     /* Update DEP_STATUS.  */
     {
@@ -1009,7 +1004,6 @@ update_dep (dep_t dep, dep_t new_dep,
   if (true_dependency_cache != NULL
       && res == DEP_CHANGED)
     update_dependency_caches (dep, old_type);
-#endif
 
   return res;
 }
@@ -1031,8 +1025,6 @@ add_or_update_dep_1 (dep_t new_dep, bool
   gcc_assert (INSN_P (DEP_PRO (new_dep)) && INSN_P (DEP_CON (new_dep))
 	      && DEP_PRO (new_dep) != DEP_CON (new_dep));
   
-#ifdef INSN_SCHEDULING
-
 #ifdef ENABLE_CHECKING
   check_dep (new_dep, mem1 != NULL);
 #endif
@@ -1059,7 +1051,6 @@ add_or_update_dep_1 (dep_t new_dep, bool
 	  break;
 	}
     }
-#endif
 
   /* Check that we don't already have this dependence.  */
   if (maybe_present_p)
@@ -1148,7 +1139,6 @@ sd_add_dep (dep_t dep, bool resolved_p)
 
   add_to_deps_list (DEP_NODE_BACK (n), con_back_deps);
 
-#ifdef INSN_SCHEDULING
 #ifdef ENABLE_CHECKING
   check_dep (dep, false);
 #endif
@@ -1159,7 +1149,6 @@ sd_add_dep (dep_t dep, bool resolved_p)
      in the bitmap caches of dependency information.  */
   if (true_dependency_cache != NULL)
     set_dependency_caches (dep);
-#endif
 }
 
 /* Add or update backward dependence between INSN and ELEM
@@ -2202,7 +2191,6 @@ sched_analyze_insn (struct deps *deps, r
   if (SCHED_GROUP_P (insn))
     fixup_sched_groups (insn);
 
-#ifdef INSN_SCHEDULING
   if ((current_sched_info->flags & DO_SPECULATION)
       && !sched_insn_is_legitimate_for_speculation_p (insn, 0))
     /* INSN has an internal dependency (e.g. r14 = [r14]) and thus cannot
@@ -2215,7 +2203,6 @@ sched_analyze_insn (struct deps *deps, r
 	   sd_iterator_cond (&sd_it, &dep);)
 	change_spec_dep_to_hard (sd_it);
     }
-#endif
 }
 
 /* Analyze every insn between HEAD and TAIL inclusive, creating backward
@@ -2788,7 +2775,6 @@ debug_ds (ds_t s)
   fprintf (stderr, "\n");
 }
 
-#ifdef INSN_SCHEDULING
 #ifdef ENABLE_CHECKING
 /* Verify that dependence type and status are consistent.
    If RELAXED_P is true, then skip dep_weakness checks.  */
@@ -2871,5 +2857,6 @@ check_dep (dep_t dep, bool relaxed_p)
 	gcc_assert (ds & BEGIN_CONTROL);
     }
 }
-#endif
-#endif  
+#endif /* ENABLE_CHECKING */
+
+#endif /* INSN_SCHEDULING */
Index: sched-int.h
===================================================================
--- sched-int.h	(revision 184625)
+++ sched-int.h	(working copy)
@@ -22,6 +22,8 @@ along with GCC; see the file COPYING3.  
 #ifndef GCC_SCHED_INT_H
 #define GCC_SCHED_INT_H
 
+#ifdef INSN_SCHEDULING
+
 /* For state_t.  */
 #include "insn-attr.h"
 /* For regset_head.  */
@@ -807,9 +809,6 @@ enum INSN_TRAP_CLASS
 #define HAIFA_INLINE __inline
 #endif
 
-/* Functions in sched-vis.c.  */
-extern void print_insn (char *, rtx, int);
-
 /* Functions in sched-deps.c.  */
 extern bool sched_insns_conditions_mutex_p (const_rtx, const_rtx);
 extern void add_dependence (rtx, rtx, enum reg_note);
@@ -992,4 +991,6 @@ extern void sd_copy_back_deps (rtx, rtx,
 extern void sd_delete_dep (sd_iterator_def);
 extern void sd_debug_lists (rtx, sd_list_types_def);
 
+#endif /* INSN_SCHEDULING */
+
 #endif /* GCC_SCHED_INT_H */
Index: rtl.h
===================================================================
--- rtl.h	(revision 184625)
+++ rtl.h	(working copy)
@@ -2109,6 +2111,7 @@ extern void dump_combine_total_stats (FI
 extern void delete_dead_jumptables (void);
 
 /* In sched-vis.c.  */
+extern void print_insn (char *, rtx, int);
 extern void print_rtl_slim_with_bb (FILE *, rtx, int);
 extern void dump_insn_slim (FILE *f, rtx x);
 extern void debug_insn_slim (rtx x);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][2/3] Unbreak m68k bootstrap
  2007-10-14 10:11 ` [PATCH][2/3] " Maxim Kuvyrkov
@ 2007-10-16 14:25   ` Andreas Schwab
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2007-10-16 14:25 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: Roman Zippel, gcc-patches

Maxim Kuvyrkov <maxim@codesourcery.com> writes:

> 2007-10-12  Maxim Kuvyrkov  <maxim@codesourcery.com>
>
> 	* config/m68k/m68k.h (m68k_sched_cpu, m68k_sched_attr_opx_type,
> 	m68k_sched_attr_opy_type, m68k_sched_attr_size, m68k_sched_attr_op_mem,
> 	m68k_sched_branch_type): Move declarations to ...
> 	* config/m68/m68k-protos.h: ... here.

OK.

:REVIEWMAIL:

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][3/3] Unbreak m68k bootstrap
  2007-10-14 10:16 ` [PATCH][3/3] " Maxim Kuvyrkov
@ 2007-10-17 17:21   ` Ian Lance Taylor
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2007-10-17 17:21 UTC (permalink / raw)
  To: Maxim Kuvyrkov
  Cc: gcc-patches, Vladimir Makarov, James E Wilson, Roman Zippel

Maxim Kuvyrkov <maxim@codesourcery.com> writes:

> 2007-10-12  Maxim Kuvyrkov  <maxim@codesourcery.com>
> 
> 	* sched-ebb.c: Surround code with '#ifdef INSN_SCHEDULING'.
> 	* ddg.c: Ditto.
> 	* sched-deps.c: Ditto.  Remove nested #ifdef's INSN_SCHEDULING.
> 	* sched-int.h: Surround declarations with '#ifdef INSN_SCHEDULING'.
> 	(print_insn): Move declaration to ...
> 	* rtl.h (print_insn): ... here.

This is OK.

Thanks.

:REVIEWMAIL:

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][1/3] Unbreak m68k bootstrap
  2007-10-14 10:08 ` [PATCH][1/3] " Maxim Kuvyrkov
@ 2007-10-17 17:46   ` Ian Lance Taylor
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2007-10-17 17:46 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: gcc-patches, Roman Zippel

Maxim Kuvyrkov <maxim@codesourcery.com> writes:

> 2007-10-12  Maxim Kuvyrkov  <maxim@codesourcery.com>
> 
> 	* genattrtab.c (main): Rearrange output of insn-attrtab.c headers.

This is OK.

Thanks.

:REVIEWMAIL:

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-10-17 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-14 10:06 Unbreak m68k bootstrap Maxim Kuvyrkov
2007-10-14 10:08 ` [PATCH][1/3] " Maxim Kuvyrkov
2007-10-17 17:46   ` Ian Lance Taylor
2007-10-14 10:11 ` [PATCH][2/3] " Maxim Kuvyrkov
2007-10-16 14:25   ` Andreas Schwab
2007-10-14 10:16 ` [PATCH][3/3] " Maxim Kuvyrkov
2007-10-17 17:21   ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).