[PATCH] pr 65702 - error out for invalid register asms earlier

2016-01-25 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

$subject.  To avoid regressions I kept the checks when generating rtl, but I
believe its impossible for those to trigger now and we can remove the checks.

bootstrapped + regtested on x86_64-linux-gnu, ok?

Trev

gcc/c/ChangeLog:

2016-01-25  Trevor Saunders  

* c-decl.c (finish_decl): Check if asm register is valid.

gcc/ChangeLog:

2016-01-25  Trevor Saunders  

* varasm.c (register_asmspec_ok_p): New function.
(make_decl_rtl): Adjust.
* varasm.h (register_asmspec_ok_p): New prototype.

gcc/cp/ChangeLog:

2016-01-25  Trevor Saunders  

* decl.c (make_rtl_for_nonlocal_decl): Check if register asm is
valid.
---
 gcc/c/c-decl.c|   8 +-
 gcc/cp/decl.c |   4 +-
 gcc/testsuite/g++.dg/torture/register-asm-1.C |  14 +++
 gcc/testsuite/gcc.dg/reg-vol-struct-1.c   |   2 +-
 gcc/testsuite/gcc.dg/torture/register-asm-1.c |  12 +++
 gcc/varasm.c  | 150 +++---
 gcc/varasm.h  |   3 +
 7 files changed, 129 insertions(+), 64 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/torture/register-asm-1.C
 create mode 100644 gcc/testsuite/gcc.dg/torture/register-asm-1.c

diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 1ec6042..9257f35 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -4867,7 +4867,9 @@ finish_decl (tree decl, location_t init_loc, tree init,
   when a tentative file-scope definition is seen.
   But at end of compilation, do output code for them.  */
DECL_DEFER_OUTPUT (decl) = 1;
- if (asmspec && C_DECL_REGISTER (decl))
+ if (asmspec
+ && C_DECL_REGISTER (decl)
+ && register_asmspec_ok_p (decl, asmspec, DECL_MODE (decl)))
DECL_HARD_REGISTER (decl) = 1;
  rest_of_decl_compilation (decl, true, 0);
}
@@ -4878,7 +4880,9 @@ finish_decl (tree decl, location_t init_loc, tree init,
 in a particular register.  */
  if (asmspec && C_DECL_REGISTER (decl))
{
- DECL_HARD_REGISTER (decl) = 1;
+ if (register_asmspec_ok_p (decl, asmspec, DECL_MODE (decl)))
+   DECL_HARD_REGISTER (decl) = 1;
+
  /* This cannot be done for a structure with volatile
 fields, on which DECL_REGISTER will have been
 reset.  */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f4604b6..6d130bd 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6201,7 +6201,9 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const 
char* asmspec)
   /* The `register' keyword, when used together with an
 asm-specification, indicates that the variable should be
 placed in a particular register.  */
-  if (VAR_P (decl) && DECL_REGISTER (decl))
+  if (VAR_P (decl)
+ && DECL_REGISTER (decl)
+ && register_asmspec_ok_p (decl, asmspec, DECL_MODE (decl)))
{
  set_user_assembler_name (decl, asmspec);
  DECL_HARD_REGISTER (decl) = 1;
diff --git a/gcc/testsuite/g++.dg/torture/register-asm-1.C 
b/gcc/testsuite/g++.dg/torture/register-asm-1.C
new file mode 100644
index 000..b5cfc84
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/register-asm-1.C
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+class A {
+ int m_fn1() const;
+};
+int a[1];
+int b;
+int A::m_fn1() const {
+   register int c asm(""); // { dg-error "invalid register name for 'c'" }
+   while (b)
+   if (a[5])
+   c = b;
+   return c;
+}
diff --git a/gcc/testsuite/gcc.dg/reg-vol-struct-1.c 
b/gcc/testsuite/gcc.dg/reg-vol-struct-1.c
index b885f91..e67c7a2 100644
--- a/gcc/testsuite/gcc.dg/reg-vol-struct-1.c
+++ b/gcc/testsuite/gcc.dg/reg-vol-struct-1.c
@@ -12,7 +12,7 @@ f (void)
 {
   register struct S a;
   register struct S b[2];
-  register struct S c __asm__("nosuchreg"); /* { dg-error "object with 
volatile field" "explicit reg name" } */
+  register struct S c __asm__("nosuchreg"); /* { dg-error "invalid register 
name for 'c'|cannot put object with volatile field into register" } */
   &a; /* { dg-error "address of register" "explicit address" } */
   b; /* { dg-error "address of register" "implicit address" } */
 }
diff --git a/gcc/testsuite/gcc.dg/torture/register-asm-1.c 
b/gcc/testsuite/gcc.dg/torture/register-asm-1.c
new file mode 100644
index 000..1949f62
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/register-asm-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+   int a[1], b;
+int
+foo ()
+{
+register int c asm (""); /* { dg-error "invalid register name for 'c'" } */
+  while (b)
+   if (a[5])
+ c = b;
+return c;
+}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 3a3573e..7e3aebc9 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1270,6 +1270,55 @@ ultimate_transparent_alias_target (tree *alias)
   return 

[PATCH] obsolete the deprecated rtems targets

2016-02-03 Thread tbsaunde+gcc
From: Trevor Saunders 

hi,

Joel said in http://gcc.gnu.org/ml/gcc/2016-01/msg00016.html we should drop
support for these targets because rtems has stopped supporting them, so this
marks them as obsolete and we can remove them in gcc 7.

tested building for {avr,h8300,m32r}-rtems without --enable-obsolete fails, and
make all-gcc for i686-linux-gnu succeeds.  ok?

Trev

gcc/ChangeLog:

2016-02-03  Trevor Saunders  

* config.gcc: Mark deprecated rtems targets as obsolete.
---
 gcc/config.gcc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index c602358..e26742e 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -240,6 +240,9 @@ case ${target} in
  | *-knetbsd-* \
  | *-openbsd2* \
  | *-openbsd3* \
+ | avr-*rtems* \
+ | h8300-*rtems*   \
+ | m32r-*rtems*\
  )
 if test "x$enable_obsolete" != xyes; then
   echo "*** Configuration ${target} is obsolete." >&2
-- 
2.7.0



[PATCH] add basic .gitattributes files to notice whitespace issues

2016-02-04 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

We can tell git to highlight whitespace errors in diffs, and if you enable the
default pre-commit hook git won't allow you to make a commit with a whitespace
error violating the rules you told it about.  These files as are could be
improved some, they don't enforce  whitespace rules on testsuite .exp files, and
I'm not sure if we want to allow whitespace errors in testsuites for libraries,
but I'd like to see if other people can suggest other improvements.

Trev



gcc/testsuite/ChangeLog:

2016-02-04  Trevor Saunders  

* .gitattributes: New file.

ChangeLog:

2016-02-04  Trevor Saunders  

* .gitattributes: New file.
---
 .gitattributes   | 1 +
 gcc/testsuite/.gitattributes | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 .gitattributes
 create mode 100644 gcc/testsuite/.gitattributes

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000..b38d7f1
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.{c,C,cc,h} whitespace=indent-with-non-tab,space-before-tab,trailing-space
diff --git a/gcc/testsuite/.gitattributes b/gcc/testsuite/.gitattributes
new file mode 100644
index 000..562b12e
--- /dev/null
+++ b/gcc/testsuite/.gitattributes
@@ -0,0 +1 @@
+* -whitespace
-- 
2.7.0



[PATCH] teach mklog to look in the current directory for ChangeLog files

2016-02-28 Thread tbsaunde+gcc
From: Trevor Saunders 

 when run in repos other than gcc mklog fails to find ChangeLog files
because it looks for $0/../$dir/ChangeLog, but of course if the diff is
for a project other than gcc that might not exist.  It should be fine to
also look for $cwd/$dir/ChangeLog, and use that if we find it.  This
means that for example in binutils-gdb.git you can do git commit,
and then in your editor read git diff HEAD~ | mklog - to generate a
template ChangeLog for that commit.

I've tested mklog still generates the write ChangeLog entries for gcc and 
binutils repos, ok?

Trev

contrib/ChangeLog:

2016-02-28  Trevor Saunders  

* mklog: Look for the ChangeLog file in $cwd.
---
 contrib/mklog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/mklog b/contrib/mklog
index 455614b..6112628 100755
--- a/contrib/mklog
+++ b/contrib/mklog
@@ -104,7 +104,7 @@ sub get_clname ($) {
my $dirname = $_[0];
while ($dirname) {
my $clname = "$dirname/ChangeLog";
-   if (-f "$gcc_root/$clname") {
+   if (-f "$gcc_root/$clname" || -f "$clname") {
my $relname = substr ($_[0], length ($dirname) + 1);
return ($clname, $relname);
} else {
-- 
2.7.0



[PATCH] remove some usage of expr_list from read_rtx

2015-07-12 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

It seems much simpler for read_rtx to just add rtxs to a vector than to deal
with a bunch of expr list rtxen.


bootstrapped + regtested on x86_64-linux-gnu, ok?

Trev

gcc/ChangeLog:

2015-07-12  Trevor Saunders  

* gensupport.c (rtx_handle_directive): Adjust.
* read-rtl.c (apply_iterators): Take vector to add rtxs to
instead of expr list rtx.
(add_define_attr_for_define_subst): Likewise.
(add_define_subst_attr): Likewise.
(read_subst_mapping): Likewise.
(read_rtx): Likewise.
* rtl.h (read_rtx): Adjust.
---
 gcc/gensupport.c | 12 
 gcc/read-rtl.c   | 47 ---
 gcc/rtl.h|  2 +-
 3 files changed, 25 insertions(+), 36 deletions(-)

diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index 729366c..e673b5c 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -26,6 +26,7 @@
 #include "errors.h"
 #include "read-md.h"
 #include "gensupport.h"
+#include "vec.h"
 
 #define MAX_OPERANDS 40
 
@@ -2248,11 +2249,14 @@ process_define_subst (void)
 static void
 rtx_handle_directive (int lineno, const char *rtx_name)
 {
-  rtx queue, x;
+  auto_vec subrtxs;
+  if (!read_rtx (rtx_name, &subrtxs))
+return;
 
-  if (read_rtx (rtx_name, &queue))
-for (x = queue; x; x = XEXP (x, 1))
-  process_rtx (XEXP (x, 0), lineno);
+  rtx x;
+  unsigned int i;
+  FOR_EACH_VEC_ELT (subrtxs, i, x)
+process_rtx (x, lineno);
 }
 
 /* Comparison function for the mnemonic hash table.  */
diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index e8c849f..0f9e618 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -506,7 +506,7 @@ add_current_iterators (void **slot, void *data 
ATTRIBUTE_UNUSED)
Build a list of expanded rtxes in the EXPR_LIST pointed to by QUEUE.  */
 
 static void
-apply_iterators (rtx original, rtx *queue)
+apply_iterators (rtx original, vec *queue)
 {
   unsigned int i;
   const char *condition;
@@ -519,8 +519,7 @@ apply_iterators (rtx original, rtx *queue)
 {
   /* Raise an error if any attributes were used.  */
   apply_attribute_uses ();
-  XEXP (*queue, 0) = original;
-  XEXP (*queue, 1) = NULL_RTX;
+  queue->safe_push (original);
   return;
 }
 
@@ -572,8 +571,7 @@ apply_iterators (rtx original, rtx *queue)
}
}
   /* Add the new rtx to the end of the queue.  */
-  XEXP (*queue, 0) = x;
-  XEXP (*queue, 1) = NULL_RTX;
+  queue->safe_push (x);
 
   /* Lexicographically increment the iterator value sequence.
 That is, cycle through iterator values, starting from the right,
@@ -590,10 +588,6 @@ apply_iterators (rtx original, rtx *queue)
break;
  iterator->current_value = iterator->values;
}
-
-  /* At least one more rtx to go.  Allocate room for it.  */
-  XEXP (*queue, 1) = rtx_alloc (EXPR_LIST);
-  queue = &XEXP (*queue, 1);
 }
 }
 
@@ -945,7 +939,7 @@ read_mapping (struct iterator_group *group, htab_t table)
define_subst ATTR_NAME should be applied.  This attribute is set and
defined implicitly and automatically.  */
 static void
-add_define_attr_for_define_subst (const char *attr_name, rtx *queue)
+add_define_attr_for_define_subst (const char *attr_name, vec *queue)
 {
   rtx const_str, return_rtx;
 
@@ -960,14 +954,13 @@ add_define_attr_for_define_subst (const char *attr_name, 
rtx *queue)
   XSTR (return_rtx, 1) = xstrdup ("no,yes");
   XEXP (return_rtx, 2) = const_str;
 
-  XEXP (*queue, 0) = return_rtx;
-  XEXP (*queue, 1) = NULL_RTX;
+  queue->safe_push (return_rtx);
 }
 
 /* This routine generates DEFINE_SUBST_ATTR expression with operands
ATTR_OPERANDS and places it to QUEUE.  */
 static void
-add_define_subst_attr (const char **attr_operands, rtx *queue)
+add_define_subst_attr (const char **attr_operands, vec *queue)
 {
   rtx return_rtx;
   int i;
@@ -978,8 +971,7 @@ add_define_subst_attr (const char **attr_operands, rtx 
*queue)
   for (i = 0; i < 4; i++)
 XSTR (return_rtx, i) = xstrdup (attr_operands[i]);
 
-  XEXP (*queue, 0) = return_rtx;
-  XEXP (*queue, 1) = NULL_RTX;
+  queue->safe_push (return_rtx);
 }
 
 /* Read define_subst_attribute construction.  It has next form:
@@ -992,18 +984,17 @@ add_define_subst_attr (const char **attr_operands, rtx 
*queue)
 
 static void
 read_subst_mapping (htab_t subst_iters_table, htab_t subst_attrs_table,
-   rtx *queue)
+   vec *queue)
 {
   struct mapping *m;
   struct map_value **end_ptr;
   const char *attr_operands[4];
-  rtx * queue_elem = queue;
   int i;
 
   for (i = 0; i < 4; i++)
 attr_operands[i] = read_string (false);
 
-  add_define_subst_attr (attr_operands, queue_elem);
+  add_define_subst_attr (attr_operands, queue);
 
   bind_subst_iter_and_attr (attr_operands[1], attr_operands[0]);
 
@@ -1015,11 +1006,7 @@ read_subst_mapping (htab_t subst_iters_table, htab_t 
subst_attrs_table,
   end_ptr = add_map_value (end_

[PATCH] fix compilation of vmsdbgout.c

2015-07-18 Thread tbsaunde+gcc
From: Trevor Saunders 

The debug-early branch renamed vmsdbgout_decl to
vmsdbgout_function_decl, but didn't update its prototype.

checked that the alpha and ia64 vms targets in config-list.mk can now build
all-gcc, and committing to trunk as obvious.

Trev

gcc/ChangeLog:

2015-07-18  Trevor Saunders  

* vmsdbgout.c (vmsdbgout_decl): Change name of prototyped
function to vmsdbgout_function_decl.
---
 gcc/ChangeLog   | 5 +
 gcc/vmsdbgout.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 095713d..128e08a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-18  Trevor Saunders  
+
+   * vmsdbgout.c (vmsdbgout_decl): Change name of prototyped
+   function to vmsdbgout_function_decl.
+
 2015-07-18  Uros Bizjak  
 
PR target/66922
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index f3ebd75..d41d4b2 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -163,7 +163,7 @@ static void vmsdbgout_end_function (unsigned int);
 static void vmsdbgout_begin_epilogue (unsigned int, const char *);
 static void vmsdbgout_end_epilogue (unsigned int, const char *);
 static void vmsdbgout_begin_function (tree);
-static void vmsdbgout_decl (tree);
+static void vmsdbgout_function_decl (tree);
 static void vmsdbgout_early_global_decl (tree);
 static void vmsdbgout_late_global_decl (tree);
 static void vmsdbgout_type_decl (tree, int);
-- 
2.4.0



[PATCH 3/4] remove unused TARGET_DEFERRED_OUTPUT_DEFS

2015-07-24 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-24  Trevor Saunders  

* config/rs6000/aix43.h (TARGET_DEFERRED_OUTPUT_DEFS): Remove.
* defaults.h (TARGET_DEFERRED_OUTPUT_DEFS): Likewise.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (TARGET_DEFERRED_OUTPUT_DEFS): Remove
documentation of TARGET_DEFERRED_OUTPUT_DEFS;
---
 gcc/config/rs6000/aix43.h | 5 -
 gcc/defaults.h| 6 --
 gcc/doc/tm.texi   | 9 -
 gcc/doc/tm.texi.in| 9 -
 4 files changed, 29 deletions(-)

diff --git a/gcc/config/rs6000/aix43.h b/gcc/config/rs6000/aix43.h
index 5bcd40f..512a634 100644
--- a/gcc/config/rs6000/aix43.h
+++ b/gcc/config/rs6000/aix43.h
@@ -150,11 +150,6 @@ do {   
\
 #undef LD_INIT_SWITCH
 #define LD_INIT_SWITCH "-binitfini"
 
-/* The IBM AIX 4.x assembler doesn't support forward references in
-   .set directives.  We handle this by deferring the output of .set
-   directives to the end of the compilation unit.  */
-#define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) true
-
 /* This target uses the aix64.opt file.  */
 #define TARGET_USES_AIX64_OPT 1
 
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 8684c58..3ecf9fd 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -85,12 +85,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
   while (0)
 #endif
 
-/* Decide whether to defer emitting the assembler output for an equate
-   of two values.  The default is to not defer output.  */
-#ifndef TARGET_DEFERRED_OUTPUT_DEFS
-#define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) false
-#endif
-
 /* This is how to output the definition of a user-level label named
NAME, such as the label on variable NAME.  */
 
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index faa3017..8495e5c 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -8272,15 +8272,6 @@ If @code{SET_ASM_OP} is defined, a default definition is 
provided which is
 correct for most systems.
 @end defmac
 
-@defmac TARGET_DEFERRED_OUTPUT_DEFS (@var{decl_of_name}, @var{decl_of_value})
-A C statement that evaluates to true if the assembler code which defines
-(equates) the symbol whose tree node is @var{decl_of_name} to have the value
-of the tree node @var{decl_of_value} should be emitted near the end of the
-current compilation unit.  The default is to not defer output of defines.
-This macro affects defines output by @samp{ASM_OUTPUT_DEF} and
-@samp{ASM_OUTPUT_DEF_FROM_DECLS}.
-@end defmac
-
 @defmac ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
 A C statement to output to the stdio stream @var{stream} assembler code
 which defines (equates) the weak symbol @var{name} to have the value
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 72a7f84..8f5f786 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -5840,15 +5840,6 @@ If @code{SET_ASM_OP} is defined, a default definition is 
provided which is
 correct for most systems.
 @end defmac
 
-@defmac TARGET_DEFERRED_OUTPUT_DEFS (@var{decl_of_name}, @var{decl_of_value})
-A C statement that evaluates to true if the assembler code which defines
-(equates) the symbol whose tree node is @var{decl_of_name} to have the value
-of the tree node @var{decl_of_value} should be emitted near the end of the
-current compilation unit.  The default is to not defer output of defines.
-This macro affects defines output by @samp{ASM_OUTPUT_DEF} and
-@samp{ASM_OUTPUT_DEF_FROM_DECLS}.
-@end defmac
-
 @defmac ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
 A C statement to output to the stdio stream @var{stream} assembler code
 which defines (equates) the weak symbol @var{name} to have the value
-- 
2.4.0



[PATCH 1/4] convert ASM_OUTPUT_ASCII to a hook

2015-07-24 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-25  Trevor Saunders  

* defaults.h (ASM_OUTPUT_ASCII): Remove default definition.
*doc/tm.texi: Regenerate.
* doc/tm.texi.in (ASM_OUTPUT_ASCII): Remove documentation of
removed macro.
* target.def (output_ascii): New hook.
* config/arm/aout.h, config/arm/arm-protos.h, config/arm/arm.c,
config/elfos.h, config/i386/att.h, config/i386/i386-protos.h,
config/i386/i386.c, config/i386/i386elf.h, config/mips/mips.c,
config/mips/mips.h, config/mmix/mmix-protos.h, config/mmix/mmix.c,
config/mmix/mmix.h, config/nvptx/nvptx-protos.h, config/nvptx/nvptx.c,
config/nvptx/nvptx.h, config/pa/pa-protos.h, config/pa/pa.c,
config/pa/pa.h, config/pdp11/pdp11-protos.h, config/pdp11/pdp11.c,
config/pdp11/pdp11.h, config/rs6000/rs6000-protos.h,
config/rs6000/rs6000.c, config/rs6000/xcoff.h, dwarf2asm.c,
output.h, varasm.c, varasm.h, vmsdbgout.c: Adjust.
---
 gcc/config/arm/aout.h |  5 +--
 gcc/config/arm/arm-protos.h   |  2 +-
 gcc/config/arm/arm.c  |  7 ++--
 gcc/config/elfos.h|  7 ++--
 gcc/config/i386/att.h | 13 +--
 gcc/config/i386/i386-protos.h |  2 +
 gcc/config/i386/i386.c| 77 +++
 gcc/config/i386/i386elf.h | 51 +-
 gcc/config/mips/mips.c|  2 +-
 gcc/config/mips/mips.h|  4 +-
 gcc/config/mmix/mmix-protos.h |  2 +-
 gcc/config/mmix/mmix.c|  4 +-
 gcc/config/mmix/mmix.h|  3 +-
 gcc/config/nvptx/nvptx-protos.h   |  2 +-
 gcc/config/nvptx/nvptx.c  |  2 +-
 gcc/config/nvptx/nvptx.h  |  5 +--
 gcc/config/pa/pa-protos.h |  2 +-
 gcc/config/pa/pa.c|  7 ++--
 gcc/config/pa/pa.h|  3 +-
 gcc/config/pdp11/pdp11-protos.h   |  2 +-
 gcc/config/pdp11/pdp11.c  |  6 +--
 gcc/config/pdp11/pdp11.h  |  3 +-
 gcc/config/rs6000/rs6000-protos.h |  2 +-
 gcc/config/rs6000/rs6000.c|  6 +--
 gcc/config/rs6000/xcoff.h |  2 +-
 gcc/defaults.h| 40 
 gcc/doc/tm.texi   | 14 +++
 gcc/doc/tm.texi.in| 11 +-
 gcc/dwarf2asm.c   |  2 +-
 gcc/output.h  |  2 +-
 gcc/target.def|  9 +
 gcc/varasm.c  | 47 
 gcc/varasm.h  |  2 +
 gcc/vmsdbgout.c   |  7 ++--
 34 files changed, 179 insertions(+), 176 deletions(-)

diff --git a/gcc/config/arm/aout.h b/gcc/config/arm/aout.h
index 6973d15..c5e63eb 100644
--- a/gcc/config/arm/aout.h
+++ b/gcc/config/arm/aout.h
@@ -241,9 +241,8 @@
   while (0)
 
 
-#undef  ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(STREAM, PTR, LEN)  \
-  output_ascii_pseudo_op (STREAM, (const unsigned char *) (PTR), LEN)
+#undef  TARGET_ASM_OUTPUT_ASCII
+#define TARGET_ASM_OUTPUT_ASCII output_ascii_pseudo_op
 
 /* Output a gap.  In fact we fill it with nulls.  */
 #undef  ASM_OUTPUT_SKIP
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 62f91ef..6fc4787d 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -144,7 +144,7 @@ extern int arm_attr_length_move_neon (rtx_insn *);
 extern int arm_address_offset_is_imm (rtx_insn *);
 extern const char *output_add_immediate (rtx *);
 extern const char *arithmetic_instr (rtx, int);
-extern void output_ascii_pseudo_op (FILE *, const unsigned char *, int);
+extern void output_ascii_pseudo_op (FILE *, const char *, size_t);
 extern const char *output_return_instruction (rtx, bool, bool, bool);
 extern void arm_poke_function_name (FILE *, const char *);
 extern void arm_final_prescan_insn (rtx_insn *);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index eeab8a8..f03abf7 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -18963,14 +18963,13 @@ int_log2 (HOST_WIDE_INT power)
 #define MAX_ASCII_LEN 51
 
 void
-output_ascii_pseudo_op (FILE *stream, const unsigned char *p, int len)
+output_ascii_pseudo_op (FILE *stream, const char *p, size_t len)
 {
-  int i;
   int len_so_far = 0;
 
   fputs ("\t.ascii\t\"", stream);
 
-  for (i = 0; i < len; i++)
+  for (size_t i = 0; i < len; i++)
 {
   int c = p[i];
 
@@ -19586,7 +19585,7 @@ arm_poke_function_name (FILE *stream, const char *name)
   length  = strlen (name) + 1;
   alignlength = ROUND_UP_WORD (length);
 
-  ASM_OUTPUT_ASCII (stream, name, length);
+  targetm.asm_out.output_ascii (stream, name, length);
   ASM_OUTPUT_ALIGN (stream, 2);
   x = GEN_INT ((unsigned HOST_WIDE_INT) 0xff00 + alignlength);
   assemble_aligned_integer (UNITS_PER_WORD, x);
diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h
index bcc3870..d2cbbfb 100644
--- a/gcc/config/elfos.h
+++ b/gcc/config/elfos.h
@@ -385,7 +385,7 @@ s

[PATCH 0/4] misc work to get rid of target macros

2015-07-24 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

$subject, this gets rid of 3 macros, and moves one more closer to being a hook.

each patch bootstrapped + regtested on x86_64-linux-gnu, and the series was run 
through config-list.mk, ok?

thanks!

Trev


Trevor Saunders (4):
  convert ASM_OUTPUT_ASCII to a hook
  make TLS_COMMON_ASM_OP a hook
  remove unused TARGET_DEFERRED_OUTPUT_DEFS
  define ASM_OUTPUT_LABEL to the name of a function

 gcc/config/arc/arc.h  |  3 +-
 gcc/config/arm/aout.h |  5 +--
 gcc/config/arm/arm-protos.h   |  2 +-
 gcc/config/arm/arm.c  |  7 ++--
 gcc/config/bfin/bfin.h|  5 +--
 gcc/config/elfos.h|  7 ++--
 gcc/config/frv/frv.h  |  6 +--
 gcc/config/i386/att.h | 13 +--
 gcc/config/i386/i386-protos.h |  2 +
 gcc/config/i386/i386.c| 77 +++
 gcc/config/i386/i386elf.h | 51 +-
 gcc/config/i386/sol2.h|  2 +-
 gcc/config/ia64/ia64-protos.h |  1 +
 gcc/config/ia64/ia64.c| 11 ++
 gcc/config/ia64/ia64.h|  8 +---
 gcc/config/lm32/lm32.h|  3 +-
 gcc/config/mep/mep.h  |  8 +---
 gcc/config/mips/mips.c|  2 +-
 gcc/config/mips/mips.h|  4 +-
 gcc/config/mmix/mmix-protos.h |  2 +-
 gcc/config/mmix/mmix.c|  4 +-
 gcc/config/mmix/mmix.h|  6 +--
 gcc/config/nvptx/nvptx-protos.h   |  2 +-
 gcc/config/nvptx/nvptx.c  |  2 +-
 gcc/config/nvptx/nvptx.h  |  5 +--
 gcc/config/pa/pa-protos.h |  3 +-
 gcc/config/pa/pa.c| 19 --
 gcc/config/pa/pa.h| 12 +-
 gcc/config/pdp11/pdp11-protos.h   |  2 +-
 gcc/config/pdp11/pdp11.c  |  6 +--
 gcc/config/pdp11/pdp11.h  |  3 +-
 gcc/config/rs6000/aix43.h |  5 ---
 gcc/config/rs6000/rs6000-protos.h |  3 +-
 gcc/config/rs6000/rs6000.c| 14 +--
 gcc/config/rs6000/xcoff.h |  5 +--
 gcc/config/spu/spu.h  |  3 +-
 gcc/config/visium/visium.h|  3 +-
 gcc/defaults.h| 58 +
 gcc/doc/tm.texi   | 30 ---
 gcc/doc/tm.texi.in| 26 +
 gcc/dwarf2asm.c   |  2 +-
 gcc/output.h  |  5 ++-
 gcc/target.def| 15 
 gcc/varasm.c  | 56 
 gcc/varasm.h  |  2 +
 gcc/vmsdbgout.c   |  8 ++--
 gcc/xcoffout.c|  1 +
 47 files changed, 251 insertions(+), 268 deletions(-)

-- 
2.4.0



[PATCH 4/4] define ASM_OUTPUT_LABEL to the name of a function

2015-07-24 Thread tbsaunde+gcc
From: Trevor Saunders 

* config/arc/arc.h, config/bfin/bfin.h, config/frv/frv.h,
config/ia64/ia64-protos.h, config/ia64/ia64.c, config/ia64/ia64.h,
config/lm32/lm32.h, config/mep/mep.h, config/mmix/mmix.h,
config/rs6000/rs6000.c, config/rs6000/xcoff.h, config/spu/spu.h,
config/visium/visium.h, defaults.h: Define ASM_OUTPUT_LABEL to
the name of a function.
* output.h (default_output_label): New prototype.
* varasm.c (default_output_label): New function.
* vmsdbgout.c: Include tm_p.h.
* xcoffout.c: Likewise.
---
 gcc/config/arc/arc.h  |  3 +--
 gcc/config/bfin/bfin.h|  5 +
 gcc/config/frv/frv.h  |  6 +-
 gcc/config/ia64/ia64-protos.h |  1 +
 gcc/config/ia64/ia64.c| 11 +++
 gcc/config/ia64/ia64.h|  8 +---
 gcc/config/lm32/lm32.h|  3 +--
 gcc/config/mep/mep.h  |  8 +---
 gcc/config/mmix/mmix.h|  3 +--
 gcc/config/pa/pa-protos.h |  1 +
 gcc/config/pa/pa.c| 12 
 gcc/config/pa/pa.h|  9 +
 gcc/config/rs6000/rs6000-protos.h |  1 +
 gcc/config/rs6000/rs6000.c|  8 
 gcc/config/rs6000/xcoff.h |  3 +--
 gcc/config/spu/spu.h  |  3 +--
 gcc/config/visium/visium.h|  3 +--
 gcc/defaults.h|  6 +-
 gcc/output.h  |  3 +++
 gcc/varasm.c  |  9 +
 gcc/vmsdbgout.c   |  1 +
 gcc/xcoffout.c|  1 +
 22 files changed, 60 insertions(+), 48 deletions(-)

diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index d98cce1..d3747b9 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -1245,8 +1245,7 @@ do {  
\
 
 /* This is how to output the definition of a user-level label named NAME,
such as the label on a static function or variable NAME.  */
-#define ASM_OUTPUT_LABEL(FILE, NAME) \
-do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
+#define ASM_OUTPUT_LABEL default_output_label
 
 #define ASM_NAME_P(NAME) ( NAME[0]=='*')
 
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index 26ba7c2..08906aa 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -1044,10 +1044,7 @@ typedef enum directives {
 ASM_OUTPUT_LABEL(FILE, NAME);  \
   } while (0)
 
-#define ASM_OUTPUT_LABEL(FILE, NAME)\
-  do {  assemble_name (FILE, NAME);\
-fputs (":\n",FILE);\
-  } while (0)
+#define ASM_OUTPUT_LABEL default_output_label
 
 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
 do {  fprintf (FILE, "_%s", NAME); \
diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index b0d66fd..1d25974 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -1668,11 +1668,7 @@ do { 
\
`assemble_name (STREAM, NAME)' to output the name itself; before and after
that, output the additional assembler syntax for defining the name, and a
newline.  */
-#define ASM_OUTPUT_LABEL(STREAM, NAME) \
-do {   \
-  assemble_name (STREAM, NAME);
\
-  fputs (":\n", STREAM);   \
-} while (0)
+#define ASM_OUTPUT_LABEL default_output_label
 
 /* Globalizing directive for a label.  */
 #define GLOBAL_ASM_OP "\t.globl "
diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h
index 29fc714..8e540e4 100644
--- a/gcc/config/ia64/ia64-protos.h
+++ b/gcc/config/ia64/ia64-protos.h
@@ -72,6 +72,7 @@ extern rtx ia64_expand_builtin (tree, rtx, rtx, machine_mode, 
int);
 extern rtx ia64_va_arg (tree, tree);
 #endif /* RTX_CODE */
 
+extern void ia64_output_label (FILE *f, const char *label);
 extern void ia64_asm_output_external (FILE *, tree, const char *);
 extern void ia64_vms_output_aligned_decl_common (FILE *, tree, const char *,
 unsigned HOST_WIDE_INT,
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 779fc58..e07ebb5 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -10522,6 +10522,17 @@ ia64_hpux_function_arg_padding (machine_mode mode, 
const_tree type)
return DEFAULT_FUNCTION_ARG_PADDING (mode, type);
 }
 
+/* Assemble a label.  */
+
+void
+ia64_output_label (FILE *f, const char *label)
+{
+  ia64_asm_output_label = 1;
+  assemble_name (f, label);
+  fputs (":\n", f);
+  ia64_asm_output_label = 0;
+}
+
 /* Emit text to declare externally defined variables and functions, because
the Intel assembler does not support undefined externals.  */
 
diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h
index 4b62423..1afa7b7 100644

[PATCH 2/4] make TLS_COMMON_ASM_OP a hook

2015-07-24 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-24  Trevor Saunders  

* config/i386/sol2.h: Adjust.
* defaults.h: Likewise.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Remove documentation of removed
TLS_COMMON_ASM_OP macro.
* target.def (tls_common_asm_op): New hook.
---
 gcc/config/i386/sol2.h | 2 +-
 gcc/defaults.h | 6 +-
 gcc/doc/tm.texi| 7 +++
 gcc/doc/tm.texi.in | 6 +-
 gcc/target.def | 6 ++
 5 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
index 9b725ad..d8e9c86 100644
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -149,7 +149,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #ifndef USE_GAS
 /* The Sun assembler uses .tcomm for TLS common sections.  */
-#define TLS_COMMON_ASM_OP ".tcomm"
+#define TARGET_TLS_COMMON_ASM_OP ".tcomm"
 
 /* Similar to the Sun assembler on SPARC, the native assembler requires
TLS objects to be declared as @tls_obj (not @tls_object).  Unlike SPARC,
diff --git a/gcc/defaults.h b/gcc/defaults.h
index dedf896..8684c58 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -73,15 +73,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #define IFUNC_ASM_TYPE "gnu_indirect_function"
 #endif
 
-#ifndef TLS_COMMON_ASM_OP
-#define TLS_COMMON_ASM_OP ".tls_common"
-#endif
-
 #if defined (HAVE_AS_TLS) && !defined (ASM_OUTPUT_TLS_COMMON)
 #define ASM_OUTPUT_TLS_COMMON(FILE, DECL, NAME, SIZE)  \
   do   \
 {  \
-  fprintf ((FILE), "\t%s\t", TLS_COMMON_ASM_OP);   \
+  fprintf ((FILE), "\t%s\t", targetm.tls_common_asm_op);   \
   assemble_name ((FILE), (NAME));  \
   fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",
\
   (SIZE), DECL_ALIGN (DECL) / BITS_PER_UNIT);  \
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 4d19252..faa3017 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -6968,11 +6968,10 @@ containing the assembler operation to identify the 
following data as
 uninitialized, writable small data.
 @end defmac
 
-@defmac TLS_COMMON_ASM_OP
-If defined, a C expression whose value is a string containing the
-assembler operation to identify the following data as thread-local
+@deftypevr {Target Hook} {const char *} TARGET_TLS_COMMON_ASM_OP
+The assembler operation to identify the following data as thread-local
 common data.  The default is @code{".tls_common"}.
-@end defmac
+@end deftypevr
 
 @defmac TLS_SECTION_ASM_FLAG
 If defined, a C expression whose value is a character constant
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index e75e818..72a7f84 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -4908,11 +4908,7 @@ containing the assembler operation to identify the 
following data as
 uninitialized, writable small data.
 @end defmac
 
-@defmac TLS_COMMON_ASM_OP
-If defined, a C expression whose value is a string containing the
-assembler operation to identify the following data as thread-local
-common data.  The default is @code{".tls_common"}.
-@end defmac
+@hook TARGET_TLS_COMMON_ASM_OP
 
 @defmac TLS_SECTION_ASM_FLAG
 If defined, a C expression whose value is a character constant
diff --git a/gcc/target.def b/gcc/target.def
index ed438de..64ae8d4 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -5752,6 +5752,12 @@ DEFHOOKPOD
 The default value is false.",
  bool, false)
 
+DEFHOOKPOD
+(tls_common_asm_op,
+"The assembler operation to identify the following data as thread-local\n\
+common data.  The default is @code{\".tls_common\"}.",
+const char *, ".tls_common")
+
 /* True if a small readonly data section is supported.  */
 DEFHOOKPOD
 (have_srodata_section,
-- 
2.4.0



[PATCH 3/9] target.h: change to use targetm.pointer_size instead of POINTER_SIZE

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* target.h (pointer_size_units): Call targetm.pointer_size ().
---
 gcc/target.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/target.h b/gcc/target.h
index 6715b07..435bc7e 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -224,7 +224,7 @@ pack_cumulative_args (CUMULATIVE_ARGS *arg)
 inline unsigned int
 pointer_size_units ()
 {
-  return (POINTER_SIZE + BITS_PER_UNIT - 1) /  BITS_PER_UNIT;
+  return (targetm.pointer_size () + BITS_PER_UNIT - 1) /  BITS_PER_UNIT;
 }
 
 #endif /* GCC_TARGET_H */
-- 
2.4.0



[PATCH 1/9] remove POINTER_SIZE_UNITS macro

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/lto/ChangeLog:

2015-07-26  Trevor Saunders  

* lto-object.c (lto_obj_begin_section): Call pointer_size_units ().

gcc/c-family/ChangeLog:

2015-07-26  Trevor Saunders  

* c-cppbuiltin.c (cpp_atomic_builtins): Call pointer_size_units ().

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* defaults.h (POINTER_SIZE_UNITS): Remove.
* dwarf2asm.c (size_of_encoded_value): Adjust.
(dw2_output_indirect_constant_1): Likewise.
* stor-layout.c (layout_type): Likewise.
* target.h (pointer_size_units): New function.
* varasm.c (assemble_addr_to_section): Adjust.
(default_assemble_integer): Likewise.
(dump_tm_clone_pairs): Likewise.
---
 gcc/c-family/c-cppbuiltin.c | 2 +-
 gcc/defaults.h  | 3 ---
 gcc/dwarf2asm.c | 4 ++--
 gcc/lto/lto-object.c| 3 ++-
 gcc/stor-layout.c   | 2 +-
 gcc/target.h| 8 
 gcc/varasm.c| 8 
 7 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 1beb2db..73ec8eb 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -674,7 +674,7 @@ cpp_atomic_builtins (cpp_reader *pfile)
 
   /* ptr_type_node can't be used here since ptr_mode is only set when
  toplev calls backend_init which is not done with -E  or pch.  */
-  psize = POINTER_SIZE_UNITS;
+  psize = pointer_size_units ();
   if (psize >= SWAP_LIMIT)
 psize = 0;
   builtin_define_with_int_value ("__GCC_ATOMIC_POINTER_LOCK_FREE", 
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 9d38ba1..1dd965b 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -771,9 +771,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #ifndef POINTER_SIZE
 #define POINTER_SIZE BITS_PER_WORD
 #endif
-#ifndef POINTER_SIZE_UNITS
-#define POINTER_SIZE_UNITS ((POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT)
-#endif
 
 
 #ifndef PIC_OFFSET_TABLE_REGNUM
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 9f3c4b1..b63f82e 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -385,7 +385,7 @@ size_of_encoded_value (int encoding)
   switch (encoding & 0x07)
 {
 case DW_EH_PE_absptr:
-  return POINTER_SIZE_UNITS;
+  return pointer_size_units ();
 case DW_EH_PE_udata2:
   return 2;
 case DW_EH_PE_udata4:
@@ -902,7 +902,7 @@ dw2_output_indirect_constant_1 (const char *sym, tree id)
 
   sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym);
   assemble_variable (decl, 1, 1, 1);
-  assemble_integer (sym_ref, POINTER_SIZE_UNITS, POINTER_SIZE, 1);
+  assemble_integer (sym_ref, pointer_size_units (), POINTER_SIZE, 1);
 
   return 0;
 }
diff --git a/gcc/lto/lto-object.c b/gcc/lto/lto-object.c
index 087c6b1..198a585 100644
--- a/gcc/lto/lto-object.c
+++ b/gcc/lto/lto-object.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cgraph.h"
 #include "lto-section-names.h"
 #include "simple-object.h"
+#include "target.h"
 
 /* An LTO file wrapped around an simple_object.  */
 
@@ -340,7 +341,7 @@ lto_obj_begin_section (const char *name)
  && lo->sobj_w != NULL
  && lo->section == NULL);
 
-  align = ceil_log2 (POINTER_SIZE_UNITS);
+  align = ceil_log2 (pointer_size_units ());
   lo->section = simple_object_write_create_section (lo->sobj_w, name, align,
&errmsg, &err);
   if (lo->section == NULL)
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 0d4f4a4..160ffe2 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2229,7 +2229,7 @@ layout_type (tree type)
 
 case OFFSET_TYPE:
   TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
-  TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE_UNITS);
+  TYPE_SIZE_UNIT (type) = size_int (pointer_size_units ());
   /* A pointer might be MODE_PARTIAL_INT, but ptrdiff_t must be
 integral, which may be an __intN.  */
   SET_TYPE_MODE (type, mode_for_size (POINTER_SIZE, MODE_INT, 0));
diff --git a/gcc/target.h b/gcc/target.h
index a79f424..6715b07 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -219,4 +219,12 @@ pack_cumulative_args (CUMULATIVE_ARGS *arg)
 }
 #endif /* GCC_TM_H */
 
+/* Return the width of a pointer in units.  */
+
+inline unsigned int
+pointer_size_units ()
+{
+  return (POINTER_SIZE + BITS_PER_UNIT - 1) /  BITS_PER_UNIT;
+}
+
 #endif /* GCC_TARGET_H */
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 6a4ba0b..8cb2ec9 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1544,7 +1544,7 @@ assemble_addr_to_section (rtx symbol, section *sec)
 {
   switch_to_section (sec);
   assemble_align (POINTER_SIZE);
-  assemble_integer (symbol, POINTER_SIZE_UNITS, POINTER_SIZE, 1);
+  assemble_integer (symbol, pointer_size_units (), POINTER_SIZE, 1);
 }
 
 /* Return the numbered .ctors.N (if CONSTRUCTOR_P) or .dtors.N (if
@@ -2732,7 +2732,7 @@ default_assemble_integer (rtx x ATTRIBUTE_U

[PATCH 5/9] ubsan.c: switch from POINTER_SIZE to targetm.pointer_size ()

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* ubsan.c (ubsan_encode_value): Call targetm.pointer_size ().
---
 gcc/ubsan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index d75c4ee..55d9440 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -63,6 +63,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-object-size.h"
 #include "tree-eh.h"
 #include "tree-cfg.h"
+#include "target.h"
 
 /* Map from a tree to a VAR_DECL tree.  */
 
@@ -139,7 +140,7 @@ ubsan_encode_value (tree t, bool in_expand_p)
 {
   tree type = TREE_TYPE (t);
   const unsigned int bitsize = GET_MODE_BITSIZE (TYPE_MODE (type));
-  if (bitsize <= POINTER_SIZE)
+  if (bitsize <= targetm.pointer_size ())
 switch (TREE_CODE (type))
   {
   case BOOLEAN_TYPE:
-- 
2.4.0



[PATCH 2/9] add pointer_size target hook

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Adjust.
* target.def (pointer_size): New hook.
* targhooks.c (default_pointer_size): New function.
* targhooks.h (default_pointer_size): New function.
---
 gcc/doc/tm.texi| 7 +++
 gcc/doc/tm.texi.in | 2 ++
 gcc/target.def | 8 
 gcc/targhooks.c| 8 
 gcc/targhooks.h| 1 +
 5 files changed, 26 insertions(+)

diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index f95646c..34cc8f6 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -907,6 +907,13 @@ you must define @code{POINTERS_EXTEND_UNSIGNED}.  If you 
do not specify
 a value the default is @code{BITS_PER_WORD}.
 @end defmac
 
+@deftypefn {Target Hook} {unsigned int} TARGET_POINTER_SIZE ()
+Width of a pointer, in bits.  You must specify a value no wider than the
+ width of @code{Pmode}.  If it is not equal to the width of @code{Pmode},
+ you must define @code{POINTERS_EXTEND_UNSIGNED}.  If you do not specify
+ a value the default is @code{BITS_PER_WORD}.
+@end deftypefn
+
 @defmac POINTERS_EXTEND_UNSIGNED
 A C expression that determines how pointers should be extended from
 @code{ptr_mode} to either @code{Pmode} or @code{word_mode}.  It is
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 2383fb9..ca08f11 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -881,6 +881,8 @@ you must define @code{POINTERS_EXTEND_UNSIGNED}.  If you do 
not specify
 a value the default is @code{BITS_PER_WORD}.
 @end defmac
 
+@hook TARGET_POINTER_SIZE
+
 @defmac POINTERS_EXTEND_UNSIGNED
 A C expression that determines how pointers should be extended from
 @code{ptr_mode} to either @code{Pmode} or @code{word_mode}.  It is
diff --git a/gcc/target.def b/gcc/target.def
index 4edc209..2e247e0 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -5716,6 +5716,14 @@ DEFHOOK
  void, (tree *hold, tree *clear, tree *update),
  default_atomic_assign_expand_fenv)
 
+DEFHOOK
+(pointer_size,
+"Width of a pointer, in bits.  You must specify a value no wider than the\n\
+ width of @code{Pmode}.  If it is not equal to the width of @code{Pmode},\n\
+ you must define @code{POINTERS_EXTEND_UNSIGNED}.  If you do not specify\n\
+ a value the default is @code{BITS_PER_WORD}.",
+unsigned int, (), default_pointer_size)
+
 /* Leave the boolean fields at the end.  */
 
 /* True if we can create zeroed data by switching to a BSS section
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 3eca47e..19272c4 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1926,4 +1926,12 @@ can_use_doloop_if_innermost (const widest_int &, const 
widest_int &,
   return loop_depth == 1;
 }
 
+/* Default implementation of TARGET_POINTER_SIZE.  */
+
+unsigned int
+default_pointer_size ()
+{
+  return POINTER_SIZE;
+}
+
 #include "gt-targhooks.h"
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 5ae991d..6782d37 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -240,4 +240,5 @@ extern void default_setup_incoming_vararg_bounds 
(cumulative_args_t ca ATTRIBUTE
  tree type ATTRIBUTE_UNUSED,
  int *pretend_arg_size 
ATTRIBUTE_UNUSED,
  int second_time 
ATTRIBUTE_UNUSED);
+extern unsigned int default_pointer_size ();
 #endif /* GCC_TARGHOOKS_H */
-- 
2.4.0



[PATCH 0/9] start converting POINTER_SIZE to a hook

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

$subject.

patches individually bootstrapped + regtested on x86_64-linux-gnu, and run
through config-list.mk with more patches removing usage of the macro.  Ok?

Trev

Trevor Saunders (9):
  remove POINTER_SIZE_UNITS macro
  add pointer_size target hook
  target.h: change to use targetm.pointer_size instead of POINTER_SIZE
  varasm.c: switch from POINTER_SIZE to targetm.pointer_size ()
  ubsan.c: switch from POINTER_SIZE to targetm.pointer_size ()
  tree-chkp.c: switch to targetm.pointer_size ()
  stor-layout.c: switch to targetm.pointer_size ()
  tree.c: switch to targetm.pointer_size ()
  emit-rtl.c: switch to targetm.pointer_size ()

 gcc/c-family/c-cppbuiltin.c |  2 +-
 gcc/defaults.h  |  3 ---
 gcc/doc/tm.texi |  7 +++
 gcc/doc/tm.texi.in  |  2 ++
 gcc/dwarf2asm.c |  4 ++--
 gcc/emit-rtl.c  |  5 +++--
 gcc/lto/lto-object.c|  3 ++-
 gcc/stor-layout.c   |  9 +
 gcc/target.def  |  8 
 gcc/target.h|  8 
 gcc/targhooks.c |  8 
 gcc/targhooks.h |  1 +
 gcc/tree-chkp.c | 14 --
 gcc/tree.c  |  3 ++-
 gcc/ubsan.c |  3 ++-
 gcc/varasm.c| 12 ++--
 16 files changed, 65 insertions(+), 27 deletions(-)

-- 
2.4.0



[PATCH 9/9] emit-rtl.c: switch to targetm.pointer_size ()

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* emit-rtl.c (init_derived_machine_modes): Call
targetm.pointer_size ().
---
 gcc/emit-rtl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index ed2b30b..9da93d1 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -76,7 +76,7 @@ struct target_rtl *this_target_rtl = &default_target_rtl;
 machine_mode byte_mode;/* Mode whose width is BITS_PER_UNIT.  */
 machine_mode word_mode;/* Mode whose width is BITS_PER_WORD.  */
 machine_mode double_mode;  /* Mode whose width is DOUBLE_TYPE_SIZE.  */
-machine_mode ptr_mode; /* Mode whose width is POINTER_SIZE.  */
+machine_mode ptr_mode; /* Mode whose width is targetm.pointer_size ().  */
 
 /* Datastructures maintained for currently processed function in RTL form.  */
 
@@ -5864,7 +5864,8 @@ init_derived_machine_modes (void)
word_mode = mode;
 }
 
-  ptr_mode = mode_for_size (POINTER_SIZE, GET_MODE_CLASS (Pmode), 0);
+  ptr_mode = mode_for_size (targetm.pointer_size (), GET_MODE_CLASS (Pmode),
+   0);
 }
 
 /* Create some permanent unique rtl objects shared between all functions.  */
-- 
2.4.0



[PATCH 8/9] tree.c: switch to targetm.pointer_size ()

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* tree.c (build_common_tree_nodes): Call targetm.pointer_size ().
---
 gcc/tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index 94263af..02cbda8 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -9986,7 +9986,8 @@ build_common_tree_nodes (bool signed_char, bool 
short_double)
 = build_pointer_type (build_type_variant (void_type_node, 1, 0));
   fileptr_type_node = ptr_type_node;
 
-  pointer_sized_int_node = build_nonstandard_integer_type (POINTER_SIZE, 1);
+  pointer_sized_int_node
+= build_nonstandard_integer_type (targetm.pointer_size (), 1);
 
   float_type_node = make_node (REAL_TYPE);
   TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE;
-- 
2.4.0



[PATCH 4/9] varasm.c: switch from POINTER_SIZE to targetm.pointer_size ()

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* varasm.c (assemble_addr_to_section): Call targetm.pointer_size ().
(dump_tm_clone_pairs): Likewise.
---
 gcc/varasm.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/varasm.c b/gcc/varasm.c
index 8cb2ec9..238ae39 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1543,8 +1543,8 @@ void
 assemble_addr_to_section (rtx symbol, section *sec)
 {
   switch_to_section (sec);
-  assemble_align (POINTER_SIZE);
-  assemble_integer (symbol, pointer_size_units (), POINTER_SIZE, 1);
+  assemble_align (targetm.pointer_size ());
+  assemble_integer (symbol, pointer_size_units (), targetm.pointer_size (), 1);
 }
 
 /* Return the numbered .ctors.N (if CONSTRUCTOR_P) or .dtors.N (if
@@ -5870,14 +5870,14 @@ dump_tm_clone_pairs (vec tm_alias_pairs)
   if (!switched)
{
  switch_to_section (targetm.asm_out.tm_clone_table_section ());
- assemble_align (POINTER_SIZE);
+ assemble_align (targetm.pointer_size ());
  switched = true;
}
 
   assemble_integer (XEXP (DECL_RTL (src), 0),
-   pointer_size_units (), POINTER_SIZE, 1);
+   pointer_size_units (), targetm.pointer_size (), 1);
   assemble_integer (XEXP (DECL_RTL (dst), 0),
-   pointer_size_units (), POINTER_SIZE, 1);
+   pointer_size_units (), targetm.pointer_size (), 1);
 }
 }
 
-- 
2.4.0



[PATCH 7/9] stor-layout.c: switch to targetm.pointer_size ()

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* stor-layout.c (layout_type): Call targetm.pointer_size ().
---
 gcc/stor-layout.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 160ffe2..6043398 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2228,12 +2228,13 @@ layout_type (tree type)
   break;
 
 case OFFSET_TYPE:
-  TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
+  TYPE_SIZE (type) = bitsize_int (targetm.pointer_size ());
   TYPE_SIZE_UNIT (type) = size_int (pointer_size_units ());
   /* A pointer might be MODE_PARTIAL_INT, but ptrdiff_t must be
 integral, which may be an __intN.  */
-  SET_TYPE_MODE (type, mode_for_size (POINTER_SIZE, MODE_INT, 0));
-  TYPE_PRECISION (type) = POINTER_SIZE;
+  SET_TYPE_MODE (type, mode_for_size (targetm.pointer_size (), MODE_INT,
+ 0));
+  TYPE_PRECISION (type) = targetm.pointer_size ();
   break;
 
 case FUNCTION_TYPE:
-- 
2.4.0



[PATCH 6/9] tree-chkp.c: switch to targetm.pointer_size ()

2015-07-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-07-26  Trevor Saunders  

* tree-chkp.c (chkp_build_array_ref): Call targetm.pointer_size ().
(chkp_find_bounds_for_elem): Likewise.
(chkp_find_bound_slots_1): Likewise.
(chkp_add_bounds_to_call_stmt): Likewise.
(chkp_instrument_function): Likewise.
---
 gcc/tree-chkp.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index 8c1b48c..456e79b 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -1583,7 +1583,7 @@ chkp_build_array_ref (tree arr, tree etype, tree esize,
 
ALL_BOUNDS[i] is filled with elem bounds if there
is a field in TYPE which has pointer type and offset
-   equal to i * POINTER_SIZE in bits.  */
+   equal to i * targetm.pointer_size () in bits.  */
 static void
 chkp_find_bounds_for_elem (tree elem, tree *all_bounds,
   HOST_WIDE_INT offs,
@@ -1593,7 +1593,7 @@ chkp_find_bounds_for_elem (tree elem, tree *all_bounds,
 
   if (BOUNDED_TYPE_P (type))
 {
-  if (!all_bounds[offs / POINTER_SIZE])
+  if (!all_bounds[offs / targetm.pointer_size ()])
{
  tree temp = make_temp_ssa_name (type, NULL, "");
  gimple assign = gimple_build_assign (temp, elem);
@@ -1602,7 +1602,8 @@ chkp_find_bounds_for_elem (tree elem, tree *all_bounds,
  gsi_insert_before (iter, assign, GSI_SAME_STMT);
  gsi = gsi_for_stmt (assign);
 
- all_bounds[offs / POINTER_SIZE] = chkp_find_bounds (temp, &gsi);
+ all_bounds[offs / targetm.pointer_size ()]
+   = chkp_find_bounds (temp, &gsi);
}
 }
   else if (RECORD_OR_UNION_TYPE_P (type))
@@ -1659,7 +1660,7 @@ chkp_find_bound_slots_1 (const_tree type, bitmap 
have_bound,
 HOST_WIDE_INT offs)
 {
   if (BOUNDED_TYPE_P (type))
-bitmap_set_bit (have_bound, offs / POINTER_SIZE);
+bitmap_set_bit (have_bound, offs / targetm.pointer_size ());
   else if (RECORD_OR_UNION_TYPE_P (type))
 {
   tree field;
@@ -1906,7 +1907,7 @@ chkp_add_bounds_to_call_stmt (gimple_stmt_iterator *gsi)
   else if (chkp_type_has_pointer (type))
{
  HOST_WIDE_INT max_bounds
-   = TREE_INT_CST_LOW (TYPE_SIZE (type)) / POINTER_SIZE;
+   = TREE_INT_CST_LOW (TYPE_SIZE (type)) / targetm.pointer_size ();
  tree *all_bounds = (tree *)xmalloc (sizeof (tree) * max_bounds);
  HOST_WIDE_INT bnd_no;
 
@@ -4267,7 +4268,8 @@ chkp_instrument_function (void)
  EXECUTE_IF_SET_IN_BITMAP (slots, 0, bnd_no, bi)
{
  tree bounds = chkp_get_next_bounds_parm (arg);
- HOST_WIDE_INT offs = bnd_no * POINTER_SIZE / BITS_PER_UNIT;
+ HOST_WIDE_INT offs
+   = bnd_no * targetm.pointer_size () / BITS_PER_UNIT;
  tree addr = chkp_build_addr_expr (orig_arg);
  tree ptr = build2 (MEM_REF, ptr_type_node, addr,
 build_int_cst (ptr_type_node, offs));
-- 
2.4.0



[PATCH] update a few places for the change from gimple_statement_base to gimple

2015-09-23 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

This fixes up a few remaining references to gimple_statement_base that were 
just brought up.

bootstrapped on x86_64-linux-gnu, but the only non comment / doc change is 
gdbhooks.py, ok?

Trev

gcc/ChangeLog:

2015-09-23  Trevor Saunders  

* doc/gimple.texi: Update references to gimple_statement_base.
* gdbhooks.py: Likewise.
* gimple.h: Likewise.
---
 gcc/doc/gimple.texi | 12 ++--
 gcc/gdbhooks.py |  2 +-
 gcc/gimple.h| 10 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi
index 543de90..d089d4f 100644
--- a/gcc/doc/gimple.texi
+++ b/gcc/doc/gimple.texi
@@ -92,8 +92,8 @@ groups: a header describing the instruction and its locations,
 and a variable length body with all the operands. Tuples are
 organized into a hierarchy with 3 main classes of tuples.
 
-@subsection @code{gimple_statement_base} (gsbase)
-@cindex gimple_statement_base
+@subsection @code{gimple} (gsbase)
+@cindex gimple
 
 This is the root of the hierarchy, it holds basic information
 needed by most GIMPLE statements. There are some fields that
@@ -223,7 +223,7 @@ is then inherited from the other two tuples.
 
 @itemize @bullet
 @item @code{gsbase}
-Inherited from @code{struct gimple_statement_base}.
+Inherited from @code{struct gimple}.
 
 @item @code{def_ops}
 Array of pointers into the operand array indicating all the slots that
@@ -300,7 +300,7 @@ kinds, along with their relationships to @code{GSS_} values 
(layouts) and
 @code{GIMPLE_} values (codes):
 
 @smallexample
-   gimple_statement_base
+   gimple
  |layout: GSS_BASE
  |used for 4 codes: GIMPLE_ERROR_MARK
  |  GIMPLE_NOP
@@ -2654,7 +2654,7 @@ any new basic blocks which are necessary.
 
 The first step in adding a new GIMPLE statement code, is
 modifying the file @code{gimple.def}, which contains all the GIMPLE
-codes.  Then you must add a corresponding gimple_statement_base subclass
+codes.  Then you must add a corresponding gimple subclass
 located in @code{gimple.h}.  This in turn, will require you to add a
 corresponding @code{GTY} tag in @code{gsstruct.def}, and code to handle
 this tag in @code{gss_for_code} which is located in @code{gimple.c}.
@@ -2667,7 +2667,7 @@ in @code{gimple.c}.
 You will probably want to create a function to build the new
 gimple statement in @code{gimple.c}.  The function should be called
 @code{gimple_build_@var{new-tuple-name}}, and should return the new tuple
-as a pointer to the appropriate gimple_statement_base subclass.
+as a pointer to the appropriate gimple subclass.
 
 If your new statement requires accessors for any members or
 operands it may have, put simple inline accessors in
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 3a62a2d..2b9a94c 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -484,7 +484,7 @@ def build_pretty_printer():
  'cgraph_node', CGraphNodePrinter)
 pp.add_printer_for_types(['dw_die_ref'],
  'dw_die_ref', DWDieRefPrinter)
-pp.add_printer_for_types(['gimple', 'gimple_statement_base *',
+pp.add_printer_for_types(['gimple', 'gimple *',
 
   # Keep this in the same order as gimple.def:
   'gimple_cond', 'const_gimple_cond',
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 91c26b6..30b1041 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -123,7 +123,7 @@ enum gimple_rhs_class
 };
 
 /* Specific flags for individual GIMPLE statements.  These flags are
-   always stored in gimple_statement_base.subcode and they may only be
+   always stored in gimple.subcode and they may only be
defined for statement codes that do not use subcodes.
 
Values for the masks can overlap as long as the overlapping values
@@ -380,7 +380,7 @@ struct GTY((tag("GSS_BIND")))
   tree vars;
 
   /* [ WORD 8 ]
- This is different than the BLOCK field in gimple_statement_base,
+ This is different than the BLOCK field in gimple,
  which is analogous to TREE_BLOCK (i.e., the lexical block holding
  this statement).  This field is the equivalent of BIND_EXPR_BLOCK
  in tree land (i.e., the lexical scope defined by this bind).  See
@@ -744,7 +744,7 @@ struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
 
 
 /* GIMPLE_OMP_ATOMIC_LOAD.
-   Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
+   Note: This is based on gimple, not g_s_omp, because g_s_omp
contains a sequence, which we don't need here.  */
 
 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
@@ -1813,7 +1813,7 @@ gimple_set_no_warning (gimple *stmt, bool no_warning)
 
You can learn more about the visited property of the gimple
statement by reading the comments of the 'visited' data member of
-   struct gimple statement_base.
+   struct gimple.
  */
 
 static inline void
@@ -1832,7 +1832,7 @@ gimple_set_visited (gimple *stmt, bool visited_p)
 

[PATCH 0/4] gimple accessor const correctness fixes

2015-10-04 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

the first patch is just some cleanup  I ran into along the way, but the rest of
this series fixes const correctness for all of the gimple_x_ptr () functions.
I was able to just remove a couple of them, but unfortunately most ar needed
for either tree walking, or the use def data structures which store pointers
into gimple statements.

patches individually bootstrapped + regtested on x86_64-gnu-linux, ok?

Trev

Trevor Saunders (4):
  make build_uses store tree * instead of tree
  remove gimple_location_ptr ()
  remove unused gasm accessors
  make more gimple_x_ptr accessors const correct

 gcc/gimple.h| 107 ++--
 gcc/tree-ssa-operands.c |  30 +++---
 gcc/tree-vrp.c  |   5 ++-
 3 files changed, 58 insertions(+), 84 deletions(-)

-- 
2.4.0



[PATCH 1/4] make build_uses store tree * instead of tree

2015-10-04 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-04  Trevor Saunders  

* tree-ssa-operands.c (build_uses): store tree * instead of
tree.
(finalize_ssa_uses): Adjust.
(append_use): Likewise.
(verify_ssa_operands): Likewise.
---
 gcc/tree-ssa-operands.c | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 85f9cca..544e9df 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -108,7 +108,7 @@ along with GCC; see the file COPYING3.  If not see
 #define opf_address_taken (1 << 5)
 
 /* Array for building all the use operands.  */
-static vec build_uses;
+static vec build_uses;
 
 /* The built VDEF operand.  */
 static tree build_vdef;
@@ -359,8 +359,7 @@ finalize_ssa_defs (struct function *fn, gimple *stmt)
 }
 
 
-/* Takes elements from build_uses and turns them into use operands of STMT.
-   TODO -- Make build_uses vec of tree *.  */
+/* Takes elements from build_uses and turns them into use operands of STMT.  */
 
 static inline void
 finalize_ssa_uses (struct function *fn, gimple *stmt)
@@ -379,7 +378,7 @@ finalize_ssa_uses (struct function *fn, gimple *stmt)
   if (oldvuse != (build_vuse != NULL_TREE
  ? build_vuse : build_vdef))
gimple_set_vuse (stmt, NULL_TREE);
-  build_uses.safe_insert (0, (tree)gimple_vuse_ptr (stmt));
+  build_uses.safe_insert (0, gimple_vuse_ptr (stmt));
 }
 
   new_list.next = NULL;
@@ -415,7 +414,7 @@ finalize_ssa_uses (struct function *fn, gimple *stmt)
   /* Now create nodes for all the new nodes.  */
   for (new_i = 0; new_i < build_uses.length (); new_i++)
 {
-  tree *op = (tree *) build_uses[new_i];
+  tree *op = build_uses[new_i];
   last = add_use_op (fn, stmt, op, last);
 }
 
@@ -463,7 +462,7 @@ start_ssa_stmt_operands (void)
 static inline void
 append_use (tree *use_p)
 {
-  build_uses.safe_push ((tree) use_p);
+  build_uses.safe_push (use_p);
 }
 
 
@@ -964,7 +963,7 @@ verify_ssa_operands (struct function *fn, gimple *stmt)
   def_operand_p def_p;
   ssa_op_iter iter;
   unsigned i;
-  tree use, def;
+  tree def;
   bool volatile_p = gimple_has_volatile_ops (stmt);
 
   /* build_ssa_operands w/o finalizing them.  */
@@ -990,7 +989,7 @@ verify_ssa_operands (struct function *fn, gimple *stmt)
   return true;
 }
 
-  use = gimple_vuse (stmt);
+  tree use = gimple_vuse (stmt);
   if (use
   && TREE_CODE (use) == SSA_NAME)
 use = SSA_NAME_VAR (use);
@@ -1009,11 +1008,12 @@ verify_ssa_operands (struct function *fn, gimple *stmt)
 
   FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
 {
-  FOR_EACH_VEC_ELT (build_uses, i, use)
+  tree *op;
+  FOR_EACH_VEC_ELT (build_uses, i, op)
{
- if (use_p->use == (tree *)use)
+ if (use_p->use == op)
{
- build_uses[i] = NULL_TREE;
+ build_uses[i] = NULL;
  break;
}
}
@@ -1024,11 +1024,13 @@ verify_ssa_operands (struct function *fn, gimple *stmt)
  return true;
}
 }
-  FOR_EACH_VEC_ELT (build_uses, i, use)
-if (use != NULL_TREE)
+
+  tree *op;
+  FOR_EACH_VEC_ELT (build_uses, i, op)
+if (op != NULL)
   {
error ("use operand missing for stmt");
-   debug_generic_expr (*(tree *)use);
+   debug_generic_expr (*op);
return true;
   }
 
-- 
2.4.0



[PATCH 2/4] remove gimple_location_ptr ()

2015-10-04 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-04  Trevor Saunders  

* gimple.h (gimple_location_ptr): Remove.
* tree-vrp.c (check_all_array_refs): Adjust.
---
 gcc/gimple.h   | 9 -
 gcc/tree-vrp.c | 5 +++--
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/gcc/gimple.h b/gcc/gimple.h
index 30b1041..cfd8d2c 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1734,15 +1734,6 @@ gimple_location_safe (const gimple *g)
   return g ? gimple_location (g) : UNKNOWN_LOCATION;
 }
 
-/* Return pointer to location information for statement G.  */
-
-static inline const location_t *
-gimple_location_ptr (const gimple *g)
-{
-  return &g->location;
-}
-
-
 /* Set location information for statement G.  */
 
 static inline void
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 3bc3b03..ef5ef10 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -6717,8 +6717,9 @@ check_all_array_refs (void)
continue;
 
  memset (&wi, 0, sizeof (wi));
- wi.info = CONST_CAST (void *, (const void *)
-   gimple_location_ptr (stmt));
+
+ location_t loc = gimple_location (stmt);
+ wi.info = &loc;
 
  walk_gimple_op (gsi_stmt (si),
  check_array_bounds,
-- 
2.4.0



[PATCH 3/4] remove unused gasm accessors

2015-10-04 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-04  Trevor Saunders  

* gimple.h (gimple_asm_input_op_ptr): Remove.
(gimple_asm_output_op_ptr): Likewise.
---
 gcc/gimple.h | 20 
 1 file changed, 20 deletions(-)

diff --git a/gcc/gimple.h b/gcc/gimple.h
index cfd8d2c..9e7a911 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3717,16 +3717,6 @@ gimple_asm_input_op (const gasm *asm_stmt, unsigned 
index)
   return asm_stmt->op[index + asm_stmt->no];
 }
 
-/* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT.  */
-
-static inline tree *
-gimple_asm_input_op_ptr (const gasm *asm_stmt, unsigned index)
-{
-  gcc_gimple_checking_assert (index < asm_stmt->ni);
-  return const_cast (&asm_stmt->op[index + asm_stmt->no]);
-}
-
-
 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT.  */
 
 static inline void
@@ -3747,16 +3737,6 @@ gimple_asm_output_op (const gasm *asm_stmt, unsigned 
index)
   return asm_stmt->op[index];
 }
 
-/* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT.  */
-
-static inline tree *
-gimple_asm_output_op_ptr (const gasm *asm_stmt, unsigned index)
-{
-  gcc_gimple_checking_assert (index < asm_stmt->no);
-  return const_cast (&asm_stmt->op[index]);
-}
-
-
 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT.  */
 
 static inline void
-- 
2.4.0



[PATCH 4/4] make more gimple_x_ptr accessors const correct

2015-10-04 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-04  Trevor Saunders  

* gimple.h (gimple_op_ptr): Require a non const gimple *.
(gimple_assign_lhs_ptr): Likewise.
(gimple_assign_rhs1_ptr): Likewise.
(gimple_assign_rhs2_ptr): Likewise.
(gimple_assign_rhs3_ptr): Likewise.
(gimple_call_lhs_ptr): Likewise.
(gimple_call_fn_ptr): Likewise.
(gimple_call_chain_ptr): Likewise.
(gimple_call_arg_ptr): Likewise.
(gimple_cond_lhs_ptr): Likewise.
(gimple_cond_rhs_ptr): Likewise.
(gimple_switch_index_ptr): Likewise.
(gimple_return_retval_ptr): Likewise.
---
 gcc/gimple.h | 78 ++--
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/gcc/gimple.h b/gcc/gimple.h
index 9e7a911..a456f54 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2346,12 +2346,12 @@ gimple_op (const gimple *gs, unsigned i)
 /* Return a pointer to operand I for statement GS.  */
 
 static inline tree *
-gimple_op_ptr (const gimple *gs, unsigned i)
+gimple_op_ptr (gimple *gs, unsigned i)
 {
   if (gimple_has_ops (gs))
 {
   gcc_gimple_checking_assert (i < gimple_num_ops (gs));
-  return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
+  return gimple_ops (gs) + i;
 }
   else
 return NULL;
@@ -2407,15 +2407,15 @@ gimple_assign_lhs (const gimple *gs)
 /* Return a pointer to the LHS of assignment statement GS.  */
 
 static inline tree *
-gimple_assign_lhs_ptr (const gassign *gs)
+gimple_assign_lhs_ptr (gassign *gs)
 {
-  return const_cast (&gs->op[0]);
+  return &gs->op[0];
 }
 
 static inline tree *
-gimple_assign_lhs_ptr (const gimple *gs)
+gimple_assign_lhs_ptr (gimple *gs)
 {
-  const gassign *ass = GIMPLE_CHECK2 (gs);
+  gassign *ass = GIMPLE_CHECK2 (gs);
   return gimple_assign_lhs_ptr (ass);
 }
 
@@ -2459,15 +2459,15 @@ gimple_assign_rhs1 (const gimple *gs)
statement GS.  */
 
 static inline tree *
-gimple_assign_rhs1_ptr (const gassign *gs)
+gimple_assign_rhs1_ptr (gassign *gs)
 {
-  return const_cast (&gs->op[1]);
+  return &gs->op[1];
 }
 
 static inline tree *
-gimple_assign_rhs1_ptr (const gimple *gs)
+gimple_assign_rhs1_ptr (gimple *gs)
 {
-  const gassign *ass = GIMPLE_CHECK2 (gs);
+  gassign *ass = GIMPLE_CHECK2 (gs);
   return gimple_assign_rhs1_ptr (ass);
 }
 
@@ -2511,16 +2511,16 @@ gimple_assign_rhs2 (const gimple *gs)
statement GS.  */
 
 static inline tree *
-gimple_assign_rhs2_ptr (const gassign *gs)
+gimple_assign_rhs2_ptr (gassign *gs)
 {
   gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
-  return const_cast (&gs->op[2]);
+  return &gs->op[2];
 }
 
 static inline tree *
-gimple_assign_rhs2_ptr (const gimple *gs)
+gimple_assign_rhs2_ptr (gimple *gs)
 {
-  const gassign *ass = GIMPLE_CHECK2 (gs);
+  gassign *ass = GIMPLE_CHECK2 (gs);
   return gimple_assign_rhs2_ptr (ass);
 }
 
@@ -2564,11 +2564,11 @@ gimple_assign_rhs3 (const gimple *gs)
statement GS.  */
 
 static inline tree *
-gimple_assign_rhs3_ptr (const gimple *gs)
+gimple_assign_rhs3_ptr (gimple *gs)
 {
-  const gassign *ass = GIMPLE_CHECK2 (gs);
+  gassign *ass = GIMPLE_CHECK2 (gs);
   gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
-  return const_cast (&ass->op[3]);
+  return &ass->op[3];
 }
 
 
@@ -2764,15 +2764,15 @@ gimple_call_lhs (const gimple *gs)
 /* Return a pointer to the LHS of call statement GS.  */
 
 static inline tree *
-gimple_call_lhs_ptr (const gcall *gs)
+gimple_call_lhs_ptr (gcall *gs)
 {
-  return const_cast (&gs->op[0]);
+  return &gs->op[0];
 }
 
 static inline tree *
-gimple_call_lhs_ptr (const gimple *gs)
+gimple_call_lhs_ptr (gimple *gs)
 {
-  const gcall *gc = GIMPLE_CHECK2 (gs);
+  gcall *gc = GIMPLE_CHECK2 (gs);
   return gimple_call_lhs_ptr (gc);
 }
 
@@ -2948,15 +2948,15 @@ gimple_call_fn (const gimple *gs)
statement GS.  */
 
 static inline tree *
-gimple_call_fn_ptr (const gcall *gs)
+gimple_call_fn_ptr (gcall *gs)
 {
-  return const_cast (&gs->op[1]);
+  return &gs->op[1];
 }
 
 static inline tree *
-gimple_call_fn_ptr (const gimple *gs)
+gimple_call_fn_ptr (gimple *gs)
 {
-  const gcall *gc = GIMPLE_CHECK2 (gs);
+  gcall *gc = GIMPLE_CHECK2 (gs);
   return gimple_call_fn_ptr (gc);
 }
 
@@ -3052,9 +3052,9 @@ gimple_call_chain (const gimple *gs)
 /* Return a pointer to the static chain for call statement CALL_STMT.  */
 
 static inline tree *
-gimple_call_chain_ptr (const gcall *call_stmt)
+gimple_call_chain_ptr (gcall *call_stmt)
 {
-  return const_cast (&call_stmt->op[2]);
+  return &call_stmt->op[2];
 }
 
 /* Set CHAIN to be the static chain for call statement CALL_STMT.  */
@@ -3103,16 +3103,16 @@ gimple_call_arg (const gimple *gs, unsigned index)
statement GS.  */
 
 static inline tree *
-gimple_call_arg_ptr (const gcall *gs, unsigned index)
+gimple_call_arg_ptr (gcall *gs, unsigned index)
 {
   gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
-  return const_cast (&gs->op[index + 3]);
+  

[PATCH] reorg.c: use vec instead of rtx_insn_list for the delay insn list

2015-10-06 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

This seems a bit cleaner, and should involve less allocation.

I tested there was no regressions for sh-sim with all languages accept
ada,lto,fortran, ok?

Trev


gcc/ChangeLog:

2015-10-06  Trevor Saunders  

* reorg.c (emit_delay_sequence): store list of delay slot insns
in a vector instead of rtx_insn_list.
(add_to_delay_list): Likewise.
(delete_from_delay_slot): Likewise.
(optimize_skip): Likewise.
(redirect_with_delay_list_safe_p): Likewise.
(check_annul_list_true_false): Likewise.
(steal_delay_list_from_target): Likewise.
(steal_delay_list_from_fallthrough): Likewise.
(redundant_insn): Likewise.
(fill_simple_delay_slots): Likewise.
(fill_slots_from_thread): Likewise.
(fill_eager_delay_slots): Likewise.
(relax_delay_slots): Likewise.
---
 gcc/reorg.c | 357 ++--
 1 file changed, 156 insertions(+), 201 deletions(-)

diff --git a/gcc/reorg.c b/gcc/reorg.c
index cdaa60c..32c4d81 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -213,38 +213,38 @@ 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);
 static rtx_code_label *find_end_label (rtx);
-static rtx_insn *emit_delay_sequence (rtx_insn *, rtx_insn_list *, int);
-static rtx_insn_list *add_to_delay_list (rtx_insn *, rtx_insn_list *);
+static rtx_insn *emit_delay_sequence (rtx_insn *, const vec &,
+ int);
+static void add_to_delay_list (rtx_insn *, vec *);
 static rtx_insn *delete_from_delay_slot (rtx_insn *);
 static void delete_scheduled_jump (rtx_insn *);
 static void note_delay_statistics (int, int);
 #if defined(ANNUL_IFFALSE_SLOTS) || defined(ANNUL_IFTRUE_SLOTS)
-static rtx_insn_list *optimize_skip (rtx_jump_insn *);
+static void optimize_skip (rtx_jump_insn *, vec *);
 #endif
 static int get_jump_flags (const rtx_insn *, rtx);
 static int mostly_true_jump (rtx);
 static rtx get_branch_condition (const rtx_insn *, rtx);
 static int condition_dominates_p (rtx, const rtx_insn *);
 static int redirect_with_delay_slots_safe_p (rtx_insn *, rtx, rtx);
-static int redirect_with_delay_list_safe_p (rtx_insn *, rtx, rtx_insn_list *);
-static int check_annul_list_true_false (int, rtx);
-static rtx_insn_list *steal_delay_list_from_target (rtx_insn *, rtx,
-   rtx_sequence *,
-   rtx_insn_list *,
-   struct resources *,
-   struct resources *,
-   struct resources *,
-   int, int *, int *,
-   rtx *);
-static rtx_insn_list *steal_delay_list_from_fallthrough (rtx_insn *, rtx,
-rtx_sequence *,
-rtx_insn_list *,
-struct resources *,
-struct resources *,
-struct resources *,
-int, int *, int *);
+static int redirect_with_delay_list_safe_p (rtx_insn *, rtx,
+   const vec &);
+static int check_annul_list_true_false (int, const vec &);
+static void steal_delay_list_from_target (rtx_insn *, rtx, rtx_sequence *,
+ vec *,
+ struct resources *,
+ struct resources *,
+ struct resources *,
+ int, int *, int *,
+ rtx *);
+static void steal_delay_list_from_fallthrough (rtx_insn *, rtx, rtx_sequence *,
+  vec *,
+  struct resources *,
+  struct resources *,
+  struct resources *,
+  int, int *, int *);
 static void try_merge_delay_insns (rtx_insn *, rtx_insn *);
-static rtx redundant_insn (rtx, rtx_insn *, rtx);
+static rtx redundant_insn (rtx, rtx_insn *, const vec &);
 static int own_thread_p (rtx, rtx, int);
 static void update_block (rtx_insn *, rtx);
 static int reorg_redirect_jump (rtx_jump_insn *, rtx);
@@ -252,9 +252,9 @@ static void update_reg_dead_notes (rtx_insn *, rtx_insn *);
 static void fix_reg_dead

[PATCH] remove an unneeded as_a ()

2015-10-10 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

obvious clean up, bootstrapped + regtested x86_64-linux-gnu, committed.

Trev

gcc/ChangeLog:

2015-10-10  Trevor Saunders  

* function.c (stack_protect_epilogue): Remove as_a ()
call that isn't needed.
---
 gcc/ChangeLog  | 5 +
 gcc/function.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 81f6ad8..6066ce8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-10  Trevor Saunders  
+
+   * function.c (stack_protect_epilogue): Remove as_a ()
+   call that isn't needed.
+
 2015-10-09  Martin Jambor  
 
tree-optimization/67794
diff --git a/gcc/function.c b/gcc/function.c
index d16d6d8..db5bc1c 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4986,7 +4986,7 @@ stack_protect_epilogue (void)
 {
   tree guard_decl = targetm.stack_protect_guard ();
   rtx_code_label *label = gen_label_rtx ();
-  rtx x, y, tmp;
+  rtx x, y;
   rtx_insn *seq;
 
   x = expand_normal (crtl->stack_protect_guard);
@@ -5005,9 +5005,9 @@ stack_protect_epilogue (void)
  things moved out of line.  Since this is the only extant case of adding
  a noreturn function at the rtl level, it doesn't seem worth doing ought
  except adding the prediction by hand.  */
-  tmp = get_last_insn ();
+  rtx_insn *tmp = get_last_insn ();
   if (JUMP_P (tmp))
-predict_insn_def (as_a  (tmp), PRED_NORETURN, TAKEN);
+predict_insn_def (tmp, PRED_NORETURN, TAKEN);
 
   expand_call (targetm.stack_protect_fail (), NULL_RTX, /*ignore=*/true);
   free_temp_slots ();
-- 
2.6.1



[PATCH 0/6] more ifdef removal

2015-10-10 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

more of the same sort of ifdef removal adding defaults.

patches individually bootstrapped + regtested on x86_64-linux-gnu, committing
as preapproved.

Trev


Trevor Saunders (6):
  always define INITIAL_FRAME_ADDRESS_RTX
  always define SETUP_FRAME_ADDRESSES
  always define DYNAMIC_CHAIN_ADDRESS
  always define FRAME_ADDR_RTX
  remove unneeded #if for HARD_FRAME_POINTER_IS_ARG_POINTER
  always define REVERSE_CONDITION

 gcc/builtins.c | 56 +++---
 gcc/defaults.h | 20 +++
 gcc/doc/tm.texi|  4 ++--
 gcc/doc/tm.texi.in |  4 ++--
 gcc/except.c   |  2 --
 gcc/jump.c |  8 +---
 6 files changed, 45 insertions(+), 49 deletions(-)

-- 
2.6.1



[PATCH 2/6] always define SETUP_FRAME_ADDRESSES

2015-10-10 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-10  Trevor Saunders  

* defaults.h (SETUP_FRAME_ADDRESSES): New default definition.
* builtins.c (expand_builtin_return_addr): Adjust.
* doc/tm.texi: Likewise.
* doc/tm.texi.in: Likewise.
* except.c (expand_builtin_unwind_init): Likewise.
---
 gcc/builtins.c | 5 -
 gcc/defaults.h | 4 
 gcc/doc/tm.texi| 4 ++--
 gcc/doc/tm.texi.in | 4 ++--
 gcc/except.c   | 2 --
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 3bbe763..bd95acb 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -784,13 +784,8 @@ expand_builtin_return_addr (enum built_in_function 
fndecl_code, int count)
}
 }
 
-  /* Some machines need special handling before we can access
- arbitrary frames.  For example, on the SPARC, we must first flush
- all register windows to the stack.  */
-#ifdef SETUP_FRAME_ADDRESSES
   if (count > 0)
 SETUP_FRAME_ADDRESSES ();
-#endif
 
   /* On the SPARC, the return address is not in the frame, it is in a
  register.  There is no way to access it off of the current frame
diff --git a/gcc/defaults.h b/gcc/defaults.h
index c4d9536..5f1ea76 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1281,6 +1281,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define INITIAL_FRAME_ADDRESS_RTX NULL
 #endif
 
+#ifndef SETUP_FRAME_ADDRESSES
+#define SETUP_FRAME_ADDRESSES() do { } while (0)
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 72366b9..d09e646 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -3020,11 +3020,11 @@ address of the stack word that points to the previous 
frame.
 @end defmac
 
 @defmac SETUP_FRAME_ADDRESSES
-If defined, a C expression that produces the machine-specific code to
+A C expression that produces the machine-specific code to
 setup the stack so that arbitrary frames can be accessed.  For example,
 on the SPARC, we must flush all of the register windows to the stack
 before we can access arbitrary stack frames.  You will seldom need to
-define this macro.
+define this macro.  The default is to do nothing.
 @end defmac
 
 @deftypefn {Target Hook} rtx TARGET_BUILTIN_SETJMP_FRAME_VALUE (void)
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index d8d0087..33939ec 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -2626,11 +2626,11 @@ address of the stack word that points to the previous 
frame.
 @end defmac
 
 @defmac SETUP_FRAME_ADDRESSES
-If defined, a C expression that produces the machine-specific code to
+A C expression that produces the machine-specific code to
 setup the stack so that arbitrary frames can be accessed.  For example,
 on the SPARC, we must flush all of the register windows to the stack
 before we can access arbitrary stack frames.  You will seldom need to
-define this macro.
+define this macro.  The default is to do nothing.
 @end defmac
 
 @hook TARGET_BUILTIN_SETJMP_FRAME_VALUE
diff --git a/gcc/except.c b/gcc/except.c
index fed18ee..8f77653 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2120,9 +2120,7 @@ expand_builtin_unwind_init (void)
  able to copy the saved values for any registers from frames we unwind.  */
   crtl->saves_all_registers = 1;
 
-#ifdef SETUP_FRAME_ADDRESSES
   SETUP_FRAME_ADDRESSES ();
-#endif
 }
 
 /* Map a non-negative number to an eh return data register number; expands
-- 
2.6.1



[PATCH 4/6] always define FRAME_ADDR_RTX

2015-10-10 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-10  Trevor Saunders  

* defaults.h (FRAME_ADDR_RTX): New default definition.
* builtins.c (expand_builtin_return_addr): Adjust.
---
 gcc/builtins.c | 4 
 gcc/defaults.h | 4 
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 750488e..65aa71f 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -808,11 +808,7 @@ expand_builtin_return_addr (enum built_in_function 
fndecl_code, int count)
   /* For __builtin_frame_address, return what we've got.  But, on
  the SPARC for example, we may have to add a bias.  */
   if (fndecl_code == BUILT_IN_FRAME_ADDRESS)
-#ifdef FRAME_ADDR_RTX
 return FRAME_ADDR_RTX (tem);
-#else
-return tem;
-#endif
 
   /* For __builtin_return_address, get the return address from that frame.  */
 #ifdef RETURN_ADDR_RTX
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 80ad35c..eb16fc8 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1289,6 +1289,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define DYNAMIC_CHAIN_ADDRESS(x) (x)
 #endif
 
+#ifndef FRAME_ADDR_RTX
+#define FRAME_ADDR_RTX(x) (x)
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
-- 
2.6.1



[PATCH 1/6] always define INITIAL_FRAME_ADDRESS_RTX

2015-10-10 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-10  Trevor Saunders  

* builtins.c (expand_builtin_return_addr): Adjust.
* defaults.h (INITIAL_FRAME_ADDRESS_RTX): New default definition.
---
 gcc/builtins.c | 41 +++--
 gcc/defaults.h |  4 
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 643eeef..3bbe763 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -761,31 +761,28 @@ static rtx
 expand_builtin_return_addr (enum built_in_function fndecl_code, int count)
 {
   int i;
-
-#ifdef INITIAL_FRAME_ADDRESS_RTX
   rtx tem = INITIAL_FRAME_ADDRESS_RTX;
-#else
-  rtx tem;
-
-  /* For a zero count with __builtin_return_address, we don't care what
- frame address we return, because target-specific definitions will
- override us.  Therefore frame pointer elimination is OK, and using
- the soft frame pointer is OK.
-
- For a nonzero count, or a zero count with __builtin_frame_address,
- we require a stable offset from the current frame pointer to the
- previous one, so we must use the hard frame pointer, and
- we must disable frame pointer elimination.  */
-  if (count == 0 && fndecl_code == BUILT_IN_RETURN_ADDRESS)
-tem = frame_pointer_rtx;
-  else
-{
-  tem = hard_frame_pointer_rtx;
+  if (tem == NULL_RTX)
+{
+  /* For a zero count with __builtin_return_address, we don't care what
+frame address we return, because target-specific definitions will
+override us.  Therefore frame pointer elimination is OK, and using
+the soft frame pointer is OK.
+
+For a nonzero count, or a zero count with __builtin_frame_address,
+we require a stable offset from the current frame pointer to the
+previous one, so we must use the hard frame pointer, and
+we must disable frame pointer elimination.  */
+  if (count == 0 && fndecl_code == BUILT_IN_RETURN_ADDRESS)
+   tem = frame_pointer_rtx;
+  else
+   {
+ tem = hard_frame_pointer_rtx;
 
-  /* Tell reload not to eliminate the frame pointer.  */
-  crtl->accesses_prior_frames = 1;
+ /* Tell reload not to eliminate the frame pointer.  */
+ crtl->accesses_prior_frames = 1;
+   }
 }
-#endif
 
   /* Some machines need special handling before we can access
  arbitrary frames.  For example, on the SPARC, we must first flush
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 14ef91a..c4d9536 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1277,6 +1277,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define CONSTANT_ALIGNMENT(EXP, ALIGN) ALIGN
 #endif
 
+#ifndef INITIAL_FRAME_ADDRESS_RTX
+#define INITIAL_FRAME_ADDRESS_RTX NULL
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
-- 
2.6.1



[PATCH 3/6] always define DYNAMIC_CHAIN_ADDRESS

2015-10-10 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-10  Trevor Saunders  

* defaults.h (DYNAMIC_CHAIN_ADDRESS): New default definition.
* builtins.c (expand_builtin_return_addr): Adjust.
---
 gcc/builtins.c | 2 --
 gcc/defaults.h | 4 
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index bd95acb..750488e 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -799,9 +799,7 @@ expand_builtin_return_addr (enum built_in_function 
fndecl_code, int count)
 {
   /* Assume the dynamic chain pointer is in the word that the
 frame address points to, unless otherwise specified.  */
-#ifdef DYNAMIC_CHAIN_ADDRESS
   tem = DYNAMIC_CHAIN_ADDRESS (tem);
-#endif
   tem = memory_address (Pmode, tem);
   tem = gen_frame_mem (Pmode, tem);
   tem = copy_to_reg (tem);
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 5f1ea76..80ad35c 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1285,6 +1285,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define SETUP_FRAME_ADDRESSES() do { } while (0)
 #endif
 
+#ifndef DYNAMIC_CHAIN_ADDRESS
+#define DYNAMIC_CHAIN_ADDRESS(x) (x)
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
-- 
2.6.1



[PATCH 5/6] remove unneeded #if for HARD_FRAME_POINTER_IS_ARG_POINTER

2015-10-10 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-10  Trevor Saunders  

* builtins.c (expand_builtin_setjmp_receiver): Don't use #if to
check HARD_FRAME_POINTER_IS_ARG_POINTER.
---
 gcc/builtins.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 65aa71f..b4ac535 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -915,8 +915,7 @@ expand_builtin_setjmp_receiver (rtx receiver_label)
   emit_clobber (hard_frame_pointer_rtx);
 }
 
-#if !HARD_FRAME_POINTER_IS_ARG_POINTER
-  if (fixed_regs[ARG_POINTER_REGNUM])
+  if (!HARD_FRAME_POINTER_IS_ARG_POINTER && fixed_regs[ARG_POINTER_REGNUM])
 {
 #ifdef ELIMINABLE_REGS
   /* If the argument pointer can be eliminated in favor of the
@@ -941,7 +940,6 @@ expand_builtin_setjmp_receiver (rtx receiver_label)
  copy_to_reg (get_arg_pointer_save_area ()));
}
 }
-#endif
 
   if (receiver_label != NULL && targetm.have_builtin_setjmp_receiver ())
 emit_insn (targetm.gen_builtin_setjmp_receiver (receiver_label));
-- 
2.6.1



[PATCH 6/6] always define REVERSE_CONDITION

2015-10-10 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-10-10  Trevor Saunders  

* defaults.h (REVERSE_CONDITION): New default definition.
* jump.c (reversed_comparison_code_parts): Adjust.
---
 gcc/defaults.h | 4 
 gcc/jump.c | 8 +---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index eb16fc8..cee799d 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1293,6 +1293,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define FRAME_ADDR_RTX(x) (x)
 #endif
 
+#ifndef REVERSE_CONDITION
+#define REVERSE_CONDITION(code, mode) reverse_condition (code)
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/jump.c b/gcc/jump.c
index 21324cd..f0d2af0 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -389,13 +389,7 @@ reversed_comparison_code_parts (enum rtx_code code, 
const_rtx arg0,
  machine description to do tricks.  */
   if (GET_MODE_CLASS (mode) == MODE_CC
   && REVERSIBLE_CC_MODE (mode))
-{
-#ifdef REVERSE_CONDITION
-  return REVERSE_CONDITION (code, mode);
-#else
-  return reverse_condition (code);
-#endif
-}
+return REVERSE_CONDITION (code, mode);
 
   /* Try a few special cases based on the comparison code.  */
   switch (code)
-- 
2.6.1



[PATCH] change a function argument from rtx to rtx_insn *

2015-10-16 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

$subject, just a small improvement  to rtx_insn type safety I happened to 
notice.

bootstrapped + regtested x86_64-linux-gnu, committing to trunk.

Trev

gcc/ChangeLog:

2015-10-16  Trevor Saunders  

* lra-constraints.c (add_next_usage_insn): Change argument type
from rtx to rtx_insn *.
---
 gcc/lra-constraints.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 2c27f1a..f8fb36e 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -4545,7 +4545,7 @@ setup_next_usage_insn (int regno, rtx insn, int 
reloads_num, bool after_p)
optional debug insns finished by a non-debug insn using REGNO.
RELOADS_NUM is current number of reload insns processed so far.  */
 static void
-add_next_usage_insn (int regno, rtx insn, int reloads_num)
+add_next_usage_insn (int regno, rtx_insn *insn, int reloads_num)
 {
   rtx next_usage_insns;
 
-- 
2.6.1



[PATCH] unconditionally compile most of the delay slot code

2015-10-21 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

$subject

bootstrapped+ regtested x86_64-linux-gnu, I wouldn't mind a second pair of eyes
on this one given its not totally trivial.

Trev

gcc/ChangeLog:

2015-10-20  Trevor Saunders  

* cfgrtl.c (pass_free_cfg::execute): Adjust.
* final.c (dbr_sequence_length): Always define.
(shorten_branches): Adjust.
* genattr-common.c (main): Always define DELAY_SLOTS.
* genattr.c (main): Unconditionally declare functions and define
macros related to delay slots.
* genattrtab.c (write_eligible_delay): Adjust.
(main): Always write out delay slot functions.
* opts.c (default_options_table): Adjust.
* reorg.c (redirect_with_delay_slots_safe_p): Likewise.
(redirect_with_delay_list_safe_p): Likewise.
(fill_simple_delay_slots): Likewise.
(fill_slots_from_thread): Likewise.
(make_return_insns): Likewise.
(dbr_schedule): Likewise.
(rest_of_handle_delay_slots): Likewise.
(pass_delay_slots::gate): Likewise.
* toplev.c (process_options): Likewise.
---
 gcc/cfgrtl.c |  4 +--
 gcc/final.c  | 12 
 gcc/genattr-common.c |  8 ++---
 gcc/genattr.c| 39 ++---
 gcc/genattrtab.c | 16 --
 gcc/opts.c   |  2 +-
 gcc/reorg.c  | 82 
 gcc/toplev.c |  4 +--
 8 files changed, 62 insertions(+), 105 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 15ce8a7..5f21ac0 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -482,15 +482,13 @@ public:
 unsigned int
 pass_free_cfg::execute (function *)
 {
-#ifdef DELAY_SLOTS
   /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
  valid at that point so it would be too late to call df_analyze.  */
-  if (optimize > 0 && flag_delayed_branch)
+  if (DELAY_SLOTS && optimize > 0 && flag_delayed_branch)
 {
   df_note_add_problem ();
   df_analyze ();
 }
-#endif
 
   if (crtl->has_bb_partition)
 insert_section_boundary_note ();
diff --git a/gcc/final.c b/gcc/final.c
index f01f4fc..c06c99d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -296,7 +296,6 @@ app_disable (void)
delayed branch sequence (we don't count the insn needing the
delay slot).   Zero if not in a delayed branch sequence.  */
 
-#ifdef DELAY_SLOTS
 int
 dbr_sequence_length (void)
 {
@@ -305,7 +304,6 @@ dbr_sequence_length (void)
   else
 return 0;
 }
-#endif
 
 /* The next two pages contain routines used to compute the length of an insn
and to shorten branches.  */
@@ -1155,11 +1153,11 @@ shorten_branches (rtx_insn *first)
{
  int i;
  int const_delay_slots;
-#ifdef DELAY_SLOTS
- const_delay_slots = const_num_delay_slots (body_seq->insn (0));
-#else
- const_delay_slots = 0;
-#endif
+ if (DELAY_SLOTS)
+   const_delay_slots = const_num_delay_slots (body_seq->insn (0));
+ else
+   const_delay_slots = 0;
+
  int (*inner_length_fun) (rtx_insn *)
= const_delay_slots ? length_fun : insn_default_length;
  /* Inside a delay slot sequence, we do not do any branch shortening
diff --git a/gcc/genattr-common.c b/gcc/genattr-common.c
index 0ff8da9..a51f8eb 100644
--- a/gcc/genattr-common.c
+++ b/gcc/genattr-common.c
@@ -87,11 +87,7 @@ main (int argc, char **argv)
break;
 
   case DEFINE_DELAY:
-   if (!have_delay)
- {
-   printf ("#define DELAY_SLOTS\n");
-   have_delay = true;
- }
+   have_delay = true;
break;
 
   case DEFINE_INSN_RESERVATION:
@@ -105,6 +101,8 @@ main (int argc, char **argv)
   default:
break;
   }
+
+   printf ("#define DELAY_SLOTS %d\n", have_delay);
   puts ("\n#endif /* GCC_INSN_ATTR_COMMON_H */");
 
   if (ferror (stdout) || fflush (stdout) || fclose (stdout))
diff --git a/gcc/genattr.c b/gcc/genattr.c
index d31f007..e45f87c 100644
--- a/gcc/genattr.c
+++ b/gcc/genattr.c
@@ -140,9 +140,8 @@ find_tune_attr (rtx exp)
 int
 main (int argc, char **argv)
 {
-  int have_delay = 0;
-  int have_annul_true = 0;
-  int have_annul_false = 0;
+  bool have_annul_true = false;
+  bool have_annul_false = false;
   int num_insn_reservations = 0;
   int i;
 
@@ -172,29 +171,13 @@ main (int argc, char **argv)
  break;
 
case DEFINE_DELAY:
- if (! have_delay)
-   {
- printf ("extern int num_delay_slots (rtx_insn *);\n");
- printf ("extern int eligible_for_delay (rtx_insn *, int, rtx_insn 
*, int);\n\n");
- printf ("extern int const_num_delay_slots (rtx_insn *);\n\n");
- have_delay = 1;
-   }
-
  for (i = 0; i < XVECLEN (def, 1); i += 3)
{
- if (XVECEXP (def, 1, i + 1) && ! have_annul_true)
-   {
- printf ("#define ANNUL_IFTRUE_SLOTS\n");
- p

[PATCH] replace BITS_PER_UNIT with __CHAR_BIT__ in target libs

2015-10-30 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

$subject as far as I am aware these are the same on all supported targets.

Trev

libgcc/ChangeLog:

2015-10-30  Trevor Saunders  

* config/visium/lib2funcs.c (__set_trampoline_parity): Use
__CHAR_BIT__ instead of BITS_PER_UNIT.
* fixed-bit.h: Likewise.
* fp-bit.h: Likewise.
* libgcc2.c (__popcountSI2): Likewise.
(__popcountDI2): Likewise.
* libgcc2.h: Likewise.
* libgcov.h: Likewise.

libobjc/ChangeLog:

2015-10-30  Trevor Saunders  

PR libobjc/24775
* encoding.c (_darwin_rs6000_special_round_type_align): Use
__CHAR_BIT__ instead of BITS_PER_UNIT.
(objc_sizeof_type): Likewise.
(objc_layout_structure): Likewise.
(objc_layout_structure_next_member): Likewise.
(objc_layout_finish_structure): Likewise.
(objc_layout_structure_get_info): Likewise.
---
 libgcc/config/visium/lib2funcs.c |  2 +-
 libgcc/fixed-bit.h   | 10 +-
 libgcc/fp-bit.h  |  4 ++--
 libgcc/libgcc2.c | 24 
 libgcc/libgcc2.h |  8 
 libgcc/libgcov.h |  4 ++--
 libobjc/encoding.c   | 35 ---
 7 files changed, 42 insertions(+), 45 deletions(-)

diff --git a/libgcc/config/visium/lib2funcs.c b/libgcc/config/visium/lib2funcs.c
index ba720a3..ed9561f 100644
--- a/libgcc/config/visium/lib2funcs.c
+++ b/libgcc/config/visium/lib2funcs.c
@@ -315,7 +315,7 @@ __set_trampoline_parity (UWtype *addr)
 {
   int i;
 
-  for (i = 0; i < (TRAMPOLINE_SIZE * BITS_PER_UNIT) / W_TYPE_SIZE; i++)
+  for (i = 0; i < (TRAMPOLINE_SIZE * __CHAR_BIT__) / W_TYPE_SIZE; i++)
 addr[i] |= parity_bit (addr[i]);
 }
 #endif
diff --git a/libgcc/fixed-bit.h b/libgcc/fixed-bit.h
index 2efe01d..7f51f7b 100644
--- a/libgcc/fixed-bit.h
+++ b/libgcc/fixed-bit.h
@@ -434,7 +434,7 @@ typedef union
 } INTunion;
 #endif
 
-#define FIXED_WIDTH(FIXED_SIZE * BITS_PER_UNIT) /* in bits.  */
+#define FIXED_WIDTH(FIXED_SIZE * __CHAR_BIT__) /* in bits.  */
 #define FIXED_C_TYPE1(NAME)NAME ## type
 #define FIXED_C_TYPE2(NAME)FIXED_C_TYPE1(NAME)
 #define FIXED_C_TYPE   FIXED_C_TYPE2(MODE_NAME)
@@ -1108,17 +1108,17 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, 
word_type);
 #if defined (FROM_MODE_NAME_S) && defined (TO_MODE_NAME_S)
 
 #if FROM_TYPE == 1 /* Signed integer.  */
-#define FROM_INT_WIDTH (FROM_INT_SIZE * BITS_PER_UNIT)
+#define FROM_INT_WIDTH (FROM_INT_SIZE * __CHAR_BIT__)
 #endif
 
 #if FROM_TYPE == 2 /* Unsigned integer.  */
-#define FROM_INT_WIDTH (FROM_INT_SIZE * BITS_PER_UNIT)
+#define FROM_INT_WIDTH (FROM_INT_SIZE * __CHAR_BIT__)
 #endif
 
 #if FROM_TYPE == 4 /* Fixed-point.  */
 #define FROM_FIXED_C_TYPE  FIXED_C_TYPE2(FROM_MODE_NAME)
 #define FROM_FBITS FBITS2(FROM_MODE_NAME)
-#define FROM_FIXED_WIDTH   (FROM_FIXED_SIZE * BITS_PER_UNIT)
+#define FROM_FIXED_WIDTH   (FROM_FIXED_SIZE * __CHAR_BIT__)
 #define FROM_FBITS FBITS2(FROM_MODE_NAME)
 #define FROM_IBITS IBITS2(FROM_MODE_NAME)
 #define FROM_I_F_BITS  (FROM_FBITS + FROM_IBITS)
@@ -1136,7 +1136,7 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, 
word_type);
 #if TO_TYPE == 4   /* Fixed-point.  */
 #define TO_FIXED_C_TYPEFIXED_C_TYPE2(TO_MODE_NAME)
 #define TO_FBITS   FBITS2(TO_MODE_NAME)
-#define TO_FIXED_WIDTH (TO_FIXED_SIZE * BITS_PER_UNIT)
+#define TO_FIXED_WIDTH (TO_FIXED_SIZE * __CHAR_BIT__)
 #define TO_FBITS   FBITS2(TO_MODE_NAME)
 #define TO_IBITS   IBITS2(TO_MODE_NAME)
 #define TO_I_F_BITS(TO_FBITS + TO_IBITS)
diff --git a/libgcc/fp-bit.h b/libgcc/fp-bit.h
index d844f42..29661be 100644
--- a/libgcc/fp-bit.h
+++ b/libgcc/fp-bit.h
@@ -117,11 +117,11 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
 
 #define MAX_USI_INT  (~(USItype)0)
 #define MAX_SI_INT   ((SItype) (MAX_USI_INT >> 1))
-#define BITS_PER_SI  (4 * BITS_PER_UNIT)
+#define BITS_PER_SI  (4 * __CHAR_BIT__)
 #ifdef TMODES
 #define MAX_UDI_INT  (~(UDItype)0)
 #define MAX_DI_INT   ((DItype) (MAX_UDI_INT >> 1))
-#define BITS_PER_DI  (8 * BITS_PER_UNIT)
+#define BITS_PER_DI  (8 * __CHAR_BIT__)
 #endif
 
 #ifdef FLOAT_ONLY
diff --git a/libgcc/libgcc2.c b/libgcc/libgcc2.c
index c737620..90dba06 100644
--- a/libgcc/libgcc2.c
+++ b/libgcc/libgcc2.c
@@ -160,7 +160,7 @@ __mulvSI3 (Wtype a, Wtype b)
 }
 #ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
 #undef WORD_SIZE
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
+#define WORD_SIZE (sizeof (SItype) * __CHAR_BIT__)
 SItype
 __mulvsi3 (SItype a, SItype b)
 {
@@ -820,16 +820,16 @@ const UQItype __popcount_tab[256] =
 #endif
 
 #if defined(L_popcountsi2) || defined(L_popcountdi2)
-#define POPCOUNTCST2(x) (((UWtype) x << BITS_PER_UNIT) | x)
-#define POPCOUNTCST4(x) (((UWtype) x << (2 * BITS_PER_UNIT)) |

[PATCH 0/5] remove tm.h from encoding.c

2015-10-30 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

Its not the nicest code in the world, and there's definitely room for cleanups,
however it seems like an improvement.  After this series the only usage of tm.h
in libobjc is thr.c which only uses tm.h so it can include gthr.h which uses
SUPPORTS_WEAK and possibly other target macros.

bootstrapped + regtested patches individually on x86_64-linux-gnu, also tested 
the
series as a whole doesn't regress check-objc on ppc64{,le}-linux-gnu and AIX,
ok?

Trev

Trevor Saunders (4):
  remove usage of ROUND_TYPE_SIZE from encoding.c
  stop using ROUND_TYPE_ALIGN in libobjc/
  remove usage of BIGGEST_FIELD_ALIGNMENT in encoding.c
  remove usage of ADJUST_FIELD_ALIGN in encoding.c

pault (1):
  2015-01-25  Paul Thomas  

 gcc/fortran/ChangeLog  |  21 +-
 gcc/fortran/trans-array.c  |  32 +++
 gcc/fortran/trans-expr.c   |  70 ---
 gcc/fortran/trans-stmt.c   |   9 +-
 gcc/testsuite/ChangeLog|  11 ++
 .../gfortran.dg/allocate_with_source_12.f03|  38 
 .../gfortran.dg/allocate_with_source_13.f03| 220 +
 .../gfortran.dg/allocate_with_source_14.f03| 214 
 libobjc/encoding.c |  48 +++--
 9 files changed, 613 insertions(+), 50 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_12.f03
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_13.f03
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_14.f03

-- 
2.6.2



[PATCH 2/5] remove usage of ROUND_TYPE_SIZE from encoding.c

2015-10-30 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc got rid of this target macro in 2003, so it seems safe to assume the
alternate path works fine on all targets.

libobjc/ChangeLog:

2015-10-30  Trevor Saunders  

PR libobjc/24775
* encoding.c (objc_layout_finish_structure): Remove usage of
ROUND_TYPE_SIZE.
---
 libobjc/encoding.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libobjc/encoding.c b/libobjc/encoding.c
index abb6145..7de768f 100644
--- a/libobjc/encoding.c
+++ b/libobjc/encoding.c
@@ -1245,14 +1245,8 @@ void objc_layout_finish_structure (struct 
objc_struct_layout *layout,
   layout->record_align = MAX (1, layout->record_align);
 #endif
 
-#ifdef ROUND_TYPE_SIZE
-  layout->record_size = ROUND_TYPE_SIZE (layout->original_type,
- layout->record_size,
- layout->record_align);
-#else
   /* Round the size up to be a multiple of the required alignment */
   layout->record_size = ROUND (layout->record_size, layout->record_align);
-#endif
 
   layout->type = NULL;
 }
-- 
2.6.2



[PATCH 1/5] 2015-01-25 Paul Thomas

2015-10-30 Thread tbsaunde+gcc
From: pault 

PR fortran/67171
* trans-array.c (structure_alloc_comps): On deallocation of
class components, reset the vptr to the declared type vtable
and reset the _len field of unlimited polymorphic components.
*trans-expr.c (gfc_find_and_cut_at_last_class_ref): Bail out on
allocatable component references to the right of part reference
with non-zero rank and return NULL.
(gfc_reset_vptr): Simplify this function by using the function
gfc_get_vptr_from_expr. Return if the vptr is NULL_TREE.
(gfc_reset_len): If gfc_find_and_cut_at_last_class_ref returns
NULL return.
* trans-stmt.c (gfc_trans_allocate): Rely on the use of
gfc_trans_assignment if expr3 is a variable expression since
this deals correctly with array sections.

2015-01-25  Paul Thomas  

PR fortran/67171
* gfortran.dg/allocate_with_source_12.f03: New test

PR fortran/61819
* gfortran.dg/allocate_with_source_13.f03: New test

PR fortran/61830
* gfortran.dg/allocate_with_source_14.f03: New test


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229303 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/fortran/ChangeLog  |  21 +-
 gcc/fortran/trans-array.c  |  32 +++
 gcc/fortran/trans-expr.c   |  70 ---
 gcc/fortran/trans-stmt.c   |   9 +-
 gcc/testsuite/ChangeLog|  11 ++
 .../gfortran.dg/allocate_with_source_12.f03|  38 
 .../gfortran.dg/allocate_with_source_13.f03| 220 +
 .../gfortran.dg/allocate_with_source_14.f03| 214 
 8 files changed, 579 insertions(+), 36 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_12.f03
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_13.f03
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_14.f03

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 1a351be..668013d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,8 +1,25 @@
+2015-01-25  Paul Thomas  
+
+   PR fortran/67171
+   * trans-array.c (structure_alloc_comps): On deallocation of
+   class components, reset the vptr to the declared type vtable
+   and reset the _len field of unlimited polymorphic components.
+   *trans-expr.c (gfc_find_and_cut_at_last_class_ref): Bail out on
+   allocatable component references to the right of part reference
+   with non-zero rank and return NULL.
+   (gfc_reset_vptr): Simplify this function by using the function
+   gfc_get_vptr_from_expr. Return if the vptr is NULL_TREE.
+   (gfc_reset_len): If gfc_find_and_cut_at_last_class_ref returns
+   NULL return.
+   * trans-stmt.c (gfc_trans_allocate): Rely on the use of
+   gfc_trans_assignment if expr3 is a variable expression since
+   this deals correctly with array sections.
+
 2015-10-25  Andre Vehreschild  
 
PR fortran/66927
-   PR fortran/67044
-   * trans-array.c (build_array_ref): Modified call to 
+   PR fortran/67044
+   * trans-array.c (build_array_ref): Modified call to
gfc_get_class_array_ref to adhere to new interface.
(gfc_conv_expr_descriptor): For one-based arrays that
are filled by a loop starting at one the start index of the
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 45c18a5..b726998 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -8024,6 +8024,38 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
 build_int_cst (TREE_TYPE (comp), 0));
}
  gfc_add_expr_to_block (&tmpblock, tmp);
+
+ /* Finally, reset the vptr to the declared type vtable and, if
+necessary reset the _len field.
+
+First recover the reference to the component and obtain
+the vptr.  */
+ comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+decl, cdecl, NULL_TREE);
+ tmp = gfc_class_vptr_get (comp);
+
+ if (UNLIMITED_POLY (c))
+   {
+ /* Both vptr and _len field should be nulled.  */
+ gfc_add_modify (&tmpblock, tmp,
+ build_int_cst (TREE_TYPE (tmp), 0));
+ tmp = gfc_class_len_get (comp);
+ gfc_add_modify (&tmpblock, tmp,
+ build_int_cst (TREE_TYPE (tmp), 0));
+   }
+ else
+   {
+ /* Build the vtable address and set the vptr with it.  */
+ tree vtab;
+ gfc_symbol *vtable;
+ vtable = gfc_find_derived_vtab (c->ts.u.derived);
+

[PATCH 3/5] stop using ROUND_TYPE_ALIGN in libobjc/

2015-10-30 Thread tbsaunde+gcc
From: Trevor Saunders 

Given the layering violation that using ROUND_TYPE_ALIGN in target libs
is, and the hacks needed to make it work just coppying the relevant code
into encoding.c seems to make sense as an incremental improvement.  The
epiphany version of this macro called a function that doesn't exist in
target libs, so libobjc must not build on that target and not coppying
that macro definition doesn't make anything worse.  We already
explicitly prefered the default version to the macro for sparc so we
don't need to copy that version either.  On ppc linux64 and freebsd64
after constant folding values of other target macros used for libobjc
the macro turned out to be the same as the default version so we can
just use the default for them.  Which means the only version of the
macro we actually need to copy are for ppc-darwin and AIX.

libobjc/ChangeLog:

2015-10-30  Trevor Saunders  

PR libobjc/24775
* encoding.c (objc_layout_finish_structure): Remove usage of
ROUND_TYPE_ALIGN.
---
 libobjc/encoding.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/libobjc/encoding.c b/libobjc/encoding.c
index 7de768f..867372d 100644
--- a/libobjc/encoding.c
+++ b/libobjc/encoding.c
@@ -1237,10 +1237,22 @@ void objc_layout_finish_structure (struct 
objc_struct_layout *layout,
   /* Work out the alignment of the record as one expression and store
  in the record type.  Round it up to a multiple of the record's
  alignment. */
-#if defined (ROUND_TYPE_ALIGN) && ! defined (__sparc__)
-  layout->record_align = ROUND_TYPE_ALIGN (layout->original_type-1,
-   1,
-   layout->record_align);
+#if _AIX
+  char type = layout->original_type[-1];
+  if (type == '{' || type == '(')
+   layout->record_align =
+ rs6000_special_round_type_align (layout->original_type-1, 1,
+  layout->record_align);
+  else
+   layout->record_align = MAX (1, layout->record_align);
+#elif __POWERPC__ && __APPLE__
+  char type = layout->original_type[-1];
+  if (type == '{' || type == '(')
+   layout->record_align
+ = darwin_rs6000_special_round_type_align (layout->original_type - 1,
+   1, layout->record_align);
+  else
+   layout->record_align = MAX (1, layout->record_align);
 #else
   layout->record_align = MAX (1, layout->record_align);
 #endif
-- 
2.6.2



[PATCH 4/5] remove usage of BIGGEST_FIELD_ALIGNMENT in encoding.c

2015-10-30 Thread tbsaunde+gcc
From: Trevor Saunders 

Similar to ROUND_TYPE_ALIGN it seems to make sense to copy the
information in the target macros to libobjc as an incremental step.  Its
worth noting a large portion of the definitions of this macro only exist
to work around ADJUST_FIELD_ALIGN being used in target libs, so once all
target macros are gone from target libs we should be able to remove most
of the definitions of BIGGEST_FIELD_ALIGNMENT in gcc/, at which point
there won't be a significant amount of dupplication.

libobjc/ChangeLog:

2015-10-30  Trevor Saunders  

PR libobjc/24775
* encoding.c (objc_layout_structure_next_member): Remove usage
of BIGGEST_FIELD_ALIGNMENT.
---
 libobjc/encoding.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libobjc/encoding.c b/libobjc/encoding.c
index 867372d..7438d64 100644
--- a/libobjc/encoding.c
+++ b/libobjc/encoding.c
@@ -1158,8 +1158,18 @@ objc_layout_structure_next_member (struct 
objc_struct_layout *layout)
 }
 
   /* The following won't work for vectors.  */
-#ifdef BIGGEST_FIELD_ALIGNMENT
-  desired_align = MIN (desired_align, BIGGEST_FIELD_ALIGNMENT);
+#if defined __x86_64__ || defined __i386__
+#if defined __CYGWIN__ || defined __MINGW32__
+  desired_align = MIN (desired_align, 64);
+#elif defined __x86_64__
+  desired_align = MIN (desired_align, 128);
+#else
+  desired_align = MIN (desired_align, 32);
+#endif
+#elif defined __tilepro__ || defined __frv__ || defined __arm__
+  desired_align = MIN (desired_align, 64);
+#elif defined __tilegx__
+  desired_align = MIN (desired_align, 128);
 #endif
 #ifdef ADJUST_FIELD_ALIGN
   desired_align = ADJUST_FIELD_ALIGN (type, desired_align);
-- 
2.6.2



[PATCH 5/5] remove usage of ADJUST_FIELD_ALIGN in encoding.c

2015-10-30 Thread tbsaunde+gcc
From: Trevor Saunders 

Not many targets define this macro in ways that do something in libojc,
so it seems to make sense to just inline the few definitions that do do
something.

libobjc/ChangeLog:

2015-10-30  Trevor Saunders  

PR libobjc/24775
* encoding.c (objc_layout_structure_next_member): Remove usage
of ADJUST_FIELD_ALIGN.
---
 libobjc/encoding.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libobjc/encoding.c b/libobjc/encoding.c
index 7438d64..0fbfd39 100644
--- a/libobjc/encoding.c
+++ b/libobjc/encoding.c
@@ -1171,8 +1171,12 @@ objc_layout_structure_next_member (struct 
objc_struct_layout *layout)
 #elif defined __tilegx__
   desired_align = MIN (desired_align, 128);
 #endif
-#ifdef ADJUST_FIELD_ALIGN
-  desired_align = ADJUST_FIELD_ALIGN (type, desired_align);
+#if defined __arc__ || defined _AIX
+  if (TYPE_MODE (strip_array_types (TREE_TYPE (type))) == DFmode)
+desired_align = MIN (desired_align, 32);
+#elif __POWERPC__ && __APPLE__
+  if (desired_align != 128)
+desired_align = MIN (desired_align, 32);
 #endif
 
   /* Record must have at least as much alignment as any field.
-- 
2.6.2



[PATCH] remove unused config/arm/coff.h

2015-11-03 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

$subject, nothing refers to this header so we might as well remove it.

tested I can still build on x86_64-linux-gnu, not that I would expect anything
else or that it is particularly relevent, ok?

Trev

gcc/ChangeLog:

2015-11-03  Trevor Saunders  

* config/arm/coff.h: Remove.
---
 gcc/config/arm/coff.h | 82 ---
 1 file changed, 82 deletions(-)
 delete mode 100644 gcc/config/arm/coff.h

diff --git a/gcc/config/arm/coff.h b/gcc/config/arm/coff.h
deleted file mode 100644
index 526f9b9..000
--- a/gcc/config/arm/coff.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Definitions of target machine for GNU compiler.
-   For ARM with COFF object format.
-   Copyright (C) 1995-2015 Free Software Foundation, Inc.
-   Contributed by Doug Evans (dev...@cygnus.com).
-   
-   This file is part of GCC.
-
-   GCC is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published
-   by the Free Software Foundation; either version 3, or (at your
-   option) any later version.
-
-   GCC is distributed in the hope that it will be useful, but WITHOUT
-   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-   License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with GCC; see the file COPYING3.  If not see
-   .  */
-
-/* Note - it is important that this definition matches the one in tcoff.h.  */
-#undef  USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
-
-
-/* Run-time Target Specification.  */
-#undef  TARGET_DEFAULT_FLOAT_ABI
-#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
-
-#undef  TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_APCS_FRAME)
-
-#ifndef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS \
-  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork" }
-#endif
-
-/* This is COFF, but prefer stabs.  */
-#define SDB_DEBUGGING_INFO 1
-
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-
-#define TARGET_ASM_FILE_START_APP_OFF true
-
-/* Switch into a generic section.  */
-#define TARGET_ASM_NAMED_SECTION  default_coff_asm_named_section
-
-/* Support the ctors/dtors and other sections.  */
-
-#undef INIT_SECTION_ASM_OP
-
-/* Define this macro if jump tables (for `tablejump' insns) should be
-   output in the text section, along with the assembler instructions.
-   Otherwise, the readonly data section is used.  */
-/* We put ARM and Thumb-2 jump tables in the text section, because it makes
-   the code more efficient, but for Thumb-1 it's better to put them out of
-   band unless we are generating compressed tables.  */
-#define JUMP_TABLES_IN_TEXT_SECTION\
-   (TARGET_32BIT || (TARGET_THUMB && (optimize_size || flag_pic)))
-
-#undef  READONLY_DATA_SECTION_ASM_OP
-#define READONLY_DATA_SECTION_ASM_OP   "\t.section .rdata"
-#undef  CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP   "\t.section .ctors,\"x\""
-#undef  DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP   "\t.section .dtors,\"x\""
-
-/* Support the ctors/dtors sections for g++.  */
-
-/* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script.  */
-#define CTOR_LISTS_DEFINED_EXTERNALLY
-
-#undef DO_GLOBAL_CTORS_BODY
-#undef DO_GLOBAL_DTORS_BODY
-
-/* The ARM development system defines __main.  */
-#define NAME__MAIN  "__gccmain"
-#define SYMBOL__MAIN __gccmain
-
-#define SUPPORTS_INIT_PRIORITY 0
-- 
2.6.2



[PATCH 00/12] misc conditional compilation work

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

basically $subject, making some code unconditionally compiled, and changing
other things from #ifdef to #if so they can be made unconditional
incrementally.

patches individually bootstrapped + regtested on x86_64-linux-gnu, and a
slightly earlier version of the series ran through config-list.mk.  I think
everything here is either preapproved, or obvious so I'll commit it later
today if nobody complains.

Trev



Trevor Saunders (12):
  reduce conditional compilation for HARD_FRAME_POINTER_IS_ARG_POINTER
  remove EXTENDED_SDB_BASIC_TYPES
  remove conditional compilation of sdb debug info
  always define XCOFF_DEBUGGING_INFO
  always define VMS_DEBUGGING_INFO
  always define DWARF2_DEBUGGING_INFO
  always define DBX_DEBUGGING_INFO
  always define DWARF2_LINENO_DEBUGGING_INFO
  always define TARGET_PECOFF
  always define EH_RETURN_HANDLER_RTX
  always define HAVE_AS_LEB128
  always define ENABLE_OFFLOADING

 gcc/acinclude.m4   |   4 ++
 gcc/c/c-parser.c   |  13 ++---
 gcc/cgraph.c   |   5 +-
 gcc/collect2.c |   4 +-
 gcc/config/arc/arc.h   |   4 +-
 gcc/config/i386/i386.h |   3 --
 gcc/config/microblaze/microblaze.h |   2 +-
 gcc/config/pdp11/pdp11.h   |   2 +-
 gcc/config/rs6000/rs6000.c |   4 +-
 gcc/configure  | 106 +++--
 gcc/configure.ac   |   5 ++
 gcc/cp/parser.c|  13 ++---
 gcc/cp/vtable-class-hierarchy.c|   8 ---
 gcc/dbxout.c   |  39 +++---
 gcc/dbxout.h   |   2 +-
 gcc/defaults.h |  48 ++---
 gcc/df-scan.c  |   2 -
 gcc/doc/tm.texi|  12 ++---
 gcc/doc/tm.texi.in |  12 ++---
 gcc/dwarf2asm.c|  12 ++---
 gcc/dwarf2out.c|  28 --
 gcc/dwarf2out.h|   2 -
 gcc/emit-rtl.c |   7 +--
 gcc/except.c   |  27 +-
 gcc/final.c|  10 ++--
 gcc/function.c |   2 +-
 gcc/gcc.c  |   8 ++-
 gcc/gsyms.h|  11 
 gcc/omp-low.c  |  16 +++---
 gcc/opts.c |   9 ++--
 gcc/output.h   |   2 -
 gcc/sdbout.c   |  12 +
 gcc/targhooks.c|   6 +--
 gcc/toplev.c   |  34 
 gcc/varasm.c   |   8 +--
 gcc/varpool.c  |  13 ++---
 gcc/vmsdbgout.c|   2 +-
 gcc/xcoffout.c |   2 +-
 38 files changed, 285 insertions(+), 214 deletions(-)

-- 
2.5.0.rc1.5.gc07173f



[PATCH 01/12] reduce conditional compilation for HARD_FRAME_POINTER_IS_ARG_POINTER

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* dbxout.c (dbxout_symbol_location): Remove #if for
HARD_FRAME_POINTER_IS_ARG_POINTER.
(dbxout_parms): Likewise.
* dwarf2out.c (rtl_for_decl_location): Likewise.
* emit-rtl.c (gen_rtx_REG): Likewise.
---
 gcc/dbxout.c| 13 +
 gcc/dwarf2out.c |  6 ++
 gcc/emit-rtl.c  |  7 ---
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 1b4a5ea..5f4ea77 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -3076,10 +3076,8 @@ dbxout_symbol_location (tree decl, tree type, const char 
*suffix, rtx home)
   || (REG_P (XEXP (home, 0))
   && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
   && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
-#if !HARD_FRAME_POINTER_IS_ARG_POINTER
-  && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
-#endif
-  )))
+  && (HARD_FRAME_POINTER_IS_ARG_POINTER
+  || REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
 /* If the value is indirect by memory or by a register
that isn't the frame pointer
then it means the object is variable-sized and address through
@@ -3490,10 +3488,9 @@ dbxout_parms (tree parms)
 && REG_P (XEXP (DECL_RTL (parms), 0))
 && REGNO (XEXP (DECL_RTL (parms), 0)) != 
HARD_FRAME_POINTER_REGNUM
 && REGNO (XEXP (DECL_RTL (parms), 0)) != STACK_POINTER_REGNUM
-#if !HARD_FRAME_POINTER_IS_ARG_POINTER
-&& REGNO (XEXP (DECL_RTL (parms), 0)) != ARG_POINTER_REGNUM
-#endif
-)
+&& (HARD_FRAME_POINTER_IS_ARG_POINTER
+|| REGNO (XEXP (DECL_RTL (parms), 0))
+  != ARG_POINTER_REGNUM))
  {
/* Parm was passed via invisible reference.
   That is, its address was passed in a register.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index f184750..c42da7e 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -16026,10 +16026,8 @@ rtl_for_decl_location (tree decl)
   && (!REG_P (XEXP (rtl, 0))
   || REGNO (XEXP (rtl, 0)) == HARD_FRAME_POINTER_REGNUM
   || REGNO (XEXP (rtl, 0)) == STACK_POINTER_REGNUM
-#if !HARD_FRAME_POINTER_IS_ARG_POINTER
-  || REGNO (XEXP (rtl, 0)) == ARG_POINTER_REGNUM
-#endif
-)
+  || (!HARD_FRAME_POINTER_IS_ARG_POINTER
+  && REGNO (XEXP (rtl, 0)) == ARG_POINTER_REGNUM))
   /* Big endian correction check.  */
   && BYTES_BIG_ENDIAN
   && TYPE_MODE (TREE_TYPE (decl)) != GET_MODE (rtl)
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index c6a37e1..3d2c6d9 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -716,11 +716,12 @@ gen_rtx_REG (machine_mode mode, unsigned int regno)
  && regno == HARD_FRAME_POINTER_REGNUM
  && (!reload_completed || frame_pointer_needed))
return hard_frame_pointer_rtx;
-#if !HARD_FRAME_POINTER_IS_ARG_POINTER
-  if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+
+  if (!HARD_FRAME_POINTER_IS_ARG_POINTER
+ && FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
  && regno == ARG_POINTER_REGNUM)
return arg_pointer_rtx;
-#endif
+
 #ifdef RETURN_ADDRESS_POINTER_REGNUM
   if (regno == RETURN_ADDRESS_POINTER_REGNUM)
return return_address_pointer_rtx;
-- 
2.5.0.rc1.5.gc07173f



[PATCH 02/12] remove EXTENDED_SDB_BASIC_TYPES

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

The last target using this was i960, which was removed many years ago,
so there's no reason to keep it.

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* gsyms.h (enum sdb_type): Remove code for
EXTENDED_SDB_BASIC_TYPES.
(enum sdb_masks): Likewise.
* sdbout.c (plain_type_1): Likewise.
---
 gcc/gsyms.h  | 11 ---
 gcc/sdbout.c |  6 +-
 2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/gcc/gsyms.h b/gcc/gsyms.h
index 608ff1e..0c458bb 100644
--- a/gcc/gsyms.h
+++ b/gcc/gsyms.h
@@ -74,9 +74,6 @@ enum sdb_type
   T_USHORT = 13,
   T_UINT = 14,
   T_ULONG = 15
-#ifdef EXTENDED_SDB_BASIC_TYPES
-  , T_LNGDBL = 16
-#endif
 };
 
 enum sdb_type_class
@@ -89,19 +86,11 @@ enum sdb_type_class
 
 enum sdb_masks
 {
-#ifdef EXTENDED_SDB_BASIC_TYPES
-  N_BTMASK = 0x1f,
-  N_TMASK = 0x60,
-  N_TMASK1 = 0x300,
-  N_TMASK2 = 0x360,
-  N_BTSHFT = 5,
-#else
   N_BTMASK = 017,
   N_TMASK = 060,
   N_TMASK1 = 0300,
   N_TMASK2 = 0360,
   N_BTSHFT = 4,
-#endif
   N_TSHIFT = 2
 };
 
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index 7964059..e495a8a 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -516,13 +516,9 @@ plain_type_1 (tree type, int level)
  return T_FLOAT;
if (precision == DOUBLE_TYPE_SIZE)
  return T_DOUBLE;
-#ifdef EXTENDED_SDB_BASIC_TYPES
-   if (precision == LONG_DOUBLE_TYPE_SIZE)
- return T_LNGDBL;
-#else
if (precision == LONG_DOUBLE_TYPE_SIZE)
  return T_DOUBLE;  /* better than nothing */
-#endif
+
return 0;
   }
 
-- 
2.5.0.rc1.5.gc07173f



[PATCH 05/12] always define VMS_DEBUGGING_INFO

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* defaults.h (VMS_DEBUGGING_INFO): New default definition.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Adjust.
* dwarf2out.c (output_file_names): Likewise.
(add_name_and_src_coords_attributes): Likewise.
* dwarf2out.h: Likewise.
* toplev.c (process_options): Likewise.
* vmsdbgout.c: Likewise.
---
 gcc/defaults.h | 8 ++--
 gcc/doc/tm.texi| 2 +-
 gcc/doc/tm.texi.in | 2 +-
 gcc/dwarf2out.c| 8 
 gcc/dwarf2out.h| 2 --
 gcc/toplev.c   | 6 +++---
 gcc/vmsdbgout.c| 2 +-
 7 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index b518863..0de7899 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -922,12 +922,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #define XCOFF_DEBUGGING_INFO 0
 #endif
 
+#ifndef VMS_DEBUGGING_INFO
+#define VMS_DEBUGGING_INFO 0
+#endif
+
 /* If more than one debugging type is supported, you must define
PREFERRED_DEBUGGING_TYPE to choose the default.  */
 
 #if 1 < (defined (DBX_DEBUGGING_INFO) + (SDB_DEBUGGING_INFO) \
 + defined (DWARF2_DEBUGGING_INFO) + (XCOFF_DEBUGGING_INFO) \
- + defined (VMS_DEBUGGING_INFO))
++ (VMS_DEBUGGING_INFO))
 #ifndef PREFERRED_DEBUGGING_TYPE
 #error You must define PREFERRED_DEBUGGING_TYPE
 #endif /* no PREFERRED_DEBUGGING_TYPE */
@@ -943,7 +947,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #elif defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
-#elif defined VMS_DEBUGGING_INFO
+#elif VMS_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
 
 #elif XCOFF_DEBUGGING_INFO
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 0399248..b3b684a 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9720,7 +9720,7 @@ number @var{line} of the current source file to the stdio 
stream
 Here are macros for VMS debug format.
 
 @defmac VMS_DEBUGGING_INFO
-Define this macro if GCC should produce debugging output for VMS
+Define this macro to 1 if GCC should produce debugging output for VMS
 in response to the @option{-g} option.  The default behavior for VMS
 is to generate minimal debug info for a traceback in the absence of
 @option{-g} unless explicitly overridden with @option{-g0}.  This
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 84e8383..0f0a4f2 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7113,7 +7113,7 @@ number @var{line} of the current source file to the stdio 
stream
 Here are macros for VMS debug format.
 
 @defmac VMS_DEBUGGING_INFO
-Define this macro if GCC should produce debugging output for VMS
+Define this macro to 1 if GCC should produce debugging output for VMS
 in response to the @option{-g} option.  The default behavior for VMS
 is to generate minimal debug info for a traceback in the absence of
 @option{-g} unless explicitly overridden with @option{-g0}.  This
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 072e485..88c931c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -101,7 +101,7 @@ static void dwarf2out_decl (tree);
 #define HAVE_XCOFF_DWARF_EXTRAS 0
 #endif
 
-#ifdef VMS_DEBUGGING_INFO
+#if VMS_DEBUGGING_INFO
 int vms_file_stats_name (const char *, long long *, long *, char *, int *);
 
 /* Define this macro to be a nonzero value if the directory specifications
@@ -10229,7 +10229,7 @@ output_file_names (void)
   int file_idx = backmap[i];
   int dir_idx = dirs[files[file_idx].dir_idx].dir_idx;
 
-#ifdef VMS_DEBUGGING_INFO
+#if VMS_DEBUGGING_INFO
 #define MAX_VMS_VERSION_LEN 6 /* ";32768" */
 
   /* Setting these fields can lead to debugger miscomparisons,
@@ -17319,7 +17319,7 @@ add_name_and_src_coords_attributes (dw_die_ref die, 
tree decl)
   add_linkage_name (die, decl);
 }
 
-#ifdef VMS_DEBUGGING_INFO
+#if VMS_DEBUGGING_INFO
   /* Get the function's name, as described by its RTL.  This may be different
  from the DECL_NAME name used in the source file.  */
   if (TREE_CODE (decl) == FUNCTION_DECL && TREE_ASM_WRITTEN (decl))
@@ -17331,7 +17331,7 @@ add_name_and_src_coords_attributes (dw_die_ref die, 
tree decl)
 #endif /* VMS_DEBUGGING_INFO */
 }
 
