RE: [patch 1/28] top-level: Use automake-1.11.6

2015-05-08 Thread Bernd Edlinger
Hi,

On Fri, 8 May 2015 20:20:55, Joseph S. Myers wrote:
>
> On Fri, 8 May 2015, Bernd Edlinger wrote:
>
>> But it made the in-tree gmp configure script fail.  That would not
>> have happened if we did not pass our version of missing to a sub-
>> module like gmp, that already has a working missing script that behaves
>> differently.
>
> However, that's still not an argument for a downgrade of the toplevel copy
> of "missing" to an older version. We can't possibly match toplevel
> scripts to subdirectories not shipped with GCC, since we want to support
> multiple versions of libraries such as GMP, which may each require a
> different version of such a script if the script makes incompatible
> changes; we can only ensure that they get configured in ways sufficiently
> isolated from GCC itself.
>

No, but I learned from it, that surprises are possible if newer versions
of the tool scripts are used together with an older version of automake.

But maybe you would like it better if we update, for instance, to:
automake-1.14  _and_  autoconf-2.69 ?


Bernd.
  

Re: [PATCH, RFC]: Next stage1, refactoring: propagating rtx subclasses

2015-05-08 Thread Trevor Saunders
On Mon, May 04, 2015 at 11:32:38PM +0300, Mikhail Maltsev wrote:
> > You'd probably be better off creating a unique rtx_insn * object and
> > using that as the marker.
> OK. Fixed the patch. Rebased and tested on x86_64-linux (fortunately, it
> did not conflict with Trevor's series of rtx_insn-related patches).

ok, that second series is now in.  I think you might conflict with the
last patch, but I think your patch is a super set of what I did so the
rebase should still be simple.

Trev



PATCH to fix libgomp OpenACC with C++11

2015-05-08 Thread Jason Merrill

noexcept () is a syntax error; I think you mean plain "noexcept" here.

In C++11 complex.h does not #define complex, so the testcase should use 
_Complex or __complex.


Tested x86_64-pc-linux-gnu, applying to trunk as obvious.
commit edb5a4d326b2e0ad7e4ed777d8f2917fd2f4eb2a
Author: Jason Merrill 
Date:   Fri May 8 16:09:58 2015 -0500

	* openacc.h (__GOACC_NOTHROW): Fix noexcept syntax.

	* testsuite/libgomp.oacc-c-c++-common/reduction-4.c (main): Use
	_Complex.

diff --git a/libgomp/openacc.h b/libgomp/openacc.h
index 3343241..44a1526 100644
--- a/libgomp/openacc.h
+++ b/libgomp/openacc.h
@@ -39,7 +39,7 @@ extern "C" {
 #endif
 
 #if __cplusplus >= 201103
-# define __GOACC_NOTHROW noexcept ()
+# define __GOACC_NOTHROW noexcept
 #elif __cplusplus
 # define __GOACC_NOTHROW throw ()
 #else /* Not C++ */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-4.c
index d7da19e..eab2428 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-4.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-4.c
@@ -14,7 +14,7 @@ main(void)
 {
   const int n = 1000;
   int i;
-  double complex vresult, result, array[n];
+  double _Complex vresult, result, array[n];
   bool lvresult, lresult;
 
   for (i = 0; i < n; i++)


v3 PATCH to fix libstdc++ build/test with C++11 default compiler

2015-05-08 Thread Jason Merrill

The first patch adds -std=c++98 for building C++98 sources.

The second patch fixes all but one of the testsuite failures that turned 
up with a compiler that defaults to C++11.


Tested x86_64-pc-linux-gnu, OK'd by Jonathan in Lenexa.
commit be5a2d163e2a25ab5a9978475e0e6e2954c9ddb3
Author: Jason Merrill 
Date:   Fri May 8 09:29:16 2015 -0500

	* src/c++98/Makefile.am (AM_CXXFLAGS): Add -std=gnu++98.
	* src/c++98/Makefile.in: Regenerate.
	* src/Makefile.am (AM_CXXFLAGS): Add -std=gnu++98.
	* src/Makefile.in: Regenerate.

diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index a5f48b2..cd07ccd 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -168,6 +168,7 @@ compatibility-condvar.o: compatibility-condvar.cc
 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
 # as the occasion calls for it.
 AM_CXXFLAGS = \
+	-std=gnu++98 \
 	$(glibcxx_compiler_pic_flag) \
 	$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
 	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 433f9ea..31b5628 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -429,6 +429,7 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
 # as the occasion calls for it.
 AM_CXXFLAGS = \
+	-std=gnu++98 \
 	$(glibcxx_compiler_pic_flag) \
 	$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
 	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am
index e348dfb..a5b68a1 100644
--- a/libstdc++-v3/src/c++98/Makefile.am
+++ b/libstdc++-v3/src/c++98/Makefile.am
@@ -215,6 +215,7 @@ parallel_settings.o: parallel_settings.cc
 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
 # as the occasion calls for it.
 AM_CXXFLAGS = \
+	-std=gnu++98 \
 	$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
 	$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
 	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in
index 3c69791..ce86136 100644
--- a/libstdc++-v3/src/c++98/Makefile.in
+++ b/libstdc++-v3/src/c++98/Makefile.in
@@ -421,6 +421,7 @@ PARALLEL_FLAGS = -D_GLIBCXX_PARALLEL
 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
 # as the occasion calls for it.
 AM_CXXFLAGS = \
+	-std=gnu++98 \
 	$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
 	$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
 	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
commit 1f4bc9e40a848eac411cac183189a8bcb1bf02ef
Author: Jason Merrill 
Date:   Fri May 8 12:03:13 2015 -0500

	* testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/1.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/2.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/3.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/4.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/5.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/6.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/7.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/3946.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/assign_neg.cc: Add -std=c++98.
	* testsuite/20_util/auto_ptr/requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/20_util/headers/functional/synopsis.cc: Add -Wno-deprecated.
	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Adjust expected errors.
	* testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:  Likewise.
	* testsuite/ext/array_allocator/1.cc: Add -Wno-deprecated.
	* testsuite/ext/array_allocator/2.cc: Add -Wno-deprecated.
	* testsuite/ext/array_allocator/26875.cc: Add -Wno-deprecated.
	* testsuite/ext/array_allocator/3.cc: Add -Wno-deprecated.
	* testsuite/ext/array_allocator/check_allocate_max_size.cc: Add -Wno-deprecated.
	* testsuite/ext/array_allocator/check_deallocate_null.cc: Add -Wno

PATCHes to help with C++11 bootstrap

2015-05-08 Thread Jason Merrill
One C++11 compatibility issue that turns up a lot in the GCC sources is 
that in C++98,


#define BAR "bar"
const char *p = "foo"BAR;

is well-formed, giving p the value "foobar".  But in C++11 this is a 
user-defined literal with the suffix BAR, which is ill-formed because 
there is no BAR suffix defined.


-Wc++11-compat didn't warn about this, which I'm fixing with the first 
patch.


The second patch fixes all the occurrences in GCC.

The third patch fixes the warning to say "-Wc++11-compat" rather than 
"-Wc++0x-compat".


The fourth patch fixes a few G++ tests that were failing with the 
compiler defaulting to C++11.


Tested x86_64-cp-linux-gnu, applying to trunk.
commit 448d6065bcfb24d5d5aa904d93a740b552855aa5
Author: Jason Merrill 
Date:   Fri May 8 22:55:30 2015 -0500

libcpp/
	* lex.c (lex_string): Add -Wc++11-compat warning.
	* include/cpplib.h: Add CPP_W_CXX11_COMPAT.
	(struct cpp_options): Add cpp_warn_cxx11_compat.
	* init.c (cpp_create_reader): Initialize it.
gcc/c-family/
	* c.opt (Wc++0x-compat): Set it.

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 3774a89..8f48d84 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -312,7 +312,7 @@ C ObjC Var(warn_cxx_compat) CPP(warn_cxx_operator_names) CppReason(CPP_W_CXX_OPE
 Warn about C constructs that are not in the common subset of C and C++
 
 Wc++0x-compat
-C++ ObjC++ Var(warn_cxx0x_compat) Warning LangEnabledBy(C++ ObjC++,Wall)
+C++ ObjC++ Var(warn_cxx0x_compat) Warning LangEnabledBy(C++ ObjC++,Wall) Init(0) CPP(cpp_warn_cxx11_compat) CppReason(CPP_W_CXX11_COMPAT)
 Deprecated in favor of -Wc++11-compat
 
 Wc++11-compat
diff --git a/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x4.C b/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x4.C
new file mode 100644
index 000..c3f0cf5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/warn_cxx0x4.C
@@ -0,0 +1,4 @@
+// { dg-options "-Wall" }
+
+#define FOO "foo"
+const char *p = "bar"FOO;	// { dg-warning "macro" }
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 5e08014..0152ec8 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -484,6 +484,9 @@ struct cpp_options
   /* True if warn about differences between C90 and C99.  */
   signed char cpp_warn_c90_c99_compat;
 
+  /* True if warn about differences between C++98 and C++11.  */
+  bool cpp_warn_cxx11_compat;
+
   /* Dependency generation.  */
   struct
   {
@@ -960,7 +963,8 @@ enum {
   CPP_W_LITERAL_SUFFIX,
   CPP_W_DATE_TIME,
   CPP_W_PEDANTIC,
-  CPP_W_C90_C99_COMPAT
+  CPP_W_C90_C99_COMPAT,
+  CPP_W_CXX11_COMPAT
 };
 
 /* Output a diagnostic of some kind.  */
diff --git a/libcpp/init.c b/libcpp/init.c
index 45a4d13..1ebd709 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -180,6 +180,7 @@ cpp_create_reader (enum c_lang lang, cpp_hash_table *table,
   CPP_OPTION (pfile, warn_trigraphs) = 2;
   CPP_OPTION (pfile, warn_endif_labels) = 1;
   CPP_OPTION (pfile, cpp_warn_c90_c99_compat) = -1;
+  CPP_OPTION (pfile, cpp_warn_cxx11_compat) = 0;
   CPP_OPTION (pfile, cpp_warn_deprecated) = 1;
   CPP_OPTION (pfile, cpp_warn_long_long) = 0;
   CPP_OPTION (pfile, dollars_in_ident) = 1;
diff --git a/libcpp/lex.c b/libcpp/lex.c
index ac96ff8..c7296a1 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1905,6 +1905,12 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
 	++cur;
 	}
 }
+  else if (CPP_OPTION (pfile, cpp_warn_cxx11_compat)
+	   && is_macro (pfile, cur)
+	   && !pfile->state.skipping)
+cpp_warning_with_line (pfile, CPP_W_CXX11_COMPAT,
+			   token->src_loc, 0, "C++11 requires a space "
+			   "between string literal and macro");
 
   pfile->buffer->cur = cur;
   create_literal (pfile, token, base, cur - base, type);
commit 48a8ea6553809e0cf7bc4af33f56281fa3908b91
Author: Jason Merrill 
Date:   Fri May 8 09:11:19 2015 -0500

	* bitmap.c, c/c-aux-info.c, cfg.c, cfghooks.c, cgraph.c,
	config/aarch64/aarch64.md config/alpha/vms.h, config/darwin.c,
	config/darwin.h, config/darwin9.h, config/elfos.h,
	config/i386/bsd.h, config/ia64/ia64.c, config/lm32/lm32.h,
	config/microblaze/microblaze.h, config/mips/mips.h,
	config/mmix/mmix.c, config/msp430/msp430.c, config/nios2/nios2.h,
	config/nvptx/nvptx.c, config/nvptx/nvptx.h, config/pa/pa.c,
	config/pa/pa.h, config/rs6000/rs6000.c, config/rs6000/sysv4.h,
	config/rs6000/xcoff.h, config/rx/rx.h, config/s390/s390.h,
	config/sparc/sol2.h, config/sparc/sparc.h, config/visium/visium.h,
	cppbuiltin.c, defaults.h, doc/invoke.texi, dwarf2cfi.c,
	dwarf2out.c, final.c, gcc.c, gcov-dump.c, gcov.c, ipa-cp.c,
	ipa-inline.c, ipa-polymorphic-call.c, ipa-profile.c, ipa-prop.c,
	ira-color.c, ira.c, loop-doloop.c, loop-iv.c, mcf.c,
	modulo-sched.c, predict.c, profile.c, stor-layout.c, toplev.c,
	tree-ssa-reassoc.c, value-prof.c, wide-int-print.cc: Add space
	between string literal and macro name.

diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 71d5b11..66066a6 100644

[PATCH 16/25] change more argument types to rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* ira-color.c: Change argument types to rtx_insn *.
* lra-eliminations.c: Likewise.
* ira.h: Adjust.
---
 gcc/ChangeLog  | 6 ++
 gcc/ira-color.c| 4 ++--
 gcc/ira.h  | 2 +-
 gcc/lra-eliminations.c | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 598510c..efe4ca0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-08  Trevor Saunders  
 
+   * ira-color.c: Change argument types to rtx_insn *.
+   * lra-eliminations.c: Likewise.
+   * ira.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* gcse.c: Change argument types to rtx_insn *.
 
 2015-05-08  Trevor Saunders  
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 0ed9edd..3faa724 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -4600,7 +4600,7 @@ ira_mark_new_stack_slot (rtx x, int regno, unsigned int 
total_size)
CALL_USED_COUNT), and the first hard regno occupied by the
pseudo-registers (through FIRST_HARD_REGNO).  */
 static int
-calculate_spill_cost (int *regnos, rtx in, rtx out, rtx insn,
+calculate_spill_cost (int *regnos, rtx in, rtx out, rtx_insn *insn,
  int *excess_pressure_live_length,
  int *nrefs, int *call_used_count, int *first_hard_regno)
 {
@@ -4661,7 +4661,7 @@ calculate_spill_cost (int *regnos, rtx in, rtx out, rtx 
insn,
decisions.  */
 bool
 ira_better_spill_reload_regno_p (int *regnos, int *other_regnos,
-rtx in, rtx out, rtx insn)
+rtx in, rtx out, rtx_insn *insn)
 {
   int cost, other_cost;
   int length, other_length;
diff --git a/gcc/ira.h b/gcc/ira.h
index 1979780..5b52cb1 100644
--- a/gcc/ira.h
+++ b/gcc/ira.h
@@ -201,7 +201,7 @@ extern bool ira_reassign_pseudos (int *, int, HARD_REG_SET, 
HARD_REG_SET *,
  HARD_REG_SET *, bitmap);
 extern rtx ira_reuse_stack_slot (int, unsigned int, unsigned int);
 extern void ira_mark_new_stack_slot (rtx, int, unsigned int);
-extern bool ira_better_spill_reload_regno_p (int *, int *, rtx, rtx, rtx);
+extern bool ira_better_spill_reload_regno_p (int *, int *, rtx, rtx, rtx_insn 
*);
 extern bool ira_bad_reload_regno (int, rtx, rtx);
 
 extern void ira_adjust_equiv_reg_cost (unsigned, int);
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c
index acf8c8a..4e5ba22 100644
--- a/gcc/lra-eliminations.c
+++ b/gcc/lra-eliminations.c
@@ -873,7 +873,7 @@ mark_not_eliminable (rtx x, machine_mode mem_mode)
found elmination offset.  If the note is not found, return NULL.
Remove the found note.  */
 static rtx
-remove_reg_equal_offset_note (rtx insn, rtx what)
+remove_reg_equal_offset_note (rtx_insn *insn, rtx what)
 {
   rtx link, *link_loc;
 
-- 
2.4.0.78.g7c6ecbf



[PATCH 10/25] prev_cc0_setter can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* emit-rtl.c (prev_cc0_setter): Change argument type to rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog  | 5 +
 gcc/emit-rtl.c | 4 +---
 gcc/rtl.h  | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f121a30..8f97fdc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-08  Trevor Saunders  
 
+   * emit-rtl.c (prev_cc0_setter): Change argument type to rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* rtlanal.c (noop_move_p): Change argument type to rtx_insn *.
* rtl.h: Adjust.
 
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index b48f88b..ad5c8b2 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3572,10 +3572,8 @@ next_cc0_user (rtx uncast_insn)
note, it is the previous insn.  */
 
 rtx_insn *
-prev_cc0_setter (rtx uncast_insn)
+prev_cc0_setter (rtx_insn *insn)
 {
-  rtx_insn *insn = safe_as_a  (uncast_insn);
-
   rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
 
   if (note)
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 870559b..35a9fbc 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2719,7 +2719,7 @@ extern rtx_insn *prev_active_insn (rtx);
 extern rtx_insn *next_active_insn (rtx);
 extern int active_insn_p (const_rtx);
 extern rtx_insn *next_cc0_user (rtx);
-extern rtx_insn *prev_cc0_setter (rtx);
+extern rtx_insn *prev_cc0_setter (rtx_insn *);
 
 /* In emit-rtl.c  */
 extern int insn_line (const rtx_insn *);
-- 
2.4.0.78.g7c6ecbf



[PATCH 22/25] rtx_insn * in combine.c

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* combine.c: Change argument type to rtx_insn *.
---
 gcc/ChangeLog | 4 
 gcc/combine.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6811ea1..b2767cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-08  Trevor Saunders  
 
+   * combine.c: Change argument type to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* rtl.h: Adjust.
* rtlanal.c: Change argument type to rtx_insn *.
 
diff --git a/gcc/combine.c b/gcc/combine.c
index b806959..d8ba220 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -554,7 +554,7 @@ target_canonicalize_comparison (enum rtx_code *code, rtx 
*op0, rtx *op1,
register.  */
 
 static rtx_insn *
-combine_split_insns (rtx pattern, rtx insn)
+combine_split_insns (rtx pattern, rtx_insn *insn)
 {
   rtx_insn *ret;
   unsigned int nregs;
-- 
2.4.0.78.g7c6ecbf



[PATCH 25/25] redirect_jump* can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* jump.c: Change argument types to rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog | 5 +
 gcc/jump.c| 6 +++---
 gcc/rtl.h | 6 +++---
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 10434e6..04c6856 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-08  Trevor Saunders  
 
+   * jump.c: Change argument types to rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* lra-constraints.c: Change argument type to rtx_insn *.
 
 2015-05-08  Trevor Saunders  
diff --git a/gcc/jump.c b/gcc/jump.c
index 513eb6e..a8ab1cc 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1545,7 +1545,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx 
insn)
not see how to do that.  */
 
 int
-redirect_jump_1 (rtx jump, rtx nlabel)
+redirect_jump_1 (rtx_insn *jump, rtx nlabel)
 {
   int ochanges = num_validated_changes ();
   rtx *loc, asmop;
@@ -1580,7 +1580,7 @@ redirect_jump_1 (rtx jump, rtx nlabel)
(this can only occur when trying to produce return insns).  */
 
 int
-redirect_jump (rtx jump, rtx nlabel, int delete_unused)
+redirect_jump (rtx_insn *jump, rtx nlabel, int delete_unused)
 {
   rtx olabel = JUMP_LABEL (jump);
 
@@ -1612,7 +1612,7 @@ redirect_jump (rtx jump, rtx nlabel, int delete_unused)
If DELETE_UNUSED is positive, delete related insn to OLABEL if its ref
count has dropped to zero.  */
 void
-redirect_jump_2 (rtx jump, rtx olabel, rtx nlabel, int delete_unused,
+redirect_jump_2 (rtx_insn *jump, rtx olabel, rtx nlabel, int delete_unused,
 int invert)
 {
   rtx note;
diff --git a/gcc/rtl.h b/gcc/rtl.h
index dbb5ca2..57a2f13 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3349,9 +3349,9 @@ extern int invert_jump (rtx_insn *, rtx, int);
 extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
 extern int true_regnum (const_rtx);
 extern unsigned int reg_or_subregno (const_rtx);
-extern int redirect_jump_1 (rtx, rtx);
-extern void redirect_jump_2 (rtx, rtx, rtx, int, int);
-extern int redirect_jump (rtx, rtx, int);
+extern int redirect_jump_1 (rtx_insn *, rtx);
+extern void redirect_jump_2 (rtx_insn *, rtx, rtx, int, int);
+extern int redirect_jump (rtx_insn *, rtx, int);
 extern void rebuild_jump_labels (rtx_insn *);
 extern void rebuild_jump_labels_chain (rtx_insn *);
 extern rtx reversed_comparison (const_rtx, machine_mode);
-- 
2.4.0.78.g7c6ecbf



[PATCH 20/25] more rtx_insn * in sched-deps.c

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* sched-deps.c: Change argument types to rtx_insn *.
* sched-int.h: Adjust.
---
 gcc/ChangeLog| 5 +
 gcc/sched-deps.c | 4 ++--
 gcc/sched-int.h  | 4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6804c36..b077c82 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-08  Trevor Saunders  
 
+   * sched-deps.c: Change argument types to rtx_insn *.
+   * sched-int.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* dwarf2cfi.c: Change argument type to rtx_insn *.
 
 2015-05-08  Trevor Saunders  
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index b6130ee..24104e0 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -814,7 +814,7 @@ sd_lists_empty_p (const_rtx insn, sd_list_types_def 
list_types)
 
 /* Initialize data for INSN.  */
 void
-sd_init_insn (rtx insn)
+sd_init_insn (rtx_insn *insn)
 {
   INSN_HARD_BACK_DEPS (insn) = create_deps_list ();
   INSN_SPEC_BACK_DEPS (insn) = create_deps_list ();
@@ -827,7 +827,7 @@ sd_init_insn (rtx insn)
 
 /* Free data for INSN.  */
 void
-sd_finish_insn (rtx insn)
+sd_finish_insn (rtx_insn *insn)
 {
   /* ??? It would be nice to deallocate dependency caches here.  */
 
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index c93412e..216cd58 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -1649,8 +1649,8 @@ sd_iterator_next (sd_iterator_def *it_ptr)
 
 extern int sd_lists_size (const_rtx, sd_list_types_def);
 extern bool sd_lists_empty_p (const_rtx, sd_list_types_def);
-extern void sd_init_insn (rtx);
-extern void sd_finish_insn (rtx);
+extern void sd_init_insn (rtx_insn *);
+extern void sd_finish_insn (rtx_insn *);
 extern dep_t sd_find_dep_between (rtx, rtx, bool);
 extern void sd_add_dep (dep_t, bool);
 extern enum DEPS_ADJUST_RESULT sd_add_or_update_dep (dep_t, bool);
-- 
2.4.0.78.g7c6ecbf



[PATCH 18/25] more rtx_insn * in recog.c

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* ira.c (decrease_live_ranges_number): Changetype of local
variable to rtx_insn *.
* recog.c: Change argument types to rtx_insn *.
* recog.h: Adjust.
---
 gcc/ChangeLog |  7 +++
 gcc/ira.c |  4 ++--
 gcc/recog.c   | 30 +++---
 gcc/recog.h   | 18 +-
 4 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9468f4e..e08209e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
 2015-05-08  Trevor Saunders  
 
+   * ira.c (decrease_live_ranges_number): Changetype of local
+   variable to rtx_insn *.
+   * recog.c: Change argument types to rtx_insn *.
+   * recog.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* reorg.c: Change argument types to rtx_insn *.
 
 2015-05-08  Trevor Saunders  
diff --git a/gcc/ira.c b/gcc/ira.c
index bba26e5..75ea6e0 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -2045,8 +2045,8 @@ decrease_live_ranges_number (void)
 {
   basic_block bb;
   rtx_insn *insn;
-  rtx set, src, dest, dest_death, q, note;
-  rtx_insn *p;
+  rtx set, src, dest, dest_death, note;
+  rtx_insn *p, *q;
   int sregno, dregno;
 
   if (! flag_expensive_optimizations)
diff --git a/gcc/recog.c b/gcc/recog.c
index a43055e..d933364 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -84,9 +84,9 @@ along with GCC; see the file COPYING3.  If not see
 #endif
 #endif
 
-static void validate_replace_rtx_1 (rtx *, rtx, rtx, rtx, bool);
+static void validate_replace_rtx_1 (rtx *, rtx, rtx, rtx_insn *, bool);
 static void validate_replace_src_1 (rtx *, void *);
-static rtx split_insn (rtx_insn *);
+static rtx_insn *split_insn (rtx_insn *);
 
 struct target_recog default_target_recog;
 #if SWITCHABLE_TARGET
@@ -319,7 +319,7 @@ validate_unshare_change (rtx object, rtx *loc, rtx new_rtx, 
bool in_group)
 
Return true if anything was changed.  */
 bool
-canonicalize_change_group (rtx insn, rtx x)
+canonicalize_change_group (rtx_insn *insn, rtx x)
 {
   if (COMMUTATIVE_P (x)
   && swap_commutative_operands_p (XEXP (x, 0), XEXP (x, 1)))
@@ -598,7 +598,7 @@ cancel_changes (int num)
rtx.  */
 
 static void
-simplify_while_replacing (rtx *loc, rtx to, rtx object,
+simplify_while_replacing (rtx *loc, rtx to, rtx_insn *object,
   machine_mode op0_mode)
 {
   rtx x = *loc;
@@ -758,7 +758,7 @@ simplify_while_replacing (rtx *loc, rtx to, rtx object,
validate_change passing OBJECT.  */
 
 static void
-validate_replace_rtx_1 (rtx *loc, rtx from, rtx to, rtx object,
+validate_replace_rtx_1 (rtx *loc, rtx from, rtx to, rtx_insn *object,
 bool simplify)
 {
   int i, j;
@@ -847,7 +847,7 @@ validate_replace_rtx_1 (rtx *loc, rtx from, rtx to, rtx 
object,
if INSN is still valid.  */
 
 int
-validate_replace_rtx_subexp (rtx from, rtx to, rtx insn, rtx *loc)
+validate_replace_rtx_subexp (rtx from, rtx to, rtx_insn *insn, rtx *loc)
 {
   validate_replace_rtx_1 (loc, from, to, insn, true);
   return apply_change_group ();
@@ -857,7 +857,7 @@ validate_replace_rtx_subexp (rtx from, rtx to, rtx insn, 
rtx *loc)
changes have been made, validate by seeing if INSN is still valid.  */
 
 int
-validate_replace_rtx (rtx from, rtx to, rtx insn)
+validate_replace_rtx (rtx from, rtx to, rtx_insn *insn)
 {
   validate_replace_rtx_1 (&PATTERN (insn), from, to, insn, true);
   return apply_change_group ();
@@ -870,7 +870,7 @@ validate_replace_rtx (rtx from, rtx to, rtx insn)
validate_replace_rtx_part (from, to, &PATTERN (insn), insn).  */
 
 int
-validate_replace_rtx_part (rtx from, rtx to, rtx *where, rtx insn)
+validate_replace_rtx_part (rtx from, rtx to, rtx *where, rtx_insn *insn)
 {
   validate_replace_rtx_1 (where, from, to, insn, true);
   return apply_change_group ();
@@ -879,7 +879,7 @@ validate_replace_rtx_part (rtx from, rtx to, rtx *where, 
rtx insn)
 /* Same as above, but do not simplify rtx afterwards.  */
 int
 validate_replace_rtx_part_nosimplify (rtx from, rtx to, rtx *where,
-  rtx insn)
+ rtx_insn *insn)
 {
   validate_replace_rtx_1 (where, from, to, insn, false);
   return apply_change_group ();
@@ -890,7 +890,7 @@ validate_replace_rtx_part_nosimplify (rtx from, rtx to, rtx 
*where,
will replace in REG_EQUAL and REG_EQUIV notes.  */
 
 void
-validate_replace_rtx_group (rtx from, rtx to, rtx insn)
+validate_replace_rtx_group (rtx from, rtx to, rtx_insn *insn)
 {
   rtx note;
   validate_replace_rtx_1 (&PATTERN (insn), from, to, insn, true);
@@ -936,7 +936,7 @@ validate_replace_src_group (rtx from, rtx to, rtx_insn 
*insn)
pattern and return true if something was simplified.  */
 
 bool
-validate_simplify_insn (rtx insn)
+validate_simplify_insn (rtx_insn *insn)
 {
   int i;
   rtx pat = NULL;
@@ -976,7 +976,7 @@ validate_simplify_insn (rtx insn)
EQ and NE tests do not count. 

[PATCH 21/25] find_all_hard_reg_sets can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* rtl.h: Adjust.
* rtlanal.c: Change argument type to rtx_insn *.
---
 gcc/ChangeLog | 5 +
 gcc/rtl.h | 2 +-
 gcc/rtlanal.c | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b077c82..6811ea1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-08  Trevor Saunders  
 
+   * rtl.h: Adjust.
+   * rtlanal.c: Change argument type to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* sched-deps.c: Change argument types to rtx_insn *.
* sched-int.h: Adjust.
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 80c0e5c..dbb5ca2 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2852,7 +2852,7 @@ extern void record_hard_reg_sets (rtx, const_rtx, void *);
 extern void record_hard_reg_uses (rtx *, void *);
 #ifdef HARD_CONST
 extern void find_all_hard_regs (const_rtx, HARD_REG_SET *);
-extern void find_all_hard_reg_sets (const_rtx, HARD_REG_SET *, bool);
+extern void find_all_hard_reg_sets (const rtx_insn *, HARD_REG_SET *, bool);
 #endif
 extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
 extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 9760bab..00d9080 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1197,7 +1197,7 @@ record_hard_reg_sets (rtx x, const_rtx pat 
ATTRIBUTE_UNUSED, void *data)
 /* Examine INSN, and compute the set of hard registers written by it.
Store it in *PSET.  Should only be called after reload.  */
 void
-find_all_hard_reg_sets (const_rtx insn, HARD_REG_SET *pset, bool implicit)
+find_all_hard_reg_sets (const rtx_insn *insn, HARD_REG_SET *pset, bool 
implicit)
 {
   rtx link;
 
-- 
2.4.0.78.g7c6ecbf



[PATCH 24/25] setup_next_usage_insn can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* lra-constraints.c: Change argument type to rtx_insn *.
---
 gcc/ChangeLog | 4 
 gcc/lra-constraints.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 96df81c..10434e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-08  Trevor Saunders  
 
+   * lra-constraints.c: Change argument type to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* df-problems.c: Change argument type to rtx_insn *.
 
 2015-05-08  Trevor Saunders  
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 1088b25..c8de418 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -4531,7 +4531,7 @@ struct usage_insns
 static struct usage_insns *usage_insns;
 
 static void
-setup_next_usage_insn (int regno, rtx insn, int reloads_num, bool after_p)
+setup_next_usage_insn (int regno, rtx_insn *insn, int reloads_num, bool 
after_p)
 {
   usage_insns[regno].check = curr_usage_insns_check;
   usage_insns[regno].insns = insn;
-- 
2.4.0.78.g7c6ecbf



[PATCH 23/25] rtx_insn * in df-problems.c

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* df-problems.c: Change argument type to rtx_insn *.
---
 gcc/ChangeLog | 4 
 gcc/df-problems.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b2767cf..96df81c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-08  Trevor Saunders  
 
+   * df-problems.c: Change argument type to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* combine.c: Change argument type to rtx_insn *.
 
 2015-05-08  Trevor Saunders  
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index b9584a8..0e6ab39 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3597,7 +3597,7 @@ df_simulate_one_insn_forwards (basic_block bb, rtx_insn 
*insn, bitmap live)
 /* Return an OR of MEMREF_NORMAL or MEMREF_VOLATILE for the MEMs in X.  */
 
 static int
-find_memory (rtx insn)
+find_memory (rtx_insn *insn)
 {
   int flags = 0;
   subrtx_iterator::array_type array;
-- 
2.4.0.78.g7c6ecbf



[PATCH 19/25] notice_args_size can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* dwarf2cfi.c: Change argument type to rtx_insn *.
---
 gcc/ChangeLog   | 4 
 gcc/dwarf2cfi.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e08209e..6804c36 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-08  Trevor Saunders  
 
+   * dwarf2cfi.c: Change argument type to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* ira.c (decrease_live_ranges_number): Changetype of local
variable to rtx_insn *.
* recog.c: Change argument types to rtx_insn *.
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 7bcbd6c..1e0594d 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -920,7 +920,7 @@ reg_save (unsigned int reg, unsigned int sreg, 
HOST_WIDE_INT offset)
and adjust data structures to match.  */
 
 static void
-notice_args_size (rtx insn)
+notice_args_size (rtx_insn *insn)
 {
   HOST_WIDE_INT args_size, delta;
   rtx note;
-- 
2.4.0.78.g7c6ecbf



[PATCH 17/25] use rtx_insn * more in reorg.c

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* reorg.c: Change argument types to rtx_insn *.
---
 gcc/ChangeLog |  4 
 gcc/reorg.c   | 10 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index efe4ca0..9468f4e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-08  Trevor Saunders  
 
+   * reorg.c: Change argument types to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* ira-color.c: Change argument types to rtx_insn *.
* lra-eliminations.c: Likewise.
* ira.h: Adjust.
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 2f7bb43..4b41f7e 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -186,7 +186,7 @@ skip_consecutive_labels (rtx label_or_return)
and REG_CC_USER notes so we can find it.  */
 
 static void
-link_cc0_insns (rtx insn)
+link_cc0_insns (rtx_insn *insn)
 {
   rtx user = next_nonnote_insn (insn);
 
@@ -260,12 +260,12 @@ static rtx_insn_list *steal_delay_list_from_fallthrough 
(rtx_insn *, rtx,
 struct resources *,
 struct resources *,
 int, int *, int *);
-static void try_merge_delay_insns (rtx, rtx_insn *);
+static void try_merge_delay_insns (rtx_insn *, rtx_insn *);
 static rtx redundant_insn (rtx, rtx_insn *, rtx);
 static int own_thread_p (rtx, rtx, int);
 static void update_block (rtx_insn *, rtx);
 static int reorg_redirect_jump (rtx_insn *, rtx);
-static void update_reg_dead_notes (rtx, rtx);
+static void update_reg_dead_notes (rtx_insn *, rtx_insn *);
 static void fix_reg_dead_note (rtx, rtx);
 static void update_reg_unused_notes (rtx, rtx);
 static void fill_simple_delay_slots (int);
@@ -1313,7 +1313,7 @@ steal_delay_list_from_fallthrough (rtx_insn *insn, rtx 
condition,
we delete the merged insn.  */
 
 static void
-try_merge_delay_insns (rtx insn, rtx_insn *thread)
+try_merge_delay_insns (rtx_insn *insn, rtx_insn *thread)
 {
   rtx_insn *trial, *next_trial;
   rtx_insn *delay_insn = as_a  (XVECEXP (PATTERN (insn), 0, 0));
@@ -1807,7 +1807,7 @@ reorg_redirect_jump (rtx_insn *jump, rtx nlabel)
is dead because it sees a REG_DEAD note immediately before a CODE_LABEL.  */
 
 static void
-update_reg_dead_notes (rtx insn, rtx delayed_insn)
+update_reg_dead_notes (rtx_insn *insn, rtx_insn *delayed_insn)
 {
   rtx link, next;
   rtx_insn *p;
-- 
2.4.0.78.g7c6ecbf



[PATCH 14/25] cse_change_cc0_mode can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* cse.c (cse_change_cc0_mode): Change argument type to rtx_insn *.
---
 gcc/ChangeLog | 4 
 gcc/cse.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b59146f..a595d23 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-08  Trevor Saunders  
 
+   * cse.c (cse_change_cc0_mode): Change argument type to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* emit-rtl.c (emit_debug_insn_before): Change argument type to
rtx_insn *.
* rtl.h: Adjust.
diff --git a/gcc/cse.c b/gcc/cse.c
index 15eb33e..fcfcd3d 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7131,7 +7131,7 @@ delete_trivially_dead_insns (rtx_insn *insns, int nreg)
 
 static void
 cse_change_cc_mode (subrtx_ptr_iterator::array_type &array,
-   rtx *loc, rtx insn, rtx newreg)
+   rtx *loc, rtx_insn *insn, rtx newreg)
 {
   FOR_EACH_SUBRTX_PTR (iter, array, loc, NONCONST)
 {
-- 
2.4.0.78.g7c6ecbf



[PATCH 15/25] pass rtx_insn * more in gcse.c

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* gcse.c: Change argument types to rtx_insn *.
---
 gcc/ChangeLog | 4 
 gcc/gcse.c| 8 
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a595d23..598510c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-08  Trevor Saunders  
 
+   * gcse.c: Change argument types to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* cse.c (cse_change_cc0_mode): Change argument type to rtx_insn *.
 
 2015-05-08  Trevor Saunders  
diff --git a/gcc/gcse.c b/gcc/gcse.c
index d9c5106..92c6014 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -493,7 +493,7 @@ static int oprs_available_p (const_rtx, const rtx_insn *);
 static void insert_expr_in_table (rtx, machine_mode, rtx_insn *, int, int,
  int, struct gcse_hash_table_d *);
 static unsigned int hash_expr (const_rtx, machine_mode, int *, int);
-static void record_last_reg_set_info (rtx, int);
+static void record_last_reg_set_info (rtx_insn *, int);
 static void record_last_mem_set_info (rtx_insn *);
 static void record_last_set_info (rtx, const_rtx, void *);
 static void compute_hash_table (struct gcse_hash_table_d *);
@@ -516,7 +516,7 @@ static void pre_insert_copies (void);
 static int pre_delete (void);
 static int pre_gcse (struct edge_list *);
 static int one_pre_gcse_pass (void);
-static void add_label_notes (rtx, rtx);
+static void add_label_notes (rtx, rtx_insn *);
 static void alloc_code_hoist_mem (int, int);
 static void free_code_hoist_mem (void);
 static void compute_code_hoist_vbeinout (void);
@@ -1471,7 +1471,7 @@ dump_hash_table (FILE *file, const char *name, struct 
gcse_hash_table_d *table)
valid, as a quick test to invalidate them.  */
 
 static void
-record_last_reg_set_info (rtx insn, int regno)
+record_last_reg_set_info (rtx_insn *insn, int regno)
 {
   struct reg_avail_info *info = ®_avail_info[regno];
   int luid = DF_INSN_LUID (insn);
@@ -2665,7 +2665,7 @@ one_pre_gcse_pass (void)
necessary REG_LABEL_OPERAND and REG_LABEL_TARGET notes.  */
 
 static void
-add_label_notes (rtx x, rtx insn)
+add_label_notes (rtx x, rtx_insn *insn)
 {
   enum rtx_code code = GET_CODE (x);
   int i, j;
-- 
2.4.0.78.g7c6ecbf



[PATCH 11/25] emit_note_after can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* emit-rtl.c (emit_note_after): Change argument type to rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog  | 5 +
 gcc/emit-rtl.c | 3 +--
 gcc/rtl.h  | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8f97fdc..99ba0f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-08  Trevor Saunders  
 
+   * emit-rtl.c (emit_note_after): Change argument type to rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* emit-rtl.c (prev_cc0_setter): Change argument type to rtx_insn *.
* rtl.h: Adjust.
 
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index ad5c8b2..2521c77 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4631,9 +4631,8 @@ note_outside_basic_block_p (enum insn_note subtype, bool 
on_bb_boundary_p)
 /* Emit a note of subtype SUBTYPE after the insn AFTER.  */
 
 rtx_note *
-emit_note_after (enum insn_note subtype, rtx uncast_after)
+emit_note_after (enum insn_note subtype, rtx_insn *after)
 {
-  rtx_insn *after = as_a  (uncast_after);
   rtx_note *note = make_note_raw (subtype);
   basic_block bb = BARRIER_P (after) ? NULL : BLOCK_FOR_INSN (after);
   bool on_bb_boundary_p = (bb != NULL && BB_END (bb) == after);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 35a9fbc..a39cdc5 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2686,7 +2686,7 @@ extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx);
 extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx, int);
 extern rtx_barrier *emit_barrier_after (rtx);
 extern rtx_insn *emit_label_after (rtx, rtx_insn *);
-extern rtx_note *emit_note_after (enum insn_note, rtx);
+extern rtx_note *emit_note_after (enum insn_note, rtx_insn *);
 extern rtx_insn *emit_insn (rtx);
 extern rtx_insn *emit_debug_insn (rtx);
 extern rtx_insn *emit_jump_insn (rtx);
-- 
2.4.0.78.g7c6ecbf



[PATCH 12/25] emit_note_before can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* emit-rtl.c (emit_note_before): Change argument type to rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog  | 5 +
 gcc/emit-rtl.c | 3 +--
 gcc/rtl.h  | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 99ba0f6..b928d40 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-08  Trevor Saunders  
 
+   * emit-rtl.c (emit_note_before): Change argument type to rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* emit-rtl.c (emit_note_after): Change argument type to rtx_insn *.
* rtl.h: Adjust.
 
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2521c77..6e70c58 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4647,9 +4647,8 @@ emit_note_after (enum insn_note subtype, rtx_insn *after)
 /* Emit a note of subtype SUBTYPE before the insn BEFORE.  */
 
 rtx_note *
-emit_note_before (enum insn_note subtype, rtx uncast_before)
+emit_note_before (enum insn_note subtype, rtx_insn *before)
 {
-  rtx_insn *before = as_a  (uncast_before);
   rtx_note *note = make_note_raw (subtype);
   basic_block bb = BARRIER_P (before) ? NULL : BLOCK_FOR_INSN (before);
   bool on_bb_boundary_p = (bb != NULL && BB_HEAD (bb) == before);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index a39cdc5..ee3ecca 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2671,7 +2671,7 @@ extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx);
 extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx, int);
 extern rtx_barrier *emit_barrier_before (rtx);
 extern rtx_insn *emit_label_before (rtx, rtx_insn *);
-extern rtx_note *emit_note_before (enum insn_note, rtx);
+extern rtx_note *emit_note_before (enum insn_note, rtx_insn *);
 extern rtx_insn *emit_insn_after (rtx, rtx);
 extern rtx_insn *emit_insn_after_noloc (rtx, rtx, basic_block);
 extern rtx_insn *emit_insn_after_setloc (rtx, rtx, int);
-- 
2.4.0.78.g7c6ecbf



[PATCH 13/25] make emit_debug_insn_before take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* emit-rtl.c (emit_debug_insn_before): Change argument type to
rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog  | 6 ++
 gcc/emit-rtl.c | 2 +-
 gcc/rtl.h  | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b928d40..b59146f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-08  Trevor Saunders  
 
+   * emit-rtl.c (emit_debug_insn_before): Change argument type to
+   rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* emit-rtl.c (emit_note_before): Change argument type to rtx_insn *.
* rtl.h: Adjust.
 
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 6e70c58..d5e09c2 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4880,7 +4880,7 @@ emit_debug_insn_before_setloc (rtx pattern, rtx before, 
int loc)
 /* Like emit_debug_insn_before_noloc,
but set insn_location according to BEFORE.  */
 rtx_insn *
-emit_debug_insn_before (rtx pattern, rtx before)
+emit_debug_insn_before (rtx pattern, rtx_insn *before)
 {
   return emit_pattern_before (pattern, before, false, false,
  make_debug_insn_raw);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index ee3ecca..80c0e5c 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2666,7 +2666,7 @@ extern rtx_insn *emit_jump_insn_before_setloc (rtx, 
rtx_insn *, int);
 extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *);
 extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *);
 extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, int);
-extern rtx_insn *emit_debug_insn_before (rtx, rtx);
+extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *);
 extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx);
 extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx, int);
 extern rtx_barrier *emit_barrier_before (rtx);
-- 
2.4.0.78.g7c6ecbf



[PATCH 09/25] make noop_move_p take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* rtlanal.c (noop_move_p): Change argument type to rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog | 5 +
 gcc/rtl.h | 2 +-
 gcc/rtlanal.c | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d519861..f121a30 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-08  Trevor Saunders  
 
+   * rtlanal.c (noop_move_p): Change argument type to rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* rtlanal.c (add_shallow_copy_of_reg_note): Change argument type
to rtx_insn *.
* rtl.h: Adjust.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 82ed3b3..870559b 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2844,7 +2844,7 @@ extern int modified_in_p (const_rtx, const_rtx);
 extern int reg_set_p (const_rtx, const_rtx);
 extern int multiple_sets (const_rtx);
 extern int set_noop_p (const_rtx);
-extern int noop_move_p (const_rtx);
+extern int noop_move_p (const rtx_insn *);
 extern bool refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
 extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
 extern const_rtx set_of (const_rtx, const_rtx);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index f1511c4..9760bab 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1368,7 +1368,7 @@ set_noop_p (const_rtx set)
value to itself.  */
 
 int
-noop_move_p (const_rtx insn)
+noop_move_p (const rtx_insn *insn)
 {
   rtx pat = PATTERN (insn);
 
-- 
2.4.0.78.g7c6ecbf



[PATCH 08/25] make add_shallow_copy_of_reg_note take an rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* rtlanal.c (add_shallow_copy_of_reg_note): Change argument type
to rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog | 6 ++
 gcc/rtl.h | 2 +-
 gcc/rtlanal.c | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c9b517fe..d519861 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-08  Trevor Saunders  
 
+   * rtlanal.c (add_shallow_copy_of_reg_note): Change argument type
+   to rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* rtlanal.c (remove_reg_equal_equiv_notes): Change argument type
to rtx_insn *.
* rtl.h: Likewise.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 1e161f7..82ed3b3 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2867,7 +2867,7 @@ extern int find_regno_fusage (const_rtx, enum rtx_code, 
unsigned int);
 extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
 extern void add_reg_note (rtx, enum reg_note, rtx);
 extern void add_int_reg_note (rtx, enum reg_note, int);
-extern void add_shallow_copy_of_reg_note (rtx, rtx);
+extern void add_shallow_copy_of_reg_note (rtx_insn *, rtx);
 extern void remove_note (rtx, const_rtx);
 extern void remove_reg_equal_equiv_notes (rtx_insn *);
 extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 1a69424..f1511c4 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2117,7 +2117,7 @@ add_int_reg_note (rtx insn, enum reg_note kind, int datum)
 /* Add a register note like NOTE to INSN.  */
 
 void
-add_shallow_copy_of_reg_note (rtx insn, rtx note)
+add_shallow_copy_of_reg_note (rtx_insn *insn, rtx note)
 {
   if (GET_CODE (note) == INT_LIST)
 add_int_reg_note (insn, REG_NOTE_KIND (note), XINT (note, 0));
-- 
2.4.0.78.g7c6ecbf



[PATCH 03/25] make stop_search_p take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* reorg.c (stop_search_p): Change argument to rtx_insn *.
---
 gcc/ChangeLog | 4 
 gcc/reorg.c   | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index db7f740..f4b88d3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-08  Trevor Saunders  
 
+   * reorg.c (stop_search_p): Change argument to rtx_insn *.
+
+2015-05-08  Trevor Saunders  
+
* except.c (make_reg_eh_region_note): Change argument to
rtx_insn *.
(make_reg_eh_region_note_nothrow_nononlocal): Likewise.
diff --git a/gcc/reorg.c b/gcc/reorg.c
index cb251ee..2f7bb43 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -225,7 +225,7 @@ static int *uid_to_ruid;
 /* Highest valid index in `uid_to_ruid'.  */
 static int max_uid;
 
-static int stop_search_p (rtx, int);
+static int stop_search_p (rtx_insn *, int);
 static int resource_conflicts_p (struct resources *, struct resources *);
 static int insn_references_resource_p (rtx, struct resources *, bool);
 static int insn_sets_resource_p (rtx, struct resources *, bool);
@@ -302,7 +302,7 @@ simplejump_or_return_p (rtx insn)
In all cases, jumps terminate the search.  */
 
 static int
-stop_search_p (rtx insn, int labels_p)
+stop_search_p (rtx_insn *insn, int labels_p)
 {
   if (insn == 0)
 return 1;
-- 
2.4.0.78.g7c6ecbf



[PATCH 04/25] change in_expr_list_p to in_insn_list_p

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* rtlanal.c (in_insn_list_p): Renamed from in_expr_list_p.
* cfgrtl.c (can_delete_label_p): Adjust.
* rtl.h: likewise.
---
 gcc/ChangeLog | 6 ++
 gcc/cfgrtl.c  | 2 +-
 gcc/rtl.h | 2 +-
 gcc/rtlanal.c | 8 
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f4b88d3..94783f8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-08  Trevor Saunders  
 
+   * rtlanal.c (in_insn_list_p): Renamed from in_expr_list_p.
+   * cfgrtl.c (can_delete_label_p): Adjust.
+   * rtl.h: likewise.
+
+2015-05-08  Trevor Saunders  
+
* reorg.c (stop_search_p): Change argument to rtx_insn *.
 
 2015-05-08  Trevor Saunders  
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 8a75044..390d718 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -145,7 +145,7 @@ can_delete_label_p (const rtx_code_label *label)
   return (!LABEL_PRESERVE_P (label)
  /* User declared labels must be preserved.  */
  && LABEL_NAME (label) == 0
- && !in_expr_list_p (forced_labels, label));
+ && !in_insn_list_p (forced_labels, label));
 }
 
 /* Delete INSN by patching it out.  */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 273e2d5..6b01dd7 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2922,7 +2922,7 @@ extern unsigned hash_rtx_cb (const_rtx, machine_mode, int 
*, int *,
 
 extern rtx regno_use_in (unsigned int, rtx);
 extern int auto_inc_p (const_rtx);
-extern int in_expr_list_p (const_rtx, const_rtx);
+extern bool in_insn_list_p (const rtx_insn_list *, const rtx_insn *);
 extern void remove_node_from_expr_list (const_rtx, rtx_expr_list **);
 extern void remove_node_from_insn_list (const rtx_insn *, rtx_insn_list **);
 extern int loc_mentioned_in_p (rtx *, const_rtx);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 2377f25a..b531010 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2205,16 +2205,16 @@ remove_reg_equal_equiv_notes_for_regno (unsigned int 
regno)
return 1 if it is found.  A simple equality test is used to determine if
NODE matches.  */
 
-int
-in_expr_list_p (const_rtx listp, const_rtx node)
+bool
+in_insn_list_p (const rtx_insn_list *listp, const rtx_insn *node)
 {
   const_rtx x;
 
   for (x = listp; x; x = XEXP (x, 1))
 if (node == XEXP (x, 0))
-  return 1;
+  return true;
 
-  return 0;
+  return false;
 }
 
 /* Search LISTP (an EXPR_LIST) for an entry whose first operand is NODE and
-- 
2.4.0.78.g7c6ecbf



[PATCH 06/25] can_nonlocal_goto can take a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* except.c (can_nonlocal_goto): Change type of argument to
rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog | 6 ++
 gcc/except.c  | 2 +-
 gcc/rtl.h | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 632a283..a95b674 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-08  Trevor Saunders  
 
+   * except.c (can_nonlocal_goto): Change type of argument to
+   rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* rtlanal.c (computed_jump_p): Cange argument type to rtx_insn *.
* rtl.h: Adjust.
 
diff --git a/gcc/except.c b/gcc/except.c
index e4264bf..770ab98 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1941,7 +1941,7 @@ insn_nothrow_p (const_rtx insn)
 /* ??? This test is here in this file because it (ab)uses REG_EH_REGION.  */
 
 bool
-can_nonlocal_goto (const_rtx insn)
+can_nonlocal_goto (const rtx_insn *insn)
 {
   if (nonlocal_goto_handler_labels && CALL_P (insn))
 {
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 2795d5a..71c000b 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2881,7 +2881,7 @@ extern bool can_throw_internal (const_rtx);
 extern bool can_throw_external (const_rtx);
 extern bool insn_could_throw_p (const_rtx);
 extern bool insn_nothrow_p (const_rtx);
-extern bool can_nonlocal_goto (const_rtx);
+extern bool can_nonlocal_goto (const rtx_insn *);
 extern void copy_reg_eh_region_note_forward (rtx, rtx_insn *, rtx);
 extern void copy_reg_eh_region_note_backward (rtx, rtx_insn *, rtx);
 extern int inequality_comparisons_p (const_rtx);
-- 
2.4.0.78.g7c6ecbf



[PATCH 07/25] make remove_reg_equal_equiv_notes take an rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* rtlanal.c (remove_reg_equal_equiv_notes): Change argument type
to rtx_insn *.
* rtl.h: Likewise.
---
 gcc/ChangeLog | 6 ++
 gcc/rtl.h | 2 +-
 gcc/rtlanal.c | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a95b674..c9b517fe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-08  Trevor Saunders  
 
+   * rtlanal.c (remove_reg_equal_equiv_notes): Change argument type
+   to rtx_insn *.
+   * rtl.h: Likewise.
+
+2015-05-08  Trevor Saunders  
+
* except.c (can_nonlocal_goto): Change type of argument to
rtx_insn *.
* rtl.h: Adjust.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 71c000b..1e161f7 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2869,7 +2869,7 @@ extern void add_reg_note (rtx, enum reg_note, rtx);
 extern void add_int_reg_note (rtx, enum reg_note, int);
 extern void add_shallow_copy_of_reg_note (rtx, rtx);
 extern void remove_note (rtx, const_rtx);
-extern void remove_reg_equal_equiv_notes (rtx);
+extern void remove_reg_equal_equiv_notes (rtx_insn *);
 extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
 extern int side_effects_p (const_rtx);
 extern int volatile_refs_p (const_rtx);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 8c9b01d..1a69424 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2159,7 +2159,7 @@ remove_note (rtx insn, const_rtx note)
 /* Remove REG_EQUAL and/or REG_EQUIV notes if INSN has such notes.  */
 
 void
-remove_reg_equal_equiv_notes (rtx insn)
+remove_reg_equal_equiv_notes (rtx_insn *insn)
 {
   rtx *loc;
 
-- 
2.4.0.78.g7c6ecbf



[PATCH 05/25] computed_jump_p takes a rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* rtlanal.c (computed_jump_p): Cange argument type to rtx_insn *.
* rtl.h: Adjust.
---
 gcc/ChangeLog | 5 +
 gcc/rtl.h | 2 +-
 gcc/rtlanal.c | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 94783f8..632a283 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-08  Trevor Saunders  
 
+   * rtlanal.c (computed_jump_p): Cange argument type to rtx_insn *.
+   * rtl.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* rtlanal.c (in_insn_list_p): Renamed from in_expr_list_p.
* cfgrtl.c (can_delete_label_p): Adjust.
* rtl.h: likewise.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 6b01dd7..2795d5a 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2890,7 +2890,7 @@ extern void replace_label (rtx *, rtx, rtx, bool);
 extern void replace_label_in_insn (rtx_insn *, rtx, rtx, bool);
 extern bool rtx_referenced_p (const_rtx, const_rtx);
 extern bool tablejump_p (const rtx_insn *, rtx *, rtx_jump_table_data **);
-extern int computed_jump_p (const_rtx);
+extern int computed_jump_p (const rtx_insn *);
 extern bool tls_referenced_p (const_rtx);
 
 /* Overload for refers_to_regno_p for checking a single register.  */
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index b531010..8c9b01d 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2990,7 +2990,7 @@ computed_jump_p_1 (const_rtx x)
we can recognize them by a (use (label_ref)).  */
 
 int
-computed_jump_p (const_rtx insn)
+computed_jump_p (const rtx_insn *insn)
 {
   int i;
   if (JUMP_P (insn))
-- 
2.4.0.78.g7c6ecbf



[PATCH 02/25] make make_reg_eh_region_note and friend take rtx_insn *

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* except.c (make_reg_eh_region_note): Change argument to
rtx_insn *.
(make_reg_eh_region_note_nothrow_nononlocal): Likewise.
* except.h: Adjust.
---
 gcc/ChangeLog | 7 +++
 gcc/except.c  | 4 ++--
 gcc/except.h  | 4 ++--
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 54297f2..db7f740 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
 2015-05-08  Trevor Saunders  
 
+   * except.c (make_reg_eh_region_note): Change argument to
+   rtx_insn *.
+   (make_reg_eh_region_note_nothrow_nononlocal): Likewise.
+   * except.h: Adjust.
+
+2015-05-08  Trevor Saunders  
+
* mode-switching.c (commit_mode_sets): Change type of local
variable from rtx to rtx_insn *.
 
diff --git a/gcc/except.c b/gcc/except.c
index d609592..e4264bf 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1694,7 +1694,7 @@ for_each_eh_label (void (*callback) (rtx))
   direct call cases) and just pull the data out of the trees.  */
 
 void
-make_reg_eh_region_note (rtx insn, int ecf_flags, int lp_nr)
+make_reg_eh_region_note (rtx_insn *insn, int ecf_flags, int lp_nr)
 {
   rtx value;
   if (ecf_flags & ECF_NOTHROW)
@@ -1711,7 +1711,7 @@ make_reg_eh_region_note (rtx insn, int ecf_flags, int 
lp_nr)
already exists.  */
 
 void
-make_reg_eh_region_note_nothrow_nononlocal (rtx insn)
+make_reg_eh_region_note_nothrow_nononlocal (rtx_insn *insn)
 {
   rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
   rtx intmin = GEN_INT (INT_MIN);
diff --git a/gcc/except.h b/gcc/except.h
index eb81203..504b4bd 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -270,8 +270,8 @@ extern eh_region get_eh_region_from_lp_number (int);
 
 extern eh_region eh_region_outermost (struct function *, eh_region, eh_region);
 
-extern void make_reg_eh_region_note (rtx insn, int ecf_flags, int lp_nr);
-extern void make_reg_eh_region_note_nothrow_nononlocal (rtx);
+extern void make_reg_eh_region_note (rtx_insn *insn, int ecf_flags, int lp_nr);
+extern void make_reg_eh_region_note_nothrow_nononlocal (rtx_insn *);
 
 extern void verify_eh_tree (struct function *);
 extern void dump_eh_tree (FILE *, struct function *);
-- 
2.4.0.78.g7c6ecbf



[PATCH 01/25] use rtx_insn * as the type of a local variable in mode-switching.c

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-05-08  Trevor Saunders  

* mode-switching.c (commit_mode_sets): Change type of local
variable from rtx to rtx_insn *.
---
 gcc/ChangeLog| 5 +
 gcc/mode-switching.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 77d9352..54297f2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-08  Trevor Saunders  
+
+   * mode-switching.c (commit_mode_sets): Change type of local
+   variable from rtx to rtx_insn *.
+
 2015-05-08  Jim Wilson  
 
* doc/install.texi (--enable-languages): Add missing jit and lto info.
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index c0f865c..dd28a3e 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -131,7 +131,7 @@ commit_mode_sets (struct edge_list *edge_list, int e, 
struct bb_info *info)
  HARD_REG_SET live_at_edge;
  basic_block src_bb = eg->src;
  int cur_mode = info[src_bb->index].mode_out;
- rtx mode_set;
+ rtx_insn *mode_set;
 
  REG_SET_TO_HARD_REG_SET (live_at_edge, df_get_live_out (src_bb));
 
@@ -145,7 +145,7 @@ commit_mode_sets (struct edge_list *edge_list, int e, 
struct bb_info *info)
  default_rtl_profile ();
 
  /* Do not bother to insert empty sequence.  */
- if (mode_set == NULL_RTX)
+ if (mode_set == NULL)
continue;
 
  /* We should not get an abnormal edge here.  */
-- 
2.4.0.78.g7c6ecbf



[PATCH 00/25] more rtx_insn *ification

2015-05-08 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

This series does a bunch more "trivial" changes from rtx to rtx_insn *.

each patch bootstrapped + regtested on x86_64-linux-gnu, and the series was run
through config-list.mk.  I think this all falls within Jeff's preapproval
again, so committing to trunk.

Trev


Trevor Saunders (25):
  use rtx_insn * as the type of a local variable in mode-switching.c
  make make_reg_eh_region_note and friend take rtx_insn *
  make stop_search_p take a rtx_insn *
  change in_expr_list_p to in_insn_list_p
  computed_jump_p takes a rtx_insn *
  can_nonlocal_goto can take a rtx_insn *
  make remove_reg_equal_equiv_notes take an rtx_insn *
  make add_shallow_copy_of_reg_note take an rtx_insn *
  make noop_move_p take a rtx_insn *
  prev_cc0_setter can take a rtx_insn *
  emit_note_after can take a rtx_insn *
  emit_note_before can take a rtx_insn *
  make emit_debug_insn_before take a rtx_insn *
  cse_change_cc0_mode can take a rtx_insn *
  pass rtx_insn * more in gcse.c
  change more argument types to rtx_insn *
  use rtx_insn * more in reorg.c
  more rtx_insn * in recog.c
  notice_args_size can take a rtx_insn *
  more rtx_insn * in sched-deps.c
  find_all_hard_reg_sets can take a rtx_insn *
  rtx_insn * in combine.c
  rtx_insn * in df-problems.c
  setup_next_usage_insn can take a rtx_insn *
  redirect_jump* can take a rtx_insn *

 gcc/ChangeLog  | 127 +
 gcc/cfgrtl.c   |   2 +-
 gcc/combine.c  |   2 +-
 gcc/cse.c  |   2 +-
 gcc/df-problems.c  |   2 +-
 gcc/dwarf2cfi.c|   2 +-
 gcc/emit-rtl.c |  12 ++---
 gcc/except.c   |   6 +--
 gcc/except.h   |   4 +-
 gcc/gcse.c |   8 ++--
 gcc/ira-color.c|   4 +-
 gcc/ira.c  |   4 +-
 gcc/ira.h  |   2 +-
 gcc/jump.c |   6 +--
 gcc/lra-constraints.c  |   2 +-
 gcc/lra-eliminations.c |   2 +-
 gcc/mode-switching.c   |   4 +-
 gcc/recog.c|  30 ++--
 gcc/recog.h|  18 +++
 gcc/reorg.c|  14 +++---
 gcc/rtl.h  |  28 +--
 gcc/rtlanal.c  |  18 +++
 gcc/sched-deps.c   |   4 +-
 gcc/sched-int.h|   4 +-
 24 files changed, 215 insertions(+), 92 deletions(-)

-- 
2.4.0.78.g7c6ecbf



Re: [patch] defer C++ mangling aliases

2015-05-08 Thread Aldy Hernandez

On 05/08/2015 08:08 PM, Jason Merrill wrote:

On 05/08/2015 07:45 PM, Aldy Hernandez wrote:

Are you OK with your own patch? :-)


Hmm...

...



Well, alright.

Jsaon


Wait...Jsaon?  This is not the same author :).

Committed to mainline.  Thank you.

Aldy



Re: [patch/C++] adapt java method aliases to use create_same_body_alias

2015-05-08 Thread Jason Merrill

OK.

Jason


Re: [patch] defer C++ mangling aliases

2015-05-08 Thread Jason Merrill

On 05/08/2015 07:45 PM, Aldy Hernandez wrote:

Are you OK with your own patch? :-)


Hmm...

...



Well, alright.

Jsaon




Re: [patch 3/10] debug-early merge: C++ front-end

2015-05-08 Thread Aldy Hernandez

On 05/08/2015 12:20 PM, Richard Biener wrote:


Just meant that it's making the changes smaller if those bits can be checked in 
independently. If that's just a hassle...


Well, who am I to look a gift horse in the mouth?  Especially when 
you've volunteered to review most of this, and hopefully finish the LTO 
streaming work? :-)))


That being said... here is the latest C++ patch bereft of C++ mangling 
and Java aliases.  Indeed it looks mighty clean.  I'm tempted to commit 
it as obvious... :).


The rest of the patches remain as is.

Thanks.
Aldy
commit 73357de442ca317e478cfcb6c0f9da630d142775
Author: Aldy Hernandez 
Date:   Fri May 8 17:26:32 2015 -0700

* cp-objcp-common.c: Update comment for
cxx_warn_unused_global_decl.
* cp-objcp-common.h (LANG_HOOKS_WRITE_GLOBALS): Remove.
(LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): New.
* cp-tree.h (cp_write_global_declarations): Remove.
(cxx_post_compilation_parsing_cleanups): New.
(wrapup_globals_for_namespace): Add argument.
* decl.c (wrapup_globals_for_namespace): Tag unused argument with
ATTRIBUTE_UNUSED.
* decl2.c (locus_at_end_of_parsing): New global.
(c_parse_final_cleanups): Rename from
cp_write_global_declarations.  Use locus_at_end_of_parsing.
Start correct TV_PHASE_* timers.
Remove code calling finalize_compilation_unit.
Move vtable verify code into its own function...
(cxx_post_compilation_parsing_cleanups): ...here.
* name-lookup.c (do_namespace_alias): Rename global_decl to
early_global_decl.

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4b27f5d..245a23e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,24 @@
+2015-05-08  Aldy Hernandez  
+
+   * cp-objcp-common.c: Update comment for
+   cxx_warn_unused_global_decl.
+   * cp-objcp-common.h (LANG_HOOKS_WRITE_GLOBALS): Remove.
+   (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): New.
+   * cp-tree.h (cp_write_global_declarations): Remove.
+   (cxx_post_compilation_parsing_cleanups): New.
+   (wrapup_globals_for_namespace): Add argument.
+   * decl.c (wrapup_globals_for_namespace): Tag unused argument with
+   ATTRIBUTE_UNUSED.
+   * decl2.c (locus_at_end_of_parsing): New global.
+   (c_parse_final_cleanups): Rename from
+   cp_write_global_declarations.  Use locus_at_end_of_parsing.
+   Start correct TV_PHASE_* timers.
+   Remove code calling finalize_compilation_unit.
+   Move vtable verify code into its own function...
+   (cxx_post_compilation_parsing_cleanups): ...here.
+   * name-lookup.c (do_namespace_alias): Rename global_decl to
+   early_global_decl.
+
 2015-05-08  Jason Merrill  
 
* decl2.c (mangling_aliases): New variable.
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index dd8e7c5..40b13ef 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -60,7 +60,7 @@ cxx_get_alias_set (tree t)
   return c_common_get_alias_set (t);
 }
 
-/* Called from check_global_declarations.  */
+/* Called from check_global_declaration.  */
 
 bool
 cxx_warn_unused_global_decl (const_tree decl)
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index 8a36e7f..c8572a7 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -84,8 +84,8 @@ extern void cp_common_init_ts (void);
 #define LANG_HOOKS_PRINT_ERROR_FUNCTIONcxx_print_error_function
 #undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
 #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL cxx_warn_unused_global_decl
-#undef LANG_HOOKS_WRITE_GLOBALS
-#define LANG_HOOKS_WRITE_GLOBALS cp_write_global_declarations
+#undef LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS
+#define LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS 
cxx_post_compilation_parsing_cleanups
 #undef  LANG_HOOKS_BUILTIN_FUNCTION
 #define LANG_HOOKS_BUILTIN_FUNCTION cxx_builtin_function
 #undef  LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4136d98..1998992 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5469,7 +5469,7 @@ extern tree cp_reconstruct_complex_type   (tree, 
tree);
 extern bool attributes_naming_typedef_ok   (tree);
 extern void cplus_decl_attributes  (tree *, tree, int);
 extern void finish_anon_union  (tree);
-extern void cp_write_global_declarations   (void);
+extern void cxx_post_compilation_parsing_cleanups (void);
 extern tree coerce_new_type(tree);
 extern tree coerce_delete_type (tree);
 extern void comdat_linkage (tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6ec1579..4a4cadf 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -892,30 +892,19 @@ walk_namespaces (walk_namespaces_fn f, void* data)
   return walk_namespaces_r (global_namespace, f, data);
 }
 
-/* Call wrapup_globals_declarations for the globals 

[patch/C++] adapt java method aliases to use create_same_body_alias

2015-05-08 Thread Aldy Hernandez

Hi Jason.

Here is another independent patch factored out from the debug-early work.

I believe you approved this already, and was merely queued for stage1.

I have tested this independently of any other patch and would like 
permission to commit it to mainline.


OK?
commit 899570880aca6c3d2e6e85fddd80946648d2d352
Author: Aldy Hernandez 
Date:   Fri May 8 16:31:06 2015 -0700

* decl2.c (collect_candidates_for_java_method_aliases): Remove.
(build_java_method_aliases): Adapt to use create_same_body_alias
instead of assemble_alias.  Move variable declarations to
definition and tidy up.
(cp_write_global_declarations): Call build_java_method_aliases
instead of collecting candidates first.

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bd9f2f3..9f9c4e3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2015-05-08  Aldy Hernandez  
+
+   * decl2.c (collect_candidates_for_java_method_aliases): Remove.
+   (build_java_method_aliases): Adapt to use create_same_body_alias
+   instead of assemble_alias.  Move variable declarations to
+   definition and tidy up.
+   (cp_write_global_declarations): Call build_java_method_aliases
+   instead of collecting candidates first.
+
 2015-05-04  Paolo Carlini  
Jakub Jelinek  
 
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b2251d8..b3c98da 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3987,20 +3987,17 @@ generate_ctor_and_dtor_functions_for_priority 
(splay_tree_node n, void * data)
 }
 
 /* Java requires that we be able to reference a local address for a
-   method, and not be confused by PLT entries.  If hidden aliases are
-   supported, collect and return all the functions for which we should
-   emit a hidden alias.  */
+   method, and not be confused by PLT entries.  If supported, create a
+   hidden alias for all such methods.  */
 
-static hash_set *
-collect_candidates_for_java_method_aliases (void)
+static void
+build_java_method_aliases (void)
 {
-  struct cgraph_node *node;
-  hash_set *candidates = NULL;
-
 #ifndef HAVE_GAS_HIDDEN
-  return candidates;
+  return;
 #endif
 
+  struct cgraph_node *node;
   FOR_EACH_FUNCTION (node)
 {
   tree fndecl = node->decl;
@@ -4009,55 +4006,18 @@ collect_candidates_for_java_method_aliases (void)
  && TYPE_FOR_JAVA (DECL_CONTEXT (fndecl))
  && TARGET_USE_LOCAL_THUNK_ALIAS_P (fndecl))
{
- if (candidates == NULL)
-   candidates = new hash_set;
- candidates->add (fndecl);
-   }
-}
-
-  return candidates;
-}
-
-
-/* Java requires that we be able to reference a local address for a
-   method, and not be confused by PLT entries.  If hidden aliases are
-   supported, emit one for each java function that we've emitted.
-   CANDIDATES is the set of FUNCTION_DECLs that were gathered
-   by collect_candidates_for_java_method_aliases.  */
-
-static void
-build_java_method_aliases (hash_set *candidates)
-{
-  struct cgraph_node *node;
-
-#ifndef HAVE_GAS_HIDDEN
-  return;
-#endif
-
-  FOR_EACH_FUNCTION (node)
-{
-  tree fndecl = node->decl;
-
-  if (TREE_ASM_WRITTEN (fndecl)
- && candidates->contains (fndecl))
-   {
  /* Mangle the name in a predictable way; we need to reference
 this from a java compiled object file.  */
- tree oid, nid, alias;
- const char *oname;
- char *nname;
-
- oid = DECL_ASSEMBLER_NAME (fndecl);
- oname = IDENTIFIER_POINTER (oid);
+ tree oid = DECL_ASSEMBLER_NAME (fndecl);
+ const char *oname = IDENTIFIER_POINTER (oid);
  gcc_assert (oname[0] == '_' && oname[1] == 'Z');
- nname = ACONCAT (("_ZGA", oname+2, NULL));
- nid = get_identifier (nname);
+ char *nname = ACONCAT (("_ZGA", oname + 2, NULL));
 
- alias = make_alias_for (fndecl, nid);
+ tree alias = make_alias_for (fndecl, get_identifier (nname));
  TREE_PUBLIC (alias) = 1;
  DECL_VISIBILITY (alias) = VISIBILITY_HIDDEN;
 
- assemble_alias (alias, oid);
+ cgraph_node::create_same_body_alias (alias, fndecl);
}
 }
 }
@@ -4390,7 +4350,6 @@ cp_write_global_declarations (void)
   unsigned ssdf_count = 0;
   int retries = 0;
   tree decl;
-  hash_set *candidates;
 
   locus = input_location;
   at_eof = 1;
@@ -4741,8 +4700,8 @@ cp_write_global_declarations (void)
  linkage now.  */
   pop_lang_context ();
 
-  /* Collect candidates for Java hidden aliases.  */
-  candidates = collect_candidates_for_java_method_aliases ();
+  /* Generate Java hidden aliases.  */
+  build_java_method_aliases ();
 
   timevar_stop (TV_PHASE_DEFERRED);
   timevar_start (TV_PHASE_OPT_GEN);
@@ -4782,13 +4741,6 @@ cp_write_global_declarations (void)
 
   perform_deferred_noexcept_checks ();
 
-  /* Generate hidden aliases for Java.  */
-  if (candidates)
-{
-  build_java_method_aliases (candidates);
-  

[patch] defer C++ mangling aliases

2015-05-08 Thread Aldy Hernandez

Hi Jason.

At Richi's request, I'm splitting up a couple of patches from the C++ 
debug-early branch that can live on its own.


This attached patch is a patch you wrote in our original attempt to 
remove deferred_asm_names from dwarf2out.c.


I have tested it independently of everything else, and would like 
permission to commit it to mainline.


Are you OK with your own patch? :-)

Aldy
commit 23c95504e7e9acd674b8a0caf607780c85ec3eaf
Author: Aldy Hernandez 
Date:   Fri May 8 16:34:51 2015 -0700

* decl2.c (mangling_aliases): New variable.
(note_mangling_alias, generate_mangling_aliases): New.
(cp_write_global_declarations): Call generate_mangling_aliases.
(generate_mangling_alias): Split out from...
* mangle.c (mangle_decl): ...here.
* cp-tree.h: Declare note_mangling_alias.

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9f9c4e3..4b27f5d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2015-05-08  Jason Merrill  
+
+   * decl2.c (mangling_aliases): New variable.
+   (note_mangling_alias, generate_mangling_aliases): New.
+   (cp_write_global_declarations): Call generate_mangling_aliases.
+   (generate_mangling_alias): Split out from...
+   * mangle.c (mangle_decl): ...here.
+   * cp-tree.h: Declare note_mangling_alias.
+
 2015-05-08  Aldy Hernandez  
 
* decl2.c (collect_candidates_for_java_method_aliases): Remove.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index e0fbf5e..4136d98 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5447,6 +5447,7 @@ extern tree finish_case_label 
(location_t, tree, tree);
 extern tree cxx_maybe_build_cleanup(tree, tsubst_flags_t);
 
 /* in decl2.c */
+extern void note_mangling_alias(tree, tree);
 extern bool check_java_method  (tree);
 extern tree build_memfn_type   (tree, tree, cp_cv_quals, 
cp_ref_qualifier);
 extern tree build_pointer_ptrmemfn_type(tree);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b3c98da..d435af2 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -118,6 +118,10 @@ static GTY(()) vec *deferred_fns;
sure are defined.  */
 static GTY(()) vec *no_linkage_decls;
 
+/* A vector of alternating decls and identifiers, where the latter
+   is to be an alias for the former if the former is defined.  */
+static GTY(()) vec *mangling_aliases;
+
 /* Nonzero if we're done parsing and into end-of-file activities.  */
 
 int at_eof;
@@ -4278,6 +4282,66 @@ handle_tls_init (void)
   expand_or_defer_fn (finish_function (0));
 }
 
+/* We're at the end of compilation, so generate any mangling aliases that
+   we've been saving up, if DECL is going to be output and ID2 isn't
+   already taken by another declaration.  */
+
+static void
+generate_mangling_alias (tree decl, tree id2)
+{
+  /* If there's a declaration already using this mangled name,
+ don't create a compatibility alias that conflicts.  */
+  if (IDENTIFIER_GLOBAL_VALUE (id2))
+return;
+
+  struct cgraph_node *n = NULL;
+  if (TREE_CODE (decl) == FUNCTION_DECL
+  && !(n = cgraph_node::get (decl)))
+/* Don't create an alias to an unreferenced function.  */
+return;
+
+  tree alias = make_alias_for (decl, id2);
+  SET_IDENTIFIER_GLOBAL_VALUE (id2, alias);
+  DECL_IGNORED_P (alias) = 1;
+  TREE_PUBLIC (alias) = TREE_PUBLIC (decl);
+  DECL_VISIBILITY (alias) = DECL_VISIBILITY (decl);
+  if (vague_linkage_p (decl))
+DECL_WEAK (alias) = 1;
+  if (TREE_CODE (decl) == FUNCTION_DECL)
+n->create_same_body_alias (alias, decl);
+  else
+varpool_node::create_extra_name_alias (alias, decl);
+}
+
+/* Note that we might want to emit an alias with the symbol ID2 for DECL at
+   the end of translation, for compatibility across bugs in the mangling
+   implementation.  */
+
+void
+note_mangling_alias (tree decl, tree id2)
+{
+#ifdef ASM_OUTPUT_DEF
+  if (at_eof)
+generate_mangling_alias (decl, id2);
+  else
+{
+  vec_safe_push (mangling_aliases, decl);
+  vec_safe_push (mangling_aliases, id2);
+}
+#endif
+}
+
+static void
+generate_mangling_aliases ()
+{
+  while (!vec_safe_is_empty (mangling_aliases))
+{
+  tree id2 = mangling_aliases->pop();
+  tree decl = mangling_aliases->pop();
+  generate_mangling_alias (decl, id2);
+}
+}
+
 /* The entire file is now complete.  If requested, dump everything
to a file.  */
 
@@ -4638,6 +4702,8 @@ cp_write_global_declarations (void)
 }
   while (reconsider);
 
+  generate_mangling_aliases ();
+
   /* All used inline functions must have a definition at this point.  */
   FOR_EACH_VEC_SAFE_ELT (deferred_fns, i, decl)
 {
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index b0f72d1..647ec70 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3554,30 +3554,7 @@ mangle_decl (const tree decl)
 flag_abi_compat_version, id2);
}
 
-#ifdef ASM_OUTPUT_DEF
-  /*

Re: PATCH] PR target/65612: Multiversioning doesn't work with DSO nor PIE

2015-05-08 Thread H.J. Lu
On Fri, May 8, 2015 at 4:00 PM, Rich Felker  wrote:
> On Fri, Apr 17, 2015 at 05:36:30AM -0700, H.J. Lu wrote:
>> On Fri, Apr 17, 2015@4:59 AM, Jakub Jelinek  wrote:
>> > On Fri, Apr 17, 2015 at 04:48:48AM -0700, H.J. Lu wrote:
>> >> > I don't like it.  Nonshared libgcc is libgcc.a, period.  No sense in
>> >> > creating yet another library for that.
>> >> > So, IMHO beyond making the __cpu* entrypoints compat symbols only (@ 
>> >> > instead
>> >> > of @@ symbol versions) the right fix is simply tweak init_gcc_spec, so 
>> >> > that
>> >> > static_name is always linked in, in the switch combinations that it 
>> >> > isn't
>> >> > right now of course after shared_name rather than before that.
>> >> > I thought we've fixed that years ago...
>> >> >
>> >>
>> >> We never pass -lgcc to linker when building C++ DSO:
>> >>
>> >>  /usr/libexec/gcc/x86_64-redhat-linux/4.9.2/collect2 -plugin
>> >> /usr/libexec/gcc/x86_64-redhat-linux/4.9.2/liblto_plugin.so
>> >> -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper
>> >> -plugin-opt=-fresolution=/tmp/ccZC7iqy.res
>> >> -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
>> >> -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed
>> >> --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -shared
>> >> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/crti.o
>> >> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/crtbeginS.o
>> >> -L/usr/lib/gcc/x86_64-redhat-linux/4.9.2
>> >> -L/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64
>> >> -L/lib/../lib64 -L/usr/lib/../lib64
>> >> -L/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../.. x.o -lstdc++ -lm
>> >> -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-redhat-linux/4.9.2/crtendS.o
>> >> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/crtn.o
>> >> [hjl@gnu-32 tmp]$
>> >>
>> >> That is why libgcc_nonshared.a is needed.
>> >
>> > See what I wrote.  I think it is a bug that we don't do that, in your case
>> > we should pass -lgcc_s -lgcc -lc -lgcc_s -lgcc.
>> > Or, if you don't want to change that, as the multi-versioning change is
>> > i386/x86_64 only change, just ensure that those targets have
>> > t-slibgcc-libgcc in libgcc/config.host and thus behave like most other 
>> > linux
>> > targets where -lgcc is linked in always after -lgcc_s.
>> >
>> > Jakub
>>
>> This patch works for me.  OK for trunk?
>>
>> gcc/testsuite/
>>
>> PR target/65612
>> * g++.dg/ext/mv18.C: New test.
>> * g++.dg/ext/mv19.C: Likewise.
>> * g++.dg/ext/mv20.C: Likewise.
>> * g++.dg/ext/mv21.C: Likewise.
>> * g++.dg/ext/mv22.C: Likewise.
>> * g++.dg/ext/mv23.C: Likewise.
>>
>> libgcc/
>>
>> PR target/65612
>> * config.host (tmake_file): Add t-slibgcc-libgcc for Linux/x86.
>> * config/i386/cpuinfo.c (__cpu_model): Initialize.
>> (__cpu_indicator_init@GCC_4.8.0): New.
>> (__cpu_model@GCC_4.8.0): Likewise.
>> * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Add
>> -DUSE_ELF_SYMVER.
>>
>> Thanks.
>
> This patch seems to be making some trouble for musl's dynamic linker,
> which I could go into details on if necessary, but I'm wondering if

It sounds like a bug in musl's dynamic linker. foo@VERSION
is visible to ld.so, but invisible to ld.

> there's any reason why simple visibility wasn't used if you want to
> hide the symbols from the linker. Could you explain the motivation for
> doing it this way? Is the intent for libgcc_s.so to refer to its own
> internal copy of __cpu_model and __cpu_indicator_init? If so, it seems
> wrong to have a relocation referring to them symbolically at all; this
> should just be a relative relocation.

It is for backward binary compatibility so that the old binaries
which have references to libgcc_s.so.1 work with the new
libgcc_s.so.1.


-- 
H.J.


Re: PATCH] PR target/65612: Multiversioning doesn't work with DSO nor PIE

2015-05-08 Thread Rich Felker
On Fri, Apr 17, 2015 at 05:36:30AM -0700, H.J. Lu wrote:
> On Fri, Apr 17, 2015@4:59 AM, Jakub Jelinek  wrote:
> > On Fri, Apr 17, 2015 at 04:48:48AM -0700, H.J. Lu wrote:
> >> > I don't like it.  Nonshared libgcc is libgcc.a, period.  No sense in
> >> > creating yet another library for that.
> >> > So, IMHO beyond making the __cpu* entrypoints compat symbols only (@ 
> >> > instead
> >> > of @@ symbol versions) the right fix is simply tweak init_gcc_spec, so 
> >> > that
> >> > static_name is always linked in, in the switch combinations that it isn't
> >> > right now of course after shared_name rather than before that.
> >> > I thought we've fixed that years ago...
> >> >
> >>
> >> We never pass -lgcc to linker when building C++ DSO:
> >>
> >>  /usr/libexec/gcc/x86_64-redhat-linux/4.9.2/collect2 -plugin
> >> /usr/libexec/gcc/x86_64-redhat-linux/4.9.2/liblto_plugin.so
> >> -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper
> >> -plugin-opt=-fresolution=/tmp/ccZC7iqy.res
> >> -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
> >> -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed
> >> --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -shared
> >> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/crti.o
> >> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/crtbeginS.o
> >> -L/usr/lib/gcc/x86_64-redhat-linux/4.9.2
> >> -L/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64
> >> -L/lib/../lib64 -L/usr/lib/../lib64
> >> -L/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../.. x.o -lstdc++ -lm
> >> -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-redhat-linux/4.9.2/crtendS.o
> >> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/crtn.o
> >> [hjl@gnu-32 tmp]$
> >>
> >> That is why libgcc_nonshared.a is needed.
> >
> > See what I wrote.  I think it is a bug that we don't do that, in your case
> > we should pass -lgcc_s -lgcc -lc -lgcc_s -lgcc.
> > Or, if you don't want to change that, as the multi-versioning change is
> > i386/x86_64 only change, just ensure that those targets have
> > t-slibgcc-libgcc in libgcc/config.host and thus behave like most other linux
> > targets where -lgcc is linked in always after -lgcc_s.
> >
> > Jakub
> 
> This patch works for me.  OK for trunk?
> 
> gcc/testsuite/
> 
> PR target/65612
> * g++.dg/ext/mv18.C: New test.
> * g++.dg/ext/mv19.C: Likewise.
> * g++.dg/ext/mv20.C: Likewise.
> * g++.dg/ext/mv21.C: Likewise.
> * g++.dg/ext/mv22.C: Likewise.
> * g++.dg/ext/mv23.C: Likewise.
> 
> libgcc/
> 
> PR target/65612
> * config.host (tmake_file): Add t-slibgcc-libgcc for Linux/x86.
> * config/i386/cpuinfo.c (__cpu_model): Initialize.
> (__cpu_indicator_init@GCC_4.8.0): New.
> (__cpu_model@GCC_4.8.0): Likewise.
> * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Add
> -DUSE_ELF_SYMVER.
> 
> Thanks.

This patch seems to be making some trouble for musl's dynamic linker,
which I could go into details on if necessary, but I'm wondering if
there's any reason why simple visibility wasn't used if you want to
hide the symbols from the linker. Could you explain the motivation for
doing it this way? Is the intent for libgcc_s.so to refer to its own
internal copy of __cpu_model and __cpu_indicator_init? If so, it seems
wrong to have a relocation referring to them symbolically at all; this
should just be a relative relocation.

Rich


Re: Question about patch for PR bootstrap/65150 (identical functions)

2015-05-08 Thread Bernhard Reutner-Fischer
On May 8, 2015 11:58:18 PM GMT+02:00, Jan Hubicka  wrote:
>> On Fri, May 08, 2015 at 01:09:52PM -0600, Jeff Law wrote:
>> > On 05/08/2015 01:07 PM, David Edelsohn wrote:
>> > Steve Ellcey wrote:
>> > >>
>> > >>After your change GCC sees that the code for f1 and f2 are
>identical
>> > >>so it replaced the body of f2 with a call to f1.  This
>optimization will
>> > >>save space but it is not going to be faster because any call to
>f2 will
>> > >>now include an extra call/return.  Do other platforms have this
>same issue
>> > >>or is there a way to make f2 an alias for f1 on other targets so
>no extra
>> > >>call is needed?  I looked around to see if there was a target
>function or
>> > >>macro that is used to make one function an alias of another but I
>didn't
>> > >>see anything.
>> > >
>> > >This probably is not good for POWER, and probably not for ARM, in
>fact
>> > >probably not good for most RISC architectures.
>> > But isn't this code going to be creating aliases when the output
>format
>> > supports them -- which avoids the call/return overheads?
>> > 
>> > Which might argue that if we don't have aliases, then ICF might
>need to be a
>> > -Os thing.
>> 
>> ICF uses aliases only when possible (when it can prove that the
>callers
>> don't care about function address equality/non-equality.  In other
>cases
>> ICF uses caller redirection (if it is possible to redirect all
>callers and
>> remove unused other call), or thunks (otherwise).
>> 
>> Thunks indeed can slow things down somewhat, especially if they can't
>tail
>> call the function.
>
>Yep, the idea here is that inliner should undo the splitting in most
>cases
>where the hot path performance matters.
>For GCC 6 we plan to work bit on this and try to chose thunks to point
>in right
>direction.  It also may be possible to arrange backend to output those
>thunks
>as simple nops just ahead of the target functions (and also to output
>thunks
>there without the redundant jump instructions)

... which will hopefully address https://gcc.gnu.org/PR65534

thanks,



Re: [PATCH diagnostics/fortran] Handle two locations for the same diagnostic. Convert all gfc_warning_1 and gfc_notify_std_1 calls

2015-05-08 Thread Manuel López-Ibáñez
Hi Dodji,

Thanks for the review. I followed all your suggestions. For the
accessor functions, I was not sure what type you would prefer, so I
implemented them as C++ methods and made use of 'private' to be sure
they are the only way to access the locations array. If you want me to
change it, just tell me what you prefer. I also replaced
diagnostic_same_locus with diagnostic_same_line.

Bootstrapped & regression tested on x86_64-linux-gnu.

OK?

Manuel.


gcc/fortran/ChangeLog:

2015-05-08  Manuel López-Ibáñez  

PR fortran/44054

Replace all calls to gfc_notify_std_1 with gfc_notify_std and
gfc_warning_1 with gfc_warning.
* decl.c (gfc_verify_c_interop_param): Here.
* resolve.c (resolve_branch): Here.
(resolve_fl_derived): Here.
* dependency.c (gfc_check_argument_var_dependency):
* scanner.c (preprocessor_line): Use gfc_warning_now_at. Fix line
counter and locations before and after warning.
* gfortran.h (gfc_warning_1, gfc_warning_now_1, gfc_notify_std_1):
Delete.
(gfc_warning_now_at): Declare.
* error.c (gfc_warning_1): Delete.
(gfc_notify_std_1): Delete.
(gfc_warning_now_1): Delete.
(gfc_format_decoder): Handle two locations.
(gfc_diagnostic_build_prefix): Rename as
gfc_diagnostic_build_kind_prefix.
(gfc_diagnostic_build_locus_prefix): Take an expanded_location
instead of diagnostic_info.
(gfc_diagnostic_build_locus_prefix): Add overload that takes two
expanded_location.
(gfc_diagnostic_starter): Handle two locations.
(gfc_warning_now_at): New.
(gfc_diagnostics_init): Initialize caret_chars array.
(gfc_diagnostics_finish): Reset caret_chars array to default.

gcc/cp/ChangeLog:

2015-05-08  Manuel López-Ibáñez  

* error.c (cp_diagnostic_starter): Use diagnostic_location
function.
(cp_print_error_function): Likewise.
(cp_printer): Replace locus pointer with accessor function.

gcc/c/ChangeLog:

2015-05-08  Manuel López-Ibáñez  

* c-objc-common.c (c_tree_printer): Replace locus pointer with
accessor function.

gcc/ChangeLog:

2015-05-08  Manuel López-Ibáñez  

* tree-pretty-print.c (percent_K_format): Replace locus pointer
with accessor function.
* tree-diagnostic.c (diagnostic_report_current_function): Use
diagnostic_location function.
(maybe_unwind_expanded_macro_loc): Likewise.
(virt_loc_aware_diagnostic_finalizer): Likewise.
(default_tree_printer): Replace locus pointer with accessor function.
* diagnostic.c (diagnostic_initialize): Initialize caret_chars array.
(diagnostic_set_info_translated): Initialize second location.
(diagnostic_build_prefix): Use CARET_LINE_MARGIN.
(diagnostic_show_locus): Handle two locations. Call
diagnostic_print_caret_line.
(diagnostic_print_caret_line): New.
(default_diagnostic_starter): Use diagnostic_location function.
(diagnostic_report_diagnostic): Use diagnostic_location function.
(verbatim): Do not set text.locus.
* diagnostic.h (struct diagnostic_info): Remove location field.
(struct diagnostic_context): Make caret_chars an array of two.
(diagnostic_location): New inline.
(diagnostic_expand_location): Handle two locations.
(diagnostic_same_line): New inline.
(diagnostic_print_caret_line): Declare.
(CARET_LINE_MARGIN): New constant.
* pretty-print.c (pp_printf): Do not set text.locus.
(pp_verbatim): Do not set text.locus.
* pretty-print.h (MAX_LOCATIONS_PER_MESSAGE): New constant.
(struct text_info): Replace locus pointer with locations
array. Add accessor functions.

gcc/testsuite/ChangeLog:

2015-05-08  Manuel López-Ibáñez  

PR fortran/44054
* lib/gfortran-dg.exp: Update regex to handle two locations for
the same diagnostic without caret.
* gfortran.dg/badline.f: Test also that line numbers are correct
before and after "left but not entered" warning.
Index: gcc/c/c-objc-common.c
===
--- gcc/c/c-objc-common.c   (revision 222903)
+++ gcc/c/c-objc-common.c   (working copy)
@@ -106,12 +106,12 @@ c_tree_printer (pretty_printer *pp, text
 }
 
   if (*spec != 'v')
 {
   t = va_arg (*text->args_ptr, tree);
-  if (set_locus && text->locus)
-   *text->locus = DECL_SOURCE_LOCATION (t);
+  if (set_locus)
+   text->set_location (0) = DECL_SOURCE_LOCATION (t);
 }
 
   switch (*spec)
 {
 case 'D':
Index: gcc/tree-pretty-print.c
===
--- gcc/tree-pretty-print.c (revision 222903)
+++ gcc/tree-pretty-print.c (working copy)
@@ -3618,12 +3618,11 @@ newline_and_indent (pretty_printer *pp, 
 
 void
 percent_K_format (text_info *text)
 {
   tree t = va_arg (*text->args_ptr, tree), block;
-  gcc_assert (text->locus != NULL);
-  *text->locus = EXPR_LOCATION (t);
+  text->set_location (0) = EXPR_LOCATION (t);
   gcc_assert (pp_ti_abstract_origin (text) 

Re: [RFC 0/6] Flags outputs for asms

2015-05-08 Thread Richard Henderson
On 05/08/2015 02:14 PM, Segher Boessenkool wrote:
> "Cleaner"?  In this code?  Heh.

Heh.

> use_crosses_set_p often estimates pessimistically.  Is that what is
> happening here?  Using real dataflow in combine would fix that (and many
> other problems).  Not that that helps you right now ;-)

Yes, I think so.  Proper data flow would fix this.  But...

My thought is that the use_crosses_set_p could grow another parameter,
ignore_luid, so that if it matches DF_INSN_LUID (rsp->last_set) we don't fail
the test.

Then can_combine_p has to adjust its use like so:

  use_crosses_set_p (src, DF_INSN_LUID (insn),
 succ ? DF_INSN_LUID (succ) : -1)

which at least handles the 3-insn combine case, if not the 4-insn combine case.

I'll try out both this and Law's set_noop_p suggestion soon.



r~


[patch, Fortran] Fix PR 66041

2015-05-08 Thread Thomas Koenig
Hello world,

this patch fixes the regression in PR 66041, plus one more case
that came up when I looked at this.

OK for trunk?

Regards, Thomas

2015-05-08  Thomas Koenig  

PR fortran/66041
* frontend-passes.c (scalarized_expr): Clear as->start, as->end
and as->stride.  Set correct dimension and shape for the
expression to be passed to lbound.  Free e_in.

2015-05-08  Thomas Koenig  

PR fortran/66041
* gfortran.dg/inline_matmul_7.f90:  New test.
* gfortran.dg/inline_matmul_8.f90:  New test.
Index: frontend-passes.c
===
--- frontend-passes.c	(Revision 222864)
+++ frontend-passes.c	(Arbeitskopie)
@@ -2611,14 +2611,40 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index,
 		{
 		  /* Look at full individual sections, like a(:).  The first index
 			 is the lbound of a full ref.  */
-
+		  int j;
 		  gfc_array_ref *ar;
+		  gfc_expr *lbound_e;
 
-		  ar = gfc_find_array_ref (e_in);
+		  lbound_e = gfc_copy_expr (e_in);
+		  ar = gfc_find_array_ref (lbound_e);
+
 		  ar->type = AR_FULL;
+		  for (j = 0; j < ar->dimen; j++)
+			{
+			  gfc_free_expr (ar->start[j]);
+			  ar->start[j] = NULL;
+			  gfc_free_expr (ar->end[j]);
+			  ar->end[j] = NULL;
+			  gfc_free_expr (ar->stride[j]);
+			  ar->stride[j] = NULL;
+			}
+
+		  /* We have to get rid of the shape, if thre is one.  Do
+			 so by freeing it and calling gfc_resolve to rebuild it,
+			 if necessary.  */
+			 
+		  if (lbound_e->shape)
+			gfc_free_shape (&(lbound_e->shape), lbound_e->rank);
+
+		  lbound_e->rank = ar->dimen;
+			
+		  gfc_resolve_expr (lbound_e);
+		  lbound = get_array_inq_function (GFC_ISYM_LBOUND,
+		   lbound_e, i + 1);
 		}
-		  lbound = get_array_inq_function (GFC_ISYM_LBOUND, e_in,
-		   i_index + 1);
+		  else
+		lbound = get_array_inq_function (GFC_ISYM_LBOUND, e_in,
+		 i_index + 1);
 		}
 	  
 	  ar->dimen_type[i] = DIMEN_ELEMENT;
@@ -2639,6 +2665,8 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index,
 	  i_index ++;
 	}
 }
+  gfc_free_expr (e_in);
+
   return e;
 }
 
! { dg-do  run }
! { dg-options "-ffrontend-optimize -fdump-tree-original" }
! PR 66041 - this used to ICE with an incomplete fix for the PR.
program main
  implicit none
  real, dimension(1,-2:0) :: a1
  real, dimension(3,2) :: b1
  real, dimension(2) :: c1

  data a1 /17., -23., 29./
  data b1 / 2.,  -3.,  5.,  -7., 11., -13./

  c1 = matmul(a1(1,:), b1)
  if (any (c1-[248., -749.] /= 0.)) call abort
end program main

! { dg-final { scan-tree-dump-times "_gfortran_matmul" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
! { dg-do  run }
! { dg-options "-ffrontend-optimize -fdump-tree-original" }

program main
  implicit none
  real(kind=8), ALLOCATABLE :: a(:,:), b(:,:), v1(:), v2(:)
  real(kind=8), dimension(3,3) :: v1res, v2res
  integer :: n, i

  data v1res/ 442.d0,   -492.d0,   586.d0, &
-4834.d0,   5694.d0, -7066.d0, &
13042.d0, -15450.d0, 19306.d0 /

  data v2res/ 5522.d0,  -6310.d0,   7754.d0, &
 -7794.d0,   8982.d0, -11034.d0, &
 10490.d0, -12160.d0,  14954.d0 /
  n = 3

  ALLOCATE(a(N,N),b(N,N),v1(N), v2(N))

  a = reshape([((-1)**i*(-i-5)*(i+3)+5,i=1,n**2)], shape(a))
  b = reshape([((-1)**i*(-i-1)*(i-2),i=1,n**2)], shape(a))

  DO i=1,N
 v1 = MATMUL(a,b(:,i))
 if (any(abs(v1-v1res(:,i)) > 1e-10)) call abort

 v2 = MATMUL(a,b(i,:))
 if (any(abs(v2-v2res(:,i)) > 1e-10)) call abort

  ENDDO

END program main
! { dg-final { scan-tree-dump-times "_gfortran_matmul" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }


Re: Enhance std::hash for pointers

2015-05-08 Thread Christopher Jefferson
My concern with accepting this patch is that many of libstdc++'s hash
functions are awful from a mixing point of view -- you would get
exactly the same problem from users who have integers which are always
a multiple of a power of 2 (which is in practice not uncommon). This
would give exactly the same problem.

Rather than try to "fix" one hash function like this, we should just
accept our hash functions might have low quality lower order bits.



On 8 May 2015 at 21:18, François Dumont  wrote:
> On 08/05/2015 10:02, Richard Biener wrote:
>>
>> On Wed, May 6, 2015 at 10:10 PM, François Dumont 
>> wrote:
>>>
>>> Hi
>>>
>>>  Following Marc Glisse comment #4
>>> on:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65641 I would like to
>>> propose this enhancement to the hash functor for pointers. It simply gets
>>> rid of the irrelevant bits on pointers hash code based on memory
>>> alignment
>>> of the pointed type. The only drawback I can think of is that the type
>>> needs
>>> to be complete at std::hash instantiation time but is it really an issue
>>> ?
>>>
>>>  IMO it is quite obvious that the resulting hash code will be better
>>> but
>>
>> If you use a real hashing function that's not true.  That is, something
>> else than GCCs pointer_hash (void *p) { return (uintptr_t)p >>3; }.
>
>
> Sorry, I don't understand your remark. Do you mean that if someone is not
> using std::hash to hash its pointers he won't benefit from the enhancement ?
>
> It is a good point however to see that gcc is using something similar
> internally.
>
> François
>


Re: [RFC 0/6] Flags outputs for asms

2015-05-08 Thread Segher Boessenkool
On Fri, May 08, 2015 at 03:32:58PM -0600, Jeff Law wrote:
> On 05/08/2015 02:15 PM, Richard Henderson wrote:
> >
> >But it *does* try to match an intermediate pattern,
> >
> >(set (reg:CCGC 17 flags)
> > (compare:CCGC (reg:CCGC 17 flags)
> > (const_int 0 [0])))
> >
> >which can be considered a no-op move.  If I add the attached pattern, then 
> >the
> >combination happens in two steps -- 9->12, 12->13 -- and we get what we 
> >hoped:
> So what happens if that pattern is actually recognized as a nop-move by 
> set_noop_p?  That would allow recog_for_combine to see it as a nop and 
> "recognize" it as valid.

It's not valid RTL though, so it is a bit more work than that.


Segher


Re: Question about patch for PR bootstrap/65150 (identical functions)

2015-05-08 Thread Jan Hubicka
> On Fri, May 08, 2015 at 01:09:52PM -0600, Jeff Law wrote:
> > On 05/08/2015 01:07 PM, David Edelsohn wrote:
> > Steve Ellcey wrote:
> > >>
> > >>After your change GCC sees that the code for f1 and f2 are identical
> > >>so it replaced the body of f2 with a call to f1.  This optimization will
> > >>save space but it is not going to be faster because any call to f2 will
> > >>now include an extra call/return.  Do other platforms have this same issue
> > >>or is there a way to make f2 an alias for f1 on other targets so no extra
> > >>call is needed?  I looked around to see if there was a target function or
> > >>macro that is used to make one function an alias of another but I didn't
> > >>see anything.
> > >
> > >This probably is not good for POWER, and probably not for ARM, in fact
> > >probably not good for most RISC architectures.
> > But isn't this code going to be creating aliases when the output format
> > supports them -- which avoids the call/return overheads?
> > 
> > Which might argue that if we don't have aliases, then ICF might need to be a
> > -Os thing.
> 
> ICF uses aliases only when possible (when it can prove that the callers
> don't care about function address equality/non-equality.  In other cases
> ICF uses caller redirection (if it is possible to redirect all callers and
> remove unused other call), or thunks (otherwise).
> 
> Thunks indeed can slow things down somewhat, especially if they can't tail
> call the function.

Yep, the idea here is that inliner should undo the splitting in most cases
where the hot path performance matters.
For GCC 6 we plan to work bit on this and try to chose thunks to point in right
direction.  It also may be possible to arrange backend to output those thunks
as simple nops just ahead of the target functions (and also to output thunks
there without the redundant jump instructions)

Honza
> 
>   Jakub


Re: [RFC 0/6] Flags outputs for asms

2015-05-08 Thread Richard Henderson
On 05/08/2015 02:32 PM, Jeff Law wrote:
> On 05/08/2015 02:15 PM, Richard Henderson wrote:
>>
>> But it *does* try to match an intermediate pattern,
>>
>> (set (reg:CCGC 17 flags)
>>  (compare:CCGC (reg:CCGC 17 flags)
>>  (const_int 0 [0])))
>>
>> which can be considered a no-op move.  If I add the attached pattern, then 
>> the
>> combination happens in two steps -- 9->12, 12->13 -- and we get what we 
>> hoped:
> So what happens if that pattern is actually recognized as a nop-move by
> set_noop_p?  That would allow recog_for_combine to see it as a nop and
> "recognize" it as valid.


Interesting suggestion -- I hadn't thought of that.  It might be easier than
playing with use_crosses_set_p, and certainly better than the nop_cmp pattern.

I'll have a go at this later.


r~


Re: [PATCH, RFC]: Next stage1, refactoring: propagating rtx subclasses

2015-05-08 Thread Jeff Law

On 05/04/2015 02:18 PM, Mikhail Maltsev wrote:

Yes, FWIW, it is only needed for assertions in peep2_regno_dead_p and
peep2_reg_dead_p which check it against NULL (they are intended to
verify that live_before field in peep2_insn_data struct is valid). At
least, when I removed the assertions and changed PEEP2_EOB to NULL (as
an experiment), the testsuite passed without regressions.


You'd probably be better off creating a unique rtx_insn * object and
using that as the marker.

OK. Fixed the patch. Rebased and tested on x86_64-linux (fortunately, it
did not conflict with Trevor's series of rtx_insn-related patches).

Thanks for taking care of that.



I'm trying to continue and the next patch (peep_split.patch,
peep_split.cl) is addressing the same task in some of the generated code
(namely, gen_peephole2_* and gen_split_* series of functions).
And that looks good.  If it's bootstrapping and regression testing then 
it's good to go too.





If you're going to continue this work, you should probably get
write-after-approval access so that you can commit your own approved
changes.

Is it OK to mention you as a maintainer who can approve my request for
write access?
Yes, absolutely.  If you haven't already done so, go ahead and get this 
going because...


Both patches are approved.  Please install onto the trunk.

jeff



Re: [C/C++ PATCH] Implement -Wshift-negative-value (PR c/65179)

2015-05-08 Thread Paul Eggert

On 05/08/2015 09:59 AM, Joseph Myers wrote:

Paul, although glibc's copy of parts of tzcode is a bit out of date, it
looks like the currenthttps://github.com/eggert/tz.git  still has the
problematic code in private.h, relying on left-shifting -1 which has
undefined behavior in C99/C11 (implementation-defined in C90, as per
DR#081).
Thanks for reporting that.  I installed the attached patch into the 
experimental tz version on github , with 
the intent that this fix propagate into the next tz release and thus 
into glibc etc.


>From b8f4f998104e74fc2c4a3759317b5153e95db16e Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Fri, 8 May 2015 14:47:40 -0700
Subject: [PATCH] Avoid left-shift-into-sign-bit undefined behavior

Problem reported by Joseph Myers in:
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00704.html
* localtime.c (detzcode, detzcode64): Don't rely on
undefined behavior with left shift into sign bit.
Port better to non-2's-complement machines.
* private.h (TWOS_COMPLEMENT, MAXVAL, MINVAL): New macros.
* private.h (time_t_min, time_t_max):
* zic.c (min_time, max_time): Use them to avoid undefined behavior.
* zdump.c (atime_shift): New constant.
(absolute_min_time, absolute_max_time):
Use it to avoid undefined behavior.
---
 localtime.c | 32 +++-
 private.h   | 23 ++-
 zdump.c |  6 --
 zic.c   |  4 ++--
 4 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/localtime.c b/localtime.c
index a2d9aa8..423e13e 100644
--- a/localtime.c
+++ b/localtime.c
@@ -216,22 +216,44 @@ detzcode(const char *const codep)
 {
 	register int_fast32_t	result;
 	register int		i;
+	int_fast32_t one = 1;
+	int_fast32_t halfmaxval = one << (32 - 2);
+	int_fast32_t maxval = halfmaxval - 1 + halfmaxval;
+	int_fast32_t minval = -1 - maxval;
 
-	result = (codep[0] & 0x80) ? -1 : 0;
-	for (i = 0; i < 4; ++i)
+	result = codep[0] & 0x7f;
+	for (i = 1; i < 4; ++i)
 		result = (result << 8) | (codep[i] & 0xff);
+
+	if (codep[0] & 0x80) {
+	  /* Do two's-complement negation even on non-two's-complement machines.
+	 If the result would be minval - 1, return minval.  */
+	  result -= !TWOS_COMPLEMENT(int_fast32_t) && result != 0;
+	  result += minval;
+	}
 	return result;
 }
 
 static int_fast64_t
 detzcode64(const char *const codep)
 {
-	register int_fast64_t result;
+	register uint_fast64_t result;
 	register int	i;
+	int_fast64_t one = 1;
+	int_fast64_t halfmaxval = one << (64 - 2);
+	int_fast64_t maxval = halfmaxval - 1 + halfmaxval;
+	int_fast64_t minval = -TWOS_COMPLEMENT(int_fast64_t) - maxval;
 
-	result = (codep[0] & 0x80) ? -1 : 0;
-	for (i = 0; i < 8; ++i)
+	result = codep[0] & 0x7f;
+	for (i = 1; i < 8; ++i)
 		result = (result << 8) | (codep[i] & 0xff);
+
+	if (codep[0] & 0x80) {
+	  /* Do two's-complement negation even on non-two's-complement machines.
+	 If the result would be minval - 1, return minval.  */
+	  result -= !TWOS_COMPLEMENT(int_fast64_t) && result != 0;
+	  result += minval;
+	}
 	return result;
 }
 
diff --git a/private.h b/private.h
index 61cf922..f277e7a 100644
--- a/private.h
+++ b/private.h
@@ -472,15 +472,20 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_PURE;
 #define TYPE_SIGNED(type) (((type) -1) < 0)
 #endif /* !defined TYPE_SIGNED */
 
-/* The minimum and maximum finite time values.  */
-static time_t const time_t_min =
-  (TYPE_SIGNED(time_t)
-   ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
-   : 0);
-static time_t const time_t_max =
-  (TYPE_SIGNED(time_t)
-   ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
-   : -1);
+#define TWOS_COMPLEMENT(t) ((t) ~ (t) 0 < 0)
+
+/* Max and min values of the integer type T, of which only the bottom
+   B bits are used, and where the highest-order used bit is considered
+   to be a sign bit if T is signed.  */
+#define MAXVAL(t, b)		\
+  ((t) (((t) 1 << ((b) - 1 - TYPE_SIGNED(t)))			\
+	- 1 + ((t) 1 << ((b) - 1 - TYPE_SIGNED(t)
+#define MINVAL(t, b)		\
+  ((t) (TYPE_SIGNED(t) ? - TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0))
+
+/* The minimum and maximum finite time values.  This assumes no padding.  */
+static time_t const time_t_min = MINVAL(time_t, TYPE_BIT(time_t));
+static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
 
 #ifndef INT_STRLEN_MAXIMUM
 /*
diff --git a/zdump.c b/zdump.c
index 13bbb0e..adb806c 100644
--- a/zdump.c
+++ b/zdump.c
@@ -246,13 +246,15 @@ extern int	optind;
 extern char *	tzname[2];
 
 /* The minimum and maximum finite time values.  */
+enum { atime_shift = CHAR_BIT * sizeof (time_t) - 2 };
 static time_t const absolute_min_time =
   ((time_t) -1 < 0
-   ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
+   ? (- ((time_t) ~ (time_t) 0 < 0)
+  - (((time_t) 1 << atime_shift) - 1 + ((time_t) 1 << atime_shift)))
: 0);
 static time_t const absolute_max_time =
   ((time_t) -1 < 0
-   ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+   ? (((time_t) 1 << atim

Re: [PATCH 5/4] libcpp: Eliminate most of the non-const/reference-returning inline fns

2015-05-08 Thread Jeff Law

On 05/05/2015 12:21 PM, David Malcolm wrote:

gcc/java/ChangeLog:
* jcf-parse.c (set_source_filename): Replace write through
ORDINARY_MAP_FILE_NAME with direct access to "to_file".

libcpp/ChangeLog:
* include/line-map.h (MAP_START_LOCATION): Eliminate the non-const
variant, and tweak comment for the const variant.
(ORDINARY_MAP_STARTING_LINE_NUMBER): Drop the non-const variant.
(ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise.
(ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise.
(SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Delete.
(ORDINARY_MAP_FILE_NAME): Drop the non-const variant.
(MACRO_MAP_MACRO): Likewise.
(MACRO_MAP_NUM_MACRO_TOKENS): Likewise.
(MACRO_MAP_LOCATIONS): Likewise.
(MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise.
* line-map.c (linemap_add): Replace writes through macros with
direct field accesses.
(linemap_enter_macro): Likewise.
(linemap_line_start): Likewise.

OK.
jeff



Re: [PATCH 2/4 v2: part 2] libcpp: Replace macro usage with C++ constructs

2015-05-08 Thread Jeff Law

On 05/05/2015 12:21 PM, David Malcolm wrote:

libcpp/ChangeLog:
* include/line-map.h (MAX_SOURCE_LOCATION): Convert from a macro
to a const source_location.
(RESERVED_LOCATION_COUNT): Likewise.
(linemap_check_ordinary): Convert from a macro to a pair of inline
functions, for const/non-const arguments.
(MAP_START_LOCATION): Likewise.
(ORDINARY_MAP_STARTING_LINE_NUMBER): Likewise.
(ORDINARY_MAP_INCLUDER_FILE_INDEX): Likewise.
(ORDINARY_MAP_IN_SYSTEM_HEADER_P): Likewise.
(ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): Convert from a macro to a
pair of inline functions, for const/non-const arguments, where the
latter is named...
(SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS): New function.
(ORDINARY_MAP_FILE_NAME): Convert from a macro to a pair of inline
functions, for const/non-const arguments.
(MACRO_MAP_MACRO): Likewise.
(MACRO_MAP_NUM_MACRO_TOKENS): Likewise.
(MACRO_MAP_LOCATIONS): Likewise.
(MACRO_MAP_EXPANSION_POINT_LOCATION): Likewise.
(LINEMAPS_MAP_INFO): Likewise.
(LINEMAPS_MAPS): Likewise.
(LINEMAPS_ALLOCATED): Likewise.
(LINEMAPS_USED): Likewise.
(LINEMAPS_CACHE): Likewise.
(LINEMAPS_ORDINARY_CACHE): Likewise.
(LINEMAPS_MACRO_CACHE): Likewise.
(LINEMAPS_MAP_AT): Convert from a macro to an inline function.
(LINEMAPS_LAST_MAP): Likewise.
(LINEMAPS_LAST_ALLOCATED_MAP): Likewise.
(LINEMAPS_ORDINARY_MAPS): Likewise.
(LINEMAPS_ORDINARY_MAP_AT): Likewise.
(LINEMAPS_ORDINARY_ALLOCATED): Likewise.
(LINEMAPS_ORDINARY_USED): Likewise.
(LINEMAPS_LAST_ORDINARY_MAP): Likewise.
(LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP): Likewise.
(LINEMAPS_MACRO_MAPS): Likewise.
(LINEMAPS_MACRO_MAP_AT): Likewise.
(LINEMAPS_MACRO_ALLOCATED): Likewise.
(LINEMAPS_MACRO_USED): Likewise.
(LINEMAPS_MACRO_LOWEST_LOCATION): Likewise.
(LINEMAPS_LAST_MACRO_MAP): Likewise.
(LINEMAPS_LAST_ALLOCATED_MACRO_MAP): Likewise.
(IS_ADHOC_LOC): Likewise.
(COMBINE_LOCATION_DATA): Likewise.
(SOURCE_LINE): Likewise.
(SOURCE_COLUMN): Likewise.
(LAST_SOURCE_LINE_LOCATION): Likewise.
(LAST_SOURCE_LINE): Likewise.
(LAST_SOURCE_COLUMN): Likewise.
(LAST_SOURCE_LINE_LOCATION)
(INCLUDED_FROM): Likewise.
(MAIN_FILE_P): Likewise.
(LINEMAP_FILE): Likewise.
(LINEMAP_LINE): Likewise.
(LINEMAP_SYSP): Likewise.
(linemap_location_before_p): Likewise.
* line-map.c (linemap_check_files_exited): Make local "map" const.
(linemap_add): Use SET_ORDINARY_MAP_NUMBER_OF_COLUMN_BITS.
(linemap_line_start): Likewise.

OK.

Jeff



Re: [PATCH 2/4 v2] libcpp: Replace macro usage with C++ constructs)

2015-05-08 Thread Jeff Law

On 05/05/2015 12:21 PM, David Malcolm wrote:

On Mon, 2015-05-04 at 13:15 -0600, Jeff Law wrote:
On 05/01/2015 06:56 PM, David Malcolm wrote:


[I didn't mark the inline functions as "static"; should they be?]
Just a follow-up on this.  I got burned by the ODR issues around 
implicit extern inlines earlier this week.  Basically I had two distinct 
implementations for an inline function with the same name.  They 
obviously appeared in different "header files".


When optimizng, this was fine as they'd actually get inlined and all was 
good.  Things blew up when the optimizer was off.  We got two functions 
with the same name, but different implementations.  The linker blindly 
chose one for me, and in one context it was the wrong one.


This led to bootstrap comparison failures.

So, just be careful :-)




I moved linemap_assert and linemap_assert_fails higher up within the
file so that they can appear before the bodies of the inline functions.
I didn't change their implementation; it's a simple cut-and-paste, so
these hunks are just an artifact of git's diff-ing algorithm getting
confused by that.

Should I have called that out in the ChangeLog entries?
It might have helped.  Or you could have pulled it out like you did in 
the follow-up.  No worries.  So consider the issues raised in that code 
as a non-issues for your patch.  They'd be nice things to clean up 
someday though.



-#define LINEMAPS_MAPS(SET, MAP_KIND) \

-  (LINEMAPS_MAP_INFO (SET, MAP_KIND))->maps
+inline line_map *
+LINEMAPS_MAPS (const line_maps *set, bool map_kind)
+{
+  return LINEMAPS_MAP_INFO (set, map_kind)->maps;
+}
+
+inline line_map * &
+LINEMAPS_MAPS (line_maps *set, bool map_kind)
+{
+  return LINEMAPS_MAP_INFO (set, map_kind)->maps;
+}

Do we really need two implementation of those various functions, one for
const line_maps * the other for line_maps *?



The issue here is when they are accessed as lvalues, rather than just as
rvalues.

I've had a go at eliminating some of the lvalue ones as a followup
patch: given that after patch 4 these become just field accesses, it's
trivial to turn the usage sites into plain accesses of fields.

Is that desirable, or are the uses of the macros regarded as useful
(e.g. for grepping)?  (my preference is for the former: to turn them
into plain field accesses at those sites)
I think macros would only be useful for those already familiar with the 
code.  If I'm looking for how a particular field gets accessed, I'm 
generally going to be grepping for the field.


Of course, if the field have names that are common ("next" anyone?), 
then, well, grepping for field names is pointless.





Ironically, one of the ones that isn't so easy to eliminate is the
one you called out above.  Eliminating those ones made the code messier,
so I kept those ones.

lol.  I just picked one after seeing the pattern repeat a bit.


I'm sending updated patches; the old patch 2 split into 2 parts, and
a followup ("patch 5 of 4", as it were):

   [PATCH 2/4 v2: part 1] Move linemap_assert higher up within the file
   [PATCH 2/4 v2: part 2] libcpp: Replace macro usage with C++ constructs
   [PATCH 5/4] libcpp: Eliminate most of the non-const/reference-returning 
inline fns

Do I need to do any performance testing of this kit?  Given that the
resulting inline functions become trivial field lookups in patch 4,
I'm assuming that our inliner is good enough to optimize it as well
as the status quo implementation.
Yea, I wouldn't worry about performance of an inline field access vs a 
macro.  We should be good to go.




Also, for comments before functions, do we prefer a blank line between
the comment and decl, or for them to abutt?

/* Foo.  */

foo ();

vs

/* Bar.  */
bar ();

How do the following look?

I've done both in my days. I try to follow whatever is in the nearby code.

Let me have a look at the followup...

jeff


Re: [PATCH] Fix 65697. Add memory model support for stronger __sync operations.

2015-05-08 Thread Andrew MacLeod

On 05/08/2015 05:27 PM, Jeff Law wrote:

On 05/07/2015 08:42 AM, Andrew MacLeod wrote:

There has been some debate over the strength requirement of barriers for

Curse you for the BZ reference.  I read maybe the first 75%, then 
glossed over 15%, then read the last bit in detail.  Hard to do near 
the end of a work week.


I spot checked the (significant) mechanical parts of this patch. I'm 
not entirely convinced that encoding the SYNC in the upper bits was 
the best choice, but it works.


OK for the trunk,
Jeff



well, using the upper bit let me still do a reasonable  if (model > 
MEMMODEL_LAST) check to make sure none of the other bits are set..

Its easy enough to change to use the next bit up or something like that.

tough sledding thru that PR.. :-P

Andrew


Re: [PATCH 2/4 v2: part 1] Move linemap_assert higher up within the file

2015-05-08 Thread Jeff Law

On 05/05/2015 12:21 PM, David Malcolm wrote:

---
  libcpp/include/line-map.h | 71 ---
  1 file changed, 36 insertions(+), 35 deletions(-)

Cobble together a quick ChangeLog and test and this is fine.

jeff




Re: [RFC 0/6] Flags outputs for asms

2015-05-08 Thread Jeff Law

On 05/08/2015 02:15 PM, Richard Henderson wrote:


But it *does* try to match an intermediate pattern,

(set (reg:CCGC 17 flags)
 (compare:CCGC (reg:CCGC 17 flags)
 (const_int 0 [0])))

which can be considered a no-op move.  If I add the attached pattern, then the
combination happens in two steps -- 9->12, 12->13 -- and we get what we hoped:
So what happens if that pattern is actually recognized as a nop-move by 
set_noop_p?  That would allow recog_for_combine to see it as a nop and 
"recognize" it as valid.







Jeff or Segher, is it worth complicating the can_combine_p test near line 1958

   /* Make sure that the value that is to be substituted for the register
  does not use any registers whose values alter in between.  However,
  If the insns are adjacent, a use can't cross a set even though we
  think it might (this can happen for a sequence of insns each setting
  the same destination; last_set of that register might point to
  a NOTE).  If INSN has a REG_EQUIV note, the register is always
  equivalent to the memory so the substitution is valid even if there
  are intervening stores.  Also, don't move a volatile asm or
  UNSPEC_VOLATILE across any other insns.  */
   || (! all_adjacent
   && (((!MEM_P (src)
 || ! find_reg_note (insn, REG_EQUIV, src))
&& use_crosses_set_p (src, DF_INSN_LUID (insn)))
   || (GET_CODE (src) == ASM_OPERANDS && MEM_VOLATILE_P (src))
   || GET_CODE (src) == UNSPEC_VOLATILE))

to notice that the set is one of SUCC or SUCC2, and is thus included in the
insns being combined?  That does seem cleaner and more general than the hacky
i386 nop_cmp pattern, but would certainly require tons more testing...
See above -- feels like we'd be better off letting combine know about 
this other form of a nop move and hopefully if we do that, all the right 
things happen.


jeff


[PATCH] Move global state in timevar.c to a new "timer" class

2015-05-08 Thread David Malcolm
I want to make the timevar infrastructure be more flexible,
to better serve some JIT use-cases.

The following is a "removal of global state" patch which gathers
together the state within timevar.c into a new "timer" class.

Within the classic cc1/cc1plus/etc use-case, this timer class
is a singleton.  For the JIT, I have a followup patch allowing
timers to be managed externally by client code, so that client code
can e.g. have multiple compiles in-process, and accumulate the
timings into different timers as appropriate (so e.g. a JavaScript
engine on one thread could accumulate its JIT-compilation timings
into one timer, whereas a Python JIT on another thread could
accumulate into another timer, and various other arrangements).

There is a global singleton for gcc's internals:

  timer *g_timer;

(which is guarded by the jit mutex for the jit case).

Currently the global bool "timevar_enable" is used for early bailout
from the timevar code, for the common needs-to-be-fast case where
timevar-tracking is disabled.  The patch eliminates this flag
throughout, replacing it with a test for g_timer being non-NULL
(it is only non-NULL if timing has been enabled).

The existing API implicitly uses "g_timer", so e.g.

  timevar_push (TV_SOMETHING);

which was:

  if (timevar_enable)
timevar_push_1 (TV_SOMETHING);

effectively becomes:

  if (g_timer)
g_timer->push (TV_SOMETHING);

A detail relating to timevar.c's get_time: "g_timer" is a singleton
as far as most of gcc is concerned, but I have a follow patch in
development in which there could be multiple timer instances in the
jit.  Hence the patch eliminated a check for timevar_enable in
"get_time" , *without* replacing it with a check for
g_timer != NULL, since with this patch get_time is only called from
methods of timer.  Doing so enables us to call methods on other timer
instances (e.g. to measure time spent waiting for the jit mutex).
There's also a test eliminated from timer::print, for similar reasons.

With timing disabled, this patch replaces the early reject
using a global bool with an early reject using a global ptr, and so
ought to be as fast:

test-benchmark.c, with timing disabled (the default case):
 Before introducing "class timer":
  100 iterations at optlevel 0 took a total of 6.150s (0.061s per iteration)
  100 iterations at optlevel 1 took a total of 6.780s (0.068s per iteration)
  100 iterations at optlevel 2 took a total of 6.990s (0.070s per iteration)
  100 iterations at optlevel 3 took a total of 8.590s (0.086s per iteration)
 After introducing "class timer:
  100 iterations at optlevel 0 took a total of 6.120s (0.061s per iteration)
  100 iterations at optlevel 1 took a total of 6.840s (0.068s per iteration)
  100 iterations at optlevel 2 took a total of 7.020s (0.070s per iteration)
  100 iterations at optlevel 3 took a total of 8.570s (0.086s per iteration)

With timing enabled, there's an extra indirection inside the
code in timevar.c, but this appears to have no significant cost,
for the jit.df/test-benchmark.c at least (though this test has just one
function):

test-benchmark.c, with timing enabled:
 Before introducing "class timer":
  100 iterations at optlevel 0 took a total of 6.110s (0.061s per iteration)
  100 iterations at optlevel 1 took a total of 6.970s (0.070s per iteration)
  100 iterations at optlevel 2 took a total of 7.080s (0.071s per iteration)
  100 iterations at optlevel 3 took a total of 8.820s (0.088s per iteration)
 After introducing "class timer":
  100 iterations at optlevel 0 took a total of 6.170s (0.062s per iteration)
  100 iterations at optlevel 1 took a total of 6.980s (0.070s per iteration)
  100 iterations at optlevel 2 took a total of 7.040s (0.070s per iteration)
  100 iterations at optlevel 3 took a total of 8.730s (0.087s per iteration)

The patch moves the structs "timevar_def" and "timevar_stack_def"
from timevar.c into timevar.h, hiding them as private within
class timer.  I had another version of this patch which kept them
within timevar.c, but to do this I had to use the "pimpl" idiom,
adding complexity and another layer of indirection.  It seemed best
to simply put them as private types within class timer.

Successfully bootstrapped®rtested on x86_64-unknown-linux-gnu
(Fedora 20).

OK for trunk?

gcc/ChangeLog:
* timevar.c (timevar_enable): Delete in favor of...
(g_timer): New global.
(struct timevar_def): Move to timevar.h inside class timer.
(struct timevar_stack_def): Likewise.
(timevars): Delete global in favor of field "m_timevars" within
class timer in timevar.h
(stack): Likewise, in favor of field "m_stack".
(unused_stack_instances): Likewise, in favor of field
"m_unused_stack_instances".
(start_time): Likewise, in favor of field "m_start_time".
(get_time): Eliminate check for timevar_enable.
(timer::timer): New function, built from part of timevar_init.
(timevar_init): Rewri

Re: [PATCH] Fix 65697. Add memory model support for stronger __sync operations.

2015-05-08 Thread Jeff Law

On 05/07/2015 08:42 AM, Andrew MacLeod wrote:

There has been some debate over the strength requirement of barriers for
__sync operations... This is documented within the PR.

Originally __sync was suppose to be synonymous with SEQ_CST, but there
has been a slight slackening of the barrier-ness of SEQ_CST from the
language lawyers. Under some circumstances, is is possible to move loads
or stores past a SEQ_CST barrier... which means that since __sync is
documented as being a "full barrier",  using SEQ_CST is technically not
always the same. There are similar issues with ACQUIRE and
__sync_lock_test_and_set.

__sync and __atomic processing were previously merged such that __sync
is now implemented in terms of __atomic under the covers, making
unwinding this a bit tricky.

In any case, I settled on adding a bit to the memory model field
indicating the atomic call originated with a __sync.  I used the upper
bit of the field and added specific entries in enum memmodel for the 3
possibilities:  MEMMODEL_SYNC_SEQ_CST, MEMMODEL_SYNC_ACQUIRE, and
MEMMODEL_SYNC_RELEASE.   This are *not* exposed to the user, and are
only created internally when expanding __sync built-ins.

In order to make this transparent to targets which do not care (which is
all of them except aarch64 right now), I provided access routines to
check the model, and converted the generic and target code to use these
routines instead of the current masking and comparisons.
ie:

 if ((model & MEMMODEL_MASK) == MEMMODEL_SEQ_CST)
becomes
 if (is_mm_seq_cst (model))

These routines ignore the sync bit, so it will return true for both
MEMMODEL_SEQ_CST and MEMMODEL_SYNC_SEQ_CST, making the bit transparent
to existing code.
For ports like aarch64 that do care about the bit,  they can check for
the __sync bit  (is_mm_sync(model)) or look for a specific model such as
MEMMODEL_SYNC_SEQ_CST.

This bootstraps on x86_64-unknown-linux-gnu with no new regressions.  It
has also been tested on aarch64, along with patches to verify it does
enable the appropriate changes to be made to the target, also with no
runtime regressions.  I have also built all the targets in
config-list.mk with no new compile errors.   I hope I caught
everything... :-)

OK for trunk?

Andrew


sync.patch


PR target/65697
* coretypes.h (MEMMODEL_SYNC, MEMMODEL_BASE_MASK): New macros.
(enum memmodel): Add SYNC_{ACQUIRE,RELEASE,SEQ_CST}.
* tree.h (memmodel_from_int, memmodel_base, is_mm_relaxed,
is_mm_consume,is_mm_acquire, is_mm_release, is_mm_acq_rel,
is_mm_seq_cst, is_mm_sync): New accessor functions.
* builtins.c (expand_builtin_sync_operation,
expand_builtin_compare_and_swap): Use MEMMODEL_SYNC_SEQ_CST.
(expand_builtin_sync_lock_release): Use MEMMODEL_SYNC_RELEASE.
(get_memmodel,  expand_builtin_atomic_compare_exchange,
expand_builtin_atomic_load, expand_builtin_atomic_store,
expand_builtin_atomic_clear): Use new accessor routines.
(expand_builtin_sync_synchronize): Use MEMMODEL_SYNC_SEQ_CST.
* optabs.c (expand_compare_and_swap_loop): Use MEMMODEL_SYNC_SEQ_CST.
(maybe_emit_sync_lock_test_and_set): Use new accessors and
MEMMODEL_SYNC_ACQUIRE.
(expand_sync_lock_test_and_set): Use MEMMODEL_SYNC_ACQUIRE.
(expand_mem_thread_fence, expand_mem_signal_fence, expand_atomic_load,
expand_atomic_store): Use new accessors.
* emit-rtl.c (need_atomic_barrier_p): Add additional enum cases.
* tsan.c (instrument_builtin_call): Update check for memory model beyond
final enum to use MEMMODEL_LAST.
* config/aarch64/aarch64.c (aarch64_expand_compare_and_swap): Use new
accessors.
* config/aarch64/atomics.md (atomic_load,atomic_store,
arch64_load_exclusive, aarch64_store_exclusive,
mem_thread_fence, *dmb): Likewise.
* config/alpha/alpha.c (alpha_split_compare_and_swap,
alpha_split_compare_and_swap_12): Likewise.
* config/arm/arm.c (arm_expand_compare_and_swap,
arm_split_compare_and_swap, arm_split_atomic_op): Likewise.
* config/arm/sync.md (atomic_load, atomic_store,
atomic_loaddi): Likewise.
* config/i386/i386.c (ix86_destroy_cost_data, ix86_memmodel_check):
Likewise.
* config/i386/sync.md (mem_thread_fence, atomic_store): Likewise.
* config/ia64/ia64.c (ia64_expand_atomic_op): Add new memmodel cases and
use new accessors.
* config/ia64/sync.md (mem_thread_fence, atomic_load,
atomic_store, atomic_compare_and_swap,
atomic_exchange): Use new accessors.
* config/mips/mips.c (mips_process_sync_loop): Likewise.
* config/pa/pa.md (atomic_loaddi, atomic_storedi): Likewise.
* config/rs6000/rs6000.c (rs6000_pre_atomic_barrier,
rs6000_post_atomic_barrier): Add new cases.
(rs6000_expand_atomic_compare_and_swap): Use new accessors.
* config/rs6000

Re: [RFC 0/6] Flags outputs for asms

2015-05-08 Thread Segher Boessenkool
Hi Richard,

On Fri, May 08, 2015 at 01:15:25PM -0700, Richard Henderson wrote:
> But it *does* try to match an intermediate pattern,
> 
> (set (reg:CCGC 17 flags)
> (compare:CCGC (reg:CCGC 17 flags)
> (const_int 0 [0])))
> 
> which can be considered a no-op move.

Maybe we should teach combine this is a no-op, then?  Then everything
should work as-is?  Combine knows about no-op moves (they don't cost,
and it deletes them itself).

> Jeff or Segher, is it worth complicating the can_combine_p test near line 1958
> 
>   /* Make sure that the value that is to be substituted for the register
>  does not use any registers whose values alter in between.  However,
>  If the insns are adjacent, a use can't cross a set even though we
>  think it might (this can happen for a sequence of insns each setting
>  the same destination; last_set of that register might point to
>  a NOTE).  If INSN has a REG_EQUIV note, the register is always
>  equivalent to the memory so the substitution is valid even if there
>  are intervening stores.  Also, don't move a volatile asm or
>  UNSPEC_VOLATILE across any other insns.  */
>   || (! all_adjacent
>   && (((!MEM_P (src)
> || ! find_reg_note (insn, REG_EQUIV, src))
>&& use_crosses_set_p (src, DF_INSN_LUID (insn)))
>   || (GET_CODE (src) == ASM_OPERANDS && MEM_VOLATILE_P (src))
>   || GET_CODE (src) == UNSPEC_VOLATILE))
> 
> to notice that the set is one of SUCC or SUCC2, and is thus included in the
> insns being combined?  That does seem cleaner and more general than the hacky
> i386 nop_cmp pattern, but would certainly require tons more testing...

"Cleaner"?  In this code?  Heh.

use_crosses_set_p often estimates pessimistically.  Is that what is
happening here?  Using real dataflow in combine would fix that (and many
other problems).  Not that that helps you right now ;-)

I'll build with your patches tomorrow and investigate.


Segher


conditional lim

2015-05-08 Thread Evgeniya Maenkova
Hi,

Could you please review my patch for predicated lim?

Let me note some details about it:



1)  Phi statements are still moved only if they have 1 or 2
arguments. However, phi statements could be move under conditions (as
it’s done for the other statements).  Probably, phi statement motion
with 3 + arguments could be implemented in the next patch after
predicated lim.

2)  Patch has limitations/features like (it was ok to me to
implement it such way, maybe I’m not correct. ):

a)  Loop1

{

  If (a)

 Loop2

 {

   Stmt - Invariant for Loop1

 }

 }

   In this case Stmt will be moved only out of Loop2, because of if (a).

b)  Or

Loop1

{

 …

 If (cond1)

  If (cond2)

  If (cond3)

  Stmt;

   }

Stmt will be moved out only if cond1 is always executed in Loop1.

c)   It took me a long time to write all of these code, so there
might be other peculiarities which I forgot to mention. :)

   Let’s discuss these ones as you will review my patch.

3)  Patch consists of 9 files:

a)  gcc/testsuite/gcc.dg/tree-ssa/loop-7.c,
gcc/testsuite/gcc.dg/tree-ssa/recip-3.c – changed tests:

-  gcc/testsuite/gcc.dg/tree-ssa/loop-7.c  changed as
predicated lim moves 2 more statements out of the loop;

-  gcc/testsuite/gcc.dg/tree-ssa/recip-3.c – with conditional
lim recip optimization in this test doesn’t work (the corresponding
value is below threshold as I could see in the code for recip, 1<3).
So to have recip working in this test I changed test a little bit.

b)  gcc/tree-ssa-loop-im.c – the patched lim per se

c)   gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-13.c,
gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-14.c,

gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-15.c,
gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-16.c,

gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-17.c,
gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-18.c

the tests for conditional lim.

4)  Patch testing:

a)  make –k check (no difference in results for me for the clean
build and the patched one,

-  Revision: 222849,

-  uname -a

   Linux Istanbul 3.16.0-23-generic #31-Ubuntu SMP Tue Oct
21 18:00:35 UTC 2014 i686 i686 i686 GNU/Linux

b)  Bootstrap.

 It goes well now, however to fix it I have made a temporary hack in
the lim code. And with this fix patch definitely shouldn’t be
committed.

I did so, as I would like to discuss this issue first.

The problem is: I got stage2-stage3 comparison failure on the single
file (tree-vect-data-refs.o). After some investigation I understood
that tree-vect-data-refs.o differs being compiled with and without
‘-g’ option (yes, more exactly on stage 2 this is  ‘-g –O2 –gtoggle’,
and for stage 3 this is ‘-g –O2’. But to simplify things I can
reproduce this difference on the same build (even not bootstrapped),
with option ‘ –g’ and without it).

Of course, the file compiled with –g option will contain debug
information and will differ from the corresponding file without debug
information. I mean there is the difference reported by
contrib/compare-debug (I mean we talk about stripped files).

Then I compared assemblers and lim dump files and made a conclusion
the difference is:

There is statement _484=something, which is conditionally moved out of
loop X. In non debug cases no usages of _484 are left inside the loop
X. In debug case, there is the single use in debug statement. So for
debug case my patch generates phi statement for _484 to make it
available inside the loop X. For non debug case, no such phi statement
generated as there is no uses of _484.

There is one more statement with lhs=_493, with exactly this pattern
of use. But this is not important for our discussion.



So, in my opinion it’s ok to generate additional phi node for debug
case. But I’m not a compiler expert and maybe there is some
requirement that debug and non-debug versions should differ only by
debug statements, I don’t know.



My temporary hack fix is just removing of such debug statements (no
debug statements, no problems J).



The alternatives I see are:

-  Move debug statements outside the loop (not good in my opinion);

-  Somehow reset values in debug statements (not good in my
opinion, if I could provide correct information for them);

-  Generate phi for debug statements and fix bootstrap (say,
let’s have some list of files, which we have special check for. I mean
for my case, the difference is not in stage2 and stage3, it’s in debug
and non-debug). I like this variant. However, as I don’t see such list
of special files in the whole gcc, I think I might be missing
something.

What do you think?



Thanks,



Evgeniya


patch_May8_3
Description: Binary data


Re: [patch 0/29] RFC: Use automake-1.11.6 across the tree

2015-05-08 Thread Jeff Law

On 05/08/2015 02:22 PM, Joseph Myers wrote:

On Fri, 8 May 2015, Jeff Law wrote:


* Sort out whether to update those top-level "missing" scripts.

Seems like we should if they came from automake.


I say we should *update* (from git).  Not *downgrade to an older version*,
which is what the posted patch did.

If we're downgrading, then yea, that seems backwards.

jeff


RE: [patch 1/28] top-level: Use automake-1.11.6

2015-05-08 Thread Joseph Myers
On Fri, 8 May 2015, Bernd Edlinger wrote:

> But it made the in-tree gmp configure script fail.  That would not
> have happened if we did not pass our version of missing to a sub-
> module like gmp, that already has a working missing script that behaves
> differently.

However, that's still not an argument for a downgrade of the toplevel copy 
of "missing" to an older version.  We can't possibly match toplevel 
scripts to subdirectories not shipped with GCC, since we want to support 
multiple versions of libraries such as GMP, which may each require a 
different version of such a script if the script makes incompatible 
changes; we can only ensure that they get configured in ways sufficiently 
isolated from GCC itself.

-- 
Joseph S. Myers
jos...@codesourcery.com

Re: [PATCH, alpha]: Remove dead (HOST_BITS_PER_WIDE_INT < 64) code

2015-05-08 Thread Richard Henderson
On 05/08/2015 09:43 AM, Uros Bizjak wrote:
> @@ -1509,8 +1509,7 @@
>   (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
>  (match_operand:DI 2 "mul8_operand" "I"))
>   (match_operand:DI 3 "immediate_operand" "i")))]
> -  "HOST_BITS_PER_WIDE_INT == 64
> -   && CONST_INT_P (operands[3])
> +  "CONST_INT_P (operands[3])

Just noticed that we can eliminate this test if we use const_int_operand 
instead.

> +  "operands[2] = force_reg (DImode, GEN_INT (HOST_WIDE_INT_1 << 63));")

I bet we're now supposed to use HOST_WIDE_INT_1U, to avoid any ubsan shift
silliness.

> @@ -1929,7 +1925,7 @@ alpha_emit_set_const_1 (rtx target, machine_mode m
>   temp = alpha_emit_set_const (subtarget, mode, new_const, i, 
> no_output);
>   if (!temp)
> {
> - new_const = (c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1);
> + new_const = (c << bits) | ((HOST_WIDE_INT_1 << bits) - 1);

Likewise.


r~


Re: [patch 0/29] RFC: Use automake-1.11.6 across the tree

2015-05-08 Thread Joseph Myers
On Fri, 8 May 2015, Jeff Law wrote:

> > * Sort out whether to update those top-level "missing" scripts.
> Seems like we should if they came from automake.

I say we should *update* (from git).  Not *downgrade to an older version*, 
which is what the posted patch did.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: Enhance std::hash for pointers

2015-05-08 Thread François Dumont

On 08/05/2015 10:02, Richard Biener wrote:

On Wed, May 6, 2015 at 10:10 PM, François Dumont  wrote:

Hi

 Following Marc Glisse comment #4
on:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65641 I would like to
propose this enhancement to the hash functor for pointers. It simply gets
rid of the irrelevant bits on pointers hash code based on memory alignment
of the pointed type. The only drawback I can think of is that the type needs
to be complete at std::hash instantiation time but is it really an issue ?

 IMO it is quite obvious that the resulting hash code will be better but

If you use a real hashing function that's not true.  That is, something
else than GCCs pointer_hash (void *p) { return (uintptr_t)p >>3; }.


Sorry, I don't understand your remark. Do you mean that if someone is 
not using std::hash to hash its pointers he won't benefit from the 
enhancement ?


It is a good point however to see that gcc is using something similar 
internally.


François



Re: [RFC 0/6] Flags outputs for asms

2015-05-08 Thread Richard Henderson
On 05/08/2015 08:54 AM, Richard Henderson wrote:
> I have a feeling I know why these didn't get merged.
> 
> The global optimizers aren't allowed to operate on hard registers lest they
> extend the lifetime of the hard register such that it creates an impossible
> situation for the register allocator.  Think what would happen if EAX were
> suddenly live across the entire function.
> 
> Similarly, combine is allowed to merge insns with hard registers if the insns
> are sequential.  But if the insns aren't sequential, we're lengthening the
> lifetime of the hard register.  Now, I thought this didn't apply to fixed
> registers like esp or flags, but perhaps not.
> 
> Note what happens if you swap the order of le and pf in the asm:
> 
>   asm("cmpl %3,%2" : "=@ccp" (pf), "=@ccle" (le) : "r" (x), "g" (y));
> 
> the order of the two setcc insns is reversed, and then the setle is in fact
> merged with the branch.
> 
> Anyway, I'll look into whether the branch around alpha can be optimized, but
> I'd be shocked if I'd be able to do anything about the branch around beta.
> True, there's nothing in between that will clobber the flags so it would be an
> excellent improvement, but combine doesn't work across basic blocks and
> changing that would be a major task.

My feeling was wrong.

(insn 9 11 10 2 (set (reg:QI 91 [ le ])
(le:QI (reg:CCGC 17 flags)
(const_int 0 [0]))) z.c:8 601 {*setcc_qi}
 (nil))
(insn 10 9 12 2 (set (reg:QI 92 [ pf ])
(eq:QI (reg:CCP 17 flags)
(const_int 0 [0]))) z.c:8 601 {*setcc_qi}
 (expr_list:REG_DEAD (reg:CCP 17 flags)
(nil)))
(insn 12 10 13 2 (set (reg:CCZ 17 flags)
(compare:CCZ (reg:QI 91 [ le ])
(const_int 0 [0]))) z.c:12 1 {*cmpqi_ccno_1}
 (expr_list:REG_DEAD (reg:QI 91 [ le ])
(nil)))
(jump_insn 13 12 14 2 (set (pc)
(if_then_else (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(label_ref 17)
(pc))) z.c:12 606 {*jcc_1}
 (expr_list:REG_DEAD (reg:CCZ 17 flags)
(int_list:REG_BR_PROB 7929 (nil)))

Combine won't allow a combination of insn 9->12->13 in one step one of the
inputs to insn 9, the flags, is clobbered in between insn 9 and insn 13.
Namely, by insn 12.  Combine has a special-case for allowing this when all
insns are consecutive, but not when there's something in the middle.

But it *does* try to match an intermediate pattern,

(set (reg:CCGC 17 flags)
(compare:CCGC (reg:CCGC 17 flags)
(const_int 0 [0])))

which can be considered a no-op move.  If I add the attached pattern, then the
combination happens in two steps -- 9->12, 12->13 -- and we get what we hoped:

(note 9 11 10 2 NOTE_INSN_DELETED)
(insn 10 9 12 2 (set (reg:QI 92 [ pf ])
(eq:QI (reg:CCP 17 flags)
(const_int 0 [0]))) z.c:8 601 {*setcc_qi}
 (nil))
(note 12 10 13 2 NOTE_INSN_DELETED)
(jump_insn 13 12 14 2 (set (pc)
(if_then_else (gt (reg:CCGC 17 flags)
(const_int 0 [0]))
(label_ref 17)
(pc))) z.c:12 606 {*jcc_1}
 (int_list:REG_BR_PROB 7929 (expr_list:REG_DEAD (reg:CCZ 17 flags)
(nil)))
 -> 17)


Jeff or Segher, is it worth complicating the can_combine_p test near line 1958

  /* Make sure that the value that is to be substituted for the register
 does not use any registers whose values alter in between.  However,
 If the insns are adjacent, a use can't cross a set even though we
 think it might (this can happen for a sequence of insns each setting
 the same destination; last_set of that register might point to
 a NOTE).  If INSN has a REG_EQUIV note, the register is always
 equivalent to the memory so the substitution is valid even if there
 are intervening stores.  Also, don't move a volatile asm or
 UNSPEC_VOLATILE across any other insns.  */
  || (! all_adjacent
  && (((!MEM_P (src)
|| ! find_reg_note (insn, REG_EQUIV, src))
   && use_crosses_set_p (src, DF_INSN_LUID (insn)))
  || (GET_CODE (src) == ASM_OPERANDS && MEM_VOLATILE_P (src))
  || GET_CODE (src) == UNSPEC_VOLATILE))

to notice that the set is one of SUCC or SUCC2, and is thus included in the
insns being combined?  That does seem cleaner and more general than the hacky
i386 nop_cmp pattern, but would certainly require tons more testing...



r~


diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index fc320f6..ffa5c46 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1320,6 +1320,22 @@
   [(set_attr "type" "icmp")
(set_attr "mode" "QI")])
 
+;; This helps combine fold away a chain of setcc insns.
+
+(define_insn_and_split "*nop_cmp"
+  [(set (reg FLAGS_REG)
+   (compare (match_operand 0 "flags_reg_operand")
+(const_int 0)))]
+  "ix86_match_ccmode (insn, GET_MODE (operands[0]))"
+  "#"
+  ""
+  [(const_int 0)]
+{
+  /* No-op move.  C

Re: [c++-concepts] code review

2015-05-08 Thread Andrew Sutton
Today is the first day I've had to look at these comments.


>>if (TEMPLATE_PARM_CONSTRAINTS (current_template_parms))
>> -TYPE_CANONICAL (type) = type;
>> +SET_TYPE_STRUCTURAL_EQUALITY (type);
>
>
> This seems like papering over an underlying issue.  What was the testcase
> that motivated this change?


It almost certainly is, but I haven't been able to find or write a
minimal test case that reproduces the reason for failure. Basically,
we end up with multiple specializations having the same type but
different constraints (since constraints are attached to the
declaration and not the type itself).

I think that I'm running into the same problems with auto a
placeholder in recent commits.


>> @@ -11854,7 +11854,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t
>> complain)
>> -   if (!spec)
>> +   if (!spec && DECL_LANG_SPECIFIC (t))
>> -   if (!local_p)
>> +   if (!local_p && DECL_LANG_SPECIFIC (r))
>
>
> What motivated these changes?  From the testcase, it seems that you're
> getting here with the decl for "using TD = int", which shouldn't happen.


That's the pretty much it... I suppose we could guard against
substituting into these kinds of declarations from within
tsubst_type_requirement and satisfy_type_constraint. To me it seems
like tsubst should work, but just return the same thing.


>> @@ -1159,7 +1159,6 @@ check_noexcept_r (tree *tp, int * /*walk_subtrees*/,
>> void * /*data*/)
>> -  tree type = TREE_TYPE (TREE_TYPE (fn));
>> -  if (!TYPE_NOTHROW_P (type))
>> +  if (!TYPE_NOTHROW_P (TREE_TYPE (fn)))
>
>
> The old code was incorrectly assuming that CALL_EXPR_FN is always a function
> pointer, but your new code seems to be incorrectly assuming that it's always
> a function or an expression taking the address of a function; I think this
> will break on a call to a function pointer variable.


I will experiment.


>> @@ -3481,13 +3481,27 @@ cxx_eval_constant_expression (const constexpr_ctx
>> *ctx, tree t,
>>  case REQUIRES_EXPR:
>> +  if (!processing_template_decl)
>> +return evaluate_constraint_expression (t, NULL_TREE);
>> +  else
>> +*non_constant_p = true;
>> +return t;
>
>
> We shouldn't get here with a dependent REQUIRES_EXPR (or any dependent
> expression), so we shouldn't ever hit the else clause.


IIRC we get here because of build_x_binary_op. It tries to build
non-dependent operands when the operands are not type-dependent.
requires-expressions have type bool, so they get run through the
constexpr evaluator even when processing_template_decl is true.

I've made requires-expressions instantiation dependent, but that
doesn't help in this case.


>> +static inline bool
>> +pending_expansion_p (tree t)
>> +{
>> +  return (TREE_CODE (t) == PARM_DECL && CONSTRAINT_VAR_P (t)
>> +  && PACK_EXPANSION_P (TREE_TYPE (t)));
>> +}
>
>
> What's the difference between this and function_parameter_pack_p?


Not a lot, except that replacing pending_expansion_p in one of the two
places that it's used causes ICEs :)  This function can almost
certainly be removed.


>> +check_implicit_conversion_constraint (tree t, tree args,
>> +  tsubst_flags_t complain, tree
>> in_decl)
>> +{
>> +  tree expr = ICONV_CONSTR_EXPR (t);
>> +
>> +  /* Don't tsubst as if we're processing a template. If we try
>> + to we can end up generating template-like expressions
>> + (e.g., modop-exprs) that aren't properly typed. */
>> +  int saved_template_decl = processing_template_decl;
>> +  processing_template_decl = 0;
>
>
> Why are we checking constraints when processing_template_decl is true?


IIRC I allow constraints to be evaluated in any context because it
lets us catch these kinds of errors:

template
void f()
{
  vector v; // error: constraints not satisfied
}


>> +  ++processing_template_decl;
>> +  tree constr = transform_expression (lift_function_definition (fn,
>> args));
>> +  --processing_template_decl;
>
>
> Why do you need to set processing_template_decl here and in other calls to
> transform_expression?  I don't notice anything that would be helped,
> especially now that you're using separate tree codes for constraints, though
> there is this in check_logical_expr:
>
>> +  /* Resolve the logical operator. Note that template processing is
>> + disabled so we get the actual call or target expression back.
>> + not_processing_template_sentinel sentinel.
>
>
> I guess that isn't needed anymore?


I've had problems in the past where substitution tries a little too
eagerly to fold expressions into constants --- especially type traits.
Those need to be preserved in the text for ordering.

Although I think this really only matters when you're instantiating a
class template whose members are constraints.


Andrew


Re: [PATCH 4/6] Convert to md_asm_adjust

2015-05-08 Thread Richard Henderson
On 05/08/2015 12:41 PM, Jeff Law wrote:
> I'm going to assume the include header order juggling/additions were all
> necessary.

Correct -- target.h now uses vec<>, which means that vec.h must be included
first.  In the olden days I'd have just put the vec.h include at the top of
target.h.  ;-)

> Presumably we don't have a symbolic return value from decode_reg_name.   
> That'd
> be a good cleanup for someone.

Correct.  Since the beginning of time, it would seem.

> Much of the cfgexpand bits were painful to read.  I did my best, things look
> reasonable, but that's largely from reading the comments and scanning the
> relevant code -- trying to match up old behaviour and new behaviour across the
> board was tough.  I realize this mess isn't of your making :-)

Yeah.  Sadly there was no smaller step; you can't half-covert a variable from
lists to vectors.  And since the existing target hook used the lists, they had
to be done at the same time.



r~


Re: [PATCH 4/6] Convert to md_asm_adjust

2015-05-08 Thread Jeff Law

On 05/07/2015 03:38 PM, Richard Henderson wrote:

Using proper vectors instead of lists of trees.
---
  gcc/cfgexpand.c  | 614 ---
  gcc/config/cris/cris.c   |  88 +++
  gcc/config/i386/i386.c   |  24 +-
  gcc/config/mn10300/mn10300.c |  20 +-
  gcc/config/rs6000/rs6000.c   |  17 +-
  gcc/config/visium/visium.c   |  21 +-
  gcc/config/vxworks.c |   2 +-
  gcc/doc/tm.texi  |  18 +-
  gcc/doc/tm.texi.in   |   2 +-
  gcc/gimple.c |   2 +-
  gcc/hooks.c  |   8 -
  gcc/hooks.h  |   1 -
  gcc/incpath.c|   1 +
  gcc/mode-switching.c |   2 +-
  gcc/system.h |   1 +
  gcc/target.def   |  30 ++-
  16 files changed, 401 insertions(+), 450 deletions(-)

ChangeLog and the usual testing.

One less use of TREE_LIST, is goodness.

I'm going to assume the include header order juggling/additions were all 
necessary.


Presumably we don't have a symbolic return value from decode_reg_name. 
  That'd be a good cleanup for someone.



Much of the cfgexpand bits were painful to read.  I did my best, things 
look reasonable, but that's largely from reading the comments and 
scanning the relevant code -- trying to match up old behaviour and new 
behaviour across the board was tough.  I realize this mess isn't of your 
making :-)


With the usual testing, this is fine.

jeff



Re: Question about patch for PR bootstrap/65150 (identical functions)

2015-05-08 Thread Jakub Jelinek
On Fri, May 08, 2015 at 01:09:52PM -0600, Jeff Law wrote:
> On 05/08/2015 01:07 PM, David Edelsohn wrote:
> Steve Ellcey wrote:
> >>
> >>After your change GCC sees that the code for f1 and f2 are identical
> >>so it replaced the body of f2 with a call to f1.  This optimization will
> >>save space but it is not going to be faster because any call to f2 will
> >>now include an extra call/return.  Do other platforms have this same issue
> >>or is there a way to make f2 an alias for f1 on other targets so no extra
> >>call is needed?  I looked around to see if there was a target function or
> >>macro that is used to make one function an alias of another but I didn't
> >>see anything.
> >
> >This probably is not good for POWER, and probably not for ARM, in fact
> >probably not good for most RISC architectures.
> But isn't this code going to be creating aliases when the output format
> supports them -- which avoids the call/return overheads?
> 
> Which might argue that if we don't have aliases, then ICF might need to be a
> -Os thing.

ICF uses aliases only when possible (when it can prove that the callers
don't care about function address equality/non-equality.  In other cases
ICF uses caller redirection (if it is possible to redirect all callers and
remove unused other call), or thunks (otherwise).

Thunks indeed can slow things down somewhat, especially if they can't tail
call the function.

Jakub


Re: [patch 3/10] debug-early merge: C++ front-end

2015-05-08 Thread Richard Biener
On May 8, 2015 8:48:26 PM GMT+02:00, Aldy Hernandez  wrote:
>On 05/08/2015 04:57 AM, Richard Biener wrote:
>> On Fri, May 8, 2015 at 2:34 AM, Aldy Hernandez 
>wrote:
>>>
>>
>> Maybe you can split out the Java aliases stuff (that annoyed me
>multiple times
>> when trying to refactor the FE - middle-end interface).  It looks
>> unrelated enough.
>>
>> Thanks,
>> Richard.
>>
>
>Jason already reviewed that part going into the branch (and most of my 
>changes actually).  I'd rather concentrate on the other bits, while I'm
>
>under fire here :).  But if Jason also wants it split up, I'll oblige.

Just meant that it's making the changes smaller if those bits can be checked in 
independently. If that's just a hassle...

Richard.

>Aldy




[PATCH][PR66010] Don't take address of ap unless necessary

2015-05-08 Thread Tom de Vries

Hi,

this patch fixes PR66010.


I.

Consider this test-case, with a va_list passed from f2 to f2_1:
...
#include 

inline int __attribute__((always_inline))
f2_1 (va_list ap)
{
  return va_arg (ap, int);
}

int
f2 (int i, ...)
{
  int res;
  va_list ap;

  va_start (ap, i);
  res = f2_1 (ap);
  va_end (ap);

  return res;
}
...

When compiling at -O2, before eline we have:
...
f2_1 (struct  * apD.1832)
{
  intD.6 _3;

  # .MEM_2 = VDEF <.MEM_1(D)>
  # USE = anything
  # CLB = anything
  _3 = VA_ARG (&apD.1832, 0B);

  # VUSE <.MEM_2>
  return _3;
}

f2 (intD.6 iD.1835)
{
  struct  apD.1839[1];
  intD.6 resD.1838;
  intD.6 _6;

  # .MEM_2 = VDEF <.MEM_1(D)>
  # USE = anything
  # CLB = anything
  __builtin_va_startD.1030 (&apD.1839, 0);

  # .MEM_3 = VDEF <.MEM_2>
  # USE = anything
  # CLB = anything
  res_4 = f2_1D.1833 (&apD.1839);

  # .MEM_5 = VDEF <.MEM_3>
  # USE = anything
  # CLB = anything
  __builtin_va_endD.1029 (&apD.1839);

  _6 = res_4;

  # .MEM_7 = VDEF <.MEM_5>
  apD.1839 ={v} {CLOBBER};

  # VUSE <.MEM_7>
  return _6;
}
...

Because the va_list type is an array type:
...
  struct  apD.1839[1];
...

we're passing the location of the initial element:
...
  res_4 = f2_1D.1833 (&apD.1839);
...

And the type of the parameter in f2_1 is accordingly a pointer to array element:
...
f2_1 (struct  * apD.1832)
...

That means the address operator here is superfluous.
...
  _3 = VA_ARG (&apD.1832, 0B);
...
Or, differently put, when we take the address of ap in va_start and va_end in 
f2, the result is a pointer to array element type.
When we take the address of ap in f2_2, the result is a pointer to pointer to 
array element type.


This extra indirection doesn't cause wrong code to be generated. The va_arg 
expansion code handles this correctly, thanks to the combination of:

- an unconditional build_fold_indirect_ref in expand_ifn_va_arg_1 which removes
  an indirection, and
- a fixup in gimplify_va_arg_internal that again adds an indirection in some
  cases.

The call gets inlined, and before pass_stdarg we have:
...
f2 (intD.6 iD.1835)
{
  struct  * apD.1849;
  struct  apD.1839[1];
  intD.6 _6;

  # .MEM_2 = VDEF <.MEM_1(D)>
  # USE = nonlocal escaped
  # CLB = nonlocal escaped { D.1839 } (escaped)
  __builtin_va_startD.1030 (&apD.1839, 0);

  # .MEM_3 = VDEF <.MEM_2>
  apD.1849 = &apD.1839;

  # .MEM_7 = VDEF <.MEM_3>
  # USE = nonlocal null { D.1839 D.1849 } (escaped)
  # CLB = nonlocal null { D.1839 D.1849 } (escaped)
  _6 = VA_ARG (&apD.1849, 0B);
...

And after expanding ifn_va_arg, we have:
...
f2 (intD.6 iD.1835)
{
  struct  * ap.3D.1853;
  struct  apD.1839[1];

  # .MEM_2 = VDEF <.MEM_1(D)>
  # USE = nonlocal escaped
  # CLB = nonlocal escaped { D.1839 } (escaped)
  __builtin_va_startD.1030 (&apD.1839, 0);

  ap_3 = &apD.1839;

  ap.3_10 = ap_3;

  # VUSE <.MEM_2>
  _11 = ap.3_10->gp_offsetD.2;
  
...

The pass_stdarg optimization fails:
...
f2: va_list escapes 1, needs to save all GPR units and all FPR units.
...

It fails on the superfluous address operator:
...
va_list escapes in ap_3 = &apD.1839;
...


II.

The patch prevents the superfluous address operator from being added.

It also removes the need for the fixup in gimplify_va_arg_internal, by deciding 
in gimplify_va_arg_expr whether the build_fold_indirect_ref in 
expand_ifn_va_arg_1 is needed before passing ap on to gimplify_va_arg_internal. 
This decision is encoded as an extra argument to ifn_va_arg.



III.

Using the patch, before inlining we can see the address operator has been 
removed in va_arg:

...
f2_1 (struct  * apD.1832)
{
  intD.6 _4;

  # .MEM_3 = VDEF <.MEM_1(D)>
  # USE = anything
  # CLB = anything

  _4 = VA_ARG (ap_2(D), 0B, 0);
  # VUSE <.MEM_3>
  return _4;
}
...

And after inlining, we see that va_start and va_arg now use the same ap:
...
f2 (intD.6 iD.1835)
{
  struct  apD.1839[1];

  # .MEM_2 = VDEF <.MEM_1(D)>
  # USE = anything
  # CLB = anything
  __builtin_va_startD.1030 (&apD.1839, 0);

  # .MEM_3 = VDEF <.MEM_2>
  # USE = anything
  # CLB = anything
  _8 = VA_ARG (&apD.1839, 0B, 0);
...

That allows the pass_stdarg optimization to succeed:
...
f2: va_list escapes 0, needs to save 8 GPR units and 0 FPR units.
...

Bootstrapped and reg-tested on x86_64, with and without -m32.

OK for trunk?

[ FWIW, I suspect this patch will make life easier for the reimplementation of 
the pass_stdarg optimization using ifn_va_arg. ]


Thanks,
- Tom
Don't take address of ap unless necessary

2015-05-08  Tom de Vries  

	PR tree-optimization/66010
	* gimplify.c (gimplify_modify_expr): Handle new do_deref argument of
	ifn_va_arg.
	* gimple.h (gimplify_va_arg_internal): Remove loc parameter.
	(gimplify_va_arg_internal): Remove loc parameter.  Assert no array-typed
	va_lists are passed, and remove corresponding handling.
	(gimplify_va_arg_expr): Only take address of ap if necessary.  Add
	do_deref argument to ifn_va_arg.
	* tree-stdarg.c (expand_ifn_va_arg_1): Handle new do_deref argument of
	ifn_va_arg.

	* c-common.

Re: [PATCH][PR66013] Update address_taken after ifn_va_arg expansion

2015-05-08 Thread Tom de Vries

On 08-05-15 17:31, Richard Biener wrote:

>OK for trunk?

As noted in one of the PRs I think that it is the proper time to
re-implement the stdarg optimization on the un-lowered form which
should also fix this.


AFAIU, the implementation of the stdarg optimization on the un-lowered form 
should contain an independent fix for this problem, and this fix won't be 
functional any more then, so indeed, it's a patch with (hopefully) a limited 
lifespan.


But I thought that the patch is simple and low-risk enough to accept for trunk 
now, hence the submission.


Also, I suppose it's not bad to start developing from a situation where more 
tests are passing.


Thanks,
- Tom


Re: [PATCH] Simple optimization for MASK_STORE.

2015-05-08 Thread Richard Biener
On May 8, 2015 8:43:15 PM GMT+02:00, Jeff Law  wrote:
>On 05/08/2015 03:27 AM, Richard Biener wrote:
>> On Wed, May 6, 2015 at 4:04 PM, Yuri Rumyantsev 
>wrote:
>>> Hi All,
>>>
>>> Here is a patch which gives us significant speed-up on HASWELL for
>>> test containing masked stores. The main goal of that patch is
>attempt
>>> to avoid HW hazard for maskmove instructions through inserting
>>> additional check on zero mask and putting all masked store
>statements
>>> into separate block on false edge.All MASK_STORE statements having
>the
>>> same mask put into one block. Any comments will be appreciate.
>>
>> Hmm.  I'm not very happy with this "optimization" happening at the
>> GIMPLE level - it feels more like a mdreorg thing...
>I haven't looked at the patch, but it sounds like just specialization 
>using a runtime check to select between the implementations which is 
>fairly natural to do at the gimple level.

Well, sure.  Which is why I suggested a un-ifcvt pass instead.

Anyway, the implementation has multiple issues.

Richard.

>Jeff




Re: [PATCH] Non-working jit patch for debug-early (was Re: [patch 0/10] debug-early merge)

2015-05-08 Thread Aldy Hernandez

On 05/08/2015 10:38 AM, David Malcolm wrote:


I tested your branch (at 09263eae7c260c305fa19ffa186afd1d89654fb8) with
the jit configuration from the docs:

../src/configure \
  --enable-host-shared \
--enable-languages=jit,c++ \
--disable-bootstrap \
--enable-checking=release \
--prefix=$PREFIX

Sadly, the jit "frontend" fails to compile:


Whoops.  My bad.  I was unaware `jit' needed to be added to 
--enable-languages.  I thought it was tested automatically.




../../src/gcc/jit/jit-playback.c: In member function ‘void
gcc::jit::playback::context::write_global_decls_2()’:
../../src/gcc/jit/jit-playback.c:710:20: error: ‘const struct
gcc_debug_hooks’ has no member named ‘global_decl’
debug_hooks->global_decl (decl);


The basic idea is that if your globals do NOT make it to 
rest_of_decl_compilation(), you need to call 
debug_hooks->early_global_decl() on them manually after parsing.


On the other hand, if your functions do NOT make it to the symbol table 
then you also need to call debug_hooks->early_global_decl() on them 
after parsing (see finalize_compilation_unit()).


The call to debug_hooks->late_global_decl() should be handled 
automagically.  I mean, I assume your symbols (functions and globals, 
etc) make it to the symbol table, in which case they'll be picked up by 
either compile_file() or by analyze_functions().  The latter in case the 
symbol was optimized away and is about to be removed from the symbol table.


Does this help?  If it doesn't, I can gladly take over this on Monday.


 ^
since the "global_decl" debug hook has gone away.  I see that
   LANG_HOOKS_WRITE_GLOBALS
also is no more, and this leads to various code in the jit becoming
dead:
../../src/gcc/jit/dummy-frontend.c:225:1: warning: ‘void
jit_langhook_write_globals()’ defined but not used [-Wunused-function]


The attached patch gets it to compile, and eliminates the now-dead code,
but it's not clear to me how global variables are meant to be created in
the debug-early world.


Thanks for working on this.

Aldy


Re: Question about patch for PR bootstrap/65150 (identical functions)

2015-05-08 Thread Jeff Law

On 05/08/2015 01:07 PM, David Edelsohn wrote:

Steve Ellcey wrote:


After your change GCC sees that the code for f1 and f2 are identical
so it replaced the body of f2 with a call to f1.  This optimization will
save space but it is not going to be faster because any call to f2 will
now include an extra call/return.  Do other platforms have this same issue
or is there a way to make f2 an alias for f1 on other targets so no extra
call is needed?  I looked around to see if there was a target function or
macro that is used to make one function an alias of another but I didn't
see anything.


This probably is not good for POWER, and probably not for ARM, in fact
probably not good for most RISC architectures.
But isn't this code going to be creating aliases when the output format 
supports them -- which avoids the call/return overheads?


Which might argue that if we don't have aliases, then ICF might need to 
be a -Os thing.


jeff


Re: Question about patch for PR bootstrap/65150 (identical functions)

2015-05-08 Thread David Edelsohn
>>> Steve Ellcey wrote:
>
> After your change GCC sees that the code for f1 and f2 are identical
> so it replaced the body of f2 with a call to f1.  This optimization will
> save space but it is not going to be faster because any call to f2 will
> now include an extra call/return.  Do other platforms have this same issue
> or is there a way to make f2 an alias for f1 on other targets so no extra
> call is needed?  I looked around to see if there was a target function or
> macro that is used to make one function an alias of another but I didn't
> see anything.

This probably is not good for POWER, and probably not for ARM, in fact
probably not good for most RISC architectures.

- David


Re: [PATCH] Add SPECIAL_FLOAT_MODE to enable adding IEEE 128-bit floating point to PowerPC

2015-05-08 Thread Jeff Law

On 05/06/2015 11:29 AM, Michael Meissner wrote:

On Wed, May 06, 2015 at 04:03:00PM +0100, Richard Sandiford wrote:

Jeff Law  writes:

So my worry here is that folks writing these loops to iterate over modes
are going to easily miss the != VOIDmode terminator, or not know when to
use GET_MODE_WIDER_SPECIAL.

We can certainly go with the patch as-is since you've done the work to
sort out which GET_MODE_WIDER to use and added the appropriate
termination checks.   But do we want to try to future proof this a
little and define two iterators for folks to use rather than write the
loops by hand every time and probably getting it wrong -- and wrong in
such a way that it only breaks on PPC, forcing someone to regularly be
fixing this stuff


If they miss the != VOIDmode, the program will hang since it will never exit
the loop (VOIDmode is the wider type for VOIDmode).
OK.  And presumably if someone is adding a new loop over the modes 
they'll actually be testing that code on whatever target they're using. 
 So it's unlikely they'll introduce an infinite loop on other targets 
by accident.






Yeah.  I might be wrong, but I don't think the emit-rtl.c code
that uses GET_MODE_WIDER_MODE_SPECIAL actually cares about one thing
being wider than another.  It just wants to iterate over _all_ modes
of a particular class.  So maybe we could just convert them to iterate
over everything between MIN_MODE_foo and MAX_MODE_foo (already defined
in insn-modes.h).  Agree proper iterators would be even nicer though :-)


The code in emit-rtl.c that uses GET_MODE_WIDER_MODE_SPECIAL just is
initializing all of the types.  There are 2 functions:

init_derived_machine_modes -- this really doesn't need special, since it is
just looking at the INT types, looking to define byte_mode, word_mode, and
ptr_mode to appropriate integer types.

init_emit_once -- this is initializing all of the special constants (-1.0, 0.0,
1.0, etc.) for each of the modes.  The only one that really needs to use
_SPECIAL is the floating point loop.  When I was making the change months ago,
I just used _SPECIAL in all of the places, just in case we ever needed to have
an INT special type, or decimal float, etc.
I wonder if we're iterating over all the modes if we should just iterate 
to # modes rather than using the GET_WIDER stuff.



Perhaps it is simpler just to have a target hook that says whether a given
conversion can happen automatically (as opposed to explicitly if asked for by
the user).
Maybe.  I may be over-thinking the issues here -- mostly I just want to 
make sure we don't introduce something folks get wrong easily and in 
turn break ports which depend on this stuff.


Jeff



RE: [PATCH 6/13] mips musl support

2015-05-08 Thread Matthew Fortune
Jeff Law  writes:
> On 05/08/2015 10:50 AM, Joseph Myers wrote:
> >
> > Note that however the dynamic linker does properly need to save and
> > restore call-clobbered registers used for argument passing (because of
> > IFUNCs, user-provided malloc, audit hooks etc. that might affect them
> > even if the dynamic linker itself doesn't); see
> > .  So any
> > floating-point-agnostic dynamic linker would, if fixing the bugs
> > around not saving / restoring such registers, need to have
> > runtime-conditional code to save and restore them rather than simple
> > compile-time conditionals.
> Right.  So there has to be some reasonable cost way to find out if you
> have FPU registers at runtime, then select between the code paths at
> runtime.

Indeed and I think there are many ways to achieve that without hardware
support as the cost of loading a global variable in the dynamic linker
wouldn't be significant. I think MIPS ABIs are the only ones with enough
information available at runtime to achieve this currently but the
principles should apply to any arch.

The work we are investigating as part of PR65862 will help all this
as the intention is to avoid FPR usage unless floating point is actually
used. There is then some thinking involved in figuring out what no-float
should really mean: i.e. no floating point types used, no FPU insns used
and/or no floating point in any of the calls/global functions. I haven't
spent enough time thinking about which ones are the most important from
above yet.

Matthew


Re: [patch 5/10] debug-early merge: Go front-end

2015-05-08 Thread Aldy Hernandez

On 05/08/2015 11:08 AM, Ian Lance Taylor wrote:

This is fine if it works.  Thanks.

Ian

On Thu, May 7, 2015 at 5:36 PM, Aldy Hernandez  wrote:




As mentioned, no regressions with --enable-languages=go.

I will mark the Go changes as approved pending on the rest of the 
patches being approved.


Thanks.


Re: [debug-early] fix -fdump-go-spec

2015-05-08 Thread Aldy Hernandez



Thanks for working on this.  Have you tried building with
--enable-languages=go?  On a GNU/Linux system it should build and pass
all tests with no extra effort.


Yes.  No regressions.

Thanks.
Aldy


Re: [PATCH 2/6] Merge expand_asm_operands into expand_asm_stmt

2015-05-08 Thread Jeff Law

On 05/07/2015 03:38 PM, Richard Henderson wrote:

Prepatory to converting from tree chains to vectors.
---
  gcc/cfgexpand.c | 167 
  1 file changed, 72 insertions(+), 95 deletions(-)

OK with a ChangeLog and the usual testing.

jeff



Re: [RFA] libiberty/mkstemps.c: Include if not available.

2015-05-08 Thread Jeff Law

On 05/08/2015 08:38 AM, Joel Brobecker wrote:

Hello,

Attempting to build libiberty on LynxOS-178 fails trying to compile
mkstemps.c with the following error:
LynxOS?  I haven't had to do anything with that since, umm, the early 
90s.  So sorry you've got that task...




libiberty/ChangeLog:

 * mkstemps.c: #include  if HAVE_TIME_H is defined
 but not HAVE_SYS_TIME_H.

OK to commit?

OK.
jeff


Re: [patch 0/29] RFC: Use automake-1.11.6 across the tree

2015-05-08 Thread Jeff Law

On 05/07/2015 09:51 AM, Michael Haubenwallner wrote:


Are there any cases where you had to do something other than just regenerate 
the various files?


Nope - at least nothing that I would call "doing something other". What I did:
* touch each configure.ac to ensure automake is really used
* do 'make bootstrap' with one single job (updating scripts while running them 
is bad)
* once-off add "testsuite/other-tests/Makefile" to AC_CONFIG_FILES in 
libvtv/configure.ac,
   as that is unused but shows up in the "by automake 1.11.x" search


If not, then as long as you fix the ChangeLog entries per Jakub's comments and 
ensure that you've also tested Ada, then this can be installed into the trunk.


Sure, and two more:
* Sort out whether to update those top-level "missing" scripts.

Seems like we should if they came from automake.


* Bump to automake 1.11.6 even in gcc/doc/install.texi, patch attached.

Yup.

Presumably there's some reason why we're not stepping to 1.12 that I 
missed in the discussion?


Jeff



Re: [patch 3/10] debug-early merge: C++ front-end

2015-05-08 Thread Aldy Hernandez

On 05/08/2015 04:57 AM, Richard Biener wrote:

On Fri, May 8, 2015 at 2:34 AM, Aldy Hernandez  wrote:




Maybe you can split out the Java aliases stuff (that annoyed me multiple times
when trying to refactor the FE - middle-end interface).  It looks
unrelated enough.

Thanks,
Richard.



Jason already reviewed that part going into the branch (and most of my 
changes actually).  I'd rather concentrate on the other bits, while I'm 
under fire here :).  But if Jason also wants it split up, I'll oblige.


Aldy


Re: [PATCH 6/6] i386: Implement asm flag outputs

2015-05-08 Thread Jeff Law

On 05/08/2015 12:40 PM, H. Peter Anvin wrote:

On 05/07/2015 02:39 PM, Richard Henderson wrote:

All j mnemonics implemented as =@cc
to make it easy for someone reading the manual
to figure out what condition is desired.


One request: would it be possible to get a cpp symbol for this (e.g.
__GCC_X86_INLINE_ASM_CC__) so we don't have to do explicit gcc version
checks?

Probably wise.  I hate version # checks.
jeff


Re: [PATCH] Simple optimization for MASK_STORE.

2015-05-08 Thread Jeff Law

On 05/08/2015 03:27 AM, Richard Biener wrote:

On Wed, May 6, 2015 at 4:04 PM, Yuri Rumyantsev  wrote:

Hi All,

Here is a patch which gives us significant speed-up on HASWELL for
test containing masked stores. The main goal of that patch is attempt
to avoid HW hazard for maskmove instructions through inserting
additional check on zero mask and putting all masked store statements
into separate block on false edge.All MASK_STORE statements having the
same mask put into one block. Any comments will be appreciate.


Hmm.  I'm not very happy with this "optimization" happening at the
GIMPLE level - it feels more like a mdreorg thing...
I haven't looked at the patch, but it sounds like just specialization 
using a runtime check to select between the implementations which is 
fairly natural to do at the gimple level.


Jeff



RE: [patch 1/28] top-level: Use automake-1.11.6

2015-05-08 Thread Bernd Edlinger
Hi,

On Fri, 8 May 2015 16:41:02, Joseph S. Myers wrote:
>
> On Fri, 8 May 2015, Bernd Edlinger wrote:
>
>> One example where there is an incompatibility is "missing":
>>
>> Formerly it had code that emulated the missing "flex" by
>> creating a dummy lex.yy.c from the hopefully installed
>> pre-compiled flex output file.  But the version from the
>> trunk does nothing, which breaks all configure scripts
>> that used AM_PROG_LEX.  I do assume that the
>> automake scripts just use a different way to achieve
>> the same goal, if flex is not installed.
>
> It seems like a bug to me that "missing" changed its interface. However,
> since GCC doesn't use flex in any directory that uses, or is a
> subdirectory of a directory that uses, automake, clearly that change is of
> no relevance to the version of automake used in GCC. In any case, GCC
> release tarballs should always have timestamps in the right order for
> non-checked-in generated files, and contrib/gcc_update should always be
> used when checking out checked-in generated files to get the timestamps in
> the right order, so no supported case of building GCC should ever get as
> far as trying to use "missing" to regenerate something unless there are
> bugs in the makefiles, gcc_update etc.
>

But it made the in-tree gmp configure script fail.  That would not
have happened if we did not pass our version of missing to a sub-
module like gmp, that already has a working missing script that behaves
differently.

Fortunately gmp does not really need flex for anything,
except one example.



Bernd.
  

Re: [PATCH 6/6] i386: Implement asm flag outputs

2015-05-08 Thread H. Peter Anvin
On 05/07/2015 02:39 PM, Richard Henderson wrote:
> All j mnemonics implemented as =@cc
> to make it easy for someone reading the manual
> to figure out what condition is desired.

One request: would it be possible to get a cpp symbol for this (e.g.
__GCC_X86_INLINE_ASM_CC__) so we don't have to do explicit gcc version
checks?

-hpa




Re: genrecog: Address -Wsign-compare diagnostics

2015-05-08 Thread Jeff Law

On 05/08/2015 03:09 AM, Thomas Schwinge wrote:

Hi!

On Mon, 27 Apr 2015 11:20:30 +0100, Richard Sandiford 
 wrote:

This patch [...] by replacing most of genrecog [...]


OK to commit?

Is it a bug that I'm seeing these warnings only in the stage 1 build with
the bootstrap GCC 4.6 compiler, but not anymore later on?  (I have not
verified the C++ standard on the rules for »comparison between signed and
unsigned integer expressions«.)

commit efef4f38205a13da90ca19b6eec1a6526756b433
Author: Thomas Schwinge 
Date:   Fri May 8 10:55:19 2015 +0200

 genrecog: Address -Wsign-compare diagnostics.

 g++-4.6 [...] [...]/gcc/genrecog.c
 [...]/gcc/genrecog.c: In function 'state_size find_subroutines(routine_type, 
state*, vec&)':
 [...]/gcc/genrecog.c:3338:35: warning: comparison between signed and 
unsigned integer expressions [-Wsign-compare]
 [...]/gcc/genrecog.c:3347:37: warning: comparison between signed and 
unsigned integer expressions [-Wsign-compare]
 [...]/gcc/genrecog.c:3359:29: warning: comparison between signed and 
unsigned integer expressions [-Wsign-compare]
 [...]/gcc/genrecog.c:3365:32: warning: comparison between signed and 
unsigned integer expressions [-Wsign-compare]

 3305   state_size size;
  [...]
 3337   state_size to_size = find_subroutines (type, trans->to, 
procs);
 3338   if (d->next && to_size.depth > MAX_DEPTH)
  [...]
 3347   if (to_size.num_statements < MIN_NUM_STATEMENTS)
  [...]
 3359   if (size.num_statements > MAX_NUM_STATEMENTS)
  [...]
 3365  && size.num_statements > MAX_NUM_STATEMENTS)

  175 static const int MAX_DEPTH = 6;
  [...]
  179 static const int MIN_NUM_STATEMENTS = 5;
  [...]
  185 static const int MAX_NUM_STATEMENTS = 200;
  [...]
 3258 struct state_size
 3259 {
  [...]
 3261   unsigned int num_statements;
  [...]
 3265   unsigned int depth;
 3266 };

gcc/
* genrecog.c (MAX_DEPTH, MIN_NUM_STATEMENTS, MAX_NUM_STATEMENTS):
Change to unsigned int.
---
  gcc/genrecog.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
OK with a ChangeLog and the usual testing.  Or you can verify the output 
of genrecog doesn't change before/after if you don't want to go through 
the full bootstrap.


jeff



Re: [PATCH 6/13] mips musl support

2015-05-08 Thread Jeff Law

On 05/08/2015 10:50 AM, Joseph Myers wrote:


Note that however the dynamic linker does properly need to save and
restore call-clobbered registers used for argument passing (because of
IFUNCs, user-provided malloc, audit hooks etc. that might affect them even
if the dynamic linker itself doesn't); see
.  So any
floating-point-agnostic dynamic linker would, if fixing the bugs around
not saving / restoring such registers, need to have runtime-conditional
code to save and restore them rather than simple compile-time
conditionals.
Right.  So there has to be some reasonable cost way to find out if you 
have FPU registers at runtime, then select between the code paths at 
runtime.



Jeff


Re: [PATCH 6/13] mips musl support

2015-05-08 Thread Jeff Law

On 05/08/2015 08:25 AM, Matthew Fortune wrote:


There is also the perspective that we should be able to aim for
an ABI variant agnostic dynamic linker at some point over the next
year by working towards a build that truly uses no float and is
hence compatible with all the ABI variants.
Having seen the pain around this for ARM up close and personal, if you 
can see a path to that goal, I'd suggest running as fast as you can to 
that goal.


jeff


Re: update docs for --enable-languages

2015-05-08 Thread Jeff Law

On 05/07/2015 04:15 PM, Jim Wilson wrote:

ping

https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01690.html

OK.  Must have missed it when it flew by -- sorry.

jeff



Re: [PATCH 5/6] i386: Add CCPmode

2015-05-08 Thread Jeff Law

On 05/07/2015 03:38 PM, Richard Henderson wrote:

For testing parity coming out of asm flags.
---
  gcc/config/i386/i386-modes.def |  2 ++
  gcc/config/i386/i386.c | 19 +++
  2 files changed, 13 insertions(+), 8 deletions(-)

Seems like it ought to move forward now.

Oh yea, I guess you should consider my prior messages as reviews with 
the following note.


Need ChangeLog entry and testing.  With those good for the trunk.

jeff



Re: [PATCH 3/6] Canonicalize asm volatility earlier

2015-05-08 Thread Jeff Law

On 05/07/2015 03:38 PM, Richard Henderson wrote:

If gimple_asm_volatile_p is correct, no point re-checking.
This is also done by the C and C++ front ends, but not Ada.
So we can't yet trust ASM_VOLATILE_P from the front end.
---
  gcc/cfgexpand.c | 11 +++
  gcc/gimplify.c  |  2 +-
  2 files changed, 4 insertions(+), 9 deletions(-)
Also seems like it ought to be able to go forward independently now 
rather than waiting.


jeff



Re: [PATCH 1/6] Only resolve_asm_operand_names once

2015-05-08 Thread Jeff Law

On 05/07/2015 03:38 PM, Richard Henderson wrote:

We do it in the front end already; no need to repeat.
---
  gcc/cfgexpand.c | 2 --
  gcc/stmt.c  | 7 ---
  2 files changed, 4 insertions(+), 5 deletions(-)
Any reason this shouldn't go into the tree immediately?  Seems like it 
stands on its own.


jeff



Re: [patch 5/10] debug-early merge: Go front-end

2015-05-08 Thread Ian Lance Taylor
This is fine if it works.  Thanks.

Ian

On Thu, May 7, 2015 at 5:36 PM, Aldy Hernandez  wrote:
>


Re: [debug-early] fix -fdump-go-spec

2015-05-08 Thread Ian Lance Taylor
On Wed, Apr 29, 2015 at 5:56 PM, Aldy Hernandez  wrote:
>
> Despite what Go thinks:
>
>   /* The debug hooks are used to implement -fdump-go-spec because it
>  gives a simple and stable API for all the information we need to
>  dump.  */
>
> ...the debug hooks are not stable... :).

Alas.


> With this patch I have done my best to give Go what it wants without
> recreating what the front-ends were doing.  I've made the go_decl() call
> work from within the early_global_decl() hook which gets called as we parse
> (rest_of_decl_compilation).  I far as I understand, this hack is a one-time
> thing for use internally in the build process, so we don't care whether
> go_decl() will receive location information??

That is true: the goal is to output the declarations in Go syntax;
location information is irrelevant.


> Is there not a more modern way of Go getting the DECLs it needs without
> abusing the debug_hook machinery?

I don't know.

Thanks for working on this.  Have you tried building with
--enable-languages=go?  On a GNU/Linux system it should build and pass
all tests with no extra effort.

Ian


Question about patch for PR bootstrap/65150 (identical functions)

2015-05-08 Thread Steve Ellcey
Jan and Martin,

I just noticed that your patch for PR bootstrap/65150 broke one of the
MIPS tests (gcc.target/mips/branch-1.c).  I can fix the test with no
problem but I am wondering if the change I am seeing with your patch 
is intended or not.

A cutdown version of the test is:

void bar (void);
void f1 (int x) { if (x & 4) bar (); }
void f2 (int x) { if ((x >> 2) & 1) bar (); }

After your change GCC sees that the code for f1 and f2 are identical
so it replaced the body of f2 with a call to f1.  This optimization will
save space but it is not going to be faster because any call to f2 will
now include an extra call/return.  Do other platforms have this same issue
or is there a way to make f2 an alias for f1 on other targets so no extra
call is needed?  I looked around to see if there was a target function or
macro that is used to make one function an alias of another but I didn't
see anything.

Steve Ellcey
sell...@imgtec.com


Re: [patch 9/10] debug-early merge: testsuite changes

2015-05-08 Thread Mike Stump
On May 7, 2015, at 5:39 PM, Aldy Hernandez  wrote:

So, I don’t feel there is anything in there for me to review, I’d like the 
front-end maintainer to review.



dearly-testsuite.patch
Description: Binary data




Re: [patch 8/10] debug-early merge: Objective-C front-end

2015-05-08 Thread Mike Stump
On May 7, 2015, at 5:38 PM, Aldy Hernandez  wrote:

Ok.


  1   2   >