From f68211cd04d4083f4c12542f1b56ac09e995f9fd Mon Sep 17 00:00:00 2001
From: Vladimir Makarov <vmakarov@redhat.com>
Date: Mon, 19 Jan 2009 17:17:14 +0000
Subject: [PATCH] re PR c/38869 (valgrind find problem with -O -mtune=generic)

2009-01-19  Vladimir Makarov  <vmakarov@redhat.com>

	PR c/38869
	* rtl.h (reinit_regs): New prototype.
	* regclass.c: Include ira.h.
	(reinit_regs): New.
	* Makefile.in (regclass.o): Add ira.h.
	* config/i386/i386.c (ix86_maybe_switch_abi): Use reinit_regs.

From-SVN: r143498
---
 gcc/ChangeLog          |  9 +++++++++
 gcc/Makefile.in        |  2 +-
 gcc/config/i386/i386.c |  2 +-
 gcc/regclass.c         | 12 ++++++++++++
 gcc/rtl.h              |  1 +
 5 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 76c5e15a4209..c36c6122fd4a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2009-01-19  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR c/38869
+	* rtl.h (reinit_regs): New prototype.
+	* regclass.c: Include ira.h.
+	(reinit_regs): New.
+	* Makefile.in (regclass.o): Add ira.h.
+	* config/i386/i386.c (ix86_maybe_switch_abi): Use reinit_regs.
+
 2009-01-18  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR target/38736
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 309a6425ad59..595366812eac 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2848,7 +2848,7 @@ regclass.o : regclass.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) addresses.h $(REGS_H) insn-config.h \
    $(RECOG_H) reload.h $(REAL_H) $(TOPLEV_H) $(FUNCTION_H) output.h $(GGC_H) \
    $(TM_P_H) $(EXPR_H) $(TIMEVAR_H) gt-regclass.h $(HASHTAB_H) \
-   $(TARGET_H) tree-pass.h $(DF_H)
+   $(TARGET_H) tree-pass.h $(DF_H) ira.h
 local-alloc.o : local-alloc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(RTL_H) $(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \
    output.h $(FUNCTION_H) $(INSN_ATTR_H) $(TOPLEV_H)  except.h reload.h $(TM_P_H) \
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index d02f5c16fae3..d7e56bdd96d5 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4624,7 +4624,7 @@ ix86_maybe_switch_abi (void)
 {
   if (TARGET_64BIT &&
       call_used_regs[4 /*RSI*/] ==  (cfun->machine->call_abi == MS_ABI))
-    init_regs ();
+    reinit_regs ();
 }
 
 /* Initialize a variable CUM of type CUMULATIVE_ARGS
diff --git a/gcc/regclass.c b/gcc/regclass.c
index f31ccd15e402..2f665d874a3a 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "tree-pass.h"
 #include "df.h"
+#include "ira.h"
 
 /* Maximum register number used in this function, plus one.  */
 
@@ -740,6 +741,17 @@ init_regs (void)
   init_reg_autoinc ();
 }
 
+/* The same as previous function plus initializing IRA if it is
+   necessary.  */
+void
+reinit_regs (void)
+{
+  init_regs ();
+
+  if (flag_ira)
+    ira_init ();
+}
+
 /* Initialize some fake stack-frame MEM references for use in
    memory_move_secondary_cost.  */
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 5bd79053c1db..5394ea6f6e21 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2230,6 +2230,7 @@ extern int reg_class_subset_p (enum reg_class, enum reg_class);
 extern void globalize_reg (int);
 extern void init_reg_modes_target (void);
 extern void init_regs (void);
+extern void reinit_regs (void);
 extern void init_fake_stack_mems (void);
 extern void save_register_info (void);
 extern void init_reg_sets (void);
-- 
GitLab