-#ifdef VMS_DEBUGGING_INFO
+#if VMS_DEBUGGING_INFO
 /* Output the debug main pointer die for VMS */
 
 void
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index 4fe3527..d344508 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -257,9 +257,7 @@ extern void debug_dwarf_loc_descr (dw_loc_descr_ref);
 extern void debug (die_struct &ref);
 extern void debug (die_struct *ptr);
 extern void dwarf2out_set_demangle_name_func (const char *(*) (const char *));
-#ifdef VMS_DEBUGGING_INFO
 extern void dwarf2out_vms_debug_main_pointer (void);
-#endif
 
 enum array_descr_ordering
 {
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 420ae3d..15b8e54 100644
--- a

[PATCH 08/12] always define DWARF2_LINENO_DEBUGGING_INFO

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* defaults.h (DWARF2_LINENO_DEBUGGING_INFO): new default
definition.
* dwarf2out.c (dwarf2out_init): Adjust.
* opts.c (set_debug_level): Likewise.
* toplev.c (process_options): Likewise.
---
 gcc/defaults.h  | 6 +-
 gcc/dwarf2out.c | 4 ++--
 gcc/opts.c  | 9 -
 gcc/toplev.c| 4 +---
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index d1728aa..65ffe59 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -926,6 +926,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #define DWARF2_DEBUGGING_INFO 0
 #endif
 
+#ifndef DWARF2_LINENO_DEBUGGING_INFO
+#define DWARF2_LINENO_DEBUGGING_INFO 0
+#endif
+
 #ifndef XCOFF_DEBUGGING_INFO
 #define XCOFF_DEBUGGING_INFO 0
 #endif
@@ -952,7 +956,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #elif SDB_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
 
-#elif DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
+#elif DWARF2_DEBUGGING_INFO || DWARF2_LINENO_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
 #elif VMS_DEBUGGING_INFO
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index cb6acc6..2d94bc3 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -23257,7 +23257,7 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
   /* Allocate the file_table.  */
   file_table = hash_table::create_ggc (50);
 
-#ifndef DWARF2_LINENO_DEBUGGING_INFO
+#if !DWARF2_LINENO_DEBUGGING_INFO
   /* Allocate the decl_die_table.  */
   decl_die_table = hash_table::create_ggc (10);
 
@@ -23379,7 +23379,7 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
   text_section_line_info = new_line_info_table ();
   text_section_line_info->end_label = text_end_label;
 
-#ifdef DWARF2_LINENO_DEBUGGING_INFO
+#if DWARF2_LINENO_DEBUGGING_INFO
   cur_line_info_table = text_section_line_info;
 #endif
 
diff --git a/gcc/opts.c b/gcc/opts.c
index 0ed9ac6..1300a92 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2287,11 +2287,10 @@ set_debug_level (enum debug_info_type type, int 
extended, const char *arg,
 
  if (extended == 2)
{
-#if DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
- opts->x_write_symbols = DWARF2_DEBUG;
-#elif DBX_DEBUGGING_INFO
- opts->x_write_symbols = DBX_DEBUG;
-#endif
+ if (DWARF2_DEBUGGING_INFO || DWARF2_LINENO_DEBUGGING_INFO)
+   opts->x_write_symbols = DWARF2_DEBUG;
+ else if (DBX_DEBUGGING_INFO)
+   opts->x_write_symbols = DBX_DEBUG;
}
 
  if (opts->x_write_symbols == NO_DEBUG)
diff --git a/gcc/toplev.c b/gcc/toplev.c
index d015f0f..f318a98 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1380,10 +1380,8 @@ process_options (void)
   && (write_symbols == VMS_DEBUG
   || write_symbols == VMS_AND_DWARF2_DEBUG))
 debug_hooks = &vmsdbg_debug_hooks;
-#ifdef DWARF2_LINENO_DEBUGGING_INFO
-  else if (write_symbols == DWARF2_DEBUG)
+  else if (DWARF2_LINENO_DEBUGGING_INFO && write_symbols == DWARF2_DEBUG)
 debug_hooks = &dwarf2_lineno_debug_hooks;
-#endif
   else
 error ("target system does not support the %qs debug format",
   debug_type_names[write_symbols]);
-- 
2.5.0.rc1.5.gc07173f



[PATCH 03/12] remove conditional compilation of sdb debug info

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

We need to include gsyms.h before tm.h because some targets (rl78 iirc) define
macros that conflict with identifiers in gsyms.h.  This means sdbout.c won't
produce correct output for those targets, but it previously couldn't either
because it wasn't compiled at all.

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* defaults.h: New definition of SDB_DEBUGGING_INFO.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Adjust.
* final.c (rest_of_clean_state): Remove check if
SDB_DEBUGGING_INFO is defined.
* function.c (number_blocks): Likewise.
* output.h: Likewise.
* sdbout.c: Likewise.
* toplev.c (process_options): Likewise.
---
 gcc/defaults.h | 8 ++--
 gcc/doc/tm.texi| 2 +-
 gcc/doc/tm.texi.in | 2 +-
 gcc/final.c| 6 +-
 gcc/function.c | 2 +-
 gcc/output.h   | 2 --
 gcc/sdbout.c   | 6 +-
 gcc/toplev.c   | 6 +-
 8 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index cee799d..ddda89a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -914,10 +914,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #define DEFAULT_GDB_EXTENSIONS 1
 #endif
 
+#ifndef SDB_DEBUGGING_INFO
+#define SDB_DEBUGGING_INFO 0
+#endif
+
 /* If more than one debugging type is supported, you must define
PREFERRED_DEBUGGING_TYPE to choose the default.  */
 
-#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) \
+#if 1 < (defined (DBX_DEBUGGING_INFO) + (SDB_DEBUGGING_INFO) \
  + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) \
  + defined (VMS_DEBUGGING_INFO))
 #ifndef PREFERRED_DEBUGGING_TYPE
@@ -929,7 +933,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #elif defined DBX_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
 
-#elif defined SDB_DEBUGGING_INFO
+#elif SDB_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
 
 #elif defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 5609a98..a174e21 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9567,7 +9567,7 @@ whose value is the highest absolute text address in the 
file.
 Here are macros for SDB and DWARF output.
 
 @defmac SDB_DEBUGGING_INFO
-Define this macro if GCC should produce COFF-style debugging output
+Define this macro to 1 if GCC should produce COFF-style debugging output
 for SDB in response to the @option{-g} option.
 @end defmac
 
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 96ca063a..9c13e9b 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -6992,7 +6992,7 @@ whose value is the highest absolute text address in the 
file.
 Here are macros for SDB and DWARF output.
 
 @defmac SDB_DEBUGGING_INFO
-Define this macro if GCC should produce COFF-style debugging output
+Define this macro to 1 if GCC should produce COFF-style debugging output
 for SDB in response to the @option{-g} option.
 @end defmac
 
diff --git a/gcc/final.c b/gcc/final.c
index 30b3826..2f57b1b 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -88,9 +88,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dbxout.h"
 #endif
 
-#ifdef SDB_DEBUGGING_INFO
 #include "sdbout.h"
-#endif
 
 /* Most ports that aren't using cc0 don't need to define CC_STATUS_INIT.
So define a null default for it to save conditionalization later.  */
@@ -4644,10 +4642,8 @@ rest_of_clean_state (void)
   /* In case the function was not output,
  don't leave any temporary anonymous types
  queued up for sdb output.  */
-#ifdef SDB_DEBUGGING_INFO
-  if (write_symbols == SDB_DEBUG)
+  if (SDB_DEBUGGING_INFO && write_symbols == SDB_DEBUG)
 sdbout_types (NULL_TREE);
-#endif
 
   flag_rerun_cse_after_global_opts = 0;
   reload_completed = 0;
diff --git a/gcc/function.c b/gcc/function.c
index a637cb3..afc2c87 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4671,7 +4671,7 @@ number_blocks (tree fn)
   /* For SDB and XCOFF debugging output, we start numbering the blocks
  from 1 within each function, rather than keeping a running
  count.  */
-#if defined (SDB_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
+#if SDB_DEBUGGING_INFO || defined (XCOFF_DEBUGGING_INFO)
   if (write_symbols == SDB_DEBUG || write_symbols == XCOFF_DEBUG)
 next_block_index = 1;
 #endif
diff --git a/gcc/output.h b/gcc/output.h
index f6a576c..d485cd6 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -309,9 +309,7 @@ extern rtx_sequence *final_sequence;
 /* The line number of the beginning of the current function.  Various
md code needs this so that it can output relative linenumbers.  */
 
-#ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers.  */
 extern int sdb_begin_function_line;
-#endif
 
 /* File in which assembler code is being written.  */
 
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index e495a8a..f22bc7c 

[PATCH 04/12] always define XCOFF_DEBUGGING_INFO

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* collect2.c (scan_prog_file): Remove check if
XCOFF_DEBUGGING_INFO is defined.
* config/rs6000/rs6000.c (macho_branch_islands): Likewise.
* dbxout.c (struct dbx_file): Likewise.
(default_stabs_asm_out_destructor): Likewise.
(default_stabs_asm_out_constructor): Likewise.
* dbxout.h: Likewise.
* defaults.h: New definition of XCOFF_DEBUGGING_INFO.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Adjust.
* dwarf2asm.c: Likewise.
* dwarf2out.c: Likewise.
* final.c: Likewise.
* function.c (number_blocks): Likewise.
* toplev.c (process_options): Likewise.
* varasm.c: Likewise.
* xcoffout.c: Likewise.
---
 gcc/collect2.c |  4 +---
 gcc/config/rs6000/rs6000.c |  4 ++--
 gcc/dbxout.c   | 16 
 gcc/dbxout.h   |  2 +-
 gcc/defaults.h |  8 ++--
 gcc/doc/tm.texi|  2 +-
 gcc/doc/tm.texi.in |  2 +-
 gcc/dwarf2asm.c|  4 
 gcc/dwarf2out.c|  4 
 gcc/final.c|  2 +-
 gcc/function.c |  2 +-
 gcc/toplev.c   |  8 +++-
 gcc/varasm.c   |  2 +-
 gcc/xcoffout.c |  2 +-
 14 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/gcc/collect2.c b/gcc/collect2.c
index 20c2533..e03c978 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -2799,12 +2799,10 @@ scan_prog_file (const char *prog_name, scanpass 
which_pass,
  if ((name = ldgetname (ldptr, &symbol)) == NULL)
continue;   /* Should never happen.  */
 
-#ifdef XCOFF_DEBUGGING_INFO
  /* All AIX function names have a duplicate entry
 beginning with a dot.  */
- if (*name == '.')
+ if (XCOFF_DEBUGGING_INFO && *name == '.')
++name;
-#endif
 
  switch (is_ctor_dtor (name))
{
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 13d0193..6ed82cb 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -30455,7 +30455,7 @@ macho_branch_islands (void)
}
   strcpy (tmp_buf, "\n");
   strcat (tmp_buf, label);
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
+#if defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
dbxout_stabd (N_SLINE, bi->line_number);
 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
@@ -30505,7 +30505,7 @@ macho_branch_islands (void)
  strcat (tmp_buf, ")\n\tmtctr r12\n\tbctr");
}
   output_asm_insn (tmp_buf, 0);
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
+#if defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
dbxout_stabd (N_SLINE, bi->line_number);
 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 5f4ea77..d9bd59f 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -91,12 +91,12 @@ along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "expr.h"
 
-#ifdef XCOFF_DEBUGGING_INFO
+#if XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"
 #endif
 
 #ifndef ASM_STABS_OP
-# ifdef XCOFF_DEBUGGING_INFO
+# if XCOFF_DEBUGGING_INFO
 #  define ASM_STABS_OP "\t.stabx\t"
 # else
 #  define ASM_STABS_OP "\t.stabs\t"
@@ -217,7 +217,7 @@ struct dbx_file
should always be 0 because we should not have needed any file numbers
yet.  */
 
-#if (defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)) \
+#if (defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)) \
 && defined (DBX_USE_BINCL)
 static struct dbx_file *current_file;
 #endif
@@ -250,7 +250,7 @@ static GTY(()) int lastfile_is_base;
 /* Typical USG systems don't have stab.h, and they also have
no use for DBX-format debugging info.  */
 
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
+#if defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
 
 #ifdef DBX_USE_BINCL
 /* If zero then there is no pending BINCL.  */
@@ -382,7 +382,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
 };
 #endif /* DBX_DEBUGGING_INFO  */
 
-#if defined (XCOFF_DEBUGGING_INFO)
+#if (XCOFF_DEBUGGING_INFO)
 const struct gcc_debug_hooks xcoff_debug_hooks =
 {
   dbxout_init,
@@ -860,7 +860,7 @@ dbxout_finish_complex_stabs (tree sym, stab_code_type code,
   obstack_free (&stabstr_ob, str);
 }
 
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
+#if defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
 
 /* When -gused is used, emit debug info for only used symbols. But in
addition to the standard intercepted debug_hooks there are some
@@ -3788,

[PATCH 06/12] always define DWARF2_DEBUGGING_INFO

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* config/arc/arc.h: Define DWARF2_DEBUGGING_INFO to 1.
* config/microblaze/microblaze.h: Likewise.
* defaults.h (DWARF2_DEBUGGING_INFO): New default definition.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Adjust.
* dwarf2out.c (dwarf2out_begin_prologue): Likewise.
(output_loc_operands): Likewise.
* gcc.c: Likewise.
* opts.c (set_debug_level): Likewise.
* targhooks.c (default_debug_unwind_info): Likewise.
* toplev.c (compile_file): Likewise.
(process_options): Likewise.
---
 gcc/config/arc/arc.h   | 2 +-
 gcc/config/microblaze/microblaze.h | 2 +-
 gcc/defaults.h | 8 ++--
 gcc/doc/tm.texi| 2 +-
 gcc/doc/tm.texi.in | 2 +-
 gcc/dwarf2out.c| 6 +++---
 gcc/gcc.c  | 4 ++--
 gcc/opts.c | 2 +-
 gcc/targhooks.c| 6 +++---
 gcc/toplev.c   | 6 ++
 10 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index e8baf5b..cb98bda 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -1446,7 +1446,7 @@ extern int arc_return_address_regs[4];
 #ifdef DWARF2_DEBUGGING_INFO
 #undef DWARF2_DEBUGGING_INFO
 #endif
-#define DWARF2_DEBUGGING_INFO
+#define DWARF2_DEBUGGING_INFO 1
 
 /* Prefer STABS (for now).  */
 #undef PREFERRED_DEBUGGING_TYPE
diff --git a/gcc/config/microblaze/microblaze.h 
b/gcc/config/microblaze/microblaze.h
index 482c4a2..fbe4761 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -185,7 +185,7 @@ extern enum pipeline_type microblaze_pipe;
   gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
 
 /* Use DWARF 2 debugging information by default.  */
-#define DWARF2_DEBUGGING_INFO
+#define DWARF2_DEBUGGING_INFO 1
 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
 /* Target machine storage layout */
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 0de7899..dddf796 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -918,6 +918,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #define SDB_DEBUGGING_INFO 0
 #endif
 
+#ifndef DWARF2_DEBUGGING_INFO
+#define DWARF2_DEBUGGING_INFO 0
+#endif
+
 #ifndef XCOFF_DEBUGGING_INFO
 #define XCOFF_DEBUGGING_INFO 0
 #endif
@@ -930,7 +934,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
PREFERRED_DEBUGGING_TYPE to choose the default.  */
 
 #if 1 < (defined (DBX_DEBUGGING_INFO) + (SDB_DEBUGGING_INFO) \
-+ defined (DWARF2_DEBUGGING_INFO) + (XCOFF_DEBUGGING_INFO) \
++ (DWARF2_DEBUGGING_INFO) + (XCOFF_DEBUGGING_INFO) \
 + (VMS_DEBUGGING_INFO))
 #ifndef PREFERRED_DEBUGGING_TYPE
 #error You must define PREFERRED_DEBUGGING_TYPE
@@ -944,7 +948,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #elif SDB_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
 
-#elif defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
+#elif DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
 #elif VMS_DEBUGGING_INFO
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index b3b684a..88c89be 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9572,7 +9572,7 @@ for SDB in response to the @option{-g} option.
 @end defmac
 
 @defmac DWARF2_DEBUGGING_INFO
-Define this macro if GCC should produce dwarf version 2 format
+Define this macro to 1 if GCC should produce dwarf version 2 format
 debugging output in response to the @option{-g} option.
 
 @deftypefn {Target Hook} int TARGET_DWARF_CALLING_CONVENTION (const_tree 
@var{function})
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 0f0a4f2..4b46a45 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -6997,7 +6997,7 @@ for SDB in response to the @option{-g} option.
 @end defmac
 
 @defmac DWARF2_DEBUGGING_INFO
-Define this macro if GCC should produce dwarf version 2 format
+Define this macro to 1 if GCC should produce dwarf version 2 format
 debugging output in response to the @option{-g} option.
 
 @hook TARGET_DWARF_CALLING_CONVENTION
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 88c931c..cb6acc6 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -1075,7 +1075,7 @@ dwarf2out_begin_prologue (unsigned int line 
ATTRIBUTE_UNUSED,
 
   /* We only want to output line number information for the genuine dwarf2
  prologue case, not the eh frame case.  */
-#ifdef DWARF2_DEBUGGING_INFO
+#if DWARF2_DEBUGGING_INFO
   if (file)
 dwarf2out_source_line (line, file, 0, true);
 #endif
@@ -1755,7 +1755,7 @@ output_loc_operands (dw_loc_descr_ref loc, int 
for_eh_or_skip)
 
   switch (loc->dw_loc_opc)
 {
-#ifdef DWARF2_DEBUGGING_INFO
+#if DWARF2_DEBUGGING_INFO
 case DW_OP_const2u:
 cas

[PATCH 10/12] always define EH_RETURN_HANDLER_RTX

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* defaults.h (EH_RETURN_HANDLER_RTX): New default definition.
* df-scan.c (df_get_exit_block_use_set): Adjust.
* except.c (expand_eh_return): Likewise.
---
 gcc/defaults.h | 4 
 gcc/df-scan.c  | 2 --
 gcc/except.c   | 9 -
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index c20de44..047a0db 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1325,6 +1325,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define TARGET_PECOFF 0
 #endif
 
+#ifndef EH_RETURN_HANDLER_RTX
+#define EH_RETURN_HANDLER_RTX NULL
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 2e5fe97..a735925 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3714,7 +3714,6 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
 }
 #endif
 
-#ifdef EH_RETURN_HANDLER_RTX
   if ((!targetm.have_epilogue () || ! epilogue_completed)
   && crtl->calls_eh_return)
 {
@@ -3722,7 +3721,6 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
   if (tmp && REG_P (tmp))
df_mark_reg (tmp, exit_block_uses);
 }
-#endif
 
   /* Mark function return value.  */
   diddle_return_value (df_mark_reg, (void*) exit_block_uses);
diff --git a/gcc/except.c b/gcc/except.c
index 1801fe7..1a41a34 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2255,11 +2255,10 @@ expand_eh_return (void)
 emit_insn (targetm.gen_eh_return (crtl->eh.ehr_handler));
   else
 {
-#ifdef EH_RETURN_HANDLER_RTX
-  emit_move_insn (EH_RETURN_HANDLER_RTX, crtl->eh.ehr_handler);
-#else
-  error ("__builtin_eh_return not supported on this target");
-#endif
+  if (rtx handler = EH_RETURN_HANDLER_RTX)
+   emit_move_insn (handler, crtl->eh.ehr_handler);
+  else
+   error ("__builtin_eh_return not supported on this target");
 }
 
   emit_label (around_label);
-- 
2.5.0.rc1.5.gc07173f



[PATCH 12/12] always define ENABLE_OFFLOADING

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/cp/ChangeLog:

2015-11-09  Trevor Saunders  

* parser.c (cp_parser_omp_declare_target): Adjust.

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* configure: Regenerate.
* configure.ac: Always define ENABLE_OFFLOADING.
* cgraph.c (cgraph_node::create): Adjust.
* gcc.c (process_command): Likewise.
* omp-low.c (create_omp_child_function): Likewise.
(expand_omp_target): Likewise.
* varpool.c (varpool_node::get_create): Likewise.

gcc/c/ChangeLog:

2015-11-09  Trevor Saunders  

* c-parser.c (c_parser_omp_declare_target): Adjust.
---
 gcc/c/c-parser.c | 13 +++--
 gcc/cgraph.c |  5 ++---
 gcc/configure|  8 ++--
 gcc/configure.ac |  3 +++
 gcc/cp/parser.c  | 13 +++--
 gcc/gcc.c|  2 --
 gcc/omp-low.c| 16 +++-
 gcc/varpool.c| 13 +++--
 8 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 23d0107..d7633be 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -15891,14 +15891,15 @@ c_parser_omp_declare_target (c_parser *parser)
  if (node != NULL)
{
  node->offloadable = 1;
-#ifdef ENABLE_OFFLOADING
- g->have_offload = true;
- if (is_a  (node))
+ if (ENABLE_OFFLOADING)
{
- vec_safe_push (offload_vars, t);
- node->force_output = 1;
+ g->have_offload = true;
+ if (is_a  (node))
+   {
+ vec_safe_push (offload_vars, t);
+ node->force_output = 1;
+   }
}
-#endif
}
}
 }
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 7839c72..b1228a2 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -499,9 +499,8 @@ cgraph_node::create (tree decl)
   && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
 {
   node->offloadable = 1;
-#ifdef ENABLE_OFFLOADING
-  g->have_offload = true;
-#endif
+  if (ENABLE_OFFLOADING)
+   g->have_offload = true;
 }
 
   node->register_symbol ();
diff --git a/gcc/configure b/gcc/configure
index 14d828c..c18c1fe 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -7715,6 +7715,10 @@ if test x"$offload_targets" != x; then
 
 $as_echo "#define ENABLE_OFFLOADING 1" >>confdefs.h
 
+else
+
+$as_echo "#define ENABLE_OFFLOADING 0" >>confdefs.h
+
 fi
 
 
@@ -18402,7 +18406,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18405 "configure"
+#line 18409 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18508,7 +18512,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18511 "configure"
+#line 18515 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 626eea2..d0cece5 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -951,6 +951,9 @@ AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
 if test x"$offload_targets" != x; then
   AC_DEFINE(ENABLE_OFFLOADING, 1,
 [Define this to enable support for offloading.])
+else
+  AC_DEFINE(ENABLE_OFFLOADING, 0,
+[Define this to enable support for offloading.])
 fi
 
 AC_ARG_WITH(multilib-list,
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d1f4970..b747563 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -34995,14 +34995,15 @@ cp_parser_omp_declare_target (cp_parser *parser, 
cp_token *pragma_tok)
  if (node != NULL)
{
  node->offloadable = 1;
-#ifdef ENABLE_OFFLOADING
- g->have_offload = true;
- if (is_a  (node))
+ if (ENABLE_OFFLOADING)
{
- vec_safe_push (offload_vars, t);
- node->force_output = 1;
+ g->have_offload = true;
+ if (is_a  (node))
+   {
+ vec_safe_push (offload_vars, t);
+ node->force_output = 1;
+   }
}
-#endif
}
}
 }
diff --git a/gcc/gcc.c b/gcc/gcc.c
index bdd64a6..979c539 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4382,12 +4382,10 @@ process_command (unsigned int decoded_options_count,
   CL_DRIVER, &handlers, global_dc);
 }
 
-#ifdef ENABLE_OFFLOADING
   /* If the user didn't specify any, default to all configured offload
  targets.  */
   if (offload_targets == NULL)
 handle_foffload_option (OFFLOAD_TARGETS);
-#endif
 
   if (output_file
   && strcmp (output_file, "-") != 0
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 45d1927..d58c98b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2436,9 +2436,9 @@ create_omp_child_function (omp_context *ctx, bool 
task_copy)
if (is_gimple_omp_offload

[PATCH 09/12] always define TARGET_PECOFF

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* config/i386/i386.h (TARGET_PECOFF): Remove define.
* defaults.h (TARGET_PECOFF): New default definition.
* varasm.c (handle_vtv_comdat_section): Adjust.

gcc/cp/ChangeLog:

2015-11-09  Trevor Saunders  

* vtable-class-hierarchy.c (vtv_generate_init_routine): Adjust.
---
 gcc/config/i386/i386.h  | 3 ---
 gcc/cp/vtable-class-hierarchy.c | 8 
 gcc/defaults.h  | 4 
 gcc/varasm.c| 6 +++---
 4 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 3d5b2b2..829c3f4 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -595,9 +595,6 @@ extern tree x86_mfence;
 /* This is re-defined by cygming.h.  */
 #define TARGET_SEH 0
 
-/* This is re-defined by cygming.h.  */
-#define TARGET_PECOFF 0
-
 /* The default abi used by target.  */
 #define DEFAULT_ABI SYSV_ABI
 
diff --git a/gcc/cp/vtable-class-hierarchy.c b/gcc/cp/vtable-class-hierarchy.c
index d5c31e8..ab308fd 100644
--- a/gcc/cp/vtable-class-hierarchy.c
+++ b/gcc/cp/vtable-class-hierarchy.c
@@ -1183,11 +1183,7 @@ vtv_generate_init_routine (void)
   TREE_STATIC (vtv_fndecl) = 1;
   TREE_USED (vtv_fndecl) = 1;
   DECL_PRESERVE_P (vtv_fndecl) = 1;
-#if defined (TARGET_PECOFF)
   if (flag_vtable_verify == VTV_PREINIT_PRIORITY && !TARGET_PECOFF)
-#else
-  if (flag_vtable_verify == VTV_PREINIT_PRIORITY)
-#endif
 DECL_STATIC_CONSTRUCTOR (vtv_fndecl) = 0;
 
   gimplify_function_tree (vtv_fndecl);
@@ -1195,11 +1191,7 @@ vtv_generate_init_routine (void)
 
   symtab->process_new_functions ();
 
-#if defined (TARGET_PECOFF)
   if (flag_vtable_verify == VTV_PREINIT_PRIORITY && !TARGET_PECOFF)
-#else
-  if (flag_vtable_verify == VTV_PREINIT_PRIORITY)
-#endif
 assemble_vtv_preinit_initializer (vtv_fndecl);
 
 }
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 65ffe59..c20de44 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1321,6 +1321,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define REVERSE_CONDITION(code, mode) reverse_condition (code)
 #endif
 
+#ifndef TARGET_PECOFF
+#define TARGET_PECOFF 0
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 75cef25..aa26e02 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -7793,7 +7793,7 @@ handle_vtv_comdat_section (section *sect, const_tree decl 
ATTRIBUTE_UNUSED)
 | SECTION_LINKONCE,
 DECL_NAME (decl));
   in_section = sect;
-#elif defined (TARGET_PECOFF)
+#else
   /* Neither OBJECT_FORMAT_PE, nor OBJECT_FORMAT_COFF is set here.
  Therefore the following check is used.
  In case a the target is PE or COFF a comdat group section
@@ -7820,8 +7820,8 @@ handle_vtv_comdat_section (section *sect, const_tree decl 
ATTRIBUTE_UNUSED)
 DECL_NAME (decl));
   in_section = sect;
 }
-#else
-  switch_to_section (sect);
+  else
+switch_to_section (sect);
 #endif
 }
 
-- 
2.5.0.rc1.5.gc07173f



[PATCH 11/12] always define HAVE_AS_LEB128

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* acinclude.m4: Always define HAVE_AS_LEB128.
* configure: Regenerate.
* configure.ac: Adjust.
* dwarf2asm.c (dw2_asm_output_data_uleb128): Likewise.
(dw2_asm_output_data_sleb128): Likewise.
(dw2_asm_output_delta_uleb128): Likewise.
(dw2_asm_output_delta_sleb128): Likewise.
* except.c (output_one_function_exception_table): Likewise.
---
 gcc/acinclude.m4 |  4 +++
 gcc/configure| 98 +++-
 gcc/configure.ac |  2 ++
 gcc/dwarf2asm.c  |  8 ++---
 gcc/except.c | 18 +--
 5 files changed, 116 insertions(+), 14 deletions(-)

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
index b8a4c28..e7d75c8 100644
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -550,6 +550,10 @@ AC_CACHE_CHECK([assembler for $1], [$2],
 ifelse([$7],,,[dnl
 if test $[$2] = yes; then
   $7
+fi])
+ifelse([$8],,,[dnl
+if test $[$2] != yes; then
+  $8
 fi])])
 
 dnl gcc_SUN_LD_VERSION
diff --git a/gcc/configure b/gcc/configure
index de6cf13..14d828c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -22411,6 +22411,7 @@ $as_echo "#define HAVE_GAS_BALIGN_AND_P2ALIGN 1" 
>>confdefs.h
 
 fi
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .p2align with 
maximum skip" >&5
 $as_echo_n "checking assembler for .p2align with maximum skip... " >&6; }
 if test "${gcc_cv_as_max_skip_p2align+set}" = set; then :
@@ -22446,6 +22447,7 @@ $as_echo "#define HAVE_GAS_MAX_SKIP_P2ALIGN 1" 
>>confdefs.h
 
 fi
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .literal16" >&5
 $as_echo_n "checking assembler for .literal16... " >&6; }
 if test "${gcc_cv_as_literal16+set}" = set; then :
@@ -22481,6 +22483,7 @@ $as_echo "#define HAVE_GAS_LITERAL16 1" >>confdefs.h
 
 fi
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for working 
.subsection -1" >&5
 $as_echo_n "checking assembler for working .subsection -1... " >&6; }
 if test "${gcc_cv_as_subsection_m1+set}" = set; then :
@@ -22528,6 +22531,7 @@ $as_echo "#define HAVE_GAS_SUBSECTION_ORDERING 1" 
>>confdefs.h
 
 fi
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .weak" >&5
 $as_echo_n "checking assembler for .weak... " >&6; }
 if test "${gcc_cv_as_weak+set}" = set; then :
@@ -22563,6 +22567,7 @@ $as_echo "#define HAVE_GAS_WEAK 1" >>confdefs.h
 
 fi
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .weakref" >&5
 $as_echo_n "checking assembler for .weakref... " >&6; }
 if test "${gcc_cv_as_weakref+set}" = set; then :
@@ -22598,6 +22603,7 @@ $as_echo "#define HAVE_GAS_WEAKREF 1" >>confdefs.h
 
 fi
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .nsubspa 
comdat" >&5
 $as_echo_n "checking assembler for .nsubspa comdat... " >&6; }
 if test "${gcc_cv_as_nsubspa_comdat+set}" = set; then :
@@ -22634,6 +22640,7 @@ $as_echo "#define HAVE_GAS_NSUBSPA_COMDAT 1" 
>>confdefs.h
 
 fi
 
+
 # .hidden needs to be supported in both the assembler and the linker,
 # because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
 # This is irritatingly difficult to feature test for; we have to check the
@@ -22673,6 +22680,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_hidden" >&5
 $as_echo "$gcc_cv_as_hidden" >&6; }
 
+
 case "${target}" in
   *-*-darwin*)
 # Darwin as has some visibility support, though with a different syntax.
@@ -23125,6 +23133,11 @@ if test $gcc_cv_as_leb128 = yes; then
 $as_echo "#define HAVE_AS_LEB128 1" >>confdefs.h
 
 fi
+if test $gcc_cv_as_leb128 != yes; then
+
+$as_echo "#define HAVE_AS_LEB128 0" >>confdefs.h
+
+fi
 
 # Check if we have assembler support for unwind directives.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for cfi 
directives" >&5
@@ -23204,6 +23217,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_cfi_directive" >&5
 $as_echo "$gcc_cv_as_cfi_directive" >&6; }
 
+
 if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for working cfi 
advance" >&5
 $as_echo_n "checking assembler for working cfi advance... " >&6; }
@@ -23241,6 +23255,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$gcc_cv_as_cfi_advance_working" >&5
 $as_echo "$gcc_cv_as_cfi_advance_working" >&6; }
 
+
 else
   # no objdump, err on the side of caution
   gcc_cv_as_cfi_advance_working=no
@@ -23284,6 +23299,7 @@ fi
 $as_echo "$gcc_cv_as_cfi_personality_directive" >&6; }
 
 
+
 cat >>confdefs.h <<_ACEOF
 #define HAVE_GAS_CFI_PERSONALITY_DIRECTIVE `if test 
$gcc_cv_as_cfi_personality_directive = yes;
 then echo 1; else echo 0; fi`
@@ -23336,6 +23352,7 @@ $as_echo "$gcc_cv_as_cfi_sections_directive" >&6; }
 
 
 
+
 cat >>confdefs.h <<_ACEOF
 #define HAVE_GAS_CFI_SECTIONS_DIRECTIVE `if test 
$gcc_cv_as_cfi_sections_directive = yes;
 then echo 1; else echo 0; fi

[PATCH 07/12] always define DBX_DEBUGGING_INFO

2015-11-09 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-11-09  Trevor Saunders  

* config/arc/arc.h: Define DBX_DEBUGGING_INFO to 1.
* config/pdp11/pdp11.h: Likewise.
* defaults.h (DBX_DEBUGGING_INFO): New default definition.
* config/rs6000/rs6000.c (macho_branch_islands): Adjust.
* dbxout.c (struct dbx_file): Likewise.
(debug_flush_symbol_queue): Likewise.
(default_stabs_asm_out_destructor): Likewise.
(default_stabs_asm_out_constructor): Likewise.
* dbxout.h: Likewise.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Adjust.
* final.c: Likewise.
* gcc.c: Likewise.
* opts.c (set_debug_level): Likewise.
* toplev.c (process_options): Likewise.
---
 gcc/config/arc/arc.h   |  2 +-
 gcc/config/pdp11/pdp11.h   |  2 +-
 gcc/config/rs6000/rs6000.c |  4 ++--
 gcc/dbxout.c   | 20 ++--
 gcc/dbxout.h   |  2 +-
 gcc/defaults.h |  8 ++--
 gcc/doc/tm.texi|  4 ++--
 gcc/doc/tm.texi.in |  4 ++--
 gcc/final.c|  2 +-
 gcc/gcc.c  |  4 ++--
 gcc/opts.c |  2 +-
 gcc/toplev.c   |  6 ++
 12 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index cb98bda..b40b04f 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -1441,7 +1441,7 @@ extern int arc_return_address_regs[4];
 #ifdef DBX_DEBUGGING_INFO
 #undef DBX_DEBUGGING_INFO
 #endif
-#define DBX_DEBUGGING_INFO
+#define DBX_DEBUGGING_INFO 1
 
 #ifdef DWARF2_DEBUGGING_INFO
 #undef DWARF2_DEBUGGING_INFO
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index 8339f1c..2c82e2c 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -38,7 +38,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Generate DBX debugging information.  */
 
-#define DBX_DEBUGGING_INFO
+#define DBX_DEBUGGING_INFO 1
 
 #define TARGET_40_PLUS (TARGET_40 || TARGET_45)
 #define TARGET_10  (! TARGET_40_PLUS)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 6ed82cb..4ccee23 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -30455,7 +30455,7 @@ macho_branch_islands (void)
}
   strcpy (tmp_buf, "\n");
   strcat (tmp_buf, label);
-#if defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
+#if (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
dbxout_stabd (N_SLINE, bi->line_number);
 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
@@ -30505,7 +30505,7 @@ macho_branch_islands (void)
  strcat (tmp_buf, ")\n\tmtctr r12\n\tbctr");
}
   output_asm_insn (tmp_buf, 0);
-#if defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
+#if (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
dbxout_stabd (N_SLINE, bi->line_number);
 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index d9bd59f..993ceda 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -217,7 +217,7 @@ struct dbx_file
should always be 0 because we should not have needed any file numbers
yet.  */
 
-#if (defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)) \
+#if ((DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)) \
 && defined (DBX_USE_BINCL)
 static struct dbx_file *current_file;
 #endif
@@ -250,7 +250,7 @@ static GTY(()) int lastfile_is_base;
 /* Typical USG systems don't have stab.h, and they also have
no use for DBX-format debugging info.  */
 
-#if defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
+#if (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
 
 #ifdef DBX_USE_BINCL
 /* If zero then there is no pending BINCL.  */
@@ -329,7 +329,7 @@ static void dbxout_handle_pch (unsigned);
 static void debug_free_queue (void);
 
 /* The debug hooks structure.  */
-#if defined (DBX_DEBUGGING_INFO)
+#if (DBX_DEBUGGING_INFO)
 
 static void dbxout_source_line (unsigned int, const char *, int, bool);
 static void dbxout_begin_prologue (unsigned int, const char *);
@@ -860,7 +860,7 @@ dbxout_finish_complex_stabs (tree sym, stab_code_type code,
   obstack_free (&stabstr_ob, str);
 }
 
-#if defined (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
+#if (DBX_DEBUGGING_INFO) || (XCOFF_DEBUGGING_INFO)
 
 /* When -gused is used, emit debug info for only used symbols. But in
addition to the standard intercepted debug_hooks there are some
@@ -885,7 +885,7 @@ static int symbol_queue_size = 0;
 
 #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
 
-#if defined (DBX_DEBUGGING_INFO)
+#if (DBX_DEBUGGING_INFO)
 
 static void
 dbxout_function_end (tree decl ATTRIBUTE_UNUSED)
@@ -1207,7 +1207,7 @@ dbxout_handle_pch (unsigned at_end)
 }
 }
 
-#if defined (DBX_DEBUG

[PATCH] PR 68366 - include emit-rtl.h in sdbout.c

2015-11-15 Thread tbsaunde+gcc
From: Trevor Saunders 

Some of the pa target macros rely on macros in emit-rtl.h and sdbout.c
uses some of those macros, which means that sdbout.c needs to include
emit-rtl.h.

this seems obvious, bootstrapped on x86_64-linux-gnu, and checked that a cross
to hppa-linux now builds so committing to trunk.

I noticed that gcc-order-headers already wanted to reorder includes so I didn't
worry about the oorder here, we can clean that up later easily anyway.

Trev


gcc/ChangeLog:

2015-11-15  Trevor Saunders  

PR middle-end/68366
* sdbout.c: Include emit-rtl.h and function.h.
---
 gcc/sdbout.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index f22bc7c..09fa06e 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -68,6 +68,8 @@ static GTY(()) bool sdbout_initialized;
 
 #include "rtl.h"
 #include "regs.h"
+#include "function.h"
+#include "emit-rtl.h"
 #include "flags.h"
 #include "insn-config.h"
 #include "reload.h"
-- 
2.1.4



[PATCH 2/2] remove val_ssa_equiv_hash_traits

2015-11-23 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

this is pretty trivial cleanup after the previous patch, but could wait for
next stage 1 if people don't like the very small risk.

boostrappped + regtested on x86_64-linux-gnu, ok?

Trev

gcc/ChangeLog:

2015-11-20  Trevor Saunders  

* tree-ssa-uncprop.c (struct val_ssa_equiv_hash_traits): Remove.
(val_ssa_equiv_hash_traits::remove): Likewise.
(pass_uncprop::execute): Adjust.
---
 gcc/tree-ssa-uncprop.c | 22 ++
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 23b4ca2..a60184e 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -275,27 +275,10 @@ struct equiv_hash_elt
   vec equivalences;
 };
 
-/* Value to ssa name equivalence hashtable helpers.  */
-
-struct val_ssa_equiv_hash_traits : simple_hashmap_traits  >
-{
-  template static inline void remove (T &);
-};
-
-/* Free an instance of equiv_hash_elt.  */
-
-template
-inline void
-val_ssa_equiv_hash_traits::remove (T &elt)
-{
-  elt.m_value.release ();
-}
-
 /* Global hash table implementing a mapping from invariant values
to a list of SSA_NAMEs which have the same value.  We might be
able to reuse tree-vn for this code.  */
-static hash_map, val_ssa_equiv_hash_traits> *val_ssa_equiv;
+static hash_map > *val_ssa_equiv;
 
 static void uncprop_into_successor_phis (basic_block);
 
@@ -518,8 +501,7 @@ pass_uncprop::execute (function *fun)
   associate_equivalences_with_edges ();
 
   /* Create our global data structures.  */
-  val_ssa_equiv
-= new hash_map, val_ssa_equiv_hash_traits> (1024);
+  val_ssa_equiv = new hash_map > (1024);
 
   /* We're going to do a dominator walk, so ensure that we have
  dominance information.  */
-- 
2.4.0



[PATCH 1/2] destroy values as well as keys when removing them from hash maps

2015-11-23 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

This fixes several leaks where a hash_map user expected deleting the map to
destruct the value part of entries as well as the key.  A couple of these bugs
have already been fixed, but there are more of them for example some of the
sanitizer code, and tree-if-conv.c).  The expectation that hash_map should
destruct values seems to be pretty obviously correct, so we should fix that to
fix the existing bugs and prevent future ones (I also seem to remember that
working at some point, but could be incorrect).

I checked all the existing hash_map users and couldn't find any value types
other than auto_vec with destructors, so its the only one with a non trivial
destructor.  So the only effected case auto_vec is fixed by this patch and no
expectations are broken.

bootstrapped + regtested on x86_64-linux-gnu, ok?

Trev

gcc/ChangeLog:

2015-11-20  Trevor Saunders  

* hash-map-traits.h (simple_hashmap_traits ::remove): call
destructors on values that are being removed.
* mem-stats.h (hash_map): Pass type of values to
simple_hashmap_traits.
* tree-sra.c (sra_deinitialize): Remove work around for hash
maps not destructing values.
* genmatch.c (sinfo_hashmap_traits): Adjust.
* tree-ssa-uncprop.c (val_ssa_equiv_hash_traits): Likewise.
---
 gcc/genmatch.c |  3 ++-
 gcc/hash-map-traits.h  | 32 +---
 gcc/mem-stats.h|  3 ++-
 gcc/tree-sra.c |  6 --
 gcc/tree-ssa-uncprop.c |  3 ++-
 5 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 3a20a48..76c8f1f 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -1397,7 +1397,8 @@ struct sinfo
   unsigned cnt;
 };
 
-struct sinfo_hashmap_traits : simple_hashmap_traits  >
+struct sinfo_hashmap_traits : simple_hashmap_traits,
+   sinfo *>
 {
   static inline hashval_t hash (const key_type &);
   static inline bool equal_keys (const key_type &, const key_type &);
diff --git a/gcc/hash-map-traits.h b/gcc/hash-map-traits.h
index 2225426..773ac1b 100644
--- a/gcc/hash-map-traits.h
+++ b/gcc/hash-map-traits.h
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 /* Implement hash_map traits for a key with hash traits H.  Empty and
deleted map entries are represented as empty and deleted keys.  */
 
-template 
+template 
 struct simple_hashmap_traits
 {
   typedef typename H::value_type key_type;
@@ -41,56 +41,58 @@ struct simple_hashmap_traits
   template  static inline void mark_deleted (T &);
 };
 
-template 
+template 
 inline hashval_t
-simple_hashmap_traits ::hash (const key_type &h)
+simple_hashmap_traits ::hash (const key_type &h)
 {
   return H::hash (h);
 }
 
-template 
+template 
 inline bool
-simple_hashmap_traits ::equal_keys (const key_type &k1, const key_type &k2)
+simple_hashmap_traits ::equal_keys (const key_type &k1,
+ const key_type &k2)
 {
   return H::equal (k1, k2);
 }
 
-template 
+template 
 template 
 inline void
-simple_hashmap_traits ::remove (T &entry)
+simple_hashmap_traits ::remove (T &entry)
 {
   H::remove (entry.m_key);
+  entry.m_value.~Value ();
 }
 
-template 
+template 
 template 
 inline bool
-simple_hashmap_traits ::is_empty (const T &entry)
+simple_hashmap_traits ::is_empty (const T &entry)
 {
   return H::is_empty (entry.m_key);
 }
 
-template 
+template 
 template 
 inline bool
-simple_hashmap_traits ::is_deleted (const T &entry)
+simple_hashmap_traits ::is_deleted (const T &entry)
 {
   return H::is_deleted (entry.m_key);
 }
 
-template 
+template 
 template 
 inline void
-simple_hashmap_traits ::mark_empty (T &entry)
+simple_hashmap_traits ::mark_empty (T &entry)
 {
   H::mark_empty (entry.m_key);
 }
 
-template 
+template 
 template 
 inline void
-simple_hashmap_traits ::mark_deleted (T &entry)
+simple_hashmap_traits ::mark_deleted (T &entry)
 {
   H::mark_deleted (entry.m_key);
 }
diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h
index a6489b5..2c68ca7 100644
--- a/gcc/mem-stats.h
+++ b/gcc/mem-stats.h
@@ -3,7 +3,8 @@
 
 /* Forward declaration.  */
 template > >
+typename Traits = simple_hashmap_traits,
+Value> >
 class hash_map;
 
 #define LOCATION_LINE_EXTRA_SPACE 30
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 2835c99..c4fea5b 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -674,12 +674,6 @@ sra_deinitialize (void)
   assign_link_pool.release ();
   obstack_free (&name_obstack, NULL);
 
-  /* TODO: hash_map does not support traits that can release
- value type of the hash_map.  */
-  for (hash_map >::iterator it =
-   base_access_vec->begin (); it != base_access_vec->end (); ++it)
-(*it).second.release ();
-
   delete base_access_vec;
 }
 
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index be6c209d..23b4ca2 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b

[PATCH] fixup hash table descriptor in winnt.c

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

Hi,

This is a straight forward fixup of the hash table descriptor in winnt.c
causing the PR.


Tested a cross to i686-cygwin now builds, and committing to trunk.

Trev

gcc/ChangeLog:

2015-05-19  Trevor Saunders  

PR c++/65835
* config/i386/winnt.c (struct wrapped_symbol_hasher): Change
value_type to const char *.
---
 gcc/ChangeLog   | 6 ++
 gcc/config/i386/winnt.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7df764b..4131b90 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-19  Trevor Saunders  
+
+   PR c++/65835
+   * config/i386/winnt.c (struct wrapped_symbol_hasher): Change
+   value_type to const char *.
+
 2015-05-19  Sandra Loosemore  
 
* config.gcc [powerpc*-*-linux*]: Allow --enable-targets=all
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index e698cd5..da67f5f 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -738,11 +738,11 @@ i386_pe_record_stub (const char *name)
 
 struct wrapped_symbol_hasher : typed_noop_remove 
 {
-  typedef char *value_type;
-  typedef char *compare_type;
+  typedef const char *value_type;
+  typedef const char *compare_type;
   static inline hashval_t hash (const char *);
   static inline bool equal (const char *, const char *);
-  static inline void remove (char *);
+  static inline void remove (const char *);
 };
 
 inline hashval_t
-- 
2.4.0.78.g7c6ecbf



[PATCH 0/7] Some ifdef removal

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

Hi,

Another week and more patches to remove conditional compilation ;-)

each patch individually bootstrapped + regtested on x86_64-unknown-linux-gnu,
and run through config-list.mk with a couple more patches I'll commit when I
finish writing ChangeLogs.  Committing to trunk, but of course reviews are
great!

Trev


Trevor Saunders (7):
  always define STACK_GROWS_DOWNWARD
  remove most ifdef STACK_GROWS_DOWNWARD
  move default for STACK_PUSH_CODE to defaults.h
  don't compare ARG_FRAME_POINTER_REGNUM and FRAME_POINTER_REGNUM with
the preprocessor
  always define HAVE_conditional_move
  remove #if HAVE_conditional_move
  always define HAVE_peephole

 gcc/ChangeLog  | 39 ++
 gcc/builtins.c | 30 +++---
 gcc/c-family/ChangeLog | 10 +
 gcc/c-family/c-cppbuiltin.c|  5 +--
 gcc/calls.c|  8 
 gcc/combine-stack-adj.c|  8 
 gcc/combine.c  | 23 +--
 gcc/config/alpha/alpha.h   |  2 +-
 gcc/config/arc/arc.h   |  2 +-
 gcc/config/avr/avr.h   |  2 +-
 gcc/config/bfin/bfin.h |  2 +-
 gcc/config/c6x/c6x.h   |  2 +-
 gcc/config/cr16/cr16.h |  2 +-
 gcc/config/cris/cris.h |  2 +-
 gcc/config/epiphany/epiphany.h |  2 +-
 gcc/config/h8300/h8300.h   |  2 +-
 gcc/config/i386/i386.h |  2 +-
 gcc/config/iq2000/iq2000.h |  2 +-
 gcc/config/m32r/m32r.h |  2 +-
 gcc/config/mcore/mcore.h   |  2 +-
 gcc/config/microblaze/microblaze.h |  2 +-
 gcc/config/mips/mips.h |  2 +-
 gcc/config/mmix/mmix.h |  2 +-
 gcc/config/mn10300/mn10300.h   |  2 +-
 gcc/config/moxie/moxie.h   |  2 +-
 gcc/config/nds32/nds32.h   |  2 +-
 gcc/config/nios2/nios2.h   |  2 +-
 gcc/config/nvptx/nvptx.h   |  2 +-
 gcc/config/pdp11/pdp11.h   |  2 +-
 gcc/config/rs6000/rs6000.h |  2 +-
 gcc/config/s390/s390.h |  2 +-
 gcc/config/sh/sh.h |  2 +-
 gcc/config/sparc/sparc.h   |  2 +-
 gcc/config/spu/spu.h   |  2 +-
 gcc/config/tilegx/tilegx.h |  2 +-
 gcc/config/tilepro/tilepro.h   |  2 +-
 gcc/config/v850/v850.h |  2 +-
 gcc/config/vax/vax.h   |  2 +-
 gcc/config/xtensa/xtensa.h |  2 +-
 gcc/defaults.h | 12 ++
 gcc/df-problems.c  |  5 +--
 gcc/df-scan.c  | 19 -
 gcc/dwarf2cfi.c| 12 +++---
 gcc/emit-rtl.c |  5 ++-
 gcc/explow.c   | 35 
 gcc/expmed.c   | 13 +++---
 gcc/expr.c | 82 +-
 gcc/final.c|  4 +-
 gcc/genconfig.c|  4 ++
 gcc/genpeep.c  |  2 -
 gcc/ifcvt.c| 11 -
 gcc/ira-color.c|  8 
 gcc/lower-subreg.c |  7 
 gcc/lra-spills.c   |  8 
 gcc/optabs.c   | 30 ++
 gcc/optabs.h   |  2 -
 gcc/output.h   |  2 -
 gcc/recog.c| 18 ++---
 gcc/reginfo.c  |  5 +--
 gcc/reload.c   |  5 +--
 gcc/rtlanal.c  |  5 +--
 gcc/sched-deps.c   |  9 ++---
 gcc/toplev.c   | 11 ++---
 gcc/tree-ssa-phiopt.c  |  4 --
 64 files changed, 221 insertions(+), 284 deletions(-)

-- 
2.4.0.78.g7c6ecbf



[PATCH 2/7] remove most ifdef STACK_GROWS_DOWNWARD

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

gcc/c-family/ChangeLog:

2015-05-20  Trevor Saunders  

* c-cppbuiltin.c (c_cpp_builtins): Use if instead of #if with
STACK_GROWS_DOWNWARD.

gcc/ChangeLog:

2015-05-20  Trevor Saunders  

* *.c: Use if instead of preprocessor checks with
STACK_GROWS_DOWNWARD.
---
 gcc/ChangeLog   |  5 
 gcc/builtins.c  | 30 +++
 gcc/c-family/ChangeLog  |  5 
 gcc/c-family/c-cppbuiltin.c |  5 ++--
 gcc/dwarf2cfi.c | 12 +-
 gcc/explow.c| 33 --
 gcc/expr.c  | 58 +++--
 gcc/recog.c |  8 ++-
 gcc/sched-deps.c|  9 ---
 9 files changed, 78 insertions(+), 87 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2dec0c3..1e6bad9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-20  Trevor Saunders  
 
+   * *.c: Use if instead of preprocessor checks with
+   STACK_GROWS_DOWNWARD.
+
+2015-05-20  Trevor Saunders  
+
* *.c: Check the value of STACK_GROWS_DOWNWARD rather than if it
is defined.
* config/**/*.h: Define STACK_GROWS_DOWNWARD to an integer.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index e81ab04..d92535e 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1521,14 +1521,14 @@ expand_builtin_apply_args_1 (void)
 
   /* Save the arg pointer to the block.  */
   tem = copy_to_reg (crtl->args.internal_arg_pointer);
-#if STACK_GROWS_DOWNWARD
   /* We need the pointer as the caller actually passed them to us, not
  as we might have pretended they were passed.  Make sure it's a valid
  operand, as emit_move_insn isn't expected to handle a PLUS.  */
-  tem
-= force_operand (plus_constant (Pmode, tem, crtl->args.pretend_args_size),
-NULL_RTX);
-#endif
+  if (STACK_GROWS_DOWNWARD)
+tem
+  = force_operand (plus_constant (Pmode, tem,
+ crtl->args.pretend_args_size),
+  NULL_RTX);
   emit_move_insn (adjust_address (registers, Pmode, 0), tem);
 
   size = GET_MODE_SIZE (Pmode);
@@ -1613,10 +1613,9 @@ expand_builtin_apply (rtx function, rtx arguments, rtx 
argsize)
   /* Fetch the arg pointer from the ARGUMENTS block.  */
   incoming_args = gen_reg_rtx (Pmode);
   emit_move_insn (incoming_args, gen_rtx_MEM (Pmode, arguments));
-#if !STACK_GROWS_DOWNWARD
-  incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize,
-  incoming_args, 0, OPTAB_LIB_WIDEN);
-#endif
+  if (!STACK_GROWS_DOWNWARD)
+incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize,
+incoming_args, 0, OPTAB_LIB_WIDEN);
 
   /* Push a new argument block and copy the arguments.  Do not allow
  the (potential) memcpy call below to interfere with our stack
@@ -1646,12 +1645,13 @@ expand_builtin_apply (rtx function, rtx arguments, rtx 
argsize)
 crtl->need_drap = true;
 
   dest = virtual_outgoing_args_rtx;
-#if !STACK_GROWS_DOWNWARD
-  if (CONST_INT_P (argsize))
-dest = plus_constant (Pmode, dest, -INTVAL (argsize));
-  else
-dest = gen_rtx_PLUS (Pmode, dest, negate_rtx (Pmode, argsize));
-#endif
+  if (!STACK_GROWS_DOWNWARD)
+{
+  if (CONST_INT_P (argsize))
+   dest = plus_constant (Pmode, dest, -INTVAL (argsize));
+  else
+   dest = gen_rtx_PLUS (Pmode, dest, negate_rtx (Pmode, argsize));
+}
   dest = gen_rtx_MEM (BLKmode, dest);
   set_mem_align (dest, PARM_BOUNDARY);
   src = gen_rtx_MEM (BLKmode, incoming_args);
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 7b526a6..b219cb9 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-20  Trevor Saunders  
 
+   * c-cppbuiltin.c (c_cpp_builtins): Use if instead of #if with
+   STACK_GROWS_DOWNWARD.
+
+2015-05-20  Trevor Saunders  
+
* c-cppbuiltin.c (c_cpp_builtins): Check the value of
STACK_GROWS_DOWNWARD rather than if it is defined.
 
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index da9cb2f..4170154 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1138,9 +1138,8 @@ c_cpp_builtins (cpp_reader *pfile)
 TRAMPOLINE_SIZE);
 
   /* For libgcc generic-morestack.c and unwinder code.  */
-#if STACK_GROWS_DOWNWARD
-  cpp_define (pfile, "__LIBGCC_STACK_GROWS_DOWNWARD__");
-#endif
+  if (STACK_GROWS_DOWNWARD)
+   cpp_define (pfile, "__LIBGCC_STACK_GROWS_DOWNWARD__");
 
   /* For libgcc unwinder code.  */
 #ifdef DONT_USE_BUILTIN_SETJMP
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 8b8931f..4b6929e 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -944,9 +944,9 @@ notice_args_size (rtx_insn *insn)
 
   /* Convert a change in args_size (always a positive in the

[PATCH 3/7] move default for STACK_PUSH_CODE to defaults.h

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

gcc/ChangeLog:

2015-05-20  Trevor Saunders  

* defaults.h: Add default for STACK_PUSH_CODE.
* expr.c: Don't redefine STACK_PUSH_CODE.
* recog.c: Likewise.
---
 gcc/ChangeLog  | 6 ++
 gcc/defaults.h | 8 
 gcc/expr.c | 8 
 gcc/recog.c| 8 
 4 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1e6bad9..2d51c33 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-20  Trevor Saunders  
 
+   * defaults.h: Add default for STACK_PUSH_CODE.
+   * expr.c: Don't redefine STACK_PUSH_CODE.
+   * recog.c: Likewise.
+
+2015-05-20  Trevor Saunders  
+
* *.c: Use if instead of preprocessor checks with
STACK_GROWS_DOWNWARD.
 
diff --git a/gcc/defaults.h b/gcc/defaults.h
index a01969a..e7bbcb8 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1233,6 +1233,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define STACK_GROWS_DOWNWARD 0
 #endif
 
+#ifndef STACK_PUSH_CODE
+#if STACK_GROWS_DOWNWARD
+#define STACK_PUSH_CODE PRE_DEC
+#else
+#define STACK_PUSH_CODE PRE_INC
+#endif
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/expr.c b/gcc/expr.c
index 09fc694..275c636 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -98,14 +98,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "rtl-chkp.h"
 #include "ccmp.h"
 
-#ifndef STACK_PUSH_CODE
-#if STACK_GROWS_DOWNWARD
-#define STACK_PUSH_CODE PRE_DEC
-#else
-#define STACK_PUSH_CODE PRE_INC
-#endif
-#endif
-
 
 /* If this is nonzero, we do not bother generating VOLATILE
around volatile memory references, and we are willing to
diff --git a/gcc/recog.c b/gcc/recog.c
index 524be67..39a5d1f 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -68,14 +68,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "insn-codes.h"
 
-#ifndef STACK_PUSH_CODE
-#if STACK_GROWS_DOWNWARD
-#define STACK_PUSH_CODE PRE_DEC
-#else
-#define STACK_PUSH_CODE PRE_INC
-#endif
-#endif
-
 #ifndef STACK_POP_CODE
 #if STACK_GROWS_DOWNWARD
 #define STACK_POP_CODE POST_INC
-- 
2.4.0.78.g7c6ecbf



[PATCH 1/7] always define STACK_GROWS_DOWNWARD

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

gcc/c-family/ChangeLog:

2015-05-20  Trevor Saunders  

* c-cppbuiltin.c (c_cpp_builtins): Check the value of
STACK_GROWS_DOWNWARD rather than if it is defined.

gcc/ChangeLog:

2015-05-20  Trevor Saunders  

* *.c: Check the value of STACK_GROWS_DOWNWARD rather than if it
is defined.
* config/**/*.h: Define STACK_GROWS_DOWNWARD to an integer.
* defaults.h: Provide default for STACK_GROWS_DOWNWARD.
---
 gcc/ChangeLog  |  7 +++
 gcc/builtins.c |  6 +++---
 gcc/c-family/ChangeLog |  5 +
 gcc/c-family/c-cppbuiltin.c|  2 +-
 gcc/calls.c|  8 
 gcc/combine-stack-adj.c|  8 
 gcc/config/alpha/alpha.h   |  2 +-
 gcc/config/arc/arc.h   |  2 +-
 gcc/config/avr/avr.h   |  2 +-
 gcc/config/bfin/bfin.h |  2 +-
 gcc/config/c6x/c6x.h   |  2 +-
 gcc/config/cr16/cr16.h |  2 +-
 gcc/config/cris/cris.h |  2 +-
 gcc/config/epiphany/epiphany.h |  2 +-
 gcc/config/h8300/h8300.h   |  2 +-
 gcc/config/i386/i386.h |  2 +-
 gcc/config/iq2000/iq2000.h |  2 +-
 gcc/config/m32r/m32r.h |  2 +-
 gcc/config/mcore/mcore.h   |  2 +-
 gcc/config/microblaze/microblaze.h |  2 +-
 gcc/config/mips/mips.h |  2 +-
 gcc/config/mmix/mmix.h |  2 +-
 gcc/config/mn10300/mn10300.h   |  2 +-
 gcc/config/moxie/moxie.h   |  2 +-
 gcc/config/nds32/nds32.h   |  2 +-
 gcc/config/nios2/nios2.h   |  2 +-
 gcc/config/nvptx/nvptx.h   |  2 +-
 gcc/config/pdp11/pdp11.h   |  2 +-
 gcc/config/rs6000/rs6000.h |  2 +-
 gcc/config/s390/s390.h |  2 +-
 gcc/config/sh/sh.h |  2 +-
 gcc/config/sparc/sparc.h   |  2 +-
 gcc/config/spu/spu.h   |  2 +-
 gcc/config/tilegx/tilegx.h |  2 +-
 gcc/config/tilepro/tilepro.h   |  2 +-
 gcc/config/v850/v850.h |  2 +-
 gcc/config/vax/vax.h   |  2 +-
 gcc/config/xtensa/xtensa.h |  2 +-
 gcc/defaults.h |  4 
 gcc/dwarf2cfi.c|  4 ++--
 gcc/explow.c   | 10 +-
 gcc/expr.c | 20 
 gcc/ira-color.c|  8 
 gcc/lower-subreg.c |  7 ---
 gcc/lra-spills.c   |  8 
 gcc/recog.c|  6 +++---
 gcc/sched-deps.c   |  2 +-
 47 files changed, 71 insertions(+), 98 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5bcbcb4..2dec0c3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-05-20  Trevor Saunders  
+
+   * *.c: Check the value of STACK_GROWS_DOWNWARD rather than if it
+   is defined.
+   * config/**/*.h: Define STACK_GROWS_DOWNWARD to an integer.
+   * defaults.h: Provide default for STACK_GROWS_DOWNWARD.
+
 2015-05-20  Mikhail Maltsev  
 
* bb-reorder.c (set_edge_can_fallthru_flag): Use rtx_jump_insn where
diff --git a/gcc/builtins.c b/gcc/builtins.c
index f6012af..e81ab04 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1521,7 +1521,7 @@ expand_builtin_apply_args_1 (void)
 
   /* Save the arg pointer to the block.  */
   tem = copy_to_reg (crtl->args.internal_arg_pointer);
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
   /* We need the pointer as the caller actually passed them to us, not
  as we might have pretended they were passed.  Make sure it's a valid
  operand, as emit_move_insn isn't expected to handle a PLUS.  */
@@ -1613,7 +1613,7 @@ expand_builtin_apply (rtx function, rtx arguments, rtx 
argsize)
   /* Fetch the arg pointer from the ARGUMENTS block.  */
   incoming_args = gen_reg_rtx (Pmode);
   emit_move_insn (incoming_args, gen_rtx_MEM (Pmode, arguments));
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
   incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize,
   incoming_args, 0, OPTAB_LIB_WIDEN);
 #endif
@@ -1646,7 +1646,7 @@ expand_builtin_apply (rtx function, rtx arguments, rtx 
argsize)
 crtl->need_drap = true;
 
   dest = virtual_outgoing_args_rtx;
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
   if (CONST_INT_P (argsize))
 dest = plus_constant (Pmode, dest, -INTVAL (argsize));
   else
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 9d7736e..7b526a6 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-20  Trevor Saunders  
+
+   * c-cppbuiltin.c (c_cpp_builtins): Check the value of
+   STACK_GROWS_DOWNWARD rather than if it is defined.
+
 2015-05-20  Marek Polacek  
 
* c-omp.c (check_omp_for_incr_expr): Use BINARY_CLASS_P.
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 6

[PATCH 4/7] don't compare ARG_FRAME_POINTER_REGNUM and FRAME_POINTER_REGNUM with the preprocessor

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

gcc/ChangeLog:

2015-05-20  Trevor Saunders  

* *.c: Remove comparison of ARG_FRAME_POINTER_REGNUM and
FRAME_POINTER_REGNUM with the preprocessor.
---
 gcc/ChangeLog |  5 +
 gcc/combine.c | 18 +++---
 gcc/df-problems.c |  5 ++---
 gcc/df-scan.c | 19 +++
 gcc/emit-rtl.c|  5 +++--
 gcc/reginfo.c |  5 ++---
 gcc/reload.c  |  5 ++---
 gcc/rtlanal.c |  5 ++---
 8 files changed, 30 insertions(+), 37 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2d51c33..21ff1b8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-20  Trevor Saunders  
 
+   * *.c: Remove comparison of ARG_FRAME_POINTER_REGNUM and
+   FRAME_POINTER_REGNUM with the preprocessor.
+
+2015-05-20  Trevor Saunders  
+
* defaults.h: Add default for STACK_PUSH_CODE.
* expr.c: Don't redefine STACK_PUSH_CODE.
* recog.c: Likewise.
diff --git a/gcc/combine.c b/gcc/combine.c
index a90849e..812b917 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1028,10 +1028,8 @@ can_combine_def_p (df_ref def)
   || (regno == HARD_FRAME_POINTER_REGNUM
  && (!reload_completed || frame_pointer_needed))
 #endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
-  || (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
-  )
+  || (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+ && regno == ARG_POINTER_REGNUM && fixed_regs[regno]))
 return false;
 
   return true;
@@ -2247,10 +2245,9 @@ combinable_i3pat (rtx_insn *i3, rtx *loc, rtx i2dest, 
rtx i1dest, rtx i0dest,
 #if !HARD_FRAME_POINTER_IS_FRAME_POINTER
  && REGNO (subdest) != HARD_FRAME_POINTER_REGNUM
 #endif
-#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && (REGNO (subdest) != ARG_POINTER_REGNUM
- || ! fixed_regs [REGNO (subdest)])
-#endif
+ && (FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
+ || (REGNO (subdest) != ARG_POINTER_REGNUM
+ || ! fixed_regs [REGNO (subdest)]))
  && REGNO (subdest) != STACK_POINTER_REGNUM)
{
  if (*pi3dest_killed)
@@ -13338,9 +13335,8 @@ mark_used_regs_combine (rtx x)
 #if !HARD_FRAME_POINTER_IS_FRAME_POINTER
  || regno == HARD_FRAME_POINTER_REGNUM
 #endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
+ || (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+ && regno == ARG_POINTER_REGNUM && fixed_regs[regno])
  || regno == FRAME_POINTER_REGNUM)
return;
 
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 25cfe08..ff08abd 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -933,12 +933,11 @@ df_lr_local_compute (bitmap all_blocks ATTRIBUTE_UNUSED)
 reference of the frame pointer.  */
   bitmap_set_bit (&df->hardware_regs_used, FRAME_POINTER_REGNUM);
 
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
   /* Pseudos with argument area equivalences may require
 reloading via the argument pointer.  */
-  if (fixed_regs[ARG_POINTER_REGNUM])
+  if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+ && fixed_regs[ARG_POINTER_REGNUM])
bitmap_set_bit (&df->hardware_regs_used, ARG_POINTER_REGNUM);
-#endif
 
   /* Any constant, or pseudo with constant equivalences, may
 require reloading from memory using the pic register.  */
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index c831730..389ce1c 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3446,12 +3446,11 @@ df_get_regular_block_artificial_uses (bitmap 
regular_block_artificial_uses)
bitmap_set_bit (regular_block_artificial_uses,
HARD_FRAME_POINTER_REGNUM);
 
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
   /* Pseudos with argument area equivalences may require
 reloading via the argument pointer.  */
-  if (fixed_regs[ARG_POINTER_REGNUM])
+  if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+ && fixed_regs[ARG_POINTER_REGNUM])
bitmap_set_bit (regular_block_artificial_uses, ARG_POINTER_REGNUM);
-#endif
 
   /* Any constant, or pseudo with constant equivalences, may
 require reloading from memory using the pic register.  */
@@ -3498,10 +3497,9 @@ df_get_eh_block_artificial_uses (bitmap 
eh_block_artificial_uses)
bitmap_set_bit (eh_block_artificial_uses,
HARD_FRAME_POINTER_REGNUM);
}
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
-  if (fixed_regs[ARG_POINTER_REGNUM])
+  if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+ && fixed_regs[ARG_POINTER_REGNUM])
bitmap_set_bit (eh_block_artificial_uses, ARG_POINTER_REGNUM);
-#endif
 }
 }
 
@@ -3579,12 +3577,11 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
   /* These registers are live everywhere.  */
   if (!reload_completed)
 {
-#if FRAME_POINTER_REGNUM != ARG_PO

[PATCH 7/7] always define HAVE_peephole

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

gcc/ChangeLog:

2015-05-20  Trevor Saunders  

* final.c (final_scan_insn): Don't check HAVE_peephole with the
preprocessor.
* output.h: Likewise.
* genconfig.c (main): Alwways define HAVE_peephole.
* genpeep.c: Don't emit checks of HAVE_peephole.
---
 gcc/ChangeLog   | 8 
 gcc/final.c | 4 +---
 gcc/genconfig.c | 2 ++
 gcc/genpeep.c   | 2 --
 gcc/output.h| 2 --
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c20d608..f41c46e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
 2015-05-20  Trevor Saunders  
 
+   * final.c (final_scan_insn): Don't check HAVE_peephole with the
+   preprocessor.
+   * output.h: Likewise.
+   * genconfig.c (main): Alwways define HAVE_peephole.
+   * genpeep.c: Don't emit checks of HAVE_peephole.
+
+2015-05-20  Trevor Saunders  
+
* *.c, *.h: DOn't check HAVE_conditional_move with the preprocessor.
 
 2015-05-20  Trevor Saunders  
diff --git a/gcc/final.c b/gcc/final.c
index f0585ca..c8f059b 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -2905,10 +2905,9 @@ final_scan_insn (rtx_insn *insn, FILE *file, int 
optimize_p ATTRIBUTE_UNUSED,
 
 #endif
 
-#ifdef HAVE_peephole
/* Do machine-specific peephole optimizations if desired.  */
 
-   if (optimize_p && !flag_no_peephole && !nopeepholes)
+   if (HAVE_peephole && optimize_p && !flag_no_peephole && !nopeepholes)
  {
rtx_insn *next = peephole (insn);
/* When peepholing, if there were notes within the peephole,
@@ -2937,7 +2936,6 @@ final_scan_insn (rtx_insn *insn, FILE *file, int 
optimize_p ATTRIBUTE_UNUSED,
/* PEEPHOLE might have changed this.  */
body = PATTERN (insn);
  }
-#endif
 
/* Try to recognize the instruction.
   If successful, verify that the operands satisfy the
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index a3e5b31..7237dede 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -369,6 +369,8 @@ main (int argc, char **argv)
 
   if (have_peephole_flag)
 printf ("#define HAVE_peephole 1\n");
+  else
+printf ("#define HAVE_peephole 0\n");
 
   if (have_peephole2_flag)
 {
diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index 3ba930c..b914e85 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -389,7 +389,6 @@ from the machine description file `md'.  */\n\n");
   printf ("#include \"flags.h\"\n");
   printf ("#include \"tm-constrs.h\"\n\n");
 
-  printf ("#ifdef HAVE_peephole\n");
   printf ("extern rtx peep_operand[];\n\n");
   printf ("#define operands peep_operand\n\n");
 
@@ -423,7 +422,6 @@ from the machine description file `md'.  */\n\n");
 max_opno = 1;
 
   printf ("rtx peep_operand[%d];\n", max_opno + 1);
-  printf ("#endif\n");
 
   fflush (stdout);
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
diff --git a/gcc/output.h b/gcc/output.h
index 81d2ad2..4ce6eea 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -289,9 +289,7 @@ extern void assemble_addr_to_section (rtx, section *);
 /* Return the size of the constant pool.  */
 extern int get_pool_size (void);
 
-#ifdef HAVE_peephole
 extern rtx_insn *peephole (rtx_insn *);
-#endif
 
 extern void output_shared_constant_pool (void);
 
-- 
2.4.0.78.g7c6ecbf



[PATCH 5/7] always define HAVE_conditional_move

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

gcc/ChangeLog:

2015-05-20  Trevor Saunders  

* genconfig.c (main): Always define HAVE_conditional_move.
* *.c: Don't check if HAVE_conditional_move is defined.
---
 gcc/ChangeLog |  4 
 gcc/combine.c |  2 +-
 gcc/expmed.c  |  4 ++--
 gcc/expr.c|  8 
 gcc/genconfig.c   |  2 ++
 gcc/ifcvt.c   | 11 ---
 gcc/optabs.c  |  6 +++---
 gcc/optabs.h  |  2 +-
 gcc/toplev.c  |  2 +-
 gcc/tree-ssa-phiopt.c |  4 
 10 files changed, 18 insertions(+), 27 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 21ff1b8..d115f6e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-20  Trevor Saunders  
 
+   * genconfig.c (main): Always define HAVE_conditional_move.
+
+2015-05-20  Trevor Saunders  
+
* *.c: Remove comparison of ARG_FRAME_POINTER_REGNUM and
FRAME_POINTER_REGNUM with the preprocessor.
 
diff --git a/gcc/combine.c b/gcc/combine.c
index 812b917..45177c8 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6816,7 +6816,7 @@ simplify_set (rtx x)
   && (GET_CODE (XEXP (src, 0)) == EQ || GET_CODE (XEXP (src, 0)) == NE)
   && XEXP (XEXP (src, 0), 1) == const0_rtx
   && GET_MODE (src) == GET_MODE (XEXP (XEXP (src, 0), 0))
-#ifdef HAVE_conditional_move
+#if HAVE_conditional_move
   && ! can_conditionally_move_p (GET_MODE (src))
 #endif
   && (num_sign_bit_copies (XEXP (XEXP (src, 0), 0),
diff --git a/gcc/expmed.c b/gcc/expmed.c
index c95299c..589a7a3 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -3797,7 +3797,7 @@ expand_sdiv_pow2 (machine_mode mode, rtx op0, 
HOST_WIDE_INT d)
   return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0);
 }
 
-#ifdef HAVE_conditional_move
+#if HAVE_conditional_move
   if (BRANCH_COST (optimize_insn_for_speed_p (), false)
   >= 2)
 {
@@ -,7 +,7 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, 
rtx op1,
target_mode);
}
 
-#ifdef HAVE_conditional_move
+#if HAVE_conditional_move
   /* Try using a setcc instruction for ORDERED/UNORDERED, followed by a
 conditional move.  */
   tem = emit_store_flag_1 (subtarget, first_code, op0, op1, mode, 0,
diff --git a/gcc/expr.c b/gcc/expr.c
index 275c636..efbf9fb 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2423,7 +2423,7 @@ get_def_for_expr (tree name, enum tree_code code)
   return def_stmt;
 }
 
-#ifdef HAVE_conditional_move
+#if HAVE_conditional_move
 /* Return the defining gimple statement for SSA_NAME NAME if it is an
assigment and the class of the expresion on the RHS is CLASS.  Return
NULL otherwise.  */
@@ -7517,7 +7517,7 @@ highest_pow2_factor_for_target (const_tree target, 
const_tree exp)
   return MAX (factor, talign);
 }
 
-#ifdef HAVE_conditional_move
+#if HAVE_conditional_move
 /* Convert the tree comparison code TCODE to the rtl one where the
signedness is UNSIGNEDP.  */
 
@@ -8021,7 +8021,7 @@ expand_cond_expr_using_cmove (tree treeop0 
ATTRIBUTE_UNUSED,
  tree treeop1 ATTRIBUTE_UNUSED,
  tree treeop2 ATTRIBUTE_UNUSED)
 {
-#ifdef HAVE_conditional_move
+#if HAVE_conditional_move
   rtx insn;
   rtx op00, op01, op1, op2;
   enum rtx_code comparison_code;
@@ -8892,7 +8892,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode 
tmode,
if (code == MIN_EXPR)
  comparison_code = LT;
  }
-#ifdef HAVE_conditional_move
+#if HAVE_conditional_move
/* Use a conditional move if possible.  */
if (can_conditionally_move_p (mode))
  {
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 2247eef..a3e5b31 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -352,6 +352,8 @@ main (int argc, char **argv)
 
   if (have_cmove_flag)
 printf ("#define HAVE_conditional_move 1\n");
+  else
+printf ("#define HAVE_conditional_move 0\n");
 
   if (have_cond_exec_flag)
 printf ("#define HAVE_conditional_execution 1\n");
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index b00aaa4..37117b7 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -72,9 +72,6 @@
 #include "shrink-wrap.h"
 #include "ifcvt.h"
 
-#ifndef HAVE_conditional_move
-#define HAVE_conditional_move 0
-#endif
 #ifndef HAVE_incscc
 #define HAVE_incscc 0
 #endif
@@ -1505,7 +1502,6 @@ noce_emit_cmove (struct noce_if_info *if_info, rtx x, 
enum rtx_code code,
return NULL_RTX;
 }
 
-#if HAVE_conditional_move
   unsignedp = (code == LTU || code == GEU
   || code == LEU || code == GTU);
 
@@ -1562,13 +1558,6 @@ noce_emit_cmove (struct noce_if_info *if_info, rtx x, 
enum rtx_code code,
 }
   else
 return NULL_RTX;
-#else
-  /* We'll never get here, as noce_process_if_block doesn't call the
- functions involved.  Ifdef code, however, should be discouraged
- because it leads to typos in the code not selected.  However,
- emit_conditional_move won'

[PATCH 6/7] remove #if HAVE_conditional_move

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

gcc/ChangeLog:

2015-05-20  Trevor Saunders  

* *.c, *.h: DOn't check HAVE_conditional_move with the preprocessor.
---
 gcc/ChangeLog |  4 
 gcc/combine.c |  5 ++---
 gcc/expmed.c  | 13 +
 gcc/expr.c| 10 ++
 gcc/optabs.c  | 30 --
 gcc/optabs.h  |  2 --
 gcc/toplev.c  | 11 ++-
 7 files changed, 31 insertions(+), 44 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d115f6e..c20d608 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-20  Trevor Saunders  
 
+   * *.c, *.h: DOn't check HAVE_conditional_move with the preprocessor.
+
+2015-05-20  Trevor Saunders  
+
* genconfig.c (main): Always define HAVE_conditional_move.
 
 2015-05-20  Trevor Saunders  
diff --git a/gcc/combine.c b/gcc/combine.c
index 45177c8..9615c79 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -6816,9 +6816,8 @@ simplify_set (rtx x)
   && (GET_CODE (XEXP (src, 0)) == EQ || GET_CODE (XEXP (src, 0)) == NE)
   && XEXP (XEXP (src, 0), 1) == const0_rtx
   && GET_MODE (src) == GET_MODE (XEXP (XEXP (src, 0), 0))
-#if HAVE_conditional_move
-  && ! can_conditionally_move_p (GET_MODE (src))
-#endif
+  && (!HAVE_conditional_move
+ || ! can_conditionally_move_p (GET_MODE (src)))
   && (num_sign_bit_copies (XEXP (XEXP (src, 0), 0),
   GET_MODE (XEXP (XEXP (src, 0), 0)))
  == GET_MODE_PRECISION (GET_MODE (XEXP (XEXP (src, 0), 0
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 589a7a3..fa13f8c 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -3797,9 +3797,8 @@ expand_sdiv_pow2 (machine_mode mode, rtx op0, 
HOST_WIDE_INT d)
   return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0);
 }
 
-#if HAVE_conditional_move
-  if (BRANCH_COST (optimize_insn_for_speed_p (), false)
-  >= 2)
+  if (HAVE_conditional_move
+  && BRANCH_COST (optimize_insn_for_speed_p (), false) >= 2)
 {
   rtx temp2;
 
@@ -3821,7 +3820,6 @@ expand_sdiv_pow2 (machine_mode mode, rtx op0, 
HOST_WIDE_INT d)
}
   end_sequence ();
 }
-#endif
 
   if (BRANCH_COST (optimize_insn_for_speed_p (),
   false) >= 2)
@@ -,7 +5553,9 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, 
rtx op1,
target_mode);
}
 
-#if HAVE_conditional_move
+  if (!HAVE_conditional_move)
+   return 0;
+
   /* Try using a setcc instruction for ORDERED/UNORDERED, followed by a
 conditional move.  */
   tem = emit_store_flag_1 (subtarget, first_code, op0, op1, mode, 0,
@@ -5573,9 +5573,6 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, 
rtx op1,
   if (tem == 0)
 delete_insns_since (last);
   return tem;
-#else
-  return 0;
-#endif
 }
 
   /* The remaining tricks only apply to integer comparisons.  */
diff --git a/gcc/expr.c b/gcc/expr.c
index efbf9fb..3605e99 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2423,7 +2423,6 @@ get_def_for_expr (tree name, enum tree_code code)
   return def_stmt;
 }
 
-#if HAVE_conditional_move
 /* Return the defining gimple statement for SSA_NAME NAME if it is an
assigment and the class of the expresion on the RHS is CLASS.  Return
NULL otherwise.  */
@@ -2443,7 +2442,6 @@ get_def_for_expr_class (tree name, enum tree_code_class 
tclass)
 
   return def_stmt;
 }
-#endif
 
 
 /* Determine whether the LEN bytes generated by CONSTFUN can be
@@ -7517,7 +7515,6 @@ highest_pow2_factor_for_target (const_tree target, 
const_tree exp)
   return MAX (factor, talign);
 }
 
-#if HAVE_conditional_move
 /* Convert the tree comparison code TCODE to the rtl one where the
signedness is UNSIGNEDP.  */
 
@@ -7575,7 +7572,6 @@ convert_tree_comp_to_rtx (enum tree_code tcode, int 
unsignedp)
 }
   return code;
 }
-#endif
 
 /* Subroutine of expand_expr.  Expand the two operands of a binary
expression EXP0 and EXP1 placing the results in OP0 and OP1.
@@ -8021,7 +8017,6 @@ expand_cond_expr_using_cmove (tree treeop0 
ATTRIBUTE_UNUSED,
  tree treeop1 ATTRIBUTE_UNUSED,
  tree treeop2 ATTRIBUTE_UNUSED)
 {
-#if HAVE_conditional_move
   rtx insn;
   rtx op00, op01, op1, op2;
   enum rtx_code comparison_code;
@@ -8105,7 +8100,6 @@ expand_cond_expr_using_cmove (tree treeop0 
ATTRIBUTE_UNUSED,
   /* Otherwise discard the sequence and fall back to code with
  branches.  */
   end_sequence ();
-#endif
   return NULL_RTX;
 }
 
@@ -8892,7 +8886,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode 
tmode,
if (code == MIN_EXPR)
  comparison_code = LT;
  }
-#if HAVE_conditional_move
+
/* Use a conditional move if possible.  */
if (can_conditionally_move_p (mode))
  {
@@ -8920,7 +8914,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode 
tmode,
   branches.  */
end_sequenc

[PATCH 1/7] always define HAVE_lo_sum

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

gcc/ChangeLog:

2015-05-23  Trevor Saunders  

* combine.c (find_split_point): Check the value of HAVE_lo_sum
instead of if it is defined.
(combine_simplify_rtx): Likewise.
* lra-constraints.c (process_address_1): Likewise.
* config/darwin.c: Adjust.
* genconfig.c (main): Always define HAVE_lo_sum.
---
 gcc/ChangeLog |  9 +++
 gcc/combine.c | 10 +++
 gcc/config/darwin.c   |  3 +--
 gcc/genconfig.c   |  2 ++
 gcc/lra-constraints.c | 72 +--
 5 files changed, 51 insertions(+), 45 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3ce1628..360f013 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2015-05-23  Trevor Saunders  
+
+   * combine.c (find_split_point): Check the value of HAVE_lo_sum
+   instead of if it is defined.
+   (combine_simplify_rtx): Likewise.
+   * lra-constraints.c (process_address_1): Likewise.
+   * config/darwin.c: Adjust.
+   * genconfig.c (main): Always define HAVE_lo_sum.
+
 2015-05-23  Prathamesh Kulkarni  
 
* genmatch.c (parser::parse_operation): Reject expanding operator-list 
inside 'for'.
diff --git a/gcc/combine.c b/gcc/combine.c
index 0817af2..73d141e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -4785,11 +4785,10 @@ find_split_point (rtx *loc, rtx_insn *insn, bool 
set_src)
   return find_split_point (&SUBREG_REG (x), insn, false);
 
 case MEM:
-#ifdef HAVE_lo_sum
   /* If we have (mem (const ..)) or (mem (symbol_ref ...)), split it
 using LO_SUM and HIGH.  */
-  if (GET_CODE (XEXP (x, 0)) == CONST
- || GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
+  if (HAVE_lo_sum && (GET_CODE (XEXP (x, 0)) == CONST
+ || GET_CODE (XEXP (x, 0)) == SYMBOL_REF))
{
  machine_mode address_mode = get_address_mode (x);
 
@@ -4799,7 +4798,6 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
 XEXP (x, 0)));
  return &XEXP (XEXP (x, 0), 0);
}
-#endif
 
   /* If we have a PLUS whose second operand is a constant and the
 address is not valid, perhaps will can split it up using
@@ -5857,16 +5855,14 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int 
in_dest,
SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0));
   break;
 
-#ifdef HAVE_lo_sum
 case LO_SUM:
   /* Convert (lo_sum (high FOO) FOO) to FOO.  This is necessary so we
 can add in an offset.  find_split_point will split this address up
 again if it doesn't match.  */
-  if (GET_CODE (XEXP (x, 0)) == HIGH
+  if (HAVE_lo_sum && GET_CODE (XEXP (x, 0)) == HIGH
  && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1)))
return XEXP (x, 1);
   break;
-#endif
 
 case PLUS:
   /* (plus (xor (and  (const_int pow2 - 1)) ) <-c>)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 5ea7088..ea7eec1 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -149,8 +149,7 @@ int generating_for_darwin_version ;
 section * darwin_sections[NUM_DARWIN_SECTIONS];
 
 /* While we transition to using in-tests instead of ifdef'd code.  */
-#ifndef HAVE_lo_sum
-#define HAVE_lo_sum 0
+#if !HAVE_lo_sum
 #define gen_macho_high(a,b) (a)
 #define gen_macho_low(a,b,c) (a)
 #endif
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 7237dede..a0a834a 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -360,6 +360,8 @@ main (int argc, char **argv)
 
   if (have_lo_sum_flag)
 printf ("#define HAVE_lo_sum 1\n");
+  else
+printf ("#define HAVE_lo_sum 0\n");
 
   if (have_rotate_flag)
 printf ("#define HAVE_rotate 1\n");
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index c0f2995..a8d0820 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -2962,42 +2962,42 @@ process_address_1 (int nop, bool check_only_p,
  rtx addr = *ad.inner;
 
  new_reg = lra_create_new_reg (Pmode, NULL_RTX, cl, "addr");
-#ifdef HAVE_lo_sum
- {
-   rtx_insn *insn;
-   rtx_insn *last = get_last_insn ();
-
-   /* addr => lo_sum (new_base, addr), case (2) above.  */
-   insn = emit_insn (gen_rtx_SET
- (new_reg,
-  gen_rtx_HIGH (Pmode, copy_rtx (addr;
-   code = recog_memoized (insn);
-   if (code >= 0)
- {
-   *ad.inner = gen_rtx_LO_SUM (Pmode, new_reg, addr);
-   if (! valid_address_p (ad.mode, *ad.outer, ad.as))
- {
-   /* Try to put lo_sum into register.  */
-   insn = emit_insn (gen_rtx_SET
- (new_reg,
-  gen_rtx_LO_SUM (Pmode, new_reg, addr)));
-   code = recog_memoized (insn);
-   if (code >= 0)
- {
- 

[PATCH 3/7] always define HAVE_memory_barrier

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

gcc/ChangeLog:

2015-05-23  Trevor Saunders  

* defaults.h (gen_memory_barrier): New function.
(HAVE_memory_barrier): Add default value.
* optabs.c: Adjust.
---
 gcc/ChangeLog  |  6 ++
 gcc/defaults.h | 10 ++
 gcc/optabs.c   |  5 -
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2f40e8d..cd0358a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-23  Trevor Saunders  
 
+   * defaults.h (gen_memory_barrier): New function.
+   (HAVE_memory_barrier): Add default value.
+   * optabs.c: Adjust.
+
+2015-05-23  Trevor Saunders  
+
* defaults.h (gen_mem_thread_fence): New function.
(HAVE_mem_thread_fence): Add default definition.
* optabs.c: Adjust.
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 72b290a..a7455e5 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1454,6 +1454,16 @@ gen_mem_thread_fence (rtx)
 }
 #endif
 
+#ifndef HAVE_memory_barrier
+#define HAVE_memory_barrier 0
+static inline rtx
+gen_memory_barrier ()
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
 #endif /* GCC_INSN_FLAGS_H  */
 
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 197e4ae..d3c1d21 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7589,11 +7589,6 @@ expand_asm_memory_barrier (void)
 /* This routine will either emit the mem_thread_fence pattern or issue a 
sync_synchronize to generate a fence for memory model MEMMODEL.  */
 
-#ifndef HAVE_memory_barrier
-# define HAVE_memory_barrier 0
-# define gen_memory_barrier()  (gcc_unreachable (), NULL_RTX)
-#endif
-
 void
 expand_mem_thread_fence (enum memmodel model)
 {
-- 
2.4.0.78.g7c6ecbf



[PATCH 0/7] More ifdef reduction

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

Hi,

yet more of the same.

each individually bootstrapped + regtested on x86_64-linux-gnu, and made sure
config-list.mk was fine at the end.  I expect this stuff is all still
preapproved so committing to trunk.

Trev

Trevor Saunders (7):
  always define HAVE_lo_sum
  provide default for HAVE_mem_thread_fence
  always define HAVE_memory_barrier
  provide default for HAVE_mem_signal_fence
  add default for HAVE_load_multiple
  add default for HAVE_store_multiple
  add default for HAVE_tablejump

 gcc/ChangeLog | 46 
 gcc/combine.c | 10 +++
 gcc/config/darwin.c   |  3 +--
 gcc/defaults.h| 60 ++
 gcc/expr.c| 11 
 gcc/genconfig.c   |  2 ++
 gcc/lra-constraints.c | 72 +--
 gcc/optabs.c  | 14 --
 gcc/stmt.c|  4 ---
 9 files changed, 148 insertions(+), 74 deletions(-)

-- 
2.4.0.78.g7c6ecbf



[PATCH 2/7] provide default for HAVE_mem_thread_fence

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

gcc/ChangeLog:

2015-05-23  Trevor Saunders  

* defaults.h (gen_mem_thread_fence): New function.
(HAVE_mem_thread_fence): Add default definition.
* optabs.c: Adjust.
---
 gcc/ChangeLog  |  6 ++
 gcc/defaults.h | 10 ++
 gcc/optabs.c   |  4 
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 360f013..2f40e8d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-23  Trevor Saunders  
 
+   * defaults.h (gen_mem_thread_fence): New function.
+   (HAVE_mem_thread_fence): Add default definition.
+   * optabs.c: Adjust.
+
+2015-05-23  Trevor Saunders  
+
* combine.c (find_split_point): Check the value of HAVE_lo_sum
instead of if it is defined.
(combine_simplify_rtx): Likewise.
diff --git a/gcc/defaults.h b/gcc/defaults.h
index e7bbcb8..72b290a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1444,6 +1444,16 @@ gen_epilogue ()
 }
 #endif
 
+#ifndef HAVE_mem_thread_fence
+#define HAVE_mem_thread_fence 0
+static inline rtx
+gen_mem_thread_fence (rtx)
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
 #endif /* GCC_INSN_FLAGS_H  */
 
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 21150db..197e4ae 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7589,10 +7589,6 @@ expand_asm_memory_barrier (void)
 /* This routine will either emit the mem_thread_fence pattern or issue a 
sync_synchronize to generate a fence for memory model MEMMODEL.  */
 
-#ifndef HAVE_mem_thread_fence
-# define HAVE_mem_thread_fence 0
-# define gen_mem_thread_fence(x) (gcc_unreachable (), NULL_RTX)
-#endif
 #ifndef HAVE_memory_barrier
 # define HAVE_memory_barrier 0
 # define gen_memory_barrier()  (gcc_unreachable (), NULL_RTX)
-- 
2.4.0.78.g7c6ecbf



[PATCH 7/7] add default for HAVE_tablejump

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

gcc/ChangeLog:

2015-05-23  Trevor Saunders  

* defaults.h (gen_tablejump): New function.
(HAVE_tablejump): Add default value.
* expr.c: Adjust.
* stmt.c: Likewise.
---
 gcc/ChangeLog  |  7 +++
 gcc/defaults.h | 10 ++
 gcc/expr.c |  5 -
 gcc/stmt.c |  4 
 4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 99ee6dd..864ce02 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
 2015-05-23  Trevor Saunders  
 
+   * defaults.h (gen_tablejump): New function.
+   (HAVE_tablejump): Add default value.
+   * expr.c: Adjust.
+   * stmt.c: Likewise.
+
+2015-05-23  Trevor Saunders  
+
* defaults.h (gen_store_multiple): New function.
(HAVE_store_multiple): Add default value.
* expr.c (move_block_from_reg): Adjust.
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 566841b..53d6682 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1494,6 +1494,16 @@ gen_store_multiple (rtx, rtx, rtx)
 }
 #endif
 
+#ifndef HAVE_tablejump
+#define HAVE_tablejump 0
+static inline rtx
+gen_tablejump (rtx, rtx)
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
 #endif /* GCC_INSN_FLAGS_H  */
 
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/expr.c b/gcc/expr.c
index 0dad737..dccaf8b 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -11226,11 +11226,6 @@ try_casesi (tree index_type, tree index_expr, tree 
minval, tree range,
 }
 
 /* Attempt to generate a tablejump instruction; same concept.  */
-#ifndef HAVE_tablejump
-#define HAVE_tablejump 0
-#define gen_tablejump(x, y) (0)
-#endif
-
 /* Subroutine of the next function.
 
INDEX is the value being switched on, with the lowest value
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 16a080a..303df72 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -796,10 +796,6 @@ dump_case_nodes (FILE *f, struct case_node *root,
 #define HAVE_casesi 0
 #endif
 
-#ifndef HAVE_tablejump
-#define HAVE_tablejump 0
-#endif
-
 /* Return the smallest number of different values for which it is best to use a
jump-table instead of a tree of conditional branches.  */
 
-- 
2.4.0.78.g7c6ecbf



[PATCH 6/7] add default for HAVE_store_multiple

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

gcc/ChangeLog:

2015-05-23  Trevor Saunders  

* defaults.h (gen_store_multiple): New function.
(HAVE_store_multiple): Add default value.
* expr.c (move_block_from_reg): Adjust.
---
 gcc/ChangeLog  |  6 ++
 gcc/defaults.h | 10 ++
 gcc/expr.c |  2 --
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5d609d4..99ee6dd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-23  Trevor Saunders  
 
+   * defaults.h (gen_store_multiple): New function.
+   (HAVE_store_multiple): Add default value.
+   * expr.c (move_block_from_reg): Adjust.
+
+2015-05-23  Trevor Saunders  
+
* defaults.h (gen_load_multiple): New function.
(HAVE_load_multiple): Add default value.
* expr.c (move_block_to_reg): Adjust.
diff --git a/gcc/defaults.h b/gcc/defaults.h
index ea5ff80..566841b 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1484,6 +1484,16 @@ gen_load_multiple (rtx, rtx, rtx)
 }
 #endif
 
+#ifndef HAVE_store_multiple
+#define HAVE_store_multiple 0
+static inline rtx
+gen_store_multiple (rtx, rtx, rtx)
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
 #endif /* GCC_INSN_FLAGS_H  */
 
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/expr.c b/gcc/expr.c
index c4b39f4..0dad737 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1548,7 +1548,6 @@ move_block_from_reg (int regno, rtx x, int nregs)
 return;
 
   /* See if the machine can do this with a store multiple insn.  */
-#ifdef HAVE_store_multiple
   if (HAVE_store_multiple)
 {
   rtx_insn *last = get_last_insn ();
@@ -1562,7 +1561,6 @@ move_block_from_reg (int regno, rtx x, int nregs)
   else
delete_insns_since (last);
 }
-#endif
 
   for (i = 0; i < nregs; i++)
 {
-- 
2.4.0.78.g7c6ecbf



[PATCH 4/7] provide default for HAVE_mem_signal_fence

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

gcc/ChangeLog:

2015-05-23  Trevor Saunders  

* defaults.h (gen_mem_signal_fence): New function.
(HAVE_mem_signal_fence): Add default value.
* optabs.c: Adjust.
---
 gcc/ChangeLog  |  6 ++
 gcc/defaults.h | 10 ++
 gcc/optabs.c   |  5 -
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cd0358a..5e540b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-23  Trevor Saunders  
 
+   * defaults.h (gen_mem_signal_fence): New function.
+   (HAVE_mem_signal_fence): Add default value.
+   * optabs.c: Adjust.
+
+2015-05-23  Trevor Saunders  
+
* defaults.h (gen_memory_barrier): New function.
(HAVE_memory_barrier): Add default value.
* optabs.c: Adjust.
diff --git a/gcc/defaults.h b/gcc/defaults.h
index a7455e5..50004d5 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1464,6 +1464,16 @@ gen_memory_barrier ()
 }
 #endif
 
+#ifndef HAVE_mem_signal_fence
+#define HAVE_mem_signal_fence 0
+static inline rtx
+gen_mem_signal_fence (rtx)
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
 #endif /* GCC_INSN_FLAGS_H  */
 
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index d3c1d21..49e1c53 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7608,11 +7608,6 @@ expand_mem_thread_fence (enum memmodel model)
 /* This routine will either emit the mem_signal_fence pattern or issue a 
sync_synchronize to generate a fence for memory model MEMMODEL.  */
 
-#ifndef HAVE_mem_signal_fence
-# define HAVE_mem_signal_fence 0
-# define gen_mem_signal_fence(x) (gcc_unreachable (), NULL_RTX)
-#endif
-
 void
 expand_mem_signal_fence (enum memmodel model)
 {
-- 
2.4.0.78.g7c6ecbf



[PATCH 5/7] add default for HAVE_load_multiple

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

gcc/ChangeLog:

2015-05-23  Trevor Saunders  

* defaults.h (gen_load_multiple): New function.
(HAVE_load_multiple): Add default value.
* expr.c (move_block_to_reg): Adjust.
---
 gcc/ChangeLog  |  6 ++
 gcc/defaults.h | 10 ++
 gcc/expr.c |  4 
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5e540b6..5d609d4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2015-05-23  Trevor Saunders  
 
+   * defaults.h (gen_load_multiple): New function.
+   (HAVE_load_multiple): Add default value.
+   * expr.c (move_block_to_reg): Adjust.
+
+2015-05-23  Trevor Saunders  
+
* defaults.h (gen_mem_signal_fence): New function.
(HAVE_mem_signal_fence): Add default value.
* optabs.c: Adjust.
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 50004d5..ea5ff80 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1474,6 +1474,16 @@ gen_mem_signal_fence (rtx)
 }
 #endif
 
+#ifndef HAVE_load_multiple
+#define HAVE_load_multiple 0
+static inline rtx
+gen_load_multiple (rtx, rtx, rtx)
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
 #endif /* GCC_INSN_FLAGS_H  */
 
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/expr.c b/gcc/expr.c
index 3605e99..c4b39f4 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1507,10 +1507,8 @@ void
 move_block_to_reg (int regno, rtx x, int nregs, machine_mode mode)
 {
   int i;
-#ifdef HAVE_load_multiple
   rtx pat;
   rtx_insn *last;
-#endif
 
   if (nregs == 0)
 return;
@@ -1519,7 +1517,6 @@ move_block_to_reg (int regno, rtx x, int nregs, 
machine_mode mode)
 x = validize_mem (force_const_mem (mode, x));
 
   /* See if the machine can do this with a load multiple insn.  */
-#ifdef HAVE_load_multiple
   if (HAVE_load_multiple)
 {
   last = get_last_insn ();
@@ -1533,7 +1530,6 @@ move_block_to_reg (int regno, rtx x, int nregs, 
machine_mode mode)
   else
delete_insns_since (last);
 }
-#endif
 
   for (i = 0; i < nregs; i++)
 emit_move_insn (gen_rtx_REG (word_mode, regno + i),
-- 
2.4.0.78.g7c6ecbf



[PATCH] remove need for store_values_directly

2015-04-16 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

Last stage 1 I introduced a second form of hash_table that stored elements of
value_type in addition to the old form that stored elements of type value_type
*.  That lead to a fair bit of code dupplication in hash_table, but it
simplified the transition by allowing it to take place one hash table at a
time.  Now I'm switching the rest of the hash_table users to use the new setup,
and removing supporot for the old one.

this was bootstrapped and regtested on x86_64-unknown-linux-gnu, and I ran make
all-gcc for the following crosses to check the hash tables they use were
correctly converted
arm-linux-androideabi
i686-apple-darwin
i686-solaris2.11
i686-w64-mingw32
ia64-linux
mips64-linux
nvptx-elf
ppc64-linux

Is this ok?

Trev

gcc/

* hash-table.h: Remove version of hash_table that stored value_type *.
* asan.c, attribs.c, bitmap.c, cfg.c, cgraph.h, config/arm/arm.c,
config/i386/winnt.c, config/ia64/ia64.c, config/mips/mips.c,
config/sol2.c, coverage.c, cselib.c, dse.c, dwarf2cfi.c,
dwarf2out.c, except.c, gcse.c, genmatch.c, ggc-common.c,
gimple-ssa-strength-reduction.c, gimplify.c, haifa-sched.c,
hard-reg-set.h, hash-map.h, hash-set.h, ipa-devirt.c, ipa-icf.h,
ipa-profile.c, ira-color.c, ira-costs.c, loop-invariant.c,
loop-iv.c, loop-unroll.c, lto-streamer.h, plugin.c, postreload-gcse.c,
reginfo.c, statistics.c, store-motion.c, trans-mem.c, tree-cfg.c,
tree-eh.c, tree-hasher.h, tree-into-ssa.c, tree-parloops.c,
tree-sra.c, tree-ssa-coalesce.c, tree-ssa-dom.c, tree-ssa-live.c,
tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-phiopt.c,
tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sccvn.c,
tree-ssa-structalias.c, tree-ssa-tail-merge.c,
tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vectorizer.h,
valtrack.h, var-tracking.c, vtable-verify.c, vtable-verify.h: Adjust.


libcc1/

* plugin.cc: Adjust for hash_table changes.

java/

* jcf-io.c: Adjust for hash_table changes.

lto/

* lto.c: Adjust for hash_table changes.

objc/

* objc-act.c: Adjust for hash_table changes.

diff --git a/gcc/asan.c b/gcc/asan.c
index 9e4a629..7b70ee2 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -407,11 +407,11 @@ asan_mem_ref_get_end (const asan_mem_ref *ref, tree len)
 struct asan_mem_ref_hasher
   : typed_noop_remove 
 {
-  typedef asan_mem_ref value_type;
-  typedef asan_mem_ref compare_type;
+  typedef asan_mem_ref *value_type;
+  typedef asan_mem_ref *compare_type;
 
-  static inline hashval_t hash (const value_type *);
-  static inline bool equal (const value_type *, const compare_type *);
+  static inline hashval_t hash (const asan_mem_ref *);
+  static inline bool equal (const asan_mem_ref *, const asan_mem_ref *);
 };
 
 /* Hash a memory reference.  */
diff --git a/gcc/attribs.c b/gcc/attribs.c
index c18bff2..7b7e2a9 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -67,21 +67,21 @@ substring_hash (const char *str, int l)
 
 struct attribute_hasher : typed_noop_remove 
 {
-  typedef attribute_spec value_type;
-  typedef substring compare_type;
-  static inline hashval_t hash (const value_type *);
-  static inline bool equal (const value_type *, const compare_type *);
+  typedef attribute_spec *value_type;
+  typedef substring *compare_type;
+  static inline hashval_t hash (const attribute_spec *);
+  static inline bool equal (const attribute_spec *, const substring *);
 };
 
 inline hashval_t
-attribute_hasher::hash (const value_type *spec)
+attribute_hasher::hash (const attribute_spec *spec)
 {
   const int l = strlen (spec->name);
   return substring_hash (spec->name, l);
 }
 
 inline bool
-attribute_hasher::equal (const value_type *spec, const compare_type *str)
+attribute_hasher::equal (const attribute_spec *spec, const substring *str)
 {
   return (strncmp (spec->name, str->str, str->length) == 0
  && !spec->name[str->length]);
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index d43a39f..71d5b11 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -61,20 +61,20 @@ struct loc
 
 struct bitmap_desc_hasher : typed_noop_remove 
 {
-  typedef bitmap_descriptor_d value_type;
-  typedef loc compare_type;
-  static inline hashval_t hash (const value_type *);
-  static inline bool equal (const value_type *, const compare_type *);
+  typedef bitmap_descriptor_d *value_type;
+  typedef loc *compare_type;
+  static inline hashval_t hash (const bitmap_descriptor_d *);
+  static inline bool equal (const bitmap_descriptor_d *, const loc *);
 };
 
 inline hashval_t
-bitmap_desc_hasher::hash (const value_type *d)
+bitmap_desc_hasher::hash (const bitmap_descriptor_d *d)
 {
   return htab_hash_pointer (d->file) + d->line;
 }
 
 inline bool
-bitmap_desc_hasher::equal (const value_type *d, const compare_type *l)
+bitmap_desc_hasher::equal (const bitmap_descriptor_d *d, const loc *l)
 {
   return d->file == l->file && d->function == l->function 

[PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* defaults.h: New definition of EH_RETURN_DATA_REGNO.
* except.c: Remove definition of EH_RETURN_DATA_REGNO.
* builtins.c (expand_builtin): Remove check if
EH_RETURN_DATA_REGNO is defined.
* df-scan.c (df_bb_refs_collect): Likewise.
(df_get_exit_block_use_set): Likewise.
* haifa-sched.c (initiate_bb_reg_pressure_info): Likewise.
* ira-lives.c (process_bb_node_lives): Likewise.
* lra-lives.c (process_bb_lives): Likewise.
---
 gcc/builtins.c| 2 --
 gcc/defaults.h| 6 ++
 gcc/df-scan.c | 4 
 gcc/except.c  | 6 --
 gcc/haifa-sched.c | 2 --
 gcc/ira-lives.c   | 2 --
 gcc/lra-lives.c   | 2 --
 7 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 9263777..028d793 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -6510,10 +6510,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, 
machine_mode mode,
   expand_builtin_eh_return (CALL_EXPR_ARG (exp, 0),
CALL_EXPR_ARG (exp, 1));
   return const0_rtx;
-#ifdef EH_RETURN_DATA_REGNO
 case BUILT_IN_EH_RETURN_DATA_REGNO:
   return expand_builtin_eh_return_data_regno (exp);
-#endif
 case BUILT_IN_EXTEND_POINTER:
   return expand_builtin_extend_pointer (CALL_EXPR_ARG (exp, 0));
 case BUILT_IN_EH_POINTER:
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 1d54798..911c2f8 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -377,6 +377,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #endif
 #endif
 
+/* Provide defaults for stuff that may not be defined when using
+   sjlj exceptions.  */
+#ifndef EH_RETURN_DATA_REGNO
+#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
+#endif
+
 /* If we have named section and we support weak symbols, then use the
.jcr section for recording java classes which need to be registered
at program start-up time.  */
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 1700be9..b2e2e5d 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3332,7 +3332,6 @@ df_bb_refs_collect (struct df_collection_rec 
*collection_rec, basic_block bb)
   return;
 }
 
-#ifdef EH_RETURN_DATA_REGNO
   if (bb_has_eh_pred (bb))
 {
   unsigned int i;
@@ -3346,7 +3345,6 @@ df_bb_refs_collect (struct df_collection_rec 
*collection_rec, basic_block bb)
 bb, NULL, DF_REF_REG_DEF, DF_REF_AT_TOP);
}
 }
-#endif
 
   /* Add the hard_frame_pointer if this block is the target of a
  non-local goto.  */
@@ -3751,7 +3749,6 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
  bitmap_set_bit (exit_block_uses, i);
 }
 
-#ifdef EH_RETURN_DATA_REGNO
   /* Mark the registers that will contain data for the handler.  */
   if (reload_completed && crtl->calls_eh_return)
 for (i = 0; ; ++i)
@@ -3761,7 +3758,6 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
  break;
bitmap_set_bit (exit_block_uses, regno);
   }
-#endif
 
 #ifdef EH_RETURN_STACKADJ_RTX
   if ((!HAVE_epilogue || ! epilogue_completed)
diff --git a/gcc/except.c b/gcc/except.c
index 833ec21..7573c88 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -174,12 +174,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfgloop.h"
 #include "builtins.h"
 
-/* Provide defaults for stuff that may not be defined when using
-   sjlj exceptions.  */
-#ifndef EH_RETURN_DATA_REGNO
-#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
-#endif
-
 static GTY(()) int call_site_base;
 
 struct tree_hash_traits : default_hashmap_traits
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index ad2450b..d47cb8c 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1070,7 +1070,6 @@ initiate_bb_reg_pressure_info (basic_block bb)
   if (NONDEBUG_INSN_P (insn))
setup_ref_regs (PATTERN (insn));
   initiate_reg_pressure_info (df_get_live_in (bb));
-#ifdef EH_RETURN_DATA_REGNO
   if (bb_has_eh_pred (bb))
 for (i = 0; ; ++i)
   {
@@ -1082,7 +1081,6 @@ initiate_bb_reg_pressure_info (basic_block bb)
  mark_regno_birth_or_death (curr_reg_live, curr_reg_pressure,
 regno, true);
   }
-#endif
 }
 
 /* Save current register pressure related info.  */
diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index b29f572..2837349 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -1319,7 +1319,6 @@ process_bb_node_lives (ira_loop_tree_node_t 
loop_tree_node)
  curr_point++;
}
 
-#ifdef EH_RETURN_DATA_REGNO
   if (bb_has_eh_pred (bb))
for (j = 0; ; ++j)
  {
@@ -1328,7 +1327,6 @@ process_bb_node_lives (ira_loop_tree_node_t 
loop_tree_node)
  break;
make_hard_regno_born (regno);
  }
-#endif
 
   /* Allocnos can't go in stack regs at the start of a basic block
 that is reached by an abnormal edge. Likewise for call
diff 

[PATCH 00/12] Reduce conditional compilation

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

This is a first round of patches to reduce the amount of code with in #if /
#ifdef.  This makes it incrementally easier to not break configs other than the
one being built, and moves things slightly closer to using target hooks for
everything.

each commit bootstrapped and regtested on x86_64-linux-gnu without regression,
and whole patch set run through config-list.mk without issue, ok?

Trevor Saunders (12):
  add default definition of EH_RETURN_DATA_REGNO
  remove some ifdef HAVE_cc0
  more HAVE_cc0
  always define HAVE_cc0
  make some HAVE_cc0 code always compiled
  provide default for RETURN_ADDR_OFFSET
  provide default for MASK_RETURN_ADDR
  reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER
  remove #if for PIC_OFFSET_TABLE_REGNUM
  remove more ifdefs for HAVE_cc0
  provide default for INSN_SETS_ARE_DELAYED
  add default for INSN_REFERENCES_ARE_DELAYED

 gcc/alias.c   |  7 ++---
 gcc/builtins.c|  2 --
 gcc/caller-save.c |  4 +--
 gcc/cfgcleanup.c  | 26 +---
 gcc/cfgrtl.c  | 12 ++--
 gcc/combine.c | 84 ++-
 gcc/conditions.h  |  6 
 gcc/cprop.c   |  4 +--
 gcc/cse.c | 22 +-
 gcc/defaults.h| 23 ++
 gcc/df-problems.c |  9 ++
 gcc/df-scan.c | 46 +++-
 gcc/emit-rtl.c|  8 ++---
 gcc/except.c  | 26 ++--
 gcc/final.c   | 43 --
 gcc/function.c|  5 ++-
 gcc/gcse.c| 24 ---
 gcc/genconfig.c   |  1 +
 gcc/haifa-sched.c |  5 +--
 gcc/ira-lives.c   |  2 --
 gcc/ira.c | 33 +---
 gcc/jump.c|  3 --
 gcc/loop-invariant.c  |  4 +--
 gcc/lra-constraints.c |  6 ++--
 gcc/lra-lives.c   |  2 --
 gcc/optabs.c  |  2 +-
 gcc/postreload.c  |  4 +--
 gcc/recog.c   |  2 --
 gcc/recog.h   |  2 --
 gcc/reginfo.c |  5 ++-
 gcc/regrename.c   |  5 ++-
 gcc/reload.c  | 12 +++-
 gcc/reload1.c | 10 +++---
 gcc/reorg.c   | 68 ++---
 gcc/resource.c| 15 +++--
 gcc/rtlanal.c |  2 --
 gcc/sched-deps.c  |  5 +--
 gcc/sched-rgn.c   |  4 +--
 gcc/simplify-rtx.c|  5 ++-
 39 files changed, 199 insertions(+), 349 deletions(-)

-- 
2.3.0.80.g18d0fec.dirty



[PATCH 02/12] remove some ifdef HAVE_cc0

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* conditions.h: Define macros even if HAVE_cc0 is undefined.
* emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
* final.c: Likewise.
* jump.c: Likewise.
* recog.c: Likewise.
* recog.h: Declare functions even when HAVE_cc0 is undefined.
* sched-deps.c (sched_analyze_2): Always compile case for cc0.
---
 gcc/conditions.h | 6 --
 gcc/emit-rtl.c   | 2 --
 gcc/final.c  | 2 --
 gcc/jump.c   | 3 ---
 gcc/recog.c  | 2 --
 gcc/recog.h  | 2 --
 gcc/sched-deps.c | 5 +++--
 7 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/gcc/conditions.h b/gcc/conditions.h
index 2308bfc..7cd1e1c 100644
--- a/gcc/conditions.h
+++ b/gcc/conditions.h
@@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_CONDITIONS_H
 #define GCC_CONDITIONS_H
 
-/* None of the things in the files exist if we don't use CC0.  */
-
-#ifdef HAVE_cc0
-
 /* The variable cc_status says how to interpret the condition code.
It is set by output routines for an instruction that sets the cc's
and examined by output routines for jump instructions.
@@ -117,6 +113,4 @@ extern CC_STATUS cc_status;
  (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
   CC_STATUS_MDEP_INIT)
 
-#endif
-
 #endif /* GCC_CONDITIONS_H */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 483eacb..c1974bb 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3541,7 +3541,6 @@ prev_active_insn (rtx uncast_insn)
   return insn;
 }
 
-#ifdef HAVE_cc0
 /* Return the next insn that uses CC0 after INSN, which is assumed to
set it.  This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
applied to the result of this function should yield INSN).
@@ -3589,7 +3588,6 @@ prev_cc0_setter (rtx uncast_insn)
 
   return insn;
 }
-#endif
 
 #ifdef AUTO_INC_DEC
 /* Find a RTX_AUTOINC class rtx which matches DATA.  */
diff --git a/gcc/final.c b/gcc/final.c
index 1fa93d9..41f6bd9 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -191,7 +191,6 @@ static rtx last_ignored_compare = 0;
 
 static int insn_counter = 0;
 
-#ifdef HAVE_cc0
 /* This variable contains machine-dependent flags (defined in tm.h)
set and examined by output routines
that describe how to interpret the condition codes properly.  */
@@ -202,7 +201,6 @@ CC_STATUS cc_status;
from before the insn.  */
 
 CC_STATUS cc_prev_status;
-#endif
 
 /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
 
diff --git a/gcc/jump.c b/gcc/jump.c
index 34b3b7b..bc91550 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1044,8 +1044,6 @@ jump_to_label_p (const rtx_insn *insn)
  && JUMP_LABEL (insn) != NULL && !ANY_RETURN_P (JUMP_LABEL (insn)));
 }
 
-#ifdef HAVE_cc0
-
 /* Return nonzero if X is an RTX that only sets the condition codes
and has no side effects.  */
 
@@ -1094,7 +1092,6 @@ sets_cc0_p (const_rtx x)
 }
   return 0;
 }
-#endif
 
 /* Find all CODE_LABELs referred to in X, and increment their use
counts.  If INSN is a JUMP_INSN and there is at least one
diff --git a/gcc/recog.c b/gcc/recog.c
index a9d3b1f..c3ad86f 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -971,7 +971,6 @@ validate_simplify_insn (rtx insn)
   return ((num_changes_pending () > 0) && (apply_change_group () > 0));
 }
 
-#ifdef HAVE_cc0
 /* Return 1 if the insn using CC0 set by INSN does not contain
any ordered tests applied to the condition codes.
EQ and NE tests do not count.  */
@@ -988,7 +987,6 @@ next_insn_tests_no_inequality (rtx insn)
   return (INSN_P (next)
  && ! inequality_comparisons_p (PATTERN (next)));
 }
-#endif
 
 /* Return 1 if OP is a valid general operand for machine mode MODE.
This is either a register reference, a memory reference,
diff --git a/gcc/recog.h b/gcc/recog.h
index 45ea671..8a38b26 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -112,9 +112,7 @@ extern void validate_replace_rtx_group (rtx, rtx, rtx);
 extern void validate_replace_src_group (rtx, rtx, rtx);
 extern bool validate_simplify_insn (rtx insn);
 extern int num_changes_pending (void);
-#ifdef HAVE_cc0
 extern int next_insn_tests_no_inequality (rtx);
-#endif
 extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
 
 extern int offsettable_memref_p (rtx);
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 5434831..31de6be 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2608,8 +2608,10 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn 
*insn)
 
   return;
 
-#ifdef HAVE_cc0
 case CC0:
+#ifdef HAVE_cc0
+  gcc_unreachable ();
+#endif
   /* User of CC0 depends on immediately preceding insn.  */
   SCHED_GROUP_P (insn) = 1;
/* Don't move CC0 setter to another block (it can set up the
@@ -2620,7 +2622,6 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn 
*insn)
sched_deps_info->finish_rhs ();
 
   return;
-#endif
 
 case R

[PATCH 05/12] make some HAVE_cc0 code always compiled

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* cfgrtl.c (rtl_merge_blocks): Change #if HAVE_cc0 to if (HAVE_cc0)
(try_redirect_by_replacing_jump): Likewise.
(rtl_tidy_fallthru_edge): Likewise.
* combine.c (insn_a_feeds_b): Likewise.
(find_split_point): Likewise.
(simplify_set): Likewise.
* cprop.c (cprop_jump): Likewise.
* cse.c (cse_extended_basic_block): Likewise.
* df-problems.c (can_move_insns_across): Likewise.
* function.c (emit_use_return_register_into_block): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ira.c (find_moveable_pseudos): Likewise.
* loop-invariant.c (find_invariant_insn): Likewise.
* lra-constraints.c (curr_insn_transform): Likewise.
* postreload.c (reload_combine_recognize_const_pattern):
* Likewise.
* reload.c (find_reloads): Likewise.
* reorg.c (delete_scheduled_jump): Likewise.
(steal_delay_list_from_target): Likewise.
(steal_delay_list_from_fallthrough): Likewise.
(redundant_insn): Likewise.
(fill_simple_delay_slots): Likewise.
(fill_slots_from_thread): Likewise.
(delete_computation): Likewise.
* sched-rgn.c (add_branch_dependences): Likewise.
---
 gcc/cfgrtl.c  | 12 +++-
 gcc/combine.c | 10 ++
 gcc/cprop.c   |  4 +---
 gcc/cse.c |  4 +---
 gcc/df-problems.c |  4 +---
 gcc/function.c|  5 ++---
 gcc/haifa-sched.c |  3 +--
 gcc/ira.c |  5 ++---
 gcc/loop-invariant.c  |  4 +---
 gcc/lra-constraints.c |  6 ++
 gcc/postreload.c  |  4 +---
 gcc/reload.c  | 10 +++---
 gcc/reorg.c   | 32 
 gcc/sched-rgn.c   |  4 +---
 14 files changed, 29 insertions(+), 78 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 4c1708f..d93a49e 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -893,10 +893,9 @@ rtl_merge_blocks (basic_block a, basic_block b)
 
   del_first = a_end;
 
-#if HAVE_cc0
   /* If this was a conditional jump, we need to also delete
 the insn that set cc0.  */
-  if (only_sets_cc0_p (prev))
+  if (HAVE_cc0 && only_sets_cc0_p (prev))
{
  rtx_insn *tmp = prev;
 
@@ -905,7 +904,6 @@ rtl_merge_blocks (basic_block a, basic_block b)
prev = BB_HEAD (a);
  del_first = tmp;
}
-#endif
 
   a_end = PREV_INSN (del_first);
 }
@@ -1064,11 +1062,9 @@ try_redirect_by_replacing_jump (edge e, basic_block 
target, bool in_cfglayout)
   /* In case we zap a conditional jump, we'll need to kill
  the cc0 setter too.  */
   kill_from = insn;
-#if HAVE_cc0
-  if (reg_mentioned_p (cc0_rtx, PATTERN (insn))
+  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, PATTERN (insn))
   && only_sets_cc0_p (PREV_INSN (insn)))
 kill_from = PREV_INSN (insn);
-#endif
 
   /* See if we can create the fallthru edge.  */
   if (in_cfglayout || can_fallthru (src, target))
@@ -1825,12 +1821,10 @@ rtl_tidy_fallthru_edge (edge e)
  delete_insn (table);
}
 
-#if HAVE_cc0
   /* If this was a conditional jump, we need to also delete
 the insn that set cc0.  */
-  if (any_condjump_p (q) && only_sets_cc0_p (PREV_INSN (q)))
+  if (HAVE_cc0 && any_condjump_p (q) && only_sets_cc0_p (PREV_INSN (q)))
q = PREV_INSN (q);
-#endif
 
   q = PREV_INSN (q);
 }
diff --git a/gcc/combine.c b/gcc/combine.c
index 430084e..d71f863 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1141,10 +1141,8 @@ insn_a_feeds_b (rtx_insn *a, rtx_insn *b)
   FOR_EACH_LOG_LINK (links, b)
 if (links->insn == a)
   return true;
-#if HAVE_cc0
-  if (sets_cc0_p (a))
+  if (HAVE_cc0 && sets_cc0_p (a))
 return true;
-#endif
   return false;
 }
 
@@ -4816,7 +4814,6 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
   break;
 
 case SET:
-#if HAVE_cc0
   /* If SET_DEST is CC0 and SET_SRC is not an operand, a COMPARE, or a
 ZERO_EXTRACT, the most likely reason why this doesn't match is that
 we need to put the operand into a register.  So split at that
@@ -4829,7 +4826,6 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
  && ! (GET_CODE (SET_SRC (x)) == SUBREG
&& OBJECT_P (SUBREG_REG (SET_SRC (x)
return &SET_SRC (x);
-#endif
 
   /* See if we can split SET_SRC as it stands.  */
   split = find_split_point (&SET_SRC (x), insn, true);
@@ -6582,13 +6578,12 @@ simplify_set (rtx x)
   else
compare_mode = SELECT_CC_MODE (new_code, op0, op1);
 
-#if !HAVE_cc0
   /* If the mode changed, we have to change SET_DEST, the mode in the
 compare, and the mode in the place SET_DEST is used.  If SET_DEST is
 a hard register, just build new versions with the proper mode.  If it
 is a pseudo, we lose unless it is only time we set the pseudo, in
 

[PATCH 04/12] always define HAVE_cc0

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* genconfig.c (main): Always define HAVE_cc0.
* caller-save.c (insert_one_insn): Change ifdef HAVE_cc0 to #if
HAVE_cc0.
* cfgcleanup.c (flow_find_cross_jump): Likewise.
(flow_find_head_matching_sequence): Likewise.
(try_head_merge_bb): Likewise.
* cfgrtl.c (rtl_merge_blocks): Likewise.
(try_redirect_by_replacing_jump): Likewise.
(rtl_tidy_fallthru_edge): Likewise.
* combine.c (do_SUBST_MODE): Likewise.
(insn_a_feeds_b): Likewise.
(combine_instructions): Likewise.
(can_combine_p): Likewise.
(try_combine): Likewise.
(find_split_point): Likewise.
(subst): Likewise.
(simplify_set): Likewise.
(distribute_notes): Likewise.
* cprop.c (cprop_jump): Likewise.
* cse.c (cse_extended_basic_block): Likewise.
* df-problems.c (can_move_insns_across): Likewise.
* final.c (final): Likewise.
(final_scan_insn): Likewise.
* function.c (emit_use_return_register_into_block): Likewise.
* gcse.c (insert_insn_end_basic_block): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ira.c (find_moveable_pseudos): Likewise.
* loop-invariant.c (find_invariant_insn): Likewise.
* lra-constraints.c (curr_insn_transform): Likewise.
* optabs.c (prepare_cmp_insn): Likewise.
* postreload.c (reload_combine_recognize_const_pattern):
* Likewise.
* reload.c (find_reloads): Likewise.
(find_reloads_address_1): Likewise.
* reorg.c (delete_scheduled_jump): Likewise.
(steal_delay_list_from_target): Likewise.
(steal_delay_list_from_fallthrough): Likewise.
(try_merge_delay_insns): Likewise.
(redundant_insn): Likewise.
(fill_simple_delay_slots): Likewise.
(fill_slots_from_thread): Likewise.
(delete_computation): Likewise.
(relax_delay_slots): Likewise.
* sched-deps.c (sched_analyze_2): Likewise.
* sched-rgn.c (add_branch_dependences): Likewise.
---
 gcc/caller-save.c |  2 +-
 gcc/cfgcleanup.c  | 12 ++--
 gcc/cfgrtl.c  |  6 +++---
 gcc/combine.c | 36 ++--
 gcc/cprop.c   |  2 +-
 gcc/cse.c |  2 +-
 gcc/df-problems.c |  4 ++--
 gcc/final.c   | 14 +++---
 gcc/function.c|  2 +-
 gcc/gcse.c|  2 +-
 gcc/genconfig.c   |  1 +
 gcc/haifa-sched.c |  2 +-
 gcc/ira.c |  4 ++--
 gcc/loop-invariant.c  |  2 +-
 gcc/lra-constraints.c |  2 +-
 gcc/optabs.c  |  2 +-
 gcc/postreload.c  |  2 +-
 gcc/reload.c  |  6 +++---
 gcc/reorg.c   | 30 +++---
 gcc/sched-deps.c  |  2 +-
 gcc/sched-rgn.c   |  2 +-
 21 files changed, 69 insertions(+), 68 deletions(-)

diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index 3b01941..fc575eb 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -1400,7 +1400,7 @@ insert_one_insn (struct insn_chain *chain, int before_p, 
int code, rtx pat)
   rtx_insn *insn = chain->insn;
   struct insn_chain *new_chain;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* If INSN references CC0, put our insns in front of the insn that sets
  CC0.  This is always safe, since the only way we could be passed an
  insn that references CC0 is for a restore, and doing a restore earlier
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index cee152e..58d235e 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1416,7 +1416,7 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, 
rtx_insn **f1,
   i2 = PREV_INSN (i2);
 }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* Don't allow the insn after a compare to be shared by
  cross-jumping unless the compare is also shared.  */
   if (ninsns && reg_mentioned_p (cc0_rtx, last1) && ! sets_cc0_p (last1))
@@ -1539,7 +1539,7 @@ flow_find_head_matching_sequence (basic_block bb1, 
basic_block bb2, rtx_insn **f
   i2 = NEXT_INSN (i2);
 }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* Don't allow a compare to be shared by cross-jumping unless the insn
  after the compare is also shared.  */
   if (ninsns && reg_mentioned_p (cc0_rtx, last1) && sets_cc0_p (last1))
@@ -2330,7 +2330,7 @@ try_head_merge_bb (basic_block bb)
   cond = get_condition (jump, &move_before, true, false);
   if (cond == NULL_RTX)
 {
-#ifdef HAVE_cc0
+#if HAVE_cc0
   if (reg_mentioned_p (cc0_rtx, jump))
move_before = prev_nonnote_nondebug_insn (jump);
   else
@@ -2499,7 +2499,7 @@ try_head_merge_bb (basic_block bb)
   cond = get_condition (jump, &move_before, true, false);
   if (cond == NULL_RTX)
{
-#ifdef HAVE_cc0
+#if HAVE_cc0
  if (reg_mentioned_p (cc0_rtx, jump))
move_before = prev_nonnote_nondebug_insn (jump);
  else
@@ -2522,7 +2522,7 @@ try_head_merge_bb

[PATCH 03/12] more removal of ifdef HAVE_cc0

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* combine.c (find_single_use): Remove HAVE_cc0 ifdef for code
that is trivially ded on non cc0 targets.
(simplify_set): Likewise.
(mark_used_regs_combine): Likewise.
* cse.c (new_basic_block): Likewise.
(fold_rtx): Likewise.
(cse_insn): Likewise.
(cse_extended_basic_block): Likewise.
(set_live_p): Likewise.
* rtlanal.c (canonicalize_condition): Likewise.
* simplify-rtx.c (simplify_binary_operation_1): Likewise.
---
 gcc/combine.c  |  6 --
 gcc/cse.c  | 18 --
 gcc/rtlanal.c  |  2 --
 gcc/simplify-rtx.c |  5 ++---
 4 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 46cd6db..0a35b8f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -686,7 +686,6 @@ find_single_use (rtx dest, rtx_insn *insn, rtx_insn **ploc)
   rtx *result;
   struct insn_link *link;
 
-#ifdef HAVE_cc0
   if (dest == cc0_rtx)
 {
   next = NEXT_INSN (insn);
@@ -699,7 +698,6 @@ find_single_use (rtx dest, rtx_insn *insn, rtx_insn **ploc)
*ploc = next;
   return result;
 }
-#endif
 
   if (!REG_P (dest))
 return 0;
@@ -6724,7 +6722,6 @@ simplify_set (rtx x)
   src = SET_SRC (x), dest = SET_DEST (x);
 }
 
-#ifdef HAVE_cc0
   /* If we have (set (cc0) (subreg ...)), we try to remove the subreg
  in SRC.  */
   if (dest == cc0_rtx
@@ -6744,7 +6741,6 @@ simplify_set (rtx x)
  src = SET_SRC (x);
}
 }
-#endif
 
 #ifdef LOAD_EXTEND_OP
   /* If we have (set FOO (subreg:M (mem:N BAR) 0)) with M wider than N, this
@@ -13193,11 +13189,9 @@ mark_used_regs_combine (rtx x)
 case ADDR_VEC:
 case ADDR_DIFF_VEC:
 case ASM_INPUT:
-#ifdef HAVE_cc0
 /* CC0 must die in the insn after it is set, so we don't need to take
special note of it here.  */
 case CC0:
-#endif
   return;
 
 case CLOBBER:
diff --git a/gcc/cse.c b/gcc/cse.c
index 2a33827..d184d27 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -281,7 +281,6 @@ struct qty_table_elem
 /* The table of all qtys, indexed by qty number.  */
 static struct qty_table_elem *qty_table;
 
-#ifdef HAVE_cc0
 /* For machines that have a CC0, we do not record its value in the hash
table since its use is guaranteed to be the insn immediately following
its definition and any other insn is presumed to invalidate it.
@@ -293,7 +292,6 @@ static struct qty_table_elem *qty_table;
 
 static rtx this_insn_cc0, prev_insn_cc0;
 static machine_mode this_insn_cc0_mode, prev_insn_cc0_mode;
-#endif
 
 /* Insn being scanned.  */
 
@@ -884,9 +882,7 @@ new_basic_block (void)
}
 }
 
-#ifdef HAVE_cc0
   prev_insn_cc0 = 0;
-#endif
 }
 
 /* Say that register REG contains a quantity in mode MODE not in any
@@ -3166,10 +3162,8 @@ fold_rtx (rtx x, rtx_insn *insn)
 case EXPR_LIST:
   return x;
 
-#ifdef HAVE_cc0
 case CC0:
   return prev_insn_cc0;
-#endif
 
 case ASM_OPERANDS:
   if (insn)
@@ -3223,7 +3217,6 @@ fold_rtx (rtx x, rtx_insn *insn)
const_arg = folded_arg;
break;
 
-#ifdef HAVE_cc0
  case CC0:
/* The cc0-user and cc0-setter may be in different blocks if
   the cc0-setter potentially traps.  In that case PREV_INSN_CC0
@@ -3247,7 +3240,6 @@ fold_rtx (rtx x, rtx_insn *insn)
const_arg = equiv_constant (folded_arg);
  }
break;
-#endif
 
  default:
folded_arg = fold_rtx (folded_arg, insn);
@@ -4522,11 +4514,9 @@ cse_insn (rtx_insn *insn)
 sets = XALLOCAVEC (struct set, XVECLEN (x, 0));
 
   this_insn = insn;
-#ifdef HAVE_cc0
   /* Records what this insn does to set CC0.  */
   this_insn_cc0 = 0;
   this_insn_cc0_mode = VOIDmode;
-#endif
 
   /* Find all regs explicitly clobbered in this insn,
  to ensure they are not replaced with any other regs
@@ -5541,7 +5531,6 @@ cse_insn (rtx_insn *insn)
}
}
 
-#ifdef HAVE_cc0
   /* If setting CC0, record what it was set to, or a constant, if it
 is equivalent to a constant.  If it is being set to a floating-point
 value, make a COMPARE with the appropriate constant of 0.  If we
@@ -5556,7 +5545,6 @@ cse_insn (rtx_insn *insn)
this_insn_cc0 = gen_rtx_COMPARE (VOIDmode, this_insn_cc0,
 CONST0_RTX (mode));
}
-#endif
 }
 
   /* Now enter all non-volatile source expressions in the hash table
@@ -6604,11 +6592,9 @@ cse_extended_basic_block (struct cse_basic_block_data 
*ebb_data)
  record_jump_equiv (insn, taken);
}
 
-#ifdef HAVE_cc0
   /* Clear the CC0-tracking related insns, they can't provide
 useful information across basic block boundaries.  */
   prev_insn_cc0 = 0;
-#endif
 }
 
   gcc_assert (next_qty <= max_qty);
@@ -6859,21 +6845,17 @@ static bool
 set_live_p (rtx set, rtx_in

[PATCH 06/12] provide default for RETURN_ADDR_OFFSET

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* defaults.h (RETURN_ADDR_OFFSET): New definition.
* except.c (expand_builtin_extract_return_addr): Remove ifdef
RETURN_ADDR_OFFSET.
(expand_builtin_frob_return_addr): Likewise.
---
 gcc/defaults.h |  5 +
 gcc/except.c   | 14 +++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 911c2f8..767901a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -383,6 +383,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
 #endif
 
+/* Offset between the eh handler address and entry in eh tables.  */
+#ifndef RETURN_ADDR_OFFSET
+#define RETURN_ADDR_OFFSET 0
+#endif
+
 /* If we have named section and we support weak symbols, then use the
.jcr section for recording java classes which need to be registered
at program start-up time.  */
diff --git a/gcc/except.c b/gcc/except.c
index 7573c88..c98163d 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2189,9 +2189,8 @@ expand_builtin_extract_return_addr (tree addr_tree)
 #endif
 
   /* Then adjust to find the real return address.  */
-#if defined (RETURN_ADDR_OFFSET)
-  addr = plus_constant (Pmode, addr, RETURN_ADDR_OFFSET);
-#endif
+  if (RETURN_ADDR_OFFSET)
+addr = plus_constant (Pmode, addr, RETURN_ADDR_OFFSET);
 
   return addr;
 }
@@ -2207,10 +2206,11 @@ expand_builtin_frob_return_addr (tree addr_tree)
 
   addr = convert_memory_address (Pmode, addr);
 
-#ifdef RETURN_ADDR_OFFSET
-  addr = force_reg (Pmode, addr);
-  addr = plus_constant (Pmode, addr, -RETURN_ADDR_OFFSET);
-#endif
+  if (RETURN_ADDR_OFFSET)
+{
+  addr = force_reg (Pmode, addr);
+  addr = plus_constant (Pmode, addr, -RETURN_ADDR_OFFSET);
+}
 
   return addr;
 }
-- 
2.3.0.80.g18d0fec.dirty



[PATCH 07/12] provide default for MASK_RETURN_ADDR

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* defaults.h (MASK_RETURN_ADDR): New definition.
* except.c (expand_builtin_extract_return_addr): Remove ifdef
MASK_RETURN_ADDR.
---
 gcc/defaults.h | 4 
 gcc/except.c   | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 767901a..843d7e2 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -388,6 +388,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #define RETURN_ADDR_OFFSET 0
 #endif
 
+#ifndef MASK_RETURN_ADDR
+#define MASK_RETURN_ADDR NULL_RTX
+#endif
+
 /* If we have named section and we support weak symbols, then use the
.jcr section for recording java classes which need to be registered
at program start-up time.  */
diff --git a/gcc/except.c b/gcc/except.c
index c98163d..5b24006 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2184,9 +2184,9 @@ expand_builtin_extract_return_addr (tree addr_tree)
 }
 
   /* First mask out any unwanted bits.  */
-#ifdef MASK_RETURN_ADDR
-  expand_and (Pmode, addr, MASK_RETURN_ADDR, addr);
-#endif
+  rtx mask = MASK_RETURN_ADDR;
+  if (mask)
+expand_and (Pmode, addr, mask, addr);
 
   /* Then adjust to find the real return address.  */
   if (RETURN_ADDR_OFFSET)
-- 
2.3.0.80.g18d0fec.dirty



[PATCH 08/12] reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* alias.c (init_alias_target): Remove ifdef
* HARD_FRAME_POINTER_IS_FRAME_POINTER.
* df-scan.c (df_insn_refs_collect): Likewise.
(df_get_regular_block_artificial_uses): Likewise.
(df_get_eh_block_artificial_uses): Likewise.
(df_get_entry_block_def_set): Likewise.
(df_get_exit_block_use_set): Likewise.
* emit-rtl.c (gen_rtx_REG): Likewise.
* ira.c (ira_setup_eliminable_regset): Likewise.
* reginfo.c (init_reg_sets_1): Likewise.
* regrename.c (rename_chains): Likewise.
* reload1.c (reload): Likewise.
(eliminate_regs_in_insn): Likewise.
* resource.c (mark_referenced_resources): Likewise.
(init_resource_info): Likewise.
---
 gcc/alias.c |  7 +++
 gcc/df-scan.c   | 35 +--
 gcc/emit-rtl.c  |  6 +++---
 gcc/ira.c   | 23 ---
 gcc/reginfo.c   |  5 ++---
 gcc/regrename.c |  5 ++---
 gcc/reload1.c   | 10 --
 gcc/resource.c  | 11 +--
 8 files changed, 48 insertions(+), 54 deletions(-)

diff --git a/gcc/alias.c b/gcc/alias.c
index a7160f3..8f48660 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2765,10 +2765,9 @@ init_alias_target (void)
 = unique_base_value (UNIQUE_BASE_VALUE_ARGP);
   static_reg_base_value[FRAME_POINTER_REGNUM]
 = unique_base_value (UNIQUE_BASE_VALUE_FP);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-  static_reg_base_value[HARD_FRAME_POINTER_REGNUM]
-= unique_base_value (UNIQUE_BASE_VALUE_HFP);
-#endif
+  if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+static_reg_base_value[HARD_FRAME_POINTER_REGNUM]
+  = unique_base_value (UNIQUE_BASE_VALUE_HFP);
 }
 
 /* Set MEMORY_MODIFIED when X modifies DATA (that is assumed
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index b2e2e5d..69332a8 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3247,12 +3247,11 @@ df_insn_refs_collect (struct df_collection_rec 
*collection_rec,
  regno_reg_rtx[FRAME_POINTER_REGNUM],
  NULL, bb, insn_info,
  DF_REF_REG_USE, 0);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-  df_ref_record (DF_REF_BASE, collection_rec,
- regno_reg_rtx[HARD_FRAME_POINTER_REGNUM],
- NULL, bb, insn_info,
- DF_REF_REG_USE, 0);
-#endif
+ if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+   df_ref_record (DF_REF_BASE, collection_rec,
+  regno_reg_rtx[HARD_FRAME_POINTER_REGNUM],
+  NULL, bb, insn_info,
+  DF_REF_REG_USE, 0);
   break;
 default:
   break;
@@ -3442,9 +3441,9 @@ df_get_regular_block_artificial_uses (bitmap 
regular_block_artificial_uses)
 reference of the frame pointer.  */
   bitmap_set_bit (regular_block_artificial_uses, FRAME_POINTER_REGNUM);
 
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-  bitmap_set_bit (regular_block_artificial_uses, 
HARD_FRAME_POINTER_REGNUM);
-#endif
+  if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+   bitmap_set_bit (regular_block_artificial_uses,
+   HARD_FRAME_POINTER_REGNUM);
 
 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
   /* Pseudos with argument area equivalences may require
@@ -3494,9 +3493,9 @@ df_get_eh_block_artificial_uses (bitmap 
eh_block_artificial_uses)
   if (frame_pointer_needed)
{
  bitmap_set_bit (eh_block_artificial_uses, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
- bitmap_set_bit (eh_block_artificial_uses, HARD_FRAME_POINTER_REGNUM);
-#endif
+ if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+   bitmap_set_bit (eh_block_artificial_uses,
+   HARD_FRAME_POINTER_REGNUM);
}
 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
   if (fixed_regs[ARG_POINTER_REGNUM])
@@ -3580,11 +3579,11 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
   /* Any reference to any pseudo before reload is a potential
 reference of the frame pointer.  */
   bitmap_set_bit (entry_block_defs, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
+
   /* If they are different, also mark the hard frame pointer as live.  */
-  if (!LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM))
+  if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
+ && !LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM))
bitmap_set_bit (entry_block_defs, HARD_FRAME_POINTER_REGNUM);
-#endif
 }
 
   /* These registers are live everywhere.  */
@@ -3718,11 +3717,11 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
   if ((!reload_completed) || frame_pointer_needed)
 {
   bitmap_set_bit (exit_block_uses, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
+
   /* If they are different, also mark the hard frame pointer as live.  */
-  if (

[PATCH 10/12] remove more ifdefs for HAVE_cc0

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* caller-save.c (insert_one_insn): Remove ifdef HAVE_cc0.
* cfgcleanup.c (flow_find_cross_jump): Likewise.
(flow_find_head_matching_sequence): Likewise.
(try_head_merge_bb): Likewise.
* combine.c (can_combine_p): Likewise.
(try_combine): Likewise.
(distribute_notes): Likewise.
* df-problems.c (can_move_insns_across): Likewise.
* final.c (final): Likewise.
* gcse.c (insert_insn_end_basic_block): Likewise.
* ira.c (find_moveable_pseudos): Likewise.
* reorg.c (try_merge_delay_insns): Likewise.
(fill_simple_delay_slots): Likewise.
(fill_slots_from_thread): Likewise.
* sched-deps.c (sched_analyze_2): Likewise.
---
 gcc/caller-save.c |  4 +---
 gcc/cfgcleanup.c  | 26 --
 gcc/combine.c | 54 +-
 gcc/df-problems.c |  5 +
 gcc/final.c   | 29 ++---
 gcc/gcse.c| 24 +---
 gcc/ira.c |  5 +
 gcc/reorg.c   | 26 +++---
 gcc/sched-deps.c  |  6 +++---
 9 files changed, 69 insertions(+), 110 deletions(-)

diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index fc575eb..76c3a7e 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -1400,18 +1400,16 @@ insert_one_insn (struct insn_chain *chain, int 
before_p, int code, rtx pat)
   rtx_insn *insn = chain->insn;
   struct insn_chain *new_chain;
 
-#if HAVE_cc0
   /* If INSN references CC0, put our insns in front of the insn that sets
  CC0.  This is always safe, since the only way we could be passed an
  insn that references CC0 is for a restore, and doing a restore earlier
  isn't a problem.  We do, however, assume here that CALL_INSNs don't
  reference CC0.  Guard against non-INSN's like CODE_LABEL.  */
 
-  if ((NONJUMP_INSN_P (insn) || JUMP_P (insn))
+  if (HAVE_cc0 && (NONJUMP_INSN_P (insn) || JUMP_P (insn))
   && before_p
   && reg_referenced_p (cc0_rtx, PATTERN (insn)))
 chain = chain->prev, insn = chain->insn;
-#endif
 
   new_chain = new_insn_chain ();
   if (before_p)
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 58d235e..e5c4747 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1416,12 +1416,11 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, 
rtx_insn **f1,
   i2 = PREV_INSN (i2);
 }
 
-#if HAVE_cc0
   /* Don't allow the insn after a compare to be shared by
  cross-jumping unless the compare is also shared.  */
-  if (ninsns && reg_mentioned_p (cc0_rtx, last1) && ! sets_cc0_p (last1))
+  if (HAVE_cc0 && ninsns && reg_mentioned_p (cc0_rtx, last1)
+  && ! sets_cc0_p (last1))
 last1 = afterlast1, last2 = afterlast2, last_dir = afterlast_dir, ninsns--;
-#endif
 
   /* Include preceding notes and labels in the cross-jump.  One,
  this may bring us to the head of the blocks as requested above.
@@ -1539,12 +1538,11 @@ flow_find_head_matching_sequence (basic_block bb1, 
basic_block bb2, rtx_insn **f
   i2 = NEXT_INSN (i2);
 }
 
-#if HAVE_cc0
   /* Don't allow a compare to be shared by cross-jumping unless the insn
  after the compare is also shared.  */
-  if (ninsns && reg_mentioned_p (cc0_rtx, last1) && sets_cc0_p (last1))
+  if (HAVE_cc0 && ninsns && reg_mentioned_p (cc0_rtx, last1)
+  && sets_cc0_p (last1))
 last1 = beforelast1, last2 = beforelast2, ninsns--;
-#endif
 
   if (ninsns)
 {
@@ -2330,11 +2328,9 @@ try_head_merge_bb (basic_block bb)
   cond = get_condition (jump, &move_before, true, false);
   if (cond == NULL_RTX)
 {
-#if HAVE_cc0
-  if (reg_mentioned_p (cc0_rtx, jump))
+  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
move_before = prev_nonnote_nondebug_insn (jump);
   else
-#endif
move_before = jump;
 }
 
@@ -2499,11 +2495,9 @@ try_head_merge_bb (basic_block bb)
   cond = get_condition (jump, &move_before, true, false);
   if (cond == NULL_RTX)
{
-#if HAVE_cc0
- if (reg_mentioned_p (cc0_rtx, jump))
+ if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
move_before = prev_nonnote_nondebug_insn (jump);
  else
-#endif
move_before = jump;
}
 }
@@ -2522,12 +2516,10 @@ try_head_merge_bb (basic_block bb)
  /* Try again, using a different insertion point.  */
  move_before = jump;
 
-#if HAVE_cc0
  /* Don't try moving before a cc0 user, as that may invalidate
 the cc0.  */
- if (reg_mentioned_p (cc0_rtx, jump))
+ if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
break;
-#endif
 
  continue;
}
@@ -2582,12 +2574,10 @@ try_head_merge_bb (basic_block bb)
  /* For the unmerged insns, try a different insertion point.  */
  move_before = jump;
 
-#if HAVE_cc0
  /* Don't try moving before a cc0 user,

[PATCH 09/12] remove #if for PIC_OFFSET_TABLE_REGNUM

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* df-scan.c (df_get_entry_block_def_set): Remove #ifdef
PIC_OFFSET_TABLE_REGNUM.
---
 gcc/df-scan.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 69332a8..4232ec8 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3589,10 +3589,6 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
   /* These registers are live everywhere.  */
   if (!reload_completed)
 {
-#ifdef PIC_OFFSET_TABLE_REGNUM
-  unsigned int picreg = PIC_OFFSET_TABLE_REGNUM;
-#endif
-
 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
   /* Pseudos with argument area equivalences may require
 reloading via the argument pointer.  */
@@ -3600,13 +3596,12 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
bitmap_set_bit (entry_block_defs, ARG_POINTER_REGNUM);
 #endif
 
-#ifdef PIC_OFFSET_TABLE_REGNUM
   /* Any constant, or pseudo with constant equivalences, may
 require reloading from memory using the pic register.  */
+  unsigned int picreg = PIC_OFFSET_TABLE_REGNUM;
   if (picreg != INVALID_REGNUM
  && fixed_regs[picreg])
bitmap_set_bit (entry_block_defs, picreg);
-#endif
 }
 
 #ifdef INCOMING_RETURN_ADDR_RTX
-- 
2.3.0.80.g18d0fec.dirty



[PATCH 12/12] add default for INSN_REFERENCES_ARE_DELAYED

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* defaults.h (INSN_REFERENCES_ARE_DELAYED): New definition.
* reorg.c (redundant_insn): Remove ifdef
INSN_REFERENCES_ARE_DELAYED.
* resource.c (mark_referenced_resources): Likewise.
---
 gcc/defaults.h | 4 
 gcc/reorg.c| 4 
 gcc/resource.c | 2 --
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 79cb599..cafcb1e 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1205,6 +1205,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define INSN_SETS_ARE_DELAYED(INSN) false
 #endif
 
+#ifndef INSN_REFERENCES_ARE_DELAYED
+#define INSN_REFERENCES_ARE_DELAYED(INSN) false
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/reorg.c b/gcc/reorg.c
index ae77f0a..d8d8ab69 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1558,10 +1558,8 @@ redundant_insn (rtx insn, rtx_insn *target, rtx 
delay_list)
  if (INSN_SETS_ARE_DELAYED (seq->insn (0)))
return 0;
 
-#ifdef INSN_REFERENCES_ARE_DELAYED
  if (INSN_REFERENCES_ARE_DELAYED (seq->insn (0)))
return 0;
-#endif
 
  /* See if any of the insns in the delay slot match, updating
 resource requirements as we go.  */
@@ -1658,10 +1656,8 @@ redundant_insn (rtx insn, rtx_insn *target, rtx 
delay_list)
  if (INSN_SETS_ARE_DELAYED (control))
return 0;
 
-#ifdef INSN_REFERENCES_ARE_DELAYED
  if (INSN_REFERENCES_ARE_DELAYED (control))
return 0;
-#endif
 
  if (JUMP_P (control))
annul_p = INSN_ANNULLED_BRANCH_P (control);
diff --git a/gcc/resource.c b/gcc/resource.c
index 5af9376..26d9fca 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -392,11 +392,9 @@ mark_referenced_resources (rtx x, struct resources *res,
  include_delayed_effects
  ? MARK_SRC_DEST_CALL : MARK_SRC_DEST);
 
-#ifdef INSN_REFERENCES_ARE_DELAYED
   if (! include_delayed_effects
  && INSN_REFERENCES_ARE_DELAYED (as_a  (x)))
return;
-#endif
 
   /* No special processing, just speed up.  */
   mark_referenced_resources (PATTERN (x), res, include_delayed_effects);
-- 
2.3.0.80.g18d0fec.dirty



[PATCH 11/12] provide default for INSN_SETS_ARE_DELAYED

2015-04-21 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-21  Trevor Saunders  

* defaults.h (INSN_SETS_ARE_DELAYED): New definition.
* reorg.c (redundant_insn): Remove ifdef INSN_SETS_ARE_DELAYED.
* resource.c (mark_set_resources): Likewise.
---
 gcc/defaults.h | 4 
 gcc/reorg.c| 4 
 gcc/resource.c | 2 --
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 843d7e2..79cb599 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1201,6 +1201,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define DEFAULT_PCC_STRUCT_RETURN 1
 #endif
 
+#ifndef INSN_SETS_ARE_DELAYED
+#define INSN_SETS_ARE_DELAYED(INSN) false
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/reorg.c b/gcc/reorg.c
index b7228f2..ae77f0a 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1555,10 +1555,8 @@ redundant_insn (rtx insn, rtx_insn *target, rtx 
delay_list)
 slots because it is difficult to track its resource needs
 correctly.  */
 
-#ifdef INSN_SETS_ARE_DELAYED
  if (INSN_SETS_ARE_DELAYED (seq->insn (0)))
return 0;
-#endif
 
 #ifdef INSN_REFERENCES_ARE_DELAYED
  if (INSN_REFERENCES_ARE_DELAYED (seq->insn (0)))
@@ -1657,10 +1655,8 @@ redundant_insn (rtx insn, rtx_insn *target, rtx 
delay_list)
  /* If this is an INSN or JUMP_INSN with delayed effects, it
 is hard to track the resource needs properly, so give up.  */
 
-#ifdef INSN_SETS_ARE_DELAYED
  if (INSN_SETS_ARE_DELAYED (control))
return 0;
-#endif
 
 #ifdef INSN_REFERENCES_ARE_DELAYED
  if (INSN_REFERENCES_ARE_DELAYED (control))
diff --git a/gcc/resource.c b/gcc/resource.c
index 9a013b3..5af9376 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -696,11 +696,9 @@ mark_set_resources (rtx x, struct resources *res, int 
in_dest,
/* An insn consisting of just a CLOBBER (or USE) is just for flow
   and doesn't actually do anything, so we ignore it.  */
 
-#ifdef INSN_SETS_ARE_DELAYED
   if (mark_type != MARK_SRC_DEST_CALL
  && INSN_SETS_ARE_DELAYED (as_a  (x)))
return;
-#endif
 
   x = PATTERN (x);
   if (GET_CODE (x) != USE && GET_CODE (x) != CLOBBER)
-- 
2.3.0.80.g18d0fec.dirty



[PATCH 0/8] remove more conditional compilation

2015-04-26 Thread tbsaunde+gcc
From: Trevor Saunders 

Hi,

Here's another series to remove some conditional compilation.

each patch was bootstrapped and regtested on x86_64-linux-gnu, and the series
was run through config-list.mk.  I think this all falls within Jeff's
preapproval so I'll commit it tomorrow (today actually) night if nobody
objects.

Trev

Trevor Saunders (8):
  add default for NO_FUNCTION_CSE
  add default for HARD_REGNO_RENAME_OK
  add default for PCC_BITFIELD_TYPE_MATTERS
  add default for EPILOGUE_USES
  always define HAVE_simple_return and HAVE_return
  always define HAVE_epilogue
  always define ARGS_GROW_DOWNWARD
  remove #if ARGS_GROW_DOWNWARD

 gcc/ChangeLog  |  32 +++
 gcc/alias.c|  10 +-
 gcc/bb-reorder.c   |   9 --
 gcc/calls.c| 129 -
 gcc/cfgrtl.c   |  20 ++--
 gcc/config/alpha/alpha.h   |   2 +-
 gcc/config/arc/arc.h   |   2 +-
 gcc/config/avr/avr.h   |   2 +-
 gcc/config/cr16/cr16.h |   2 +-
 gcc/config/epiphany/epiphany.h |   2 +-
 gcc/config/frv/frv.h   |   2 +-
 gcc/config/h8300/h8300.h   |   2 +-
 gcc/config/i386/i386.h |   2 +-
 gcc/config/ia64/ia64.h |   2 +-
 gcc/config/lm32/lm32.h |   2 +-
 gcc/config/m32r/m32r.h |   2 +-
 gcc/config/mep/mep.h   |   2 +-
 gcc/config/mn10300/mn10300.h   |   2 +-
 gcc/config/nds32/nds32.h   |   2 +-
 gcc/config/nios2/nios2.h   |   2 +-
 gcc/config/pa/pa.h |   4 +-
 gcc/config/rs6000/rs6000.h |   2 +-
 gcc/config/s390/s390.h |   2 +-
 gcc/config/sparc/sparc.h   |   2 +-
 gcc/config/spu/spu.h   |   2 +-
 gcc/config/stormy16/stormy16.h |   2 +-
 gcc/config/v850/v850.h |   2 +-
 gcc/cp/class.c |   4 +-
 gcc/cse.c  |   4 +-
 gcc/defaults.h |  50 ++
 gcc/df-scan.c  |   7 --
 gcc/doc/tm.texi|   2 +-
 gcc/doc/tm.texi.in |   2 +-
 gcc/dwarf2out.c|   2 -
 gcc/function.c | 209 ++---
 gcc/regrename.c|   5 +-
 gcc/reorg.c|  14 +--
 gcc/resource.c |   6 +-
 gcc/sel-sched.c|   6 --
 gcc/shrink-wrap.c  |   3 -
 gcc/shrink-wrap.h  |   6 --
 gcc/stor-layout.c  |  10 --
 gcc/targhooks.c|   5 +-
 gcc/toplev.c   |   3 -
 44 files changed, 287 insertions(+), 297 deletions(-)

-- 
2.3.0.80.g18d0fec.dirty



[PATCH 1/8] add default for NO_FUNCTION_CSE

2015-04-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-26  Trevor Saunders  

* calls.c (prepare_call_address): Remove ifdef NO_FUNCTION_CSE.
* cse.c (fold_rtx): Likewise.
* config/alpha/alpha.h (NO_FUNCTION_CSE): Define to 1.
* config/arc/arc.h (NO_FUNCTION_CSE): Likewise.
* config/avr/avr.h (NO_FUNCTION_CSE): Likewise.
* config/cr16/cr16.h (NO_FUNCTION_CSE): Likewise.
* config/epiphany/epiphany.h (NO_FUNCTION_CSE): Likewise.
* config/frv/frv.h (NO_FUNCTION_CSE): Likewise.
* config/h8300/h8300.h (NO_FUNCTION_CSE): Likewise.
* config/i386/i386.h (NO_FUNCTION_CSE): Likewise.
* config/ia64/ia64.h (NO_FUNCTION_CSE): Likewise.
* config/lm32/lm32.h (enum reg_class) (NO_FUNCTION_CSE):
* Likewise.
* config/m32r/m32r.h (NO_FUNCTION_CSE): Likewise.
* config/mep/mep.h (NO_FUNCTION_CSE): Likewise.
* config/mn10300/mn10300.h (NO_FUNCTION_CSE): Likewise.
* config/nds32/nds32.h (NO_FUNCTION_CSE): Likewise.
* config/nios2/nios2.h (NO_FUNCTION_CSE): Likewise.
* config/pa/pa.h (NO_FUNCTION_CSE): Likewise.
* config/rs6000/rs6000.h (NO_FUNCTION_CSE): Likewise.
* config/s390/s390.h (NO_FUNCTION_CSE): Likewise.
* config/sparc/sparc.h (NO_FUNCTION_CSE): Likewise.
* config/spu/spu.h (NO_FUNCTION_CSE): Likewise.
* config/stormy16/stormy16.h (NO_FUNCTION_CSE): Likewise.
* config/v850/v850.h (NO_FUNCTION_CSE): Likewise.
* defaults.h (NO_FUNCTION_CSE): Provide default definition to 0.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in: Document NO_FUNCTION_CSE is always defined to
either true or false.
---
 gcc/ChangeLog  | 32 
 gcc/calls.c|  4 +---
 gcc/config/alpha/alpha.h   |  2 +-
 gcc/config/arc/arc.h   |  2 +-
 gcc/config/avr/avr.h   |  2 +-
 gcc/config/cr16/cr16.h |  2 +-
 gcc/config/epiphany/epiphany.h |  2 +-
 gcc/config/frv/frv.h   |  2 +-
 gcc/config/h8300/h8300.h   |  2 +-
 gcc/config/i386/i386.h |  2 +-
 gcc/config/ia64/ia64.h |  2 +-
 gcc/config/lm32/lm32.h |  2 +-
 gcc/config/m32r/m32r.h |  2 +-
 gcc/config/mep/mep.h   |  2 +-
 gcc/config/mn10300/mn10300.h   |  2 +-
 gcc/config/nds32/nds32.h   |  2 +-
 gcc/config/nios2/nios2.h   |  2 +-
 gcc/config/pa/pa.h |  2 +-
 gcc/config/rs6000/rs6000.h |  2 +-
 gcc/config/s390/s390.h |  2 +-
 gcc/config/sparc/sparc.h   |  2 +-
 gcc/config/spu/spu.h   |  2 +-
 gcc/config/stormy16/stormy16.h |  2 +-
 gcc/config/v850/v850.h |  2 +-
 gcc/cse.c  |  4 +---
 gcc/defaults.h |  4 
 gcc/doc/tm.texi|  2 +-
 gcc/doc/tm.texi.in |  2 +-
 28 files changed, 62 insertions(+), 30 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b1c5356..194e1c4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,35 @@
+2015-04-26  Trevor Saunders  
+
+   * calls.c (prepare_call_address): Remove ifdef NO_FUNCTION_CSE.
+   * cse.c (fold_rtx): Likewise.
+   * config/alpha/alpha.h (NO_FUNCTION_CSE): Define to 1.
+   * config/arc/arc.h (NO_FUNCTION_CSE): Likewise.
+   * config/avr/avr.h (NO_FUNCTION_CSE): Likewise.
+   * config/cr16/cr16.h (NO_FUNCTION_CSE): Likewise.
+   * config/epiphany/epiphany.h (NO_FUNCTION_CSE): Likewise.
+   * config/frv/frv.h (NO_FUNCTION_CSE): Likewise.
+   * config/h8300/h8300.h (NO_FUNCTION_CSE): Likewise.
+   * config/i386/i386.h (NO_FUNCTION_CSE): Likewise.
+   * config/ia64/ia64.h (NO_FUNCTION_CSE): Likewise.
+   * config/lm32/lm32.h (enum reg_class) (NO_FUNCTION_CSE):
+   * Likewise.
+   * config/m32r/m32r.h (NO_FUNCTION_CSE): Likewise.
+   * config/mep/mep.h (NO_FUNCTION_CSE): Likewise.
+   * config/mn10300/mn10300.h (NO_FUNCTION_CSE): Likewise.
+   * config/nds32/nds32.h (NO_FUNCTION_CSE): Likewise.
+   * config/nios2/nios2.h (NO_FUNCTION_CSE): Likewise.
+   * config/pa/pa.h (NO_FUNCTION_CSE): Likewise.
+   * config/rs6000/rs6000.h (NO_FUNCTION_CSE): Likewise.
+   * config/s390/s390.h (NO_FUNCTION_CSE): Likewise.
+   * config/sparc/sparc.h (NO_FUNCTION_CSE): Likewise.
+   * config/spu/spu.h (NO_FUNCTION_CSE): Likewise.
+   * config/stormy16/stormy16.h (NO_FUNCTION_CSE): Likewise.
+   * config/v850/v850.h (NO_FUNCTION_CSE): Likewise.
+   * defaults.h (NO_FUNCTION_CSE): Provide default definition to 0.
+   * doc/tm.texi: Regenerate.
+   * doc/tm.texi.in: Document NO_FUNCTION_CSE is always defined to
+   either true or false.
+
 2015-04-24  Thomas Preud'homme  
 
* config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): fix
diff --git a/gcc/calls.c b/gcc/calls.c
index 3be7ca5..a6cd33b 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -227,10 +227,8 @@ prepare_call_addres

[PATCH 2/8] add default for HARD_REGNO_RENAME_OK

2015-04-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-27  Trevor Saunders  

* defaults.h (HARD_REGNO_RENAME_OK): Add default definition to
true.
* regrename.c (check_new_reg_p): Remove check if
HARD_REGNO_RENAME_OK is defined.
* sel-sched.c (sel_hard_regno_rename_ok): Likewise.
---
 gcc/defaults.h  | 4 
 gcc/regrename.c | 5 +
 gcc/sel-sched.c | 6 --
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 4ae5d98..7e04be2 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1213,6 +1213,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define NO_FUNCTION_CSE false
 #endif
 
+#ifndef HARD_REGNO_RENAME_OK
+#define HARD_REGNO_RENAME_OK(FROM, TO) true
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 147aaa8..d45ad0a 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -333,10 +333,7 @@ check_new_reg_p (int reg ATTRIBUTE_UNUSED, int new_reg,
|| (crtl->is_leaf
&& !LEAF_REGISTERS[new_reg + i])
 #endif
-#ifdef HARD_REGNO_RENAME_OK
-   || ! HARD_REGNO_RENAME_OK (reg + i, new_reg + i)
-#endif
-   )
+   || ! HARD_REGNO_RENAME_OK (reg + i, new_reg + i))
   return false;
 
   /* See whether it accepts all modes that occur in
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 988f9d5..9443629 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -1047,7 +1047,6 @@ get_reg_class (rtx_insn *insn)
   return NO_REGS;
 }
 
-#ifdef HARD_REGNO_RENAME_OK
 /* Calculate HARD_REGNO_RENAME_OK data for REGNO.  */
 static void
 init_hard_regno_rename (int regno)
@@ -1066,14 +1065,12 @@ init_hard_regno_rename (int regno)
 SET_HARD_REG_BIT (sel_hrd.regs_for_rename[regno], cur_reg);
 }
 }
-#endif
 
 /* A wrapper around HARD_REGNO_RENAME_OK that will look into the hard regs
data first.  */
 static inline bool
 sel_hard_regno_rename_ok (int from ATTRIBUTE_UNUSED, int to ATTRIBUTE_UNUSED)
 {
-#ifdef HARD_REGNO_RENAME_OK
   /* Check whether this is all calculated.  */
   if (TEST_HARD_REG_BIT (sel_hrd.regs_for_rename[from], from))
 return TEST_HARD_REG_BIT (sel_hrd.regs_for_rename[from], to);
@@ -1081,9 +1078,6 @@ sel_hard_regno_rename_ok (int from ATTRIBUTE_UNUSED, int 
to ATTRIBUTE_UNUSED)
   init_hard_regno_rename (from);
 
   return TEST_HARD_REG_BIT (sel_hrd.regs_for_rename[from], to);
-#else
-  return true;
-#endif
 }
 
 /* Calculate set of registers that are capable of holding MODE.  */
-- 
2.3.0.80.g18d0fec.dirty



[PATCH 3/8] add default for PCC_BITFIELD_TYPE_MATTERS

2015-04-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-27  Trevor Saunders  

* defaults.h (PCC_BITFIELD_TYPE_MATTERS): Add default definition
to false.
* dwarf2out.c (field_byte_offset): REmove check if
PCC_BITFIELD_TYPE_MATTERS is defined.
* stor-layout.c (layout_decl): Likewise.
(update_alignment_for_field): Likewise.
(place_field): Likewise.

gcc/cp/ChangeLog:

2015-04-27  Trevor Saunders  

* class.c (layout_class_type): Remove check if
PCC_BITFIELD_TYPE_MATTERS is defined.
---
 gcc/cp/class.c|  4 ++--
 gcc/defaults.h|  4 
 gcc/dwarf2out.c   |  2 --
 gcc/stor-layout.c | 10 --
 4 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index d80d312e..be5f5c2 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6258,7 +6258,7 @@ layout_class_type (tree t, tree *virtuals_p)
padding = size_binop (MINUS_EXPR, DECL_SIZE (field),
  TYPE_SIZE (integer_type));
}
-#ifdef PCC_BITFIELD_TYPE_MATTERS
+
  /* An unnamed bitfield does not normally affect the
 alignment of the containing class on a target where
 PCC_BITFIELD_TYPE_MATTERS.  But, the C++ ABI does not
@@ -6270,7 +6270,7 @@ layout_class_type (tree t, tree *virtuals_p)
  was_unnamed_p = true;
  DECL_NAME (field) = make_anon_name ();
}
-#endif
+
  DECL_SIZE (field) = TYPE_SIZE (integer_type);
  DECL_ALIGN (field) = TYPE_ALIGN (integer_type);
  DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type);
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 7e04be2..0af7a02 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1201,6 +1201,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define DEFAULT_PCC_STRUCT_RETURN 1
 #endif
 
+#ifndef PCC_BITFIELD_TYPE_MATTERS
+#define PCC_BITFIELD_TYPE_MATTERS false
+#endif
+
 #ifndef INSN_SETS_ARE_DELAYED
 #define INSN_SETS_ARE_DELAYED(INSN) false
 #endif
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index a04e6f6..8591cd7 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -15120,7 +15120,6 @@ field_byte_offset (const_tree decl)
 
   bitpos_int = wi::to_offset (bit_position (decl));
 
-#ifdef PCC_BITFIELD_TYPE_MATTERS
   if (PCC_BITFIELD_TYPE_MATTERS)
 {
   tree type;
@@ -15218,7 +15217,6 @@ field_byte_offset (const_tree decl)
}
 }
   else
-#endif /* PCC_BITFIELD_TYPE_MATTERS */
 object_offset_in_bits = bitpos_int;
 
   object_offset_in_bytes
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index f18f1ac..6150d85 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -85,10 +85,8 @@ static tree self_referential_size (tree);
 static void finalize_record_size (record_layout_info);
 static void finalize_type_size (tree);
 static void place_union_field (record_layout_info, tree);
-#if defined (PCC_BITFIELD_TYPE_MATTERS) || defined (BITFIELD_NBYTES_LIMITED)
 static int excess_unit_span (HOST_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT,
 HOST_WIDE_INT, tree);
-#endif
 extern void debug_rli (record_layout_info);
 
 /* Show that REFERENCE_TYPES are internal and should use address_mode.
@@ -698,11 +696,9 @@ layout_decl (tree decl, unsigned int known_align)
{
  zero_bitfield = true;
  packed_p = false;
-#ifdef PCC_BITFIELD_TYPE_MATTERS
  if (PCC_BITFIELD_TYPE_MATTERS)
do_type_align (type, decl);
  else
-#endif
{
 #ifdef EMPTY_FIELD_BOUNDARY
  if (EMPTY_FIELD_BOUNDARY > DECL_ALIGN (decl))
@@ -1066,7 +1062,6 @@ update_alignment_for_field (record_layout_info rli, tree 
field,
  rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
}
 }
-#ifdef PCC_BITFIELD_TYPE_MATTERS
   else if (is_bitfield && PCC_BITFIELD_TYPE_MATTERS)
 {
   /* Named bit-fields cause the entire structure to have the
@@ -1109,7 +1104,6 @@ update_alignment_for_field (record_layout_info rli, tree 
field,
  user_align |= TYPE_USER_ALIGN (type);
}
 }
-#endif
   else
 {
   rli->record_align = MAX (rli->record_align, desired_align);
@@ -1147,7 +1141,6 @@ place_union_field (record_layout_info rli, tree field)
   DECL_SIZE_UNIT (field), rli->offset);
 }
 
-#if defined (PCC_BITFIELD_TYPE_MATTERS) || defined (BITFIELD_NBYTES_LIMITED)
 /* A bitfield of SIZE with a required access alignment of ALIGN is allocated
at BYTE_OFFSET / BIT_OFFSET.  Return nonzero if the field would span more
units of alignment than the underlying TYPE.  */
@@ -1163,7 +1156,6 @@ excess_unit_span (HOST_WIDE_INT byte_offset, 
HOST_WIDE_INT bit_offset,
   return ((offset + size + align - 1) / align
  > tree_to_uhwi (TYPE_SIZE (type)) / align);
 }
-#endif
 
 /* RLI contains information about the layout of a RECORD_TYPE.  FIELD
i

[PATCH 4/8] add default for EPILOGUE_USES

2015-04-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-27  Trevor Saunders  

* defaults.h (EPILOGUE_USES): Add default definition of false.
* df-scan.c (EPILOGUE_USES): Remove check if its undefined.
* resource.c (init_resource_info): Likewise.
---
 gcc/defaults.h | 4 
 gcc/df-scan.c  | 4 
 gcc/resource.c | 6 +-
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 0af7a02..6f915bd 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1221,6 +1221,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define HARD_REGNO_RENAME_OK(FROM, TO) true
 #endif
 
+#ifndef EPILOGUE_USES
+#define EPILOGUE_USES(REG) false
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 4232ec8..9f0e47f 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -72,10 +72,6 @@ typedef struct df_mw_hardreg *df_mw_hardreg_ptr;
 #define HAVE_sibcall_epilogue 0
 #endif
 
-#ifndef EPILOGUE_USES
-#define EPILOGUE_USES(REGNO)  0
-#endif
-
 /* The set of hard registers in eliminables[i].from. */
 
 static HARD_REG_SET elim_reg_set;
diff --git a/gcc/resource.c b/gcc/resource.c
index 26d9fca..ba9de12 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -1200,11 +1200,7 @@ init_resource_info (rtx_insn *epilogue_insn)
   &end_of_function_needs, true);
 
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-if (global_regs[i]
-#ifdef EPILOGUE_USES
-   || EPILOGUE_USES (i)
-#endif
-   )
+if (global_regs[i] || EPILOGUE_USES (i))
   SET_HARD_REG_BIT (end_of_function_needs.regs, i);
 
   /* The registers required to be live at the end of the function are
-- 
2.3.0.80.g18d0fec.dirty



[PATCH 5/8] always define HAVE_simple_return and HAVE_return

2015-04-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-27  Trevor Saunders  

* bb-reorder.c (HAVE_return): Don't check if its undefined.
* defaults.h (gen_simple_return): New function.
(gen_simple_return): Likewise.
(HAVE_return): Add default definition to false.
(HAVE_simple_return): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect): Remove checks if
HAVE_return and HAVE_simple_return are defined.
* function.c (gen_return_pattern): Likewise.
(convert_jumps_to_returns): Likewise.
(thread_prologue_and_epilogue_insns): Likewise.
* reorg.c (find_end_label): Likewise.
(dbr_schedule): Likewise.
* shrink-wrap.c: Likewise.
* shrink-wrap.h: Likewise.
---
 gcc/bb-reorder.c  |  9 -
 gcc/cfgrtl.c  | 14 ++
 gcc/defaults.h| 20 
 gcc/function.c| 52 ++--
 gcc/reorg.c   | 12 +---
 gcc/shrink-wrap.c |  3 ---
 gcc/shrink-wrap.h |  6 --
 7 files changed, 41 insertions(+), 75 deletions(-)

diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index c2a3be3..c134712 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -142,15 +142,6 @@
the object file there will be an extra round.  */
 #define N_ROUNDS 5
 
-/* Stubs in case we don't have a return insn.
-   We have to check at run time too, not only compile time.  */
-
-#ifndef HAVE_return
-#define HAVE_return 0
-#define gen_return() NULL_RTX
-#endif
-
-
 struct target_bb_reorder default_target_bb_reorder;
 #if SWITCHABLE_TARGET
 struct target_bb_reorder *this_target_bb_reorder = &default_target_bb_reorder;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 322d1a9..7027502 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1705,21 +1705,19 @@ force_nonfallthru_and_redirect (edge e, basic_block 
target, rtx jump_label)
 {
   if (jump_label == ret_rtx)
{
-#ifdef HAVE_return
+ if (!HAVE_return)
+   gcc_unreachable ();
+
  emit_jump_insn_after_setloc (gen_return (), BB_END (jump_block), loc);
-#else
- gcc_unreachable ();
-#endif
}
   else
{
  gcc_assert (jump_label == simple_return_rtx);
-#ifdef HAVE_simple_return
+ if (!HAVE_simple_return)
+   gcc_unreachable ();
+
  emit_jump_insn_after_setloc (gen_simple_return (),
   BB_END (jump_block), loc);
-#else
- gcc_unreachable ();
-#endif
}
   set_return_jump_label (BB_END (jump_block));
 }
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 6f915bd..d3da328 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1398,6 +1398,26 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
 If not, see
 #define TARGET_SUPPORTS_WIDE_INT 0
 #endif
 
+#ifndef HAVE_simple_return
+#define HAVE_simple_return 0
+static inline rtx
+gen_simple_return ()
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
+#ifndef HAVE_return
+#define HAVE_return 0
+static inline rtx
+gen_return ()
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
 #endif /* GCC_INSN_FLAGS_H  */
 
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/function.c b/gcc/function.c
index 9077c91..561a1c5 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5649,7 +5649,6 @@ prologue_epilogue_contains (const_rtx insn)
   return 0;
 }
 
-#ifdef HAVE_return
 /* Insert use of return register before the end of BB.  */
 
 static void
@@ -5674,12 +5673,10 @@ emit_use_return_register_into_block (basic_block bb)
 static rtx
 gen_return_pattern (bool simple_p)
 {
-#ifdef HAVE_simple_return
+  if (!HAVE_simple_return)
+gcc_assert (!simple_p);
+
   return simple_p ? gen_simple_return () : gen_return ();
-#else
-  gcc_assert (!simple_p);
-  return gen_return ();
-#endif
 }
 
 /* Insert an appropriate return pattern at the end of block BB.  This
@@ -5697,7 +5694,6 @@ emit_return_into_block (bool simple_p, basic_block bb)
   gcc_assert (ANY_RETURN_P (pat));
   JUMP_LABEL (jump) = pat;
 }
-#endif
 
 /* Set JUMP_LABEL for a return insn.  */
 
@@ -5713,7 +5709,6 @@ set_return_jump_label (rtx returnjump)
 JUMP_LABEL (returnjump) = ret_rtx;
 }
 
-#if defined (HAVE_return) || defined (HAVE_simple_return)
 /* Return true if there are any active insns between HEAD and TAIL.  */
 bool
 active_insn_between (rtx_insn *head, rtx_insn *tail)
@@ -5788,15 +5783,13 @@ convert_jumps_to_returns (basic_block last_bb, bool 
simple_p,
dest = ret_rtx;
  if (!redirect_jump (jump, dest, 0))
{
-#ifdef HAVE_simple_return
- if (simple_p)
+ if (HAVE_simple_return && simple_p)
{
  if (dump_file)
fprintf (dump_file,
 "Failed to redirect bb %d branch.\n", bb->index);
  unconverted.safe_push (e);
}
-#endif
  continue;
}
 
@@ -5811,15 +5804,13 @@ convert_jumps_

[PATCH 6/8] always define HAVE_epilogue

2015-04-26 Thread tbsaunde+gcc
From: Trevor Saunders 

gcc/ChangeLog:

2015-04-27  Trevor Saunders  

* defaults.h (gen_epilogue): New function.
(HAVE_epilogue): Add default definition to false.
* alias.c (init_alias_analysis): don't check if HAVE_epilogue is
defined.
* cfgrtl.c (cfg_layout_finalize): Likewise.
* df-scan.c: Likewise.
* function.c (thread_prologue_and_epilogue_insns): Likewise.
(reposition_prologue_and_epilogue_notes): Likewise.
* reorg.c (find_end_label): Likewise.
* toplev.c: Likewise.
---
 gcc/alias.c| 10 +++---
 gcc/cfgrtl.c   |  6 +-
 gcc/defaults.h | 10 ++
 gcc/df-scan.c  |  3 ---
 gcc/function.c | 12 +---
 gcc/reorg.c|  2 --
 gcc/toplev.c   |  3 ---
 7 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/gcc/alias.c b/gcc/alias.c
index 8f48660..7d9a3d9 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2925,15 +2925,19 @@ init_alias_analysis (void)
{
  rtx note, set;
 
-#if defined (HAVE_prologue) || defined (HAVE_epilogue)
+#if defined (HAVE_prologue)
+ static const bool prologue = true;
+#else
+ static const bool prologue = false;
+#endif
+
  /* The prologue/epilogue insns are not threaded onto the
 insn chain until after reload has completed.  Thus,
 there is no sense wasting time checking if INSN is in
 the prologue/epilogue until after reload has completed.  */
- if (reload_completed
+ if ((prologue || HAVE_epilogue) && reload_completed
  && prologue_epilogue_contains (insn))
continue;
-#endif
 
  /* If this insn has a noalias note, process it,  Otherwise,
 scan for sets.  A simple set will have no side effects
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 7027502..8a75044 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -4339,11 +4339,7 @@ cfg_layout_finalize (void)
 #endif
   force_one_exit_fallthru ();
   rtl_register_cfg_hooks ();
-  if (reload_completed
-#ifdef HAVE_epilogue
-  && !HAVE_epilogue
-#endif
-  )
+  if (reload_completed && !HAVE_epilogue)
 fixup_fallthru_exit_predecessor ();
   fixup_reorder_chain ();
 
diff --git a/gcc/defaults.h b/gcc/defaults.h
index d3da328..4c87191 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1418,6 +1418,16 @@ gen_return ()
 }
 #endif
 
+#ifndef HAVE_epilogue
+#define HAVE_epilogue 0
+static inline rtx
+gen_epilogue ()
+{
+  gcc_unreachable ();
+  return NULL;
+}
+#endif
+
 #endif /* GCC_INSN_FLAGS_H  */
 
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 9f0e47f..a990a7b 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -62,9 +62,6 @@ along with GCC; see the file COPYING3.  If not see
 typedef struct df_mw_hardreg *df_mw_hardreg_ptr;
 
 
-#ifndef HAVE_epilogue
-#define HAVE_epilogue 0
-#endif
 #ifndef HAVE_prologue
 #define HAVE_prologue 0
 #endif
diff --git a/gcc/function.c b/gcc/function.c
index 561a1c5..14afc53 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6066,7 +6066,6 @@ thread_prologue_and_epilogue_insns (void)
   if (exit_fallthru_edge == NULL)
 goto epilogue_done;
 
-#ifdef HAVE_epilogue
   if (HAVE_epilogue)
 {
   start_sequence ();
@@ -6090,7 +6089,6 @@ thread_prologue_and_epilogue_insns (void)
set_return_jump_label (returnjump);
 }
   else
-#endif
 {
   basic_block cur_bb;
 
@@ -6183,7 +6181,6 @@ epilogue_done:
 }
 #endif
 
-#ifdef HAVE_epilogue
   if (epilogue_end)
 {
   rtx_insn *insn, *next;
@@ -6201,7 +6198,6 @@ epilogue_done:
reorder_insns (insn, insn, PREV_INSN (epilogue_end));
}
 }
-#endif
 
   bitmap_clear (&bb_flags);
 
@@ -6217,8 +6213,11 @@ epilogue_done:
 void
 reposition_prologue_and_epilogue_notes (void)
 {
-#if defined (HAVE_prologue) || defined (HAVE_epilogue) \
-|| defined (HAVE_sibcall_epilogue)
+#if ! defined (HAVE_prologue) && ! defined (HAVE_sibcall_epilogue)
+  if (!HAVE_epilogue)
+return;
+#endif
+
   /* Since the hash table is created on demand, the fact that it is
  non-null is a signal that it is non-empty.  */
   if (prologue_insn_hash != NULL)
@@ -6315,7 +6314,6 @@ reposition_prologue_and_epilogue_notes (void)
}
}
 }
-#endif /* HAVE_prologue or HAVE_epilogue */
 }
 
 /* Returns the name of function declared by FNDECL.  */
diff --git a/gcc/reorg.c b/gcc/reorg.c
index a44d4a3..e9af7b7 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -484,14 +484,12 @@ find_end_label (rtx kind)
}
   else
{
-#ifdef HAVE_epilogue
  if (HAVE_epilogue && ! HAVE_return)
/* The RETURN insn has its delay slot filled so we cannot
   emit the label just before it.  Since we already have
   an epilogue and cannot emit a new RETURN, we cannot
   emit the label at all.  */
  

  1   2   3   4   >