Re: [PATCH, i386] RTM support

2012-03-14 Thread Kirill Yukhin
Thanks!

K

On Tue, Mar 13, 2012 at 11:14 PM, Uros Bizjak ubiz...@gmail.com wrote:
 On Sun, Mar 11, 2012 at 10:16 AM, Kirill Yukhin kirill.yuk...@gmail.com 
 wrote:

 The patch is OK for mainline, if there are no further comments in next 24h.

 According to Tobias's input, I've added few lines about RTM to
 doc/invoke.texi. If no objections - I'll commit the patch tomorrow.

 A small no-op change - there is no need for a constraint in an expand
 pattern.  Plus some formatting.

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/i386.md (xbegin): Remove constraint from expander.

 Tested on x86_64-pc-linux-gnu, committed to mainline SVN.

 Uros.

 Index: i386.md
 ===
 --- i386.md     (revision 185350)
 +++ i386.md     (working copy)
 @@ -18206,7 +18206,7 @@
    (set_attr memory unknown)])

  (define_expand xbegin
 -  [(set (match_operand:SI 0 register_operand =a)
 +  [(set (match_operand:SI 0 register_operand )
        (unspec_volatile:SI [(match_dup 1)] UNSPECV_XBEGIN))]
   TARGET_RTM
  {
 @@ -18258,8 +18258,8 @@
  {
   emit_insn (gen_xtest_1 ());

 -  ix86_expand_setcc (operands[0], EQ, gen_rtx_REG (CCZmode,
 FLAGS_REG), const0_rtx);
 -
 +  ix86_expand_setcc (operands[0], EQ,
 +                    gen_rtx_REG (CCZmode, FLAGS_REG), const0_rtx);
   DONE;
  })


Re: [RFC]: Add support for pragma pointer_size

2012-03-14 Thread Tristan Gingold

On Mar 13, 2012, at 9:57 PM, Gary Funck wrote:

 On 03/06/12 14:09:23, Tristan Gingold wrote:
 The patch is simple: the C front-end will now calls
 c_build_pointer_type (instead of build_pointer_type), which in
 turn calls build_pointer_type_for_mode using the right mode.
 [...]
 
 Joining this discussion a bit late ... I have a few questions.
 This change impacts the GUPC branch, mainly because UPC introduces
 pointers that are generally larger than conventional C pointers,
 and thus some changes were needed in the build pointer area,
 and that logic needed to be adjusted to work with this patch.
 
 Here is the new c_build_pointer_type.  It a static function
 constrained to be called from within the c-decl.c file wehre
 it resides.
 
 static tree
 c_build_pointer_type (tree to_type)
 {
  addr_space_t as = to_type == error_mark_node? ADDR_SPACE_GENERIC
  : TYPE_ADDR_SPACE (to_type);
  enum machine_mode pointer_mode;
 
  if (as != ADDR_SPACE_GENERIC || c_default_pointer_mode == VOIDmode)
pointer_mode = targetm.addr_space.pointer_mode (as);
  else
pointer_mode = c_default_pointer_mode;
  return build_pointer_type_for_mode (to_type, pointer_mode, false);
 }
 
 Here is the old build_pointer_type() in tree.c.  It is external/public
 and is called from various places.
 
 tree
 build_pointer_type (tree to_type)
 {
  addr_space_t as = to_type == error_mark_node? ADDR_SPACE_GENERIC
  : TYPE_ADDR_SPACE (to_type);
  enum machine_mode pointer_mode = targetm.addr_space.pointer_mode (as);
  return build_pointer_type_for_mode (to_type, pointer_mode, false);
 }
 
 c_build_pointer_type () introduces c_default_pointer_mode
 and uses it as long as:
   as == ADDR_SPACE_GENERIC  c_default_pointer_mode != VOIDmode
 but build_pointer_type will not use c_default_pointer_mode.
 
 My first question is: are there still contexts where build_pointer_type()
 is called to compile C statements/expressions for cases not
 covered by the calls within c-decl.c?

Yes.  In the discussion, Joseph Myers has pointed them.
Some of them are bugs (but should be replaced by build_pointer_type_for_mode),
others aren't incorrect (e.g. for built-in functions).

Currently c_build_pointer_type is called for user declared pointer types.

  I ask, because we tried
 moving our checks for UPC pointer-to-shared types from
 build_pointer_type() into only c_build_pointer_type() and
 ran into calls to build_pointer_type() that still passed
 in UPC pointer-to-shared typed objects.  What this may
 indicate is that there are situations where the new
 c_default_pointer_mode may need to be applied when
 build_pointer_type() is called.  I don't recall off-hand
 when these situations came up, but it might be easy enough
 to put some assertions in build_pointer_type() and then
 run the C test suite and see what turns up.

I think we should discuss these cases.  From my current understanding, these
direct calls that affect you are currently bugs.

Once I completed the VMS patch submission, I would add some tests to check
the handling of pointer modes.

 Thus, I wonder if it might not be best to generalize
 build_pointer_type() instead of introducing c_build_pointer_type()
 and dealing with any C specific checks (somehow) there?

I am almost sure that this is not correct.  build_pointer_type is part of the
middle end, where the 'pragma pointer_size' doesn't apply and the ptr_mode
should be used.

Tristan.



Re: [PATCH, i386]: Declare constant_call_address_operand as special predicate

2012-03-14 Thread Uros Bizjak
On Wed, Mar 14, 2012 at 12:13 AM, H.J. Lu hjl.to...@gmail.com wrote:

 Similar to tls_symbolic_operand and tls_modbase_operand, we are not
 interested in the mode of the operand in the predicate.

 2012-03-13  Uros Bizjak  ubiz...@gmail.com

        * config/i386/predicates.md (constant_call_address_operand): Declare
        as special predicate.  Update all uses.
        * config/i386/i386.md: Remove mode from constant_call_address_operand
        predicates.
        * config/i386/i386.c (ix86_output_call_insn): Call
        constant_call_address_operand with VOIDmode.

 Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.


 gcc.c-torture/compile/20020129-1.c fails to compile with -mx32 -O:

 [hjl@gnu-6 gcc]$ ./xgcc -B./ -mx32
 /export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c
 -S -O
 /export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c:
 In function \u2018foo\u2019:
 /export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c:17:1:
 error: unrecognizable insn:
 (call_insn 10 9 11 3 (set (reg:SI 0 ax)
        (call (mem:QI (symbol_ref:SI (a.1707) [flags 0x2] var_decl
 0x715a01e0 a) [0 *a.0_1 S1 A8])
            (const_int 0 [0])))
 /export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c:16
 -1
     (nil)
    (expr_list:REG_BR_PRED (use (reg:SI 5 di))
        (nil)))
 /export/gnu/import/git/gcc/gcc/testsuite/gcc.c-torture/compile/20020129-1.c:17:1:
 internal compiler error: in extract_insn, at recog.c:2123
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See http://gcc.gnu.org/bugs.html for instructions.
 [hjl@gnu-6 gcc]$

I have reverted part of the patch.

2012-03-14  Uros Bizjak  ubiz...@gmail.com

Revert:
2012-03-14  Uros Bizjak  ubiz...@gmail.com

* config/i386/predicates.md (constant_call_address_operand): Declare
as special predicate.  Update all uses.

Uros.


[Patch]: Update fixincludes/README

2012-03-14 Thread Tristan Gingold
Hi,

fixinc.sh is not anymore in gcc/ directory.  So I propose to adjust 
fixincludes/README.

Ok for trunk ?

Tristan.

fixincludes/
2012-03-14  Tristan Gingold  ging...@adacore.com

* README (EXAMPLES OF FIXES): Update.

diff --git a/fixincludes/README b/fixincludes/README
index 07a3964..c7144a0 100644
--- a/fixincludes/README
+++ b/fixincludes/README
@@ -314,7 +314,7 @@ EXAMPLES OF FIXES:
 GCC.  But you can also:
 
 cd ${top_builddir}/gcc
-rm -rf fixinc.sh include/ stmp-fixinc
+rm -rf include-fixed/ stmp-fixinc
 make stmp-fixinc
 
 I would really recommend, however:



Re: [PATCH] Fix PR 50971 and PR 35629: Only one loop detected when there should be two

2012-03-14 Thread Richard Guenther
On Tue, Mar 13, 2012 at 7:31 PM, Andrew Pinski pins...@gmail.com wrote:
 Ping?  Rebootstrapped on x86_64-linux-gnu with no regressions.

Zdenek, can you have a look here?  I think the patch is reasonable, but
you should have a better idea ;)

Thanks,
Richard.

 Thanks,
 Andrew Pinski

 On Sat, Jan 21, 2012 at 1:21 PM, Andrew Pinski pins...@gmail.com wrote:
 The problem with these two bug reports is that the cfgloop does not do
 a good job for disambiguating some loops.  This patch rewrites
 find_subloop_latch_edge_by_ivs to be better.  It is able to detect
 much more loops and gets the ones which are referenced in PR 50971 and
 PR 35629.  It does make sure the loops it finds are really loops and
 not ones where the continue would cause a loop not to be done.

 OK for 4.8 when stage 1 comes?  Bootstrapped and tested on
 x86_64-linux-gnu with no regressions.

 ChangeLog:
 cfgloop.c (skip_to_exit): New function.
 (find_subloop_latch_edge_by_ivs): Rewrite to better detect subloop latches by
 IVs.  Also look at the cfg for those IVs to check for a better choice.

 testsuite/ChangeLog:
 * gcc.dg/tree-ssa/loop-25.c: Remove xfails and remove Found latch
 edge/Merged latch edges tests.
 * gcc.dg/tree-ssa/loop-38.c: New testcase.


Re: PATCH RFA: Update Go frontend on gcc 4.7 branch

2012-03-14 Thread Rainer Orth
Ian Lance Taylor i...@google.com writes:

 I would like to update the Go support on the 4.7 branch.  As I've
 mentioned before, Go is working toward a stable Go 1 release.  That
 release is not complete, but it is quite close.  The 4.7 branch was made
 at a slightly unstable point in the process.  I've updated the library
 one more time, and I've spent the week testing the result on a bunch of
 Google-internal programs.  What I have now is not perfect, but it is
 better than what is on the 4.7 branch today.

 This proposed patch does include a library update, which is fairly
 large.  However, this update should not be destabilizing.  I've tested
 the 4.7 branch plus this patch on x86_64-unknown-linux-gnu, and I'm
 preparing to test it on Solaris.

Unfortunately, this patch introduced several go and/or libgo testsuite
failures on both Solaris/SPARC and x86 on the 4.7 branch while the
results were clean before.  I've filed PR go/52583 for this, but not yet
investigated in detail.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[PATCH] Fix PR52571

2012-03-14 Thread Richard Guenther

This fixes PR52571, we should not align DECL_COMMON variables as
they might be pre-empted by a definition with lower alignment.

At LTO/WPA level we might recover from missed optimizations by
promoting DECL_COMMON variables to non-common.  Not sure if we
do that already.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2012-03-14  Richard Guenther  rguent...@suse.de

PR tree-optimization/52571
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Move
flag_section_anchors check ...
(vect_can_force_dr_alignment_p): ... here.  Do not re-align
DECL_COMMON variables.

Index: gcc/tree-vect-data-refs.c
===
*** gcc/tree-vect-data-refs.c   (revision 185379)
--- gcc/tree-vect-data-refs.c   (working copy)
*** vect_compute_data_ref_alignment (struct
*** 872,881 
  
if (!base_aligned)
  {
!   /* Do not change the alignment of global variables if
!flag_section_anchors is enabled.  */
!   if (!vect_can_force_dr_alignment_p (base, TYPE_ALIGN (vectype))
! || (TREE_STATIC (base)  flag_section_anchors))
{
  if (vect_print_dump_info (REPORT_DETAILS))
{
--- 872,878 
  
if (!base_aligned)
  {
!   if (!vect_can_force_dr_alignment_p (base, TYPE_ALIGN (vectype)))
{
  if (vect_print_dump_info (REPORT_DETAILS))
{
*** vect_can_force_dr_alignment_p (const_tre
*** 4546,4557 
if (TREE_CODE (decl) != VAR_DECL)
  return false;
  
!   if (DECL_EXTERNAL (decl))
  return false;
  
if (TREE_ASM_WRITTEN (decl))
  return false;
  
if (TREE_STATIC (decl))
  return (alignment = MAX_OFILE_ALIGNMENT);
else
--- 4543,4564 
if (TREE_CODE (decl) != VAR_DECL)
  return false;
  
!   /* We cannot change alignment of common or external symbols as another
!  translation unit may contain a definition with lower alignment.  
!  The rules of common symbol linking mean that the definition
!  will override the common symbol.  */
!   if (DECL_EXTERNAL (decl)
!   || DECL_COMMON (decl))
  return false;
  
if (TREE_ASM_WRITTEN (decl))
  return false;
  
+   /* Do not change the alignment of global variables if flag_section_anchors
+  is enabled.  */
+   if (TREE_STATIC (decl)  flag_section_anchors)
+ return false;
+ 
if (TREE_STATIC (decl))
  return (alignment = MAX_OFILE_ALIGNMENT);
else


Re: [Patch]: Update fixincludes/README

2012-03-14 Thread Bruce Korb
I suppose after a decade of being gone, it's time to stop referencing it.
OK for *ALL* active branches.

On Wed, Mar 14, 2012 at 2:36 AM, Tristan Gingold ging...@adacore.com wrote:
 Hi,

 fixinc.sh is not anymore in gcc/ directory.  So I propose to adjust 
 fixincludes/README.

 Ok for trunk ?

 Tristan.

 fixincludes/
 2012-03-14  Tristan Gingold  ging...@adacore.com

        * README (EXAMPLES OF FIXES): Update.

 diff --git a/fixincludes/README b/fixincludes/README
 index 07a3964..c7144a0 100644
 --- a/fixincludes/README
 +++ b/fixincludes/README
 @@ -314,7 +314,7 @@ EXAMPLES OF FIXES:
     GCC.  But you can also:

         cd ${top_builddir}/gcc
 -        rm -rf fixinc.sh include/ stmp-fixinc
 +        rm -rf include-fixed/ stmp-fixinc
         make stmp-fixinc

     I would really recommend, however:



Re: [PATCH] Fix PR52571

2012-03-14 Thread Richard Guenther
On Wed, 14 Mar 2012, Richard Guenther wrote:

 
 This fixes PR52571, we should not align DECL_COMMON variables as
 they might be pre-empted by a definition with lower alignment.
 
 At LTO/WPA level we might recover from missed optimizations by
 promoting DECL_COMMON variables to non-common.  Not sure if we
 do that already.
 
 Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Checked in with some testcase adjustments.

Richard.

2012-03-14  Richard Guenther  rguent...@suse.de

PR tree-optimization/52571
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Move
flag_section_anchors check ...
(vect_can_force_dr_alignment_p): ... here.  Do not re-align
DECL_COMMON variables.

* gcc.dg/vect/vect-2.c: Initialize arrays.
* gcc.dg/vect/no-section-anchors-vect-34.c: Likewise.
* gcc.target/i386/recip-vec-divf.c: Use -fno-common.
* gcc.target/i386/recip-vec-sqrtf.c: Likewise.

Index: gcc/tree-vect-data-refs.c
===
*** gcc/tree-vect-data-refs.c   (revision 185379)
--- gcc/tree-vect-data-refs.c   (working copy)
*** vect_compute_data_ref_alignment (struct
*** 872,881 
  
if (!base_aligned)
  {
!   /* Do not change the alignment of global variables if
!flag_section_anchors is enabled.  */
!   if (!vect_can_force_dr_alignment_p (base, TYPE_ALIGN (vectype))
! || (TREE_STATIC (base)  flag_section_anchors))
{
  if (vect_print_dump_info (REPORT_DETAILS))
{
--- 872,878 
  
if (!base_aligned)
  {
!   if (!vect_can_force_dr_alignment_p (base, TYPE_ALIGN (vectype)))
{
  if (vect_print_dump_info (REPORT_DETAILS))
{
*** vect_can_force_dr_alignment_p (const_tre
*** 4546,4557 
if (TREE_CODE (decl) != VAR_DECL)
  return false;
  
!   if (DECL_EXTERNAL (decl))
  return false;
  
if (TREE_ASM_WRITTEN (decl))
  return false;
  
if (TREE_STATIC (decl))
  return (alignment = MAX_OFILE_ALIGNMENT);
else
--- 4543,4564 
if (TREE_CODE (decl) != VAR_DECL)
  return false;
  
!   /* We cannot change alignment of common or external symbols as another
!  translation unit may contain a definition with lower alignment.  
!  The rules of common symbol linking mean that the definition
!  will override the common symbol.  */
!   if (DECL_EXTERNAL (decl)
!   || DECL_COMMON (decl))
  return false;
  
if (TREE_ASM_WRITTEN (decl))
  return false;
  
+   /* Do not change the alignment of global variables if flag_section_anchors
+  is enabled.  */
+   if (TREE_STATIC (decl)  flag_section_anchors)
+ return false;
+ 
if (TREE_STATIC (decl))
  return (alignment = MAX_OFILE_ALIGNMENT);
else
Index: gcc/testsuite/gcc.dg/vect/vect-2.c
===
--- gcc/testsuite/gcc.dg/vect/vect-2.c  (revision 185379)
+++ gcc/testsuite/gcc.dg/vect/vect-2.c  (working copy)
@@ -6,7 +6,7 @@
 #define N 16
 
 char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-char ca[N];
+char ca[N] = {};
 
 __attribute__ ((noinline)) 
 int main1 ()
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-34.c
===
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-34.c  (revision 
185379)
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-34.c  (working copy)
@@ -7,7 +7,7 @@
  
 struct {
   char ca[N];
-} s;
+} s = {};
 char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
 
 __attribute__ ((noinline))
Index: gcc/testsuite/gcc.target/i386/recip-vec-divf.c
===
--- gcc/testsuite/gcc.target/i386/recip-vec-divf.c  (revision 185379)
+++ gcc/testsuite/gcc.target/i386/recip-vec-divf.c  (working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options -O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip 
} */
+/* { dg-options -O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip 
-fno-common } */
 
 float a[4];
 float b[4];
Index: gcc/testsuite/gcc.target/i386/recip-vec-sqrtf.c
===
--- gcc/testsuite/gcc.target/i386/recip-vec-sqrtf.c (revision 185379)
+++ gcc/testsuite/gcc.target/i386/recip-vec-sqrtf.c (working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options -O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip 
} */
+/* { dg-options -O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip 
-fno-common } */
 
 float a[4];
 float b[4];


[v3] Fix some comments in forward_list wrongly referring to size()

2012-03-14 Thread Paolo Carlini

Hi,

highly misleading. Committed to mainline (suitable for 4.7.1 too of course)

Thanks,
Paolo.

///
2012-03-14  Paolo Carlini  paolo.carl...@oracle.com

* include/bits/forward_list.h: Fix comments.
Index: include/bits/forward_list.h
===
--- include/bits/forward_list.h (revision 185379)
+++ include/bits/forward_list.h (working copy)
@@ -536,7 +536,8 @@
*  @param  __al  An allocator object.
*
*  Create a %forward_list consisting of copies of the elements
-   *  in the initializer_list @a __il.  This is linear in __il.size().
+   *  in the initializer_list @a __il.  This is linear in the number
+   *  of elements of __il.
*/
   forward_list(std::initializer_list_Tp __il,
const _Alloc __al = _Alloc())
@@ -585,7 +586,7 @@
*
*  Replace the contents of the %forward_list with copies of the
*  elements in the initializer_list @a __il.  This is linear in
-   *  __il.size().
+   *  the number of elements of __il.
*/
   forward_list
   operator=(std::initializer_list_Tp __il)
@@ -603,8 +604,8 @@
*  in the range [@a __first,@a __last).
*
*  Note that the assignment completely changes the %forward_list and
-   *  that the resulting %forward_list's size is the same as the number
-   *  of elements assigned.  Old data may be lost.
+   *  that the number of elements of the resulting %forward_list's is the
+   *  same as the number of elements assigned.  Old data is lost.
*/
   templatetypename _InputIterator,
   typename = std::_RequireInputIter_InputIterator
@@ -620,10 +621,10 @@
*  @param  __n  Number of elements to be assigned.
*  @param  __val  Value to be assigned.
*
-   *  This function fills a %forward_list with @a __n copies of the given
-   *  value.  Note that the assignment completely changes the
-   *  %forward_list and that the resulting %forward_list's size is the
-   *  same as the number of elements assigned.  Old data may be lost.
+   *  This function fills a %forward_list with @a __n copies of the
+   *  given value.  Note that the assignment completely changes the
+   *  %forward_list, and that the resulting %forward_list has __n
+   *  elements.  Old data is lost.
*/
   void
   assign(size_type __n, const _Tp __val)
@@ -742,7 +743,7 @@
   { return this-_M_impl._M_head._M_next == 0; }
 
   /**
-   *  Returns the largest possible size of %forward_list.
+   *  Returns the largest possible number of elements of %forward_list.
*/
   size_type
   max_size() const noexcept
@@ -996,9 +997,9 @@
*
*  This function will %resize the %forward_list to the specified
*  number of elements.  If the number is smaller than the
-   *  %forward_list's current size the %forward_list is truncated,
-   *  otherwise the %forward_list is extended and the new elements
-   *  are default constructed.
+   *  %forward_list's current number of elements the %forward_list
+   *  is truncated, otherwise the %forward_list is extended and the
+   *  new elements are default constructed.
*/
   void
   resize(size_type __sz);
@@ -1011,9 +1012,9 @@
*
*  This function will %resize the %forward_list to the specified
*  number of elements.  If the number is smaller than the
-   *  %forward_list's current size the %forward_list is truncated,
-   *  otherwise the %forward_list is extended and new elements are
-   *  populated with given data.
+   *  %forward_list's current number of elements the %forward_list
+   *  is truncated, otherwise the %forward_list is extended and new
+   *  elements are populated with given data.
*/
   void
   resize(size_type __sz, const value_type __val);
@@ -1233,11 +1234,11 @@
*  @brief  Forward list equality comparison.
*  @param  __lx  A %forward_list
*  @param  __ly  A %forward_list of the same type as @a __lx.
-   *  @return  True iff the size and elements of the forward lists are equal.
+   *  @return  True iff the elements of the forward lists are equal.
*
-   *  This is an equivalence relation.  It is linear in the size of the
-   *  forward lists.  Deques are considered equivalent if corresponding
-   *  elements compare equal.
+   *  This is an equivalence relation.  It is linear in the number of 
+   *  elements of the forward lists.  Deques are considered equivalent
+   *  if corresponding elements compare equal.
*/
   templatetypename _Tp, typename _Alloc
 bool
@@ -1250,8 +1251,9 @@
*  @param  __ly  A %forward_list of the same type as @a __lx.
*  @return  True iff @a __lx is lexicographically less than @a __ly.
*
-   *  This is a total ordering relation.  It is linear in 

[committed] Workaround for PR c++/52582

2012-03-14 Thread Jakub Jelinek
Hi!

I've committed the following workaround for PR52582 to 4.7 branch (acked
on IRC by David and Richard) after bootstrapping/regtesting it on
powerpc64-linux (--with-cpu=default32 as well as -m64 defaulted build),
and for trunk committed just the testcase.  Richard committed some fix to
the trunk already, but we still should figure out why the DECL_EXTERNAL
on the devirtualized fndecl isn't set.

2012-03-14  Jakub Jelinek  ja...@redhat.com

PR c++/52582
* config/rs6000/rs6000.c (call_ABI_of_interest): Return true
if c_node is NULL.

* g++.dg/opt/pr52582.C: New test.

--- gcc/config/rs6000/rs6000.c.jj   2012-03-12 10:45:17.0 +0100
+++ gcc/config/rs6000/rs6000.c  2012-03-14 11:34:18.043648481 +0100
@@ -7452,6 +7452,9 @@ call_ABI_of_interest (tree fndecl)
   /* Interesting functions that we are emitting in this object file.  */
   c_node = cgraph_get_node (fndecl);
   c_node = cgraph_function_or_thunk_node (c_node, NULL);
+  if (c_node == NULL)
+   return true;
+
   return !cgraph_only_called_directly_p (c_node);
 }
   return false;
--- gcc/testsuite/g++.dg/opt/pr52582.C.jj   2012-03-14 11:29:34.008618924 
+0100
+++ gcc/testsuite/g++.dg/opt/pr52582.C  2012-03-14 11:20:26.0 +0100
@@ -0,0 +1,28 @@
+// PR c++/52582
+// { dg-do compile }
+// { dg-options -O2 }
+
+inline void *operator new (__SIZE_TYPE__, void *p) throw ()
+{
+  return p;
+}
+
+struct B
+{
+  virtual ~B ();
+  B ();
+};
+
+struct A : B
+{
+  A () : B () {}
+  virtual void bar ();
+};
+
+void
+foo ()
+{
+  char a[64];
+  B *b = new (a) A ();
+  b-~B ();
+}

Jakub


Re: [Patch ARM/ configury] Add fall-back check for gnu_unique_object

2012-03-14 Thread Ramana Radhakrishnan
On 12 March 2012 18:10, DJ Delorie d...@redhat.com wrote:

 Looks OK to me.

I was about to commit this into my svn checkout and then realized the
patch p4 didn't have the changes to configure - So I regenerated it
again and then began a journey into the depths of m4 and autoconf for
a bit before I gave up. Empirically I spotted this odd behaviour  with
gcc_GAS_CHECK_FEATURE and comments - Attached are the 2 alternate
patches that I tried and the difference in the configure scripts
themselves . I am no m4 expert but it does look like the m4_substr in
gcc_GAS_CHECK_FEATURE doesn't really like that comment there.

Any ideas anyone ? I must decline any knowledge of m4 at this point
and I don't want to commit this until I understand what's going on
here.

Ramana

- correct-configure-output.txt : Patch where everything looks sane.
- incorrect-configure-output.txt:  Patch where everything looks insane.
- Diffs in the configure output : differences in configure files - for
ease of viewing.
Index: configure.ac
===
--- configure.ac(revision 185343)
+++ configure.ac(working copy)
@@ -4177,7 +4177,8 @@
   esac],
  [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
[elf,2,19,52],,
-   [.type foo, @gnu_unique_object],,
+   [.type foo, '$target_type_format_char'gnu_unique_object],,
+# We need to unquote above to to use the definition from config.gcc.
 # Also check for ld.so support, i.e. glibc 2.11 or higher.
[[if test x$host = x$build -a x$host = x$target 
ldd --version 2/dev/null 
Index: configure
===
--- configure   (revision 185343)
+++ configure   (working copy)
@@ -26167,7 +26167,7 @@
   then gcc_cv_as_gnu_unique_object=yes
 fi
   elif test x$gcc_cv_as != x; then
-$as_echo '.type foo, @gnu_unique_object'  conftest.s
+$as_echo '.type foo, '$target_type_format_char'gnu_unique_object'  
conftest.s
 if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s 5'
   { { eval echo \\$as_me\:${as_lineno-$LINENO}: \$ac_try\; } 5
   (eval $ac_try) 25
@@ -26186,7 +26186,8 @@
 { $as_echo $as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gnu_unique_object 
5
 $as_echo $gcc_cv_as_gnu_unique_object 6; }
 if test $gcc_cv_as_gnu_unique_object = yes; then
-  # Also check for ld.so support, i.e. glibc 2.11 or higher.
+  # We need to unquote above to to use the definition from config.gcc.
+# Also check for ld.so support, i.e. glibc 2.11 or higher.
if test x$host = x$build -a x$host = x$target 
ldd --version 2/dev/null 
glibcver=`ldd --version 2/dev/null | sed 's/.* //;q'`; then
Index: config.gcc
===
--- config.gcc  (revision 185343)
+++ config.gcc  (working copy)
@@ -182,6 +182,11 @@
 #  the --with-sysroot configure option or the
 #  --sysroot command line option is used this
 #  will be relative to the sysroot.
+# target_type_format_char 
+#  The default character to be used for formatting
+#  the attribute in a
+#  .type symbol_name, ${t_t_f_c}property
+#  directive.
 
 # The following variables are used in each case-construct to build up the
 # outgoing variables:
@@ -232,6 +237,7 @@
 need_64bit_hwint=
 need_64bit_isa=
 native_system_header_dir=/usr/include
+target_type_format_char='@'
 
 # Don't carry these over build-host-target.  Please.
 xm_file=
@@ -316,6 +322,7 @@
 arm*-*-*)
cpu_type=arm
extra_headers=mmintrin.h arm_neon.h
+   target_type_format_char='%'
c_target_objs=arm-c.o
cxx_target_objs=arm-c.o
extra_options=${extra_options} arm/arm-tables.opt
Index: configure.ac
===
--- configure.ac(revision 185343)
+++ configure.ac(working copy)
@@ -4177,7 +4177,8 @@
   esac],
  [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
[elf,2,19,52],,
-   [.type foo, @gnu_unique_object],,
+# We need to unquote above to to use the definition from config.gcc.
+   [.type foo, '$target_type_format_char'gnu_unique_object],,
 # Also check for ld.so support, i.e. glibc 2.11 or higher.
[[if test x$host = x$build -a x$host = x$target 
ldd --version 2/dev/null 
Index: configure
===
--- configure   (revision 185343)
+++ configure   (working copy)
@@ -26167,7 +26167,7 @@
   then gcc_cv_as_gnu_unique_object=yes
 fi
   elif test x$gcc_cv_as != x; then
-$as_echo '.type foo, @gnu_unique_object'  conftest.s
+$as_echo   conftest.s
 if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s 5'
   { { eval echo \\$as_me\:${as_lineno-$LINENO}: \$ac_try\; } 5
   (eval $ac_try) 25
Index: config.gcc

[dwarf]:

2012-03-14 Thread Tristan Gingold
Hi,

the dwarf3 DW_OP_call_frame_cfa implicitly refers to .debug_frame section.  But 
if we aren't
emitting dwarf unwinding info, it isn't anymore well defined.

There is one target that doesn't emit dwarf unwind info: ia64.  And gdb is not 
able to deal
with DW_OP_call_frame_cfa on ia64, thus breaking -gdwarf-3.

I think the simplest is to disable this opcode for such targets.

Manually tested with gdb on ia64-linux.
No regressions for x86_64-darwin.

Ok for trunk ?

Tristan.

2012-03-14  Tristan Gingold  ging...@adacore.com

* dwarf2out.c (gen_subprogram_die): Require dwarf unwinding to
use DW_OP_call_frame_cfa.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index b5f921a..b43dfcf 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -17485,7 +17485,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
 (3) We can at least reuse the code inspection and interpretation
 code that determines the CFA position at various points in the
 function.  */
-  if (dwarf_version = 3)
+  if (dwarf_version = 3  targetm.debug_unwind_info () == UI_DWARF2)
{
  dw_loc_descr_ref op = new_loc_descr (DW_OP_call_frame_cfa, 0, 0);
  add_AT_loc (subr_die, DW_AT_frame_base, op);




[C] Handle #pragma before a parameter

2012-03-14 Thread Tristan Gingold
Hi,

it happens that some system headers on VMS have #pragma between parameters.  
This is spotted by building the Ada runtime.

This patch simply handles them.

Manually tested by building for ia64-hp-openvms.
No regressions for c on x86_64-darwin.

Ok for trunk ?

Tristan.

2012-03-14  Tristan Gingold  ging...@adacore.com

* c-parser.c (c_parser_parameter_declaration): Handle #pragma
before a parameter.

diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 56134c2..0d6f7a4 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -3305,6 +3305,11 @@ c_parser_parameter_declaration (c_parser *parser, tree at
   tree prefix_attrs;
   tree postfix_attrs = NULL_TREE;
   bool dummy = false;
+
+  /* Accept #pragmas between parameter declarations.  */
+  while (c_parser_next_token_is (parser, CPP_PRAGMA))
+c_parser_pragma (parser, pragma_external);
+
   if (!c_parser_next_token_starts_declspecs (parser))
 {
   c_token *token = c_parser_peek_token (parser);




Re: [Patch ARM/ configury] Add fall-back check for gnu_unique_object

2012-03-14 Thread Paolo Bonzini
Il 14/03/2012 16:37, Ramana Radhakrishnan ha scritto:
 Empirically I spotted this odd behaviour  with
 gcc_GAS_CHECK_FEATURE and comments - Attached are the 2 alternate
 patches that I tried and the difference in the configure scripts
 themselves . I am no m4 expert but it does look like the m4_substr in
 gcc_GAS_CHECK_FEATURE doesn't really like that comment there.
 
 Any ideas anyone ? I must decline any knowledge of m4 at this point
 and I don't want to commit this until I understand what's going on
 here.

Yes, the # comment is actually part of the macro argument.  If you want
to write a real comment (i.e. at the m4 rather than shell level) use
dnl instead of #.

The patch with correct configure output is ok.

Paolo


[Patch/cfgexpand]: also consider assembler_name to call expand_main_function

2012-03-14 Thread Tristan Gingold
Hi,

the code to call expand_main_function currently only checks DECL_NAME.  This 
leads
to a hack in ada/gcc-interface/utils.c to handle the gnatbind generated file 
that could
declare:

package ada_main is
…
   function my_main
 (argc : Integer;
  argv : System.Address;
  envp : System.Address)
  return Integer;
   pragma Export (C, my_main, main);
…
end ada_main;

But expand_main_function is also called for function whose name is main but 
assembly name isn't.  Eg:

package pkg is
   procedure main;
end pkg;

So I think we should consider the assembler name is set, otherwise the decl 
name.

Manually tested on ia64-hp-openvms (where this issue was discovered).
No C regressions for x86_64-darwin.

Ok for trunk ?

Tristan.

gcc/
2012-03-14  Tristan Gingold  ging...@adacore.com

* cfgexpand.c (gimple_expand_cfg): Consider the assembly name
to call expand_main_function.

gcc/ada/
2012-03-14  Tristan Gingold  ging...@adacore.com

* gcc-interface/utils.c (create_subprog_decl): Do not override
DECL_NAME if asm_name is set.


diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 2f38bb4..8693876 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -4501,8 +4501,12 @@ gimple_expand_cfg (void)
   /* If this function is `main', emit a call to `__main'
  to run global initializers, etc.  */
   if (DECL_NAME (current_function_decl)
-   MAIN_NAME_P (DECL_NAME (current_function_decl))
-   DECL_FILE_SCOPE_P (current_function_decl))
+   DECL_FILE_SCOPE_P (current_function_decl)
+   main_identifier_node != NULL_TREE
+   ((!DECL_ASSEMBLER_NAME_SET_P (current_function_decl)
+   MAIN_NAME_P (DECL_NAME (current_function_decl)))
+ || decl_assembler_name_equal (current_function_decl,
+   main_identifier_node)))
 expand_main_function ();
 
   /* Initialize the stack_protect_guard field.  This must happen after the

diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 7383358..81a1a0a 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -1899,18 +1899,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, 
tree subprog_type,
   DECL_RESULT (subprog_decl) = result_decl;
 
   if (asm_name)
-{
-  SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name);
-
-  /* The expand_main_function circuitry expects main_identifier_node to
-designate the DECL_NAME of the 'main' entry point, in turn expected
-to be declared as the main function literally by default.  Ada
-program entry points are typically declared with a different name
-within the binder generated file, exported as 'main' to satisfy the
-system expectations.  Force main_identifier_node in this case.  */
-  if (asm_name == main_identifier_node)
-   DECL_NAME (subprog_decl) = main_identifier_node;
-}
+SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name);
 
   /* Add this decl to the current binding level.  */
   gnat_pushdecl (subprog_decl, gnat_node);




Re: Remove DWARF_OFFSET_SIZE, DWARF_INITIAL_LENGTH_SIZE

2012-03-14 Thread Rainer Orth
Jason Merrill ja...@redhat.com writes:

 On 03/12/2012 01:41 PM, Joseph S. Myers wrote:
 As a *target macro* it makes sense to remove it - reomve it from
 defaults.h, make it purely internal to dwarf2out.c.  But I think it makes
 sense to have it inside dwarf2out.c

 Agreed.

Here's the revised patch.  Bootstrapped without regressions on
i386-pc-solaris2.10, ok for mainline?

Rainer


2012-03-11  Rainer Orth  r...@cebitec.uni-bielefeld.de

* defaults.h (DWARF_OFFSET_SIZE): Move ...
* dwarf2out.c (DWARF_OFFSET_SIZE): ... here.
Define unconditionally.
(DWARF_INITIAL_LENGTH_SIZE): Hardcode default.
(DWARF_CIE_ID): Remove non-default DWARF_OFFSET_SIZE handling.
(DW_FORM_data): Remove.
(DW_FORM_ref): Remove.
(output_fde): Remove non-default DWARF_INITIAL_LENGTH_SIZE,
DWARF_OFFSET_SIZE handling.
(output_call_frame_info): Likewise.
(value_format): Likewise.
Replace DW_FORM_data by DW_FORM_data4.
Replace DW_FORM_ref by DW_FORM_ref4.
(output_compilation_unit_header): Remove non-default
DWARF_INITIAL_LENGTH_SIZE, DWARF_OFFSET_SIZE handling.
(output_pubnames): Likewise.
(output_aranges): Likewise.
(output_line_info): Likewise.
(output_macinfo_op): Likewise.
(optimize_macinfo_range): Likewise.
(output_macinfo): Likewise.
* config/sparc/freebsd.h (DWARF_OFFSET_SIZE): Remove comment.
* config/sparc/linux64.h : Remove comment.
* config/sparc/linux64.h : Likewise.

# HG changeset patch
# Parent 1e36853765843a5d65f6a1967bddab425338fd2a
Remove DWARF_OFFSET_SIZE, DWARF_INITIAL_LENGTH_SIZE

diff --git a/gcc/config/sparc/freebsd.h b/gcc/config/sparc/freebsd.h
--- a/gcc/config/sparc/freebsd.h
+++ b/gcc/config/sparc/freebsd.h
@@ -1,5 +1,5 @@
 /* Definitions for Sun SPARC64 running FreeBSD using the ELF format
-   Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2010, 2011
+   Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by David E. O'Brien obr...@freebsd.org and BSDi.
 
@@ -124,15 +124,6 @@ along with GCC; see the file COPYING3.  
 #undef  DBX_CONTIN_CHAR
 #define DBX_CONTIN_CHAR	'?'
 
-/* DWARF bits.  */
-
-/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. 
-   Obviously the Dwarf2 folks havn't tried to actually build systems
-   with their spec.  On a 64-bit system, only 64-bit relocs become
-   RELATIVE relocations.  */
-
-/* #define DWARF_OFFSET_SIZE PTR_SIZE */
-
 #ifdef HAVE_AS_TLS
 #undef TARGET_SUN_TLS
 #undef TARGET_GNU_TLS
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -1,6 +1,6 @@
 /* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF.
Copyright 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-   2009, 2010, 2011 Free Software Foundation, Inc.
+   2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by David S. Miller (da...@caip.rutgers.edu)
 
 This file is part of GCC.
@@ -236,15 +236,6 @@ do {	\
 #undef  LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX  .
 
-/* DWARF bits.  */
-
-/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. 
-   Obviously the Dwarf2 folks haven't tried to actually build systems
-   with their spec.  On a 64-bit system, only 64-bit relocs become
-   RELATIVE relocations.  */
-
-/* #define DWARF_OFFSET_SIZE PTR_SIZE */
-
 #undef DITF_CONVERSION_LIBFUNCS
 #define DITF_CONVERSION_LIBFUNCS 1
 
diff --git a/gcc/defaults.h b/gcc/defaults.h
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -462,14 +462,6 @@ see the files COPYING3 and COPYING.RUNTI
 #define DWARF2_ADDR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
 #endif
 
-/* The size in bytes of a DWARF field indicating an offset or length
-   relative to a debug info section, specified to be 4 bytes in the
-   DWARF-2 specification.  The SGI/MIPS ABI defines it to be the same
-   as PTR_SIZE.  */
-#ifndef DWARF_OFFSET_SIZE
-#define DWARF_OFFSET_SIZE 4
-#endif
-
 /* The size in bytes of a DWARF 4 type signature.  */
 #ifndef DWARF_TYPE_SIGNATURE_SIZE
 #define DWARF_TYPE_SIGNATURE_SIZE 8
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -162,17 +162,20 @@ static GTY(()) section *debug_frame_sect
 /* Maximum size (in bytes) of an artificially generated label.  */
 #define MAX_ARTIFICIAL_LABEL_BYTES	30
 
+/* The size in bytes of a DWARF field indicating an offset or length
+   relative to a debug info section, specified to be 4 bytes in the
+   DWARF-2 specification.  The SGI/MIPS ABI defined it to be the same
+   as PTR_SIZE, but that is no longer supported.  */
+#define DWARF_OFFSET_SIZE 4
+
 /* According to the (draft) DWARF 3 specification, the initial length
should either be 4 or 12 bytes.  When it's 12 bytes, the first 4
bytes are 0x, followed by 

Re: [Patch/cfgexpand]: also consider assembler_name to call expand_main_function

2012-03-14 Thread Richard Guenther
On Wed, 14 Mar 2012, Tristan Gingold wrote:

 Hi,
 
 the code to call expand_main_function currently only checks DECL_NAME.  This 
 leads
 to a hack in ada/gcc-interface/utils.c to handle the gnatbind generated file 
 that could
 declare:
 
 package ada_main is
 …
function my_main
  (argc : Integer;
   argv : System.Address;
   envp : System.Address)
   return Integer;
pragma Export (C, my_main, main);
 …
 end ada_main;
 
 But expand_main_function is also called for function whose name is main but 
 assembly name isn't.  Eg:
 
 package pkg is
procedure main;
 end pkg;
 
 So I think we should consider the assembler name is set, otherwise the decl 
 name.
 
 Manually tested on ia64-hp-openvms (where this issue was discovered).
 No C regressions for x86_64-darwin.
 
 Ok for trunk ?

There are more checks for MAIN_NAME_P, so this certainly isn't enough.
And if it is a good idea then the whole check, whether a FUNCTION_DECL
is considered 'main' should be put into a function in tree.[ch] and
used everywhere.  Note that what is 'main' is controlled by
main_identifier_node, controlled by frontends.  So - why is that not
enough to control for Ada?

Richard.

 Tristan.
 
 gcc/
 2012-03-14  Tristan Gingold  ging...@adacore.com
 
   * cfgexpand.c (gimple_expand_cfg): Consider the assembly name
   to call expand_main_function.
 
 gcc/ada/
 2012-03-14  Tristan Gingold  ging...@adacore.com
 
   * gcc-interface/utils.c (create_subprog_decl): Do not override
   DECL_NAME if asm_name is set.
 
 
 diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
 index 2f38bb4..8693876 100644
 --- a/gcc/cfgexpand.c
 +++ b/gcc/cfgexpand.c
 @@ -4501,8 +4501,12 @@ gimple_expand_cfg (void)
/* If this function is `main', emit a call to `__main'
   to run global initializers, etc.  */
if (DECL_NAME (current_function_decl)
 -   MAIN_NAME_P (DECL_NAME (current_function_decl))
 -   DECL_FILE_SCOPE_P (current_function_decl))
 +   DECL_FILE_SCOPE_P (current_function_decl)
 +   main_identifier_node != NULL_TREE
 +   ((!DECL_ASSEMBLER_NAME_SET_P (current_function_decl)
 + MAIN_NAME_P (DECL_NAME (current_function_decl)))
 +   || decl_assembler_name_equal (current_function_decl,
 + main_identifier_node)))
  expand_main_function ();
  
/* Initialize the stack_protect_guard field.  This must happen after the
 
 diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
 index 7383358..81a1a0a 100644
 --- a/gcc/ada/gcc-interface/utils.c
 +++ b/gcc/ada/gcc-interface/utils.c
 @@ -1899,18 +1899,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, 
 tree subprog_type,
DECL_RESULT (subprog_decl) = result_decl;
  
if (asm_name)
 -{
 -  SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name);
 -
 -  /* The expand_main_function circuitry expects main_identifier_node to
 -  designate the DECL_NAME of the 'main' entry point, in turn expected
 -  to be declared as the main function literally by default.  Ada
 -  program entry points are typically declared with a different name
 -  within the binder generated file, exported as 'main' to satisfy the
 -  system expectations.  Force main_identifier_node in this case.  */
 -  if (asm_name == main_identifier_node)
 - DECL_NAME (subprog_decl) = main_identifier_node;
 -}
 +SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name);
  
/* Add this decl to the current binding level.  */
gnat_pushdecl (subprog_decl, gnat_node);
 
 
 

-- 
Richard Guenther rguent...@suse.de
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Re: Remove non-GAS non-ELF support in alpha backend

2012-03-14 Thread Rainer Orth
Richard Henderson r...@redhat.com writes:

 On 03/12/12 09:22, Rainer Orth wrote:
 There are only two issues:
 
 * In alpha.c (alpha_option_override), it's unclear if the optimize  0
   test can be removed completely.

 Yeah, I guess leave that for now.

 * During testing, I ran into this error:
 
   alpha.md:5861: `*builtin_setjmp_receiver_er_1' matches 
 `*builtin_setjmp_receiver_er_sl_1'
   alpha.md:5856: previous definition of `*builtin_setjmp_receiver_er_sl_1'

 Delete builtin_setjmp_receiver_er_1, which ought to have had  
 !TARGET_AS_CAN_SUBTRACT_LABELS,
 but since patterns are matched in order, was implied by the filtering of the 
 previous pattern.

Here's the revised patch, retested by building cc1 in a i386-solaris2.11
x alpha-freebsd6.0 cross.

Ok for mainline now?

Rainer


2012-03-09  Rainer Orth  r...@cebitec.uni-bielefeld.de

* config/alpha/alpha.c [HAVE_STAMP_H]: Remove.
(alpha_file_start) [MS_STAMP]: Remove.

* config/alpha/elf.h (TARGET_GAS): Remove.
* config/alpha/freebsd.h (TARGET_DEFAULT): Remove.
* config/alpha/linux.h (TARGET_DEFAULT): Remove.
* config/alpha/netbsd.h (TARGET_DEFAULT): Remove.
* config/alpha/vms.h (TARGET_DEFAULT): Remove.
* config.gcc (alpha*-*-linux*): Remove target_cpu_default.
(alpha*-*-freebsd*): Likewise.
(alpha*-*-netbsd*): Likewise.
(alpha*-*-openbsd*): Likewise.
(alpha*-*-*): Remove target_cpu_default2.
* config/alpha/alpha.c (alpha_output_filename): Remove !TARGET_GAS
handling.
* config/alpha/alpha.h (TARGET_AS_CAN_SUBTRACT_LABELS): Remove.
(TARGET_AS_SLASH_BEFORE_SUFFIX): Remove.
* config/alpha/alpha.c (print_operand): Always assume
TARGET_AS_SLASH_BEFORE_SUFFIX.
* config/alpha/alpha.md (*builtin_setjmp_receiver_er_sl_1):
Remove TARGET_AS_CAN_SUBTRACT_LABELS.
(*builtin_setjmp_receiver_er_1): Remove.
* config/alpha/alpha.opt (malpha-as): Remove.
(mgas): Ignore.
* doc/invoke.texi (Option Summary, DEC Alpha Options): Remove
-malpha-as, -mgas.
Remove DEC Unix reference.

* config/alpha/alpha.h (OBJECT_FORMAT_COFF): Remove.
(EXTENDED_COFF): Remove.
* config/alpha/elf.h (OBJECT_FORMAT_COFF): Don't undef.
(EXTENDED_COFF): Don't undef.
* config/alpha/alpha.c (alpha_file_start): Always assume
OBJECT_FORMAT_ELF.
[!OBJECT_FORMAT_ELF]: Remove.

* config/alpha/alpha.h (SDB_DEBUGGING_INFO): Remove.
(DBX_DEBUGGING_INFO): Remove.
(MIPS_DEBUGGING_INFO): Remove.
(PREFERRED_DEBUGGING_TYPE): Remove.
(DBX_OUTPUT_SOURCE_LINE): Remove.
(SDB_OUTPUT_SOURCE_LINE): Remove.
(DBX_CONTIN_LENGTH): Remove.
(NO_DBX_FUNCTION_END): Remove.
(ASM_STABS_OP): Remove.
(ASM_STABN_OP): Remove.
(ASM_STABD_OP): Remove.
(SDB_ALLOW_FORWARD_REFERENCES): Remove.
(SDB_ALLOW_UNKNOWN_REFERENCES): Remove.
(PUT_SDB_DEF): Remove.
(PUT_SDB_PLAIN_DEF): Remove.
(PUT_SDB_TYPE): Remove.
(sdb_label_count): Remove.
(PUT_SDB_BLOCK_START): Remove.
(PUT_SDB_BLOCK_END): Remove.
(PUT_SDB_FUNCTION_START): Remove.
(PUT_SDB_FUNCTION_END): Remove.
(PUT_SDB_EPILOGUE_END): Remove.
* config/alpha/elf.h (SDB_DEBUGGING_INFO): Don't undef.
(MIPS_DEBUGGING_INFO): Don't undef.
(DBX_DEBUGGING_INFO): Don't undef.
* config/alpha/vms.h (SDB_DEBUGGING_INFO): Don't undef.
(MIPS_DEBUGGING_INFO): Don't undef.
(DBX_DEBUGGING_INFO): Don't undef.
* config/alpha/freebsd.h (DBX_CONTIN_CHAR): Remove.
* config/alpha/alpha.c (alpha_option_override): Remove SDB_DEBUG
handling.
(alpha_start_function): Likewise.
(sdb_label_count): Remove.
(alpha_output_filename): Remove DBX_DEBUG handling.
(alpha_file_start): Likewise.

# HG changeset patch
# Parent 465e0a61b396af5b96f194a4eecaa8d2103c3cfb
Remove non-GAS non-ELF support in alpha backend

diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -763,25 +763,21 @@ case ${target} in
 alpha*-*-linux*)
 	tm_file=${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h
 	extra_options=${extra_options} alpha/elf.opt
-	target_cpu_default=MASK_GAS
 	;;
 alpha*-*-freebsd*)
 	tm_file=${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h
 	extra_options=${extra_options} alpha/elf.opt
-	target_cpu_default=MASK_GAS
 	;;
 alpha*-*-netbsd*)
 	tm_file=${tm_file} netbsd.h alpha/elf.h netbsd-elf.h alpha/netbsd.h
 	extra_options=${extra_options} netbsd.opt netbsd-elf.opt \
 		   alpha/elf.opt
-	target_cpu_default=MASK_GAS
 	;;
 alpha*-*-openbsd*)
 	tm_defines=${tm_defines} OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_FUNCTION_SIZE OBSD_HAS_DECLARE_OBJECT
 	tm_file=alpha/alpha.h alpha/elf.h openbsd.h openbsd-stdint.h 

Re: [PATCH 3/3] Misaligned MEM_REF reads

2012-03-14 Thread Martin Jambor
Hi,

On Mon, Mar 12, 2012 at 03:09:04PM +0100, Martin Jambor wrote:
 Hi,
 
 this patch is very similar to the one I posted before
 (http://gcc.gnu.org/ml/gcc-patches/2012-02/msg01377.html) except that
 it is now adjusted to sit on top of the new one before this and does
 not ignore complex numbers...

This is the same patch updated to apply on top of the new version of
the previous one (which I have committed a moment ago).  Again,
bootstrapped and tested on x86_64-linux (all languages including Ada
and Java), usparc64-linux (without Java) and ia64-linux (without
Ada), the i686 compile farm machine was not accessible yesterday so I
don't have any results from it but will start a test right now.

OK for trunk?

Thanks,

Martin



2012-03-12  Martin Jambor  mjam...@suse.cz

* expr.c (expand_expr_real_1): handle misaligned scalar reads from
memory through MEM_REFs by calling extract_bit_field.

* testsuite/gcc.dg/misaligned-expand-1.c: New test.
* testsuite/gcc.dg/misaligned-expand-3.c: Likewise.


Index: src/gcc/expr.c
===
--- src.orig/gcc/expr.c
+++ src/gcc/expr.c
@@ -9411,21 +9411,27 @@ expand_expr_real_1 (tree exp, rtx target
  MEM_VOLATILE_P (temp) = 1;
if (modifier != EXPAND_WRITE
 mode != BLKmode
-align  GET_MODE_ALIGNMENT (mode)
-   /* If the target does not have special handling for unaligned
-  loads of mode then it can use regular moves for them.  */
-((icode = optab_handler (movmisalign_optab, mode))
-   != CODE_FOR_nothing))
+align  GET_MODE_ALIGNMENT (mode))
  {
-   struct expand_operand ops[2];
+   if ((icode = optab_handler (movmisalign_optab, mode))
+   != CODE_FOR_nothing)
+ {
+   struct expand_operand ops[2];
 
-   /* We've already validated the memory, and we're creating a
-  new pseudo destination.  The predicates really can't fail,
-  nor can the generator.  */
-   create_output_operand (ops[0], NULL_RTX, mode);
-   create_fixed_operand (ops[1], temp);
-   expand_insn (icode, 2, ops);
-   return ops[0].value;
+   /* We've already validated the memory, and we're creating a
+  new pseudo destination.  The predicates really can't fail,
+  nor can the generator.  */
+   create_output_operand (ops[0], NULL_RTX, mode);
+   create_fixed_operand (ops[1], temp);
+   expand_insn (icode, 2, ops);
+   return ops[0].value;
+ }
+   else if (SLOW_UNALIGNED_ACCESS (mode, align))
+ temp = extract_bit_field (temp, GET_MODE_BITSIZE (mode),
+   0, TYPE_UNSIGNED (TREE_TYPE (exp)),
+   true, (modifier == EXPAND_STACK_PARM
+  ? NULL_RTX : target),
+   mode, mode);
  }
return temp;
   }
Index: src/gcc/testsuite/gcc.dg/misaligned-expand-1.c
===
--- /dev/null
+++ src/gcc/testsuite/gcc.dg/misaligned-expand-1.c
@@ -0,0 +1,41 @@
+/* Test that expand can generate correct loads of misaligned data even on
+   strict alignment platforms.  */
+
+/* { dg-do run } */
+/* { dg-options -O0 } */
+
+extern void abort ();
+
+typedef unsigned int myint __attribute__((aligned(1)));
+
+unsigned int
+foo (myint *p)
+{
+  return *p;
+}
+
+#define cst 0xdeadbeef
+#define NUM 8
+
+struct blah
+{
+  char c;
+  myint i[NUM];
+};
+
+struct blah g;
+
+int
+main (int argc, char **argv)
+{
+  int i, k;
+  for (k = 0; k  NUM; k++)
+{
+  g.i[k] = cst;
+  i = foo (g.i[k]);
+
+  if (i != cst)
+   abort ();
+}
+  return 0;
+}
Index: src/gcc/testsuite/gcc.dg/misaligned-expand-3.c
===
--- /dev/null
+++ src/gcc/testsuite/gcc.dg/misaligned-expand-3.c
@@ -0,0 +1,43 @@
+/* Test that expand can generate correct stores to misaligned data of complex
+   type even on strict alignment platforms.  */
+
+/* { dg-do run } */
+/* { dg-options -O0 } */
+
+extern void abort ();
+
+typedef _Complex float mycmplx __attribute__((aligned(1)));
+
+void
+foo (mycmplx *p, float r, float i)
+{
+  __real__ *p = r;
+  __imag__ *p = i;
+}
+
+#define cvr 3.2f
+#define cvi 2.5f
+#define NUM 8
+
+struct blah
+{
+  char c;
+  mycmplx x[NUM];
+} __attribute__((packed));
+
+struct blah g;
+
+int
+main (int argc, char **argv)
+{
+  int k;
+
+  for (k = 0; k  NUM; k++)
+{
+  foo (g.x[k], cvr, cvi);
+  if (__real__ g.x[k] != cvr
+ || __imag__ g.x[k] != cvi)
+   abort ();
+}
+  return 0;
+}


Re: [C] Handle #pragma before a parameter

2012-03-14 Thread Joseph S. Myers
On Wed, 14 Mar 2012, Tristan Gingold wrote:

 Hi,
 
 it happens that some system headers on VMS have #pragma between parameters.  
 This is spotted by building the Ada runtime.
 
 This patch simply handles them.
 
 Manually tested by building for ia64-hp-openvms.
 No regressions for c on x86_64-darwin.
 
 Ok for trunk ?

OK.

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


Re: [Patch ARM/ configury] Add fall-back check for gnu_unique_object

2012-03-14 Thread Andreas Schwab
Paolo Bonzini bonz...@gnu.org writes:

 Yes, the # comment is actually part of the macro argument.  If you want
 to write a real comment (i.e. at the m4 rather than shell level) use
 dnl instead of #.

Actually both are part of the macro argument and act like comment
introducers at the m4 level, but they differ in what they expand to.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


Re: Remove DWARF_OFFSET_SIZE, DWARF_INITIAL_LENGTH_SIZE

2012-03-14 Thread Joseph S. Myers
On Wed, 14 Mar 2012, Rainer Orth wrote:

 Jason Merrill ja...@redhat.com writes:
 
  On 03/12/2012 01:41 PM, Joseph S. Myers wrote:
  As a *target macro* it makes sense to remove it - reomve it from
  defaults.h, make it purely internal to dwarf2out.c.  But I think it makes
  sense to have it inside dwarf2out.c
 
  Agreed.
 
 Here's the revised patch.  Bootstrapped without regressions on
 i386-pc-solaris2.10, ok for mainline?

No, I don't think you should simplify all the things you are simplifying 
inside dwarf2out.c.  The initial length really is a function of the offset 
size, not a magic constant 4, and the same applies to all the other things 
you are changing: they are not constants in DWARF so should not be treated 
as such.

I think you should move the definition of DWARF_OFFSET_SIZE into 
dwarf2out.c - with a comment that GCC doesn't generate 64-bit DWARF since 
it's only needed if you have more than 2GB of debug info in a section in a 
single .o file (or something like that) and not change anything else in 
dwarf2out.c.

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


Re: Remove DWARF_OFFSET_SIZE, DWARF_INITIAL_LENGTH_SIZE

2012-03-14 Thread Rainer Orth
Joseph S. Myers jos...@codesourcery.com writes:

 On Wed, 14 Mar 2012, Rainer Orth wrote:

 Jason Merrill ja...@redhat.com writes:
 
  On 03/12/2012 01:41 PM, Joseph S. Myers wrote:
  As a *target macro* it makes sense to remove it - reomve it from
  defaults.h, make it purely internal to dwarf2out.c.  But I think it makes
  sense to have it inside dwarf2out.c
 
  Agreed.
 
 Here's the revised patch.  Bootstrapped without regressions on
 i386-pc-solaris2.10, ok for mainline?

 No, I don't think you should simplify all the things you are simplifying 
 inside dwarf2out.c.  The initial length really is a function of the offset 
 size, not a magic constant 4, and the same applies to all the other things 
 you are changing: they are not constants in DWARF so should not be treated 
 as such.

 I think you should move the definition of DWARF_OFFSET_SIZE into 
 dwarf2out.c - with a comment that GCC doesn't generate 64-bit DWARF since 
 it's only needed if you have more than 2GB of debug info in a section in a 
 single .o file (or something like that) and not change anything else in 
 dwarf2out.c.

Ok, I'll leave that to one of the DWARF maintainers.  Patch withdrawn.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: Remove non-GAS non-ELF support in alpha backend

2012-03-14 Thread Richard Henderson
On 03/14/12 09:09, Rainer Orth wrote:

Nearly ok.

 +  targetm.asm_file_start_file_directive = 0;

This is default and may be deleted.


r~


[patch, gcc RFA] dg-extract-results.sh: Handle KFAILs.

2012-03-14 Thread Doug Evans
The results of running the testsuite in parallel should match the
results when run serially.  This patch adds KFAIL counts so that happens.
[There's still a nit that the order of the results don't precisely match,
but that's a separate issue.]

I will check this into the gdb tree if there are no objections.
Any reason not to apply it to the gcc tree as well?

2012-03-14  Doug Evans  d...@google.com

* dg-extract-results.sh: Handle KFAILs.

Index: dg-extract-results.sh
===
RCS file: /cvs/src/src/gdb/testsuite/dg-extract-results.sh,v
retrieving revision 1.4
diff -u -p -r1.4 dg-extract-results.sh
--- dg-extract-results.sh   4 Jan 2012 08:17:26 -   1.4
+++ dg-extract-results.sh   14 Mar 2012 17:15:07 -
@@ -345,7 +345,7 @@ EOF
 BEGIN {
   variant=$VAR
   tool=$TOOL
-  passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; unsupcnt=0; 
unrescnt=0;
+  passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kfailcnt=0; 
unsupcnt=0; unrescnt=0;
   curvar=; insummary=0
 }
 /^Running target / { curvar = \$3; next }
@@ -354,6 +354,7 @@ BEGIN {
 /^# of unexpected successes/   { if (insummary == 1) xpasscnt += \$5; next; }
 /^# of unexpected failures/{ if (insummary == 1) failcnt += \$5; next; }
 /^# of expected failures/  { if (insummary == 1) xfailcnt += \$5; next; }
+/^# of known failures/ { if (insummary == 1) kfailcnt += \$5; next; }
 /^# of untested testcases/ { if (insummary == 1) untstcnt += \$5; next; }
 /^# of unresolved testcases/   { if (insummary == 1) unrescnt += \$5; next; }
 /^# of unsupported tests/  { if (insummary == 1) unsupcnt += \$5; next; }
@@ -368,6 +369,7 @@ END {
   if (failcnt != 0) printf (# of unexpected failures\t%d\n, failcnt)
   if (xpasscnt != 0) printf (# of unexpected successes\t%d\n, xpasscnt)
   if (xfailcnt != 0) printf (# of expected failures\t\t%d\n, xfailcnt)
+  if (kfailcnt != 0) printf (# of known failures\t\t%d\n, kfailcnt)
   if (untstcnt != 0) printf (# of untested testcases\t\t%d\n, untstcnt)
   if (unrescnt != 0) printf (# of unresolved testcases\t%d\n, unrescnt)
   if (unsupcnt != 0) printf (# of unsupported tests\t\t%d\n, unsupcnt)
@@ -391,12 +393,13 @@ TOTAL_AWK=${TMP}/total.awk
 cat  EOF  $TOTAL_AWK
 BEGIN {
   tool=$TOOL
-  passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; unsupcnt=0; 
unrescnt=0
+  passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kfailcnt=0; 
unsupcnt=0; unrescnt=0
 }
 /^# of expected passes/{ passcnt += \$5 }
 /^# of unexpected failures/{ failcnt += \$5 }
 /^# of unexpected successes/   { xpasscnt += \$5 }
 /^# of expected failures/  { xfailcnt += \$5 }
+/^# of known failures/ { kfailcnt += \$5 }
 /^# of untested testcases/ { untstcnt += \$5 }
 /^# of unresolved testcases/   { unrescnt += \$5 }
 /^# of unsupported tests/  { unsupcnt += \$5 }
@@ -406,6 +409,7 @@ END {
   if (failcnt != 0) printf (# of unexpected failures\t%d\n, failcnt)
   if (xpasscnt != 0) printf (# of unexpected successes\t%d\n, xpasscnt)
   if (xfailcnt != 0) printf (# of expected failures\t\t%d\n, xfailcnt)
+  if (kfailcnt != 0) printf (# of known failures\t\t%d\n, kfailcnt)
   if (untstcnt != 0) printf (# of untested testcases\t\t%d\n, untstcnt)
   if (unrescnt != 0) printf (# of unresolved testcases\t%d\n, unrescnt)
   if (unsupcnt != 0) printf (# of unsupported tests\t\t%d\n, unsupcnt)


[PATCH] Optimize in VRP if ((x cst1) cmp cst2) (PR tree-optimization/52267)

2012-03-14 Thread Jakub Jelinek
Hi!

This patch adds ASSERT_EXPRs derived from
  tmp_N = var_M  cst2;
  if (tmp_N cmp val)
where cst2 and val are constants.  Bootstrapped/regtested
on x86_64-linux and i686-linux, ok for trunk?

2012-03-14  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/52267
* tree-vrp.c (masked_increment): New function.
(register_edge_assert_for_2): Derive ASSERT_EXPRs
from (X  CST1) cmp CST2 tests.

* gcc.dg/pr52267.c: New test.
* gcc.dg/tree-ssa/vrp65.c: New test.
* gcc.dg/tree-ssa/vrp66.c: New test.

--- gcc/tree-vrp.c.jj   2012-03-14 09:39:41.574262693 +0100
+++ gcc/tree-vrp.c  2012-03-14 13:22:49.468537249 +0100
@@ -4338,6 +4338,34 @@ extract_code_and_val_from_cond_with_ops
   return true;
 }
 
+/* Find out smallest RES where RES  VAL  (RES  MASK) == RES, if any
+   (otherwise return VAL).  VAL and MASK must be zero-extended for
+   precision PREC.  If SGNBIT is non-zero, first xor VAL with SGNBIT
+   (to transform signed values into unsigned) and at the end xor
+   SGNBIT back.  */
+
+static double_int
+masked_increment (double_int val, double_int mask, double_int sgnbit,
+ unsigned int prec)
+{
+  double_int bit = double_int_one, res;
+  unsigned int i;
+
+  val = double_int_xor (val, sgnbit);
+  for (i = 0; i  prec; i++, bit = double_int_add (bit, bit))
+{
+  res = mask;
+  if (double_int_zero_p (double_int_and (res, bit)))
+   continue;
+  res = double_int_sub (bit, double_int_one);
+  res = double_int_and_not (double_int_add (val, bit), res);
+  res = double_int_and (res, mask);
+  if (double_int_ucmp (res, val)  0)
+   return double_int_xor (res, sgnbit);
+}
+  return double_int_xor (val, sgnbit);
+}
+
 /* Try to register an edge assertion for SSA name NAME on edge E for
the condition COND contributing to the conditional jump pointed to by BSI.
Invert the condition COND if INVERT is true.
@@ -4466,7 +4494,7 @@ register_edge_assert_for_2 (tree name, e
TREE_CODE (val) == INTEGER_CST)
 {
   gimple def_stmt = SSA_NAME_DEF_STMT (name);
-  tree name2 = NULL_TREE, cst2 = NULL_TREE;
+  tree name2 = NULL_TREE, names[2], cst2 = NULL_TREE;
   tree val2 = NULL_TREE;
   double_int mask = double_int_zero;
   unsigned int prec = TYPE_PRECISION (TREE_TYPE (val));
@@ -4591,6 +4619,248 @@ register_edge_assert_for_2 (tree name, e
  retval = true;
}
}
+
+  /* Add asserts for NAME cmp CST and NAME being defined as
+NAME = NAME2  CST2.
+
+Extract CST2 from the and.  */
+  names[0] = NULL_TREE;
+  names[1] = NULL_TREE;
+  cst2 = NULL_TREE;
+  if (is_gimple_assign (def_stmt)
+  gimple_assign_rhs_code (def_stmt) == BIT_AND_EXPR)
+   {
+ name2 = gimple_assign_rhs1 (def_stmt);
+ cst2 = gimple_assign_rhs2 (def_stmt);
+ if (TREE_CODE (name2) == SSA_NAME
+  INTEGRAL_TYPE_P (TREE_TYPE (name2))
+  TREE_CODE (cst2) == INTEGER_CST
+  !integer_zerop (cst2)
+  prec = 2 * HOST_BITS_PER_WIDE_INT
+  (prec  1
+ || TYPE_UNSIGNED (TREE_TYPE (val
+   {
+ gimple def_stmt2 = SSA_NAME_DEF_STMT (name2);
+ if (gimple_assign_cast_p (def_stmt2))
+   {
+ names[1] = gimple_assign_rhs1 (def_stmt2);
+ if (!CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt2))
+ || !INTEGRAL_TYPE_P (TREE_TYPE (names[1]))
+ || (TYPE_PRECISION (TREE_TYPE (name2))
+ != TYPE_PRECISION (TREE_TYPE (names[1])))
+ || !live_on_edge (e, names[1])
+ || has_single_use (names[1]))
+   names[1] = NULL_TREE;
+   }
+ if (live_on_edge (e, name2)
+  !has_single_use (name2))
+   names[0] = name2;
+   }
+   }
+  if (names[0] || names[1])
+   {
+ double_int minv, maxv = double_int_zero, valv, cst2v;
+ double_int tem, sgnbit;
+ bool valid_p = false, valn = false, cst2n = false;
+ enum tree_code ccode = comp_code;
+
+ valv = double_int_zext (tree_to_double_int (val), prec);
+ cst2v = double_int_zext (tree_to_double_int (cst2), prec);
+ if (!TYPE_UNSIGNED (TREE_TYPE (val)))
+   {
+ valn = double_int_negative_p (double_int_sext (valv, prec));
+ cst2n = double_int_negative_p (double_int_sext (cst2v, prec));
+   }
+ /* If CST2 doesn't have most significant bit set,
+but VAL is negative, we have comparison like
+if ((x  0x123)  -4) (always true).  Just give up.  */
+ if (!cst2n  valn)
+   ccode = ERROR_MARK;
+ if (cst2n)
+   sgnbit = double_int_zext (double_int_lshift (double_int_one,
+   

Re: PATCH RFA: Update Go frontend on gcc 4.7 branch

2012-03-14 Thread Rainer Orth
Ian Lance Taylor i...@google.com writes:

 Unfortunately, this patch introduced several go and/or libgo testsuite
 failures on both Solaris/SPARC and x86 on the 4.7 branch while the
 results were clean before.  I've filed PR go/52583 for this, but not yet
 investigated in detail.

 Hmmm, the patch just copied code from mainline--did you see these issues
 on mainline before?  I did not see these issues when I tested the patch

I did, but didn't get around to reporting them before.

 on the 4.7 branch on Solaris SPARC.

Strange: in my tests, SPARC and x86 are equally affected (with only
slight differences).

 Unfortunately I think it may be too late to change things before the
 4.7.0 release.

Would be a pity, but I fear you're right, given that Richard plans to
cut the release late next week.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: Remove MIPS_DEBUGGING_INFO support

2012-03-14 Thread Rainer Orth
Joseph S. Myers jos...@codesourcery.com writes:

 On Mon, 5 Mar 2012, Rainer Orth wrote:

 The only two users of MIPS_DEBUGGING_INFO are on their way out: I've
 just submitted a patch to remove the OpenBSD/MIPS configuration, and
 IRIX removal will follow soon.  There seems to be no point in retaining
 what seems to be primarily workarounds for quirks in SGI dbx, so the
 following patch removes all other remnants of MIPS_DEBUGGING_INFO.

 As a removed target macro it should be poisoned in system.h.

This is the patch I comitted after rebootstrapping on
i386-pc-solaris2.11, once the remaining uses of MIPS_DEBUGGING_INFO in
gcc/config/alpha were gone.

Rainer


2012-02-24  Rainer Orth  r...@cebitec.uni-bielefeld.de

* dwarf2cfi.c (def_cfa_0): Remove MIPS_DEBUGGING_INFO handling.
(dwarf2out_do_cfi_asm): Likewise.
* dwarf2out.c (output_call_frame_info): Remove MIPS_DEBUGGING_INFO
handling.
(add_data_member_location_attribute): Likewise.
(gen_array_type_die): Likewise.
(gen_subprogram_die): Likewise.
(gen_producer_string): Likewise.
* sdbout.c (sdbout_begin_prologue): Declare unconditionally.
Remove MIPS_DEBUGGING_INFO handling.
(sdb_debug_hooks): Likewise.
(sdbout_begin_block): Likewise.
(sdbout_end_block): Likewise.
(sdbout_begin_prologue): Likewise.
(sdbout_start_source_file): Likewise.
(sdbout_end_source_file): Likewise.
(sdbout_init): Likewise.
* system.h (MIPS_DEBUGGING_INFO): Poison.

# HG changeset patch
# Parent 4495daa74b1dc1d5edbb14483970ce19ec823529
Remove MIPS_DEBUGGING_INFO support

diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -1,6 +1,6 @@
 /* Dwarf2 Call Frame Information helper routines.
Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -724,8 +724,6 @@ def_cfa_0 (dw_cfa_location *old_cfa, dw_
 	cfi-dw_cfi_opc = DW_CFA_def_cfa_offset;
   cfi-dw_cfi_oprnd1.dw_cfi_offset = new_cfa-offset;
 }
-
-#ifndef MIPS_DEBUGGING_INFO  /* SGI dbx thinks this means no offset.  */
   else if (new_cfa-offset == old_cfa-offset
 	old_cfa-reg != INVALID_REGNUM
 	!new_cfa-indirect
@@ -737,8 +735,6 @@ def_cfa_0 (dw_cfa_location *old_cfa, dw_
   cfi-dw_cfi_opc = DW_CFA_def_cfa_register;
   cfi-dw_cfi_oprnd1.dw_cfi_reg_num = new_cfa-reg;
 }
-#endif
-
   else if (new_cfa-indirect == 0)
 {
   /* Construct a DW_CFA_def_cfa register offset instruction,
@@ -3388,10 +3384,6 @@ dwarf2out_do_cfi_asm (void)
 {
   int enc;
 
-#ifdef MIPS_DEBUGGING_INFO
-  return false;
-#endif
-
   if (saved_do_cfi_asm != 0)
 return saved_do_cfi_asm  0;
 
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -879,11 +879,6 @@ output_call_frame_info (int for_eh)
 
   if (for_eh  targetm.terminate_dw2_eh_frame_info)
 dw2_asm_output_data (4, 0, End of Table);
-#ifdef MIPS_DEBUGGING_INFO
-  /* Work around Irix 6 assembler bug whereby labels at the end of a section
- get a value of 0.  Putting .align 0 after the label fixes it.  */
-  ASM_OUTPUT_ALIGN (asm_out_file, 0);
-#endif
 
   /* Turn off app to make assembly quicker.  */
   if (flag_debug_asm)
@@ -14330,16 +14325,7 @@ add_data_member_location_attribute (dw_d
 	  /* The DWARF2 standard says that we should assume that the structure
 	 address is already on the stack, so we can specify a structure
 	 field address by using DW_OP_plus_uconst.  */
-
-#ifdef MIPS_DEBUGGING_INFO
-	  /* ??? The SGI dwarf reader does not handle the DW_OP_plus_uconst
-	 operator correctly.  It works only if we leave the offset on the
-	 stack.  */
-	  op = DW_OP_constu;
-#else
 	  op = DW_OP_plus_uconst;
-#endif
-
 	  loc_descr = new_loc_descr (op, offset, 0);
 	}
 }
@@ -16368,17 +16354,6 @@ gen_array_type_die (tree type, dw_die_re
   return;
 }
 
-  /* ??? The SGI dwarf reader fails for array of array of enum types
- (e.g. const enum machine_mode insn_operand_mode[2][10]) unless the inner
- array type comes before the outer array type.  We thus call gen_type_die
- before we new_die and must prevent nested array types collapsing for this
- target.  */
-
-#ifdef MIPS_DEBUGGING_INFO
-  gen_type_die (TREE_TYPE (type), context_die);
-  collapse_nested_arrays = false;
-#endif
-
   array_die = new_die (DW_TAG_array_type, scope_die, type);
   add_name_attribute (array_die, type_tag (type));
   equate_type_number_to_die (type, array_die);
@@ -16404,14 +16379,6 @@ gen_array_type_die (tree type, dw_die_re
   add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_row_major);
 #endif
 
-#ifdef MIPS_DEBUGGING_INFO
-  /* The SGI compilers handle arrays of unknown bound by setting
- AT_declaration 

Re: [gimplefe] [patch] splits cpp_lshift and cpp_rshift tokens into discrete cpp_less and cpp_greater tokens respectively

2012-03-14 Thread Sandeep Soni
On Tue, Mar 13, 2012 at 9:42 PM, Diego Novillo dnovi...@google.com wrote:
 On 08/03/12 20:47 , Sandeep Soni wrote:

 +/* Splits the token TOKEN into two tokens FIRST_TOKEN and SECOND_TOKEN.
 +   Note that the split should work only if the type of the TOKEN is
 +   either CPP_RSHIFT or CPP_LSHIFT which gets splitted into two tokens


 s/splitted/split/

   while (gl_lex_token (lexer, token))
 -    VEC_safe_push (gimple_token, gc, lexer-tokens, token);
 +    {
 +      if (gl_token_is_of_type (token,CPP_LSHIFT) ||
 +         gl_token_is_of_type (token,CPP_RSHIFT))


 '||' goes at the start of the second line, aligned with the first character
 after the '('.


 OK with those changes.


 Diego.

Done.

-- 
Cheers
Sandy


[google/4.6] Fix problem where -gfission emits duplicate strings (issue5824050)

2012-03-14 Thread Cary Coutant
This is for the google/gcc-4_6 branch only.

Fix output_indirect_string so that it does not output strings that
have already been written to the .debug_str.dwo section.

This is a backport of  part of an unrelated change from upstream 4.7:
http://gcc.gnu.org/ml/gcc-cvs/2011-05/msg00130.html

Tested: bootstrap, core, mantle, crust (in progress).


2012-03-14   Cary Coutant  ccout...@google.com

* dwarf2out.c (output_indirect_string): Check for DW_FORM_strp
instead of presence of label and non-zero refcount.


Index: dwarf2out.c
===
--- dwarf2out.c (revision 185269)
+++ dwarf2out.c (working copy)
@@ -23042,7 +23042,7 @@ output_indirect_string (void **h, void *
 {
   struct indirect_string_node *node = (struct indirect_string_node *) *h;
 
-  if (node-label  node-refcount)
+  if (node-form == DW_FORM_strp)
 {
   switch_to_section (debug_str_section);
   ASM_OUTPUT_LABEL (asm_out_file, node-label);

--
This patch is available for review at http://codereview.appspot.com/5824050


Re: [google/4.6] Fix problem where -gfission emits duplicate strings (issue 5824050)

2012-03-14 Thread saugustine

On 2012/03/14 18:15:25, Cary wrote:

This is for the google/gcc-4_6 branch only.



Fix output_indirect_string so that it does not output strings that
have already been written to the .debug_str.dwo section.



This is a backport of  part of an unrelated change from upstream 4.7:
http://gcc.gnu.org/ml/gcc-cvs/2011-05/msg00130.html



Tested: bootstrap, core, mantle, crust (in progress).




2012-03-14   Cary Coutant  mailto:ccout...@google.com



* dwarf2out.c (output_indirect_string): Check for DW_FORM_strp
instead of presence of label and non-zero refcount.




Index: dwarf2out.c
===
--- dwarf2out.c (revision 185269)
+++ dwarf2out.c (working copy)
@@ -23042,7 +23042,7 @@ output_indirect_string (void **h, void *
  {
struct indirect_string_node *node = (struct indirect_string_node *)

*h;


-  if (node-label  node-refcount)
+  if (node-form == DW_FORM_strp)
  {
switch_to_section (debug_str_section);
ASM_OUTPUT_LABEL (asm_out_file, node-label);



--
This patch is available for review at

http://codereview.appspot.com/5824050

This is OK for google branches.

http://codereview.appspot.com/5824050/


Re: RFC: PATCH: Add -maddress-mode=short|long for x86

2012-03-14 Thread Joseph S. Myers
On Wed, 14 Mar 2012, Uros Bizjak wrote:

 The patch is technically OK for mainline, Joseph - can you please
 review option stuff?

The option changes look fine to me.

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


Re: [patch, gcc RFA] dg-extract-results.sh: Handle KFAILs.

2012-03-14 Thread Mike Stump
On Mar 14, 2012, at 10:21 AM, Doug Evans wrote:
 The results of running the testsuite in parallel should match the
 results when run serially.  This patch adds KFAIL counts so that happens.
 [There's still a nit that the order of the results don't precisely match,
 but that's a separate issue.]
 
 I will check this into the gdb tree if there are no objections.
 Any reason not to apply it to the gcc tree as well?

I don't know that the gcc tree has any of the known stuff, though, that's not 
on purpose or by design, just no one has done it, I think.


New Swedish PO file for 'gcc' (version 4.7-b20120128)

2012-03-14 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Swedish team of translators.  The file is available at:

http://translationproject.org/latest/gcc/sv.po

(This file, 'gcc-4.7-b20120128.sv.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.
coordina...@translationproject.org



[C++ Patch] PR 44783

2012-03-14 Thread Paolo Carlini

Hi,

Manuel provided this patchlet improving his template instantiation notes 
work to use a template_backtrace_limit parameter, as requested in 
c++/44783. I booted and tested it on x86_64-linux.


Is it Ok for mainline? Anything else we want to do here?

Thanks,
Paolo.

///
/c-family
2012-03-14  Manuel López-Ibáñez  m...@gcc.gnu.org

PR c++/44783
* c.opt (ftemplate-backtrace-limit) Add.

/cp
2012-03-14  Manuel López-Ibáñez  m...@gcc.gnu.org

PR c++/44783
* error.c (print_instantiation_partial_context): Use
template_backtrace_limit.

/doc
2012-03-14  Manuel López-Ibáñez  m...@gcc.gnu.org

PR c++/44783
* doc/invoke.texi [C++ Language Options]: Document
-ftemplate-backtrace-limit.
Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 185392)
+++ doc/invoke.texi (working copy)
@@ -192,7 +192,8 @@ in the following sections.
 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names @gol
 -fno-optional-diags  -fpermissive @gol
 -fno-pretty-templates @gol
--frepo  -fno-rtti  -fstats  -ftemplate-depth=@var{n} @gol
+-frepo  -fno-rtti  -fstats  -ftemplate-backtrace-limit=@var{n} @gol
+-ftemplate-depth=@var{n} @gol
 -fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
 -fno-default-inline  -fvisibility-inlines-hidden @gol
 -fvisibility-ms-compat @gol
@@ -2124,6 +2125,11 @@ represented in the minimum number of bits needed t
 enumerators).  This assumption may not be valid if the program uses a
 cast to convert an arbitrary integer value to the enumerated type.
 
+@item -ftemplate-backtrace-limit=@var{n}
+@opindex ftemplate-backtrace-limit
+Set the maximum number of template instantiation notes for a single
+warning or error to @var{n}.  The default value is 10.
+
 @item -ftemplate-depth=@var{n}
 @opindex ftemplate-depth
 Set the maximum instantiation depth for template classes to @var{n}.
Index: c-family/c.opt
===
--- c-family/c.opt  (revision 185392)
+++ c-family/c.opt  (working copy)
@@ -1035,6 +1035,10 @@ ftabstop=
 C ObjC C++ ObjC++ Joined RejectNegative UInteger
 -ftabstop=number Distance between tab stops for column reporting
 
+ftemplate-backtrace-limit=
+C++ ObjC++ Joined RejectNegative UInteger Var(template_backtrace_limit) 
Init(10)
+Set the maximum number of template instantiation notes for a single warning or 
error
+
 ftemplate-depth-
 C++ ObjC++ Joined RejectNegative Undocumented Alias(ftemplate-depth=)
 
Index: cp/error.c
===
--- cp/error.c  (revision 185392)
+++ cp/error.c  (working copy)
@@ -3076,10 +3076,20 @@ print_instantiation_partial_context (diagnostic_co
 
   t = t0;
 
-  if (n_total = 12) 
+  if (template_backtrace_limit
+   n_total  template_backtrace_limit) 
 {
-  int skip = n_total - 10;
-  for (n = 0; n  5; n++)
+  int skip = n_total - template_backtrace_limit;
+  int head = template_backtrace_limit / 2;
+
+  /* Avoid skipping just 1.  If so, skip 2.  */
+  if (skip == 1)
+   {
+ skip = 2;
+ head = (template_backtrace_limit - 1) / 2;
+   }
+ 
+  for (n = 0; n  head; n++)
{
  gcc_assert (t != NULL);
  if (loc != t-locus)
@@ -3088,17 +3098,19 @@ print_instantiation_partial_context (diagnostic_co
  loc = t-locus;
  t = t-next;
}
-  if (t != NULL  skip  1)
+  if (t != NULL  skip  0)
{
  expanded_location xloc;
  xloc = expand_location (loc);
  if (context-show_column)
pp_verbatim (context-printer,
-_(%s:%d:%d:   [ skipping %d instantiation contexts 
]\n),
+_(%s:%d:%d:   [ skipping %d instantiation contexts, 
+  use -ftemplate-backtrace-limit=0 to disable ]\n),
 xloc.file, xloc.line, xloc.column, skip);
  else
pp_verbatim (context-printer,
-_(%s:%d:   [ skipping %d instantiation contexts ]\n),
+_(%s:%d:   [ skipping %d instantiation contexts, 
+  use -ftemplate-backtrace-limit=0 to disable ]\n),
 xloc.file, xloc.line, skip);
  
  do {


[google][4.6]Make option -freorder-functions= invoke function reordering linker plugin (issue5825054)

2012-03-14 Thread Sriraman Tallam
This patch overloads GCC option -freorder-functions with -freoder-functions=* 
which will invoke the linker plugin libfunction_reordering_plugin.so. For now, 
the only accepted option is -freoder-functions=cgedge, where the functions 
which are connected by hot callgraph edges are placed closer.  When 
-freorder-functions is specified without the '=', the original behaviour is 
maintained.  This patch also removes the -fcallgraph-profiles-sections option.

For context, the function_reordering_plugin is only available in gcc-4_6 
branch. I am working on porting this to trunk and will send out a patch soon.


* cgraphbuild.c (remove_cgraph_callee_edges): Replace
flag_callgraph_profiles_sections with flag_reorder_functions.
* final.c (rest_of_handle_final): Ditto.
* configure: Regenerate.
* config.in: undef FRPLUGINSONAME.
* congifure.ac: Define FRPLUGINSONAME.
* config.host: Set host_function_reordering_plugin_soname.
* gcc.c: Invoke function_reordering linker plugin with
-freorder-functions=* option.
(set_func_reorder_linker_plugin_spec): New function.
(main): Call set_func_reorder_linker_plugin_spec when
-freorder-functions=* option is seen.
* common.opt (fcallgraph-profiles-sections):  Remove.
(freorder-functions=): New option.

* function_reordering_plugin.c (register_claim_file_hook): New function
pointer.
(register_all_symbols_read_hook): Ditto.
(no_op): New global.
(out_file): Make static.
(is_api_exist): Make static.
(process_option): New function.
(onload): Return if no_op is set. Do not register handlers until
necessary.


Index: function_reordering_plugin/function_reordering_plugin.c
===
--- function_reordering_plugin/function_reordering_plugin.c (revision 
185372)
+++ function_reordering_plugin/function_reordering_plugin.c (working copy)
@@ -64,6 +64,9 @@ enum ld_plugin_status claim_file_hook (const struc
int *claimed);
 enum ld_plugin_status all_symbols_read_hook ();
 
+static ld_plugin_register_claim_file register_claim_file_hook = NULL;
+static ld_plugin_register_all_symbols_read
+  register_all_symbols_read_hook = NULL;
 static ld_plugin_get_input_section_count get_input_section_count = NULL;
 static ld_plugin_get_input_section_type get_input_section_type = NULL;
 static ld_plugin_get_input_section_name get_input_section_name = NULL;
@@ -73,12 +76,16 @@ static ld_plugin_allow_section_ordering allow_sect
 
 /* The file where the final function order will be stored.
It is ./final_layout.txt.  It can be changed by passing
-   new name to --plugin-opt  */
+   new name to --plugin-opt  as --plugin-opt file=name.
+   To dump to stderr, say --plugin-opt file=stderr.  */
 
-char *out_file = ./final_layout.txt;
+static char *out_file = ./final_layout.txt;
 
-int is_api_exist = 0;
+static int is_api_exist = 0;
 
+/* The plugin does nothing when no-op is 1.  */
+static int no_op = 0;
+
 /* Copies new output file name out_file  */
 void get_filename (const char *name)
 {
@@ -91,6 +98,39 @@ void get_filename (const char *name)
   strcpy (out_file, name);
 }
 
+/* Process options to plugin.  Options with prefix group= are special.
+   They specify the type of grouping. The option group=none makes the
+   plugin do nothing.   Options with prefix file= set the output file
+   where the final function order must be stored.  */
+void
+process_option (const char *name)
+{
+  const char *option_group = group=;
+  const char *option_file = file=;
+
+  /* Check if option is group=  */
+  if (strncmp (name, option_group, strlen (option_group)) == 0)
+{
+  if (strcmp (name + strlen (option_group), none) == 0)
+   no_op = 1;
+  else
+   no_op = 0;
+  return;
+}
+
+  /* Check if option is file= */
+  if (strncmp (name, option_file, strlen (option_file)) == 0)
+{
+  get_filename (name + strlen (option_file));
+  return;
+}
+
+  /* Unknown option, set no_op to 1.  */
+  no_op = 1;
+  fprintf (stderr, Unknown option to function reordering plugin :%s\n,
+  name);
+}
+
 /* Plugin entry point.  */
 enum ld_plugin_status
 onload (struct ld_plugin_tv *tv)
@@ -105,14 +145,16 @@ onload (struct ld_plugin_tv *tv)
 case LDPT_GOLD_VERSION:
   break;
 case LDPT_OPTION:
- get_filename (entry-tv_u.tv_string);
+ process_option (entry-tv_u.tv_string);
+ /* If no_op is set, do not do anything else.  */
+ if (no_op) return LDPS_OK;
  break;
 case LDPT_REGISTER_CLAIM_FILE_HOOK:
-  assert ((*entry-tv_u.tv_register_claim_file) (claim_file_hook) == 
LDPS_OK);
+ register_claim_file_hook = *entry-tv_u.tv_register_claim_file;
   break;
case LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK:
-  assert 

Re: [google][4.6]Make option -freorder-functions= invoke function reordering linker plugin (issue5825054)

2012-03-14 Thread Sriraman Tallam
On Wed, Mar 14, 2012 at 1:56 PM, Sriraman Tallam tmsri...@google.com wrote:
 This patch overloads GCC option -freorder-functions with -freoder-functions=* 
 which will invoke the linker plugin libfunction_reordering_plugin.so. For 
 now, the only accepted option is -freoder-functions=cgedge, where the 
 functions which are connected by hot callgraph edges are placed closer.  When 
 -freorder-functions is specified without the '=', the original behaviour is 
 maintained.  This patch also removes the -fcallgraph-profiles-sections option.

 For context, the function_reordering_plugin is only available in gcc-4_6 
 branch. I am working on porting this to trunk and will send out a patch soon.


        * cgraphbuild.c (remove_cgraph_callee_edges): Replace
        flag_callgraph_profiles_sections with flag_reorder_functions.
        * final.c (rest_of_handle_final): Ditto.
        * configure: Regenerate.
        * config.in: undef FRPLUGINSONAME.
        * congifure.ac: Define FRPLUGINSONAME.
        * config.host: Set host_function_reordering_plugin_soname.
        * gcc.c: Invoke function_reordering linker plugin with
        -freorder-functions=* option.
        (set_func_reorder_linker_plugin_spec): New function.
        (main): Call set_func_reorder_linker_plugin_spec when
        -freorder-functions=* option is seen.
        * common.opt (fcallgraph-profiles-sections):  Remove.
        (freorder-functions=): New option.

        * function_reordering_plugin.c (register_claim_file_hook): New function
        pointer.
        (register_all_symbols_read_hook): Ditto.
        (no_op): New global.
        (out_file): Make static.
        (is_api_exist): Make static.
        (process_option): New function.
        (onload): Return if no_op is set. Do not register handlers until
        necessary.


 Index: function_reordering_plugin/function_reordering_plugin.c
 ===
 --- function_reordering_plugin/function_reordering_plugin.c     (revision 
 185372)
 +++ function_reordering_plugin/function_reordering_plugin.c     (working copy)
 @@ -64,6 +64,9 @@ enum ld_plugin_status claim_file_hook (const struc
                                        int *claimed);
  enum ld_plugin_status all_symbols_read_hook ();

 +static ld_plugin_register_claim_file register_claim_file_hook = NULL;
 +static ld_plugin_register_all_symbols_read
 +  register_all_symbols_read_hook = NULL;
  static ld_plugin_get_input_section_count get_input_section_count = NULL;
  static ld_plugin_get_input_section_type get_input_section_type = NULL;
  static ld_plugin_get_input_section_name get_input_section_name = NULL;
 @@ -73,12 +76,16 @@ static ld_plugin_allow_section_ordering allow_sect

  /* The file where the final function order will be stored.
    It is ./final_layout.txt.  It can be changed by passing
 -   new name to --plugin-opt  */
 +   new name to --plugin-opt  as --plugin-opt file=name.
 +   To dump to stderr, say --plugin-opt file=stderr.  */

 -char *out_file = ./final_layout.txt;
 +static char *out_file = ./final_layout.txt;

 -int is_api_exist = 0;
 +static int is_api_exist = 0;

 +/* The plugin does nothing when no-op is 1.  */
 +static int no_op = 0;
 +
  /* Copies new output file name out_file  */
  void get_filename (const char *name)
  {
 @@ -91,6 +98,39 @@ void get_filename (const char *name)
   strcpy (out_file, name);
  }

 +/* Process options to plugin.  Options with prefix group= are special.
 +   They specify the type of grouping. The option group=none makes the
 +   plugin do nothing.   Options with prefix file= set the output file
 +   where the final function order must be stored.  */
 +void
 +process_option (const char *name)
 +{
 +  const char *option_group = group=;
 +  const char *option_file = file=;
 +
 +  /* Check if option is group=  */
 +  if (strncmp (name, option_group, strlen (option_group)) == 0)
 +    {
 +      if (strcmp (name + strlen (option_group), none) == 0)
 +       no_op = 1;
 +      else
 +       no_op = 0;
 +      return;
 +    }
 +
 +  /* Check if option is file= */
 +  if (strncmp (name, option_file, strlen (option_file)) == 0)
 +    {
 +      get_filename (name + strlen (option_file));
 +      return;
 +    }
 +
 +  /* Unknown option, set no_op to 1.  */
 +  no_op = 1;
 +  fprintf (stderr, Unknown option to function reordering plugin :%s\n,
 +          name);
 +}
 +
  /* Plugin entry point.  */
  enum ld_plugin_status
  onload (struct ld_plugin_tv *tv)
 @@ -105,14 +145,16 @@ onload (struct ld_plugin_tv *tv)
         case LDPT_GOLD_VERSION:
           break;
         case LDPT_OPTION:
 -         get_filename (entry-tv_u.tv_string);
 +         process_option (entry-tv_u.tv_string);
 +         /* If no_op is set, do not do anything else.  */
 +         if (no_op) return LDPS_OK;
          break;
         case LDPT_REGISTER_CLAIM_FILE_HOOK:
 -          assert ((*entry-tv_u.tv_register_claim_file) (claim_file_hook) == 
 LDPS_OK);
 +         

Re: RFC: PATCH: Add -maddress-mode=short|long for x86

2012-03-14 Thread Gerald Pfeifer
On Wed, 14 Mar 2012, Uros Bizjak wrote:
 I have also added Gerald to CC, to check if everything is OK with
 added documentation.

Joseph is better with that than I am, but I'll give it a try. :-)

+@item -maddress-mode=long
+@opindex maddress-mode=long
+Generate code for long address mode.  It is only supported for 64-bit
+and x32 environments.  This is the default address mode for 64-bit
+environment.

I cannot formally explain why, but would swap It and This in
this paragraph and the other.

In any case 64-bit environments (Plural).

Fine with these changes.


Apart from the above, at least invoke.texi does not define what an x32 
environment is.  Shouldn't that done somewhere (before this terminology
is used)?

Gerald


Re: [PATCH] Fix PR49484, gthr requirements update (target maintainers have a looksee)

2012-03-14 Thread Gerald Pfeifer
On Tue, 13 Mar 2012, Richard Guenther wrote:
 Goes back to rev. 5880 by rms, at which time tsystem.h did not exist.
 
 I'm going to remove those two lines, bootstrap  test it and commit as
 obvious.

Thanks, Richard.  I could not do the tests you suggested yesterday
before seeing this other mail.  But I can confirm that GCC again
bootstraps on the FreeBSD tester(s) in question.

Gerald


[SH] Add FPUL usage testcase

2012-03-14 Thread Oleg Endo
Hi,

I'd like to add an SH target testcase which is supposed to check the
usage of the FPUL register when float values are treated as int and vice
versa.  Does this make sense?

Tested against rev 185360 with the usual 

make -k check RUNTESTFLAGS=--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a-single/-mb,
-m4-single/-ml,-m4-single/-mb,
-m4a-single/-ml,-m4a-single/-mb}

and individually with some of the sub-target variations that do not have
an FPU (for which the test is skipped).

Cheers,
Oleg


testsuite/ChangeLog

* gcc.target/sh/fpul-usage-1.c: New.



Re: [google][4.6]Make option -freorder-functions= invoke function reordering linker plugin (issue5825054)

2012-03-14 Thread Xinliang David Li
thanks. This greatly improves the usability of the plugin based
function reordering feature and is in a shape that can be pushed to
trunk.

Regarding the sub-options, cgedge does not seem user friendly. How
about just -freorder-functions=callgraph or
-freorder-function=clustering?

What is the interaction with -ffunction-sections? Should it be turned
on when this flavor of reordering is on? Or at least a warning is
given ?

Thanks,

David

On Wed, Mar 14, 2012 at 1:56 PM, Sriraman Tallam tmsri...@google.com wrote:
 This patch overloads GCC option -freorder-functions with -freoder-functions=* 
 which will invoke the linker plugin libfunction_reordering_plugin.so. For 
 now, the only accepted option is -freoder-functions=cgedge, where the 
 functions which are connected by hot callgraph edges are placed closer.  When 
 -freorder-functions is specified without the '=', the original behaviour is 
 maintained.  This patch also removes the -fcallgraph-profiles-sections option.

 For context, the function_reordering_plugin is only available in gcc-4_6 
 branch. I am working on porting this to trunk and will send out a patch soon.


        * cgraphbuild.c (remove_cgraph_callee_edges): Replace
        flag_callgraph_profiles_sections with flag_reorder_functions.
        * final.c (rest_of_handle_final): Ditto.
        * configure: Regenerate.
        * config.in: undef FRPLUGINSONAME.
        * congifure.ac: Define FRPLUGINSONAME.
        * config.host: Set host_function_reordering_plugin_soname.
        * gcc.c: Invoke function_reordering linker plugin with
        -freorder-functions=* option.
        (set_func_reorder_linker_plugin_spec): New function.
        (main): Call set_func_reorder_linker_plugin_spec when
        -freorder-functions=* option is seen.
        * common.opt (fcallgraph-profiles-sections):  Remove.
        (freorder-functions=): New option.

        * function_reordering_plugin.c (register_claim_file_hook): New function
        pointer.
        (register_all_symbols_read_hook): Ditto.
        (no_op): New global.
        (out_file): Make static.
        (is_api_exist): Make static.
        (process_option): New function.
        (onload): Return if no_op is set. Do not register handlers until
        necessary.


 Index: function_reordering_plugin/function_reordering_plugin.c
 ===
 --- function_reordering_plugin/function_reordering_plugin.c     (revision 
 185372)
 +++ function_reordering_plugin/function_reordering_plugin.c     (working copy)
 @@ -64,6 +64,9 @@ enum ld_plugin_status claim_file_hook (const struc
                                        int *claimed);
  enum ld_plugin_status all_symbols_read_hook ();

 +static ld_plugin_register_claim_file register_claim_file_hook = NULL;
 +static ld_plugin_register_all_symbols_read
 +  register_all_symbols_read_hook = NULL;
  static ld_plugin_get_input_section_count get_input_section_count = NULL;
  static ld_plugin_get_input_section_type get_input_section_type = NULL;
  static ld_plugin_get_input_section_name get_input_section_name = NULL;
 @@ -73,12 +76,16 @@ static ld_plugin_allow_section_ordering allow_sect

  /* The file where the final function order will be stored.
    It is ./final_layout.txt.  It can be changed by passing
 -   new name to --plugin-opt  */
 +   new name to --plugin-opt  as --plugin-opt file=name.
 +   To dump to stderr, say --plugin-opt file=stderr.  */

 -char *out_file = ./final_layout.txt;
 +static char *out_file = ./final_layout.txt;

 -int is_api_exist = 0;
 +static int is_api_exist = 0;

 +/* The plugin does nothing when no-op is 1.  */
 +static int no_op = 0;
 +
  /* Copies new output file name out_file  */
  void get_filename (const char *name)
  {
 @@ -91,6 +98,39 @@ void get_filename (const char *name)
   strcpy (out_file, name);
  }

 +/* Process options to plugin.  Options with prefix group= are special.
 +   They specify the type of grouping. The option group=none makes the
 +   plugin do nothing.   Options with prefix file= set the output file
 +   where the final function order must be stored.  */
 +void
 +process_option (const char *name)
 +{
 +  const char *option_group = group=;
 +  const char *option_file = file=;
 +
 +  /* Check if option is group=  */
 +  if (strncmp (name, option_group, strlen (option_group)) == 0)
 +    {
 +      if (strcmp (name + strlen (option_group), none) == 0)
 +       no_op = 1;
 +      else
 +       no_op = 0;
 +      return;
 +    }
 +
 +  /* Check if option is file= */
 +  if (strncmp (name, option_file, strlen (option_file)) == 0)
 +    {
 +      get_filename (name + strlen (option_file));
 +      return;
 +    }
 +
 +  /* Unknown option, set no_op to 1.  */
 +  no_op = 1;
 +  fprintf (stderr, Unknown option to function reordering plugin :%s\n,
 +          name);
 +}
 +
  /* Plugin entry point.  */
  enum ld_plugin_status
  onload (struct ld_plugin_tv *tv)
 @@ -105,14 +145,16 @@ onload (struct 

Re: RFC: PATCH: Add -maddress-mode=short|long for x86

2012-03-14 Thread H.J. Lu
On Wed, Mar 14, 2012 at 2:57 PM, Gerald Pfeifer ger...@pfeifer.com wrote:
 On Wed, 14 Mar 2012, Uros Bizjak wrote:
 I have also added Gerald to CC, to check if everything is OK with
 added documentation.

 Joseph is better with that than I am, but I'll give it a try. :-)

 +@item -maddress-mode=long
 +@opindex maddress-mode=long
 +Generate code for long address mode.  It is only supported for 64-bit
 +and x32 environments.  This is the default address mode for 64-bit
 +environment.

 I cannot formally explain why, but would swap It and This in
 this paragraph and the other.

 In any case 64-bit environments (Plural).

 Fine with these changes.

I checked in the updated patch.


 Apart from the above, at least invoke.texi does not define what an x32
 environment is.  Shouldn't that done somewhere (before this terminology
 is used)?


I am not sure where to put it.  In any case, here is a patch to update
GCC 4.7.0 changes with link to x32 website.


-- 
H.J.
Index: htdocs/gcc-4.7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.96
diff -u -p -r1.96 changes.html
--- htdocs/gcc-4.7/changes.html	7 Mar 2012 14:15:35 -	1.96
+++ htdocs/gcc-4.7/changes.html	14 Mar 2012 22:31:50 -
@@ -720,6 +720,8 @@ int add_values (const __flash int *p, in
   for Windows mingw targets./li
 liSupport for new AMD family 15h processors (Piledriver core) is now available
   through code-march=bdver2/code and code-mtune=bdver2/code options./li
+liSupport for a href=http://sites.google.com/site/x32abi/;x32 psABI/a
+  is now available through code-mx32/code option.
 li.../li
   /ul
 


Re: [SH] Add FPUL usage testcase

2012-03-14 Thread Oleg Endo
On Thu, 2012-03-15 at 08:12 +0900, Kaz Kojima wrote:
 Oleg Endo oleg.e...@t-online.de wrote:
  I'd like to add an SH target testcase which is supposed to check the
  usage of the FPUL register when float values are treated as int and vice
  versa.  Does this make sense?
  
  Tested against rev 185360 with the usual 
  
  make -k check RUNTESTFLAGS=--target_board=sh-sim
  \{-m2/-ml,-m2/-mb,-m2a-single/-mb,
  -m4-single/-ml,-m4-single/-mb,
  -m4a-single/-ml,-m4a-single/-mb}
  
  and individually with some of the sub-target variations that do not have
  an FPU (for which the test is skipped).
 
 ENOPATCH.  Sounds a good idea though.

Argh, sorry .. now there is.
Index: gcc/testsuite/gcc.target/sh/fpul-usage-1.c
===
--- gcc/testsuite/gcc.target/sh/fpul-usage-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/fpul-usage-1.c	(revision 0)
@@ -0,0 +1,24 @@
+/* Check that the FPUL register is used when reading a float as an int and
+   vice versa, as opposed to pushing and popping the values over the stack.  */
+/* { dg-do compile { target sh*-*-* } } */
+/* { dg-options -O1 } */
+/* { dg-skip-if  { sh*-*-* } { -m1 -m2 -m4al *nofpu -m4-340* -m4-400* -m4-500* -m5* } {  } }  */
+/* { dg-final { scan-assembler fpul } } */
+/* { dg-final { scan-assembler-not r15 } } */
+
+int
+float_as_int (float val)
+{
+  union { float f; int i; } u;
+  u.f = val;
+  return u.i;
+}
+
+float
+int_as_float (int val)
+{
+  union { float f; int i; } u;
+  u.i = val;
+  return u.f;
+}
+


Re: [Patch, libfortran] Reduce default precision for list-directed and G0 real output

2012-03-14 Thread Jerry DeLisle

On 03/12/2012 05:28 PM, Janne Blomqvist wrote:

Hi,

currently when writing a value of type real or complex using
list-directed output, the G0 edit descriptor, or namelist output,
gfortran chooses the number of significant digits such that a
binary-ascii-binary roundtrip recovers the original value exactly,
per IEEE 754-2008. Assuming, of course, that the target snprintf() and
strto{f,d,ld,q} functions are up to the task. However, I think this
choice is not a good idea:

- The standard doesn't require this behavior, it merely says something
along reasonable processor-dependent values for w, d, and e shall be
chosen. Thus, a user who requires an exact roundtrip must specify the
number of digits (d) himself anyway.


True, but we did deliberately make an effort to do the round trip and at the 
time all thought it was the right thing to do, putting accuracy over speed. 
This would be a reversal of philosophy and in my opinion, if people need speed 
with formatted I/O, your other patch that adjusts the internal guard digits is 
the way to go.  I vote do not change.


- If an exact roundtrip is required, the standard provides the B, O,
and Z edit descriptors which do guarantee this.


Maybe, but not very convenient.



- G formatting doesn't work very well when d is large (in libgfortran,
list-directed and namelist real output uses G formatting, so this
applies in these cases as well). Somewhat simplified, G formatting
works such that when the exponent is in the range [-1, d], F editing
is used, otherwise E editing. Thus, with a large d, F editing is used
for numbers with a large magnitude, making the result more or less
unreadable. For instance, what is the magnitude of
-333.33350? This output is for quad
precision, but the same problem exists to a lesser extent for smaller
real kinds as well.


We still have some outstanding rounding issues to resolve and I think we should 
do so before getting into these finer points.  The above example illustrates a 
feature, not necessarily that anyone really uses it.  if one wants more readable 
results, format it to suit.




- In many if not most uses, printing out the result in full precision
is not needed or just pointless if precision loss has already occured
during the calculation.


Agree



Thus, I suggest that the choice of d should be based on readability
and usefulness for the common case rather than guaranteeing an exact
roundtrip. The attached patch does this. Based on my own unscientific
tests, the patch chooses d=6 significant digits, as with 6 digits it's
still relatively easy to eyeball the magnitude of a number when F
editing is used without having to explicitly count digits. At the same
time, 6 significant digits is usually more than enough when reading
the output of a program.  Incidentally, 6 significant digits is also
what is used with the printf() %g specifier if the precision is not
explicitly specified, presumably for roughly similar reasons as stated
above.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?


I appreciate your thoughts and efforts, but think we should hold off on this 
one.

Sincerely best regards,

Jerry


Re: [SH] Add FPUL usage testcase

2012-03-14 Thread Kaz Kojima
Oleg Endo oleg.e...@t-online.de wrote:
 I'd like to add an SH target testcase which is supposed to check the
 usage of the FPUL register when float values are treated as int and vice
 versa.  Does this make sense?
 
 Tested against rev 185360 with the usual 
 
 make -k check RUNTESTFLAGS=--target_board=sh-sim
 \{-m2/-ml,-m2/-mb,-m2a-single/-mb,
 -m4-single/-ml,-m4-single/-mb,
 -m4a-single/-ml,-m4a-single/-mb}
 
 and individually with some of the sub-target variations that do not have
 an FPU (for which the test is skipped).
 
 ENOPATCH.  Sounds a good idea though.
 
 Argh, sorry .. now there is.

This patch is OK.

Regards,
kaz


[pph] Identify and diagnose one class of bad merges (issue5822054)

2012-03-14 Thread Diego Novillo
Detect one class of invalid merges.

When merging two different EXPRs, we are currently merging some trees
that should not be merged.  This patch tries to identify one case
where we can certainly detect that a bad merge is about to happen.

This fixes no tests, but diagnoses quite a few bad merges in our
internal testing.  Lawrence will be producing test cases for those.

2012-03-14   Diego Novillo  dnovi...@google.com

* pph-in.c (pph_in_merge_key_tree_with_searcher): Detect and
diagnose attempts to merge two distinct trees from the same
PPH image.

diff --git a/gcc/cp/pph-in.c b/gcc/cp/pph-in.c
index a328e13..ba89aa4 100644
--- a/gcc/cp/pph-in.c
+++ b/gcc/cp/pph-in.c
@@ -2625,7 +2625,23 @@ pph_in_merge_key_tree_with_searcher (pph_stream *stream, 
void *holder,
   gcc_assert (expr != NULL);
 
   if (expr != read_expr)
-pph_merge_tree_attributes (expr, read_expr);
+{
+  /* When STREAM was generated, EXPR and READ_EXPR were saved as
+distinct trees (otherwise, we would have gotten READ_EXPR as
+an internal reference). That's why we are reading them now as
+distinct pointers.
+
+So, if we find that EXPR has already been registered in
+STREAM's cache, it means that we should not be trying to
+merge them.  After all, the writer considered them different
+objects.  */
+  if (pph_cache_lookup (stream-cache, expr, NULL,
+   pph_tree_code_to_tag (expr)))
+   fatal_error (Trying to merge distinct trees from the same 
+PPH image %s, stream-name);
+
+  pph_merge_tree_attributes (expr, read_expr);
+}
 
   pph_cache_insert_at (stream-cache, expr, ix,
   pph_tree_code_to_tag (expr));

--
This patch is available for review at http://codereview.appspot.com/5822054


[pph] Add a GC root for the lexer (issue5822055)

2012-03-14 Thread Diego Novillo
Add a GC root for the lexer.

This GC root is required to support running the garbage collector
during lexing.  This happens when the lexer loads pre-parsed headers.
Loading these headers calls into the middle-end, which may run the
garbage collector.

This was triggering in some of the bigger translation units that cause
a lot of GC activity.

2012-03-14   Diego Novillo  dnovi...@google.com

* parser.c (the_lexer): Declare.
(cp_lexer_new_main): Initialize.
(c_parse_file): Set to NULL.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 8c231c02..0d87b0f 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -613,6 +613,14 @@ cp_lexer_alloc (void)
 }
 
 
+/* The lexer.   This GC root is required to support running the
+   garbage collector during lexing.  This happens when the lexer loads
+   pre-parsed headers.  Loading these headers calls into the
+   middle-end, which may run the garbage collector.  */
+
+static GTY (()) cp_lexer *the_lexer;
+
+
 /* Create a new main C++ lexer, the lexer that gets tokens from the
preprocessor.  */
 
@@ -627,7 +635,7 @@ cp_lexer_new_main (void)
  allocating any memory.  */
   cp_parser_initial_pragma (token);
 
-  lexer = cp_lexer_alloc ();
+  the_lexer = lexer = cp_lexer_alloc ();
 
   /* Put the first token in the buffer.  */
   VEC_quick_push (cp_token, lexer-buffer, token);
@@ -27497,6 +27505,7 @@ c_parse_file (void)
? dk_no_deferred : dk_no_check);
   cp_parser_translation_unit (the_parser);
   the_parser = NULL;
+  the_lexer = NULL;
 
   if (pph_enabled_p ())
 pph_finish ();

--
This patch is available for review at http://codereview.appspot.com/5822055


[google][4.6]Make option -freorder-functions= invoke function reordering linker plugin (issue5825054)

2012-03-14 Thread Sriraman Tallam
Made the following changes:

* -ffunction-sections turned on with -freorder-functions=
* Change name from cgedge to callgraph.
* The plugin should not dump final layout to file by default.


* cgraphbuild.c (remove_cgraph_callee_edges): Replace
flag_callgraph_profiles_sections with flag_reorder_functions.
* final.c (rest_of_handle_final): Ditto.
* configure: Regenerate.
* config.in: undef FRPLUGINSONAME.
* congifure.ac: Define FRPLUGINSONAME.
* config.host: Set host_function_reordering_plugin_soname.
* gcc.c: Invoke function_reordering linker plugin with
-freorder-functions=* option.
(set_func_reorder_linker_plugin_spec): New function.
(main): Call set_func_reorder_linker_plugin_spec when
-freorder-functions=* option is seen.
* common.opt (fcallgraph-profiles-sections):  Remove.
(freorder-functions=): New option.
* testsuite/g++.dg/tree-prof/callgraph-profiles.C: Replace
-fcallgraph-profiles-sections with -freorder-functions=callgraph.
* opts.c (finish_options): Turn on -ffunction-sections when
-freorder-functions= is used.

* function_reordering_plugin.c (register_claim_file_hook): New function
pointer.
(register_all_symbols_read_hook): Ditto.
(no_op): New global.
(out_file): Make static.
(is_api_exist): Make static.
(process_option): New function.
(onload): Return if no_op is set. Do not register handlers until
necessary.
(get_load): Check if out_file is NULL before opening  closing the
file.
* callgraph.c (find_pettis_hansen_function_layout):
(get_layout): Dump only when fp is not NULL.


Index: gcc/cgraphbuild.c
===
--- gcc/cgraphbuild.c   (revision 185372)
+++ gcc/cgraphbuild.c   (working copy)
@@ -703,10 +703,10 @@ extern bool cgraph_callee_edges_final_cleanup;
 static unsigned int
 remove_cgraph_callee_edges (void)
 {
-  /* The -fcallgraph-profiles-sections flag needs the call-graph preserved
+  /* The -freorder-functions=* flag needs the call-graph preserved
  till pass_final.  */
   if (cgraph_callee_edges_final_cleanup
-   flag_callgraph_profiles_sections)
+   flag_reorder_functions  1)
   return 0;
 
   cgraph_node_remove_callees (cgraph_node (current_function_decl));
Index: gcc/configure
===
--- gcc/configure   (revision 185372)
+++ gcc/configure   (working copy)
@@ -4861,7 +4861,7 @@ fi
 { $as_echo $as_me:${as_lineno-$LINENO}: result: $acx_cv_cc_gcc_supports_ada 
5
 $as_echo $acx_cv_cc_gcc_supports_ada 6; }
 
-if test x$GNATBIND != xno  test x$GNATMAKE != xno  test 
x$acx_cv_cc_gcc_supports_ada != xno; then
+if test x$GNATBIND != xno  test x$GNATMAKE != xno  test 
x$acx_cv_cc_gcc_supports_ada != xno; then
   have_gnat=yes
 else
   have_gnat=no
@@ -11480,6 +11480,12 @@ esac
 
 
 cat confdefs.h _ACEOF
+#define FRPLUGINSONAME ${host_function_reordering_plugin_soname}
+_ACEOF
+
+
+
+cat confdefs.h _ACEOF
 #define LTOPLUGINSONAME ${host_lto_plugin_soname}
 _ACEOF
 
@@ -17572,7 +17578,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext _LT_EOF
-#line 17575 configure
+#line 17581 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
@@ -17678,7 +17684,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext _LT_EOF
-#line 17681 configure
+#line 17687 configure
 #include confdefs.h
 
 #if HAVE_DLFCN_H
Index: gcc/final.c
===
--- gcc/final.c (revision 185372)
+++ gcc/final.c (working copy)
@@ -4421,9 +4421,9 @@ rest_of_handle_final (void)
decl_fini_priority_lookup
  (current_function_decl));
 
-  /* With -fcallgraph-profiles-sections, add .gnu.callgraph.text section
+  /* With -freorder-functions=, add .gnu.callgraph.text section
  for storing profiling information. */
-  if (flag_callgraph_profiles_sections
+  if (flag_reorder_functions  1
flag_profile_use
cgraph_node (current_function_decl) != NULL
(cgraph_node (current_function_decl))-callees != NULL)
Index: gcc/gcc.c
===
--- gcc/gcc.c   (revision 185372)
+++ gcc/gcc.c   (working copy)
@@ -663,6 +663,9 @@ proper position among the other output files.  */
 -plugin-opt=-fresolution=%u.res \
 %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} 
\
 }PLUGIN_COND_CLOSE \
+%{freorder-functions=*: \
+-plugin %(func_reorder_linker_plugin_file) \
+-plugin-opt=%(func_reorder_linker_plugin_opt)} \
 %{flto|flto=*:%fcompare-debug*} \
 %{flto} %{flto=*} %l  LINK_PIE_SPEC \

Re: [google][4.6]Make option -freorder-functions= invoke function reordering linker plugin (issue5825054)

2012-03-14 Thread Sriraman Tallam
On Wed, Mar 14, 2012 at 6:56 PM, Sriraman Tallam tmsri...@google.com wrote:
 Made the following changes:

 * -ffunction-sections turned on with -freorder-functions=
 * Change name from cgedge to callgraph.
 * The plugin should not dump final layout to file by default.


        * cgraphbuild.c (remove_cgraph_callee_edges): Replace
        flag_callgraph_profiles_sections with flag_reorder_functions.
        * final.c (rest_of_handle_final): Ditto.
        * configure: Regenerate.
        * config.in: undef FRPLUGINSONAME.
        * congifure.ac: Define FRPLUGINSONAME.
        * config.host: Set host_function_reordering_plugin_soname.
        * gcc.c: Invoke function_reordering linker plugin with
        -freorder-functions=* option.
        (set_func_reorder_linker_plugin_spec): New function.
        (main): Call set_func_reorder_linker_plugin_spec when
        -freorder-functions=* option is seen.
        * common.opt (fcallgraph-profiles-sections):  Remove.
        (freorder-functions=): New option.
        * testsuite/g++.dg/tree-prof/callgraph-profiles.C: Replace
        -fcallgraph-profiles-sections with -freorder-functions=callgraph.
        * opts.c (finish_options): Turn on -ffunction-sections when
        -freorder-functions= is used.

        * function_reordering_plugin.c (register_claim_file_hook): New function
        pointer.
        (register_all_symbols_read_hook): Ditto.
        (no_op): New global.
        (out_file): Make static.
        (is_api_exist): Make static.
        (process_option): New function.
        (onload): Return if no_op is set. Do not register handlers until
        necessary.
        (get_load): Check if out_file is NULL before opening  closing the
        file.
        * callgraph.c (find_pettis_hansen_function_layout):
        (get_layout): Dump only when fp is not NULL.


 Index: gcc/cgraphbuild.c
 ===
 --- gcc/cgraphbuild.c   (revision 185372)
 +++ gcc/cgraphbuild.c   (working copy)
 @@ -703,10 +703,10 @@ extern bool cgraph_callee_edges_final_cleanup;
  static unsigned int
  remove_cgraph_callee_edges (void)
  {
 -  /* The -fcallgraph-profiles-sections flag needs the call-graph preserved
 +  /* The -freorder-functions=* flag needs the call-graph preserved
      till pass_final.  */
   if (cgraph_callee_edges_final_cleanup
 -       flag_callgraph_profiles_sections)
 +       flag_reorder_functions  1)
       return 0;

   cgraph_node_remove_callees (cgraph_node (current_function_decl));
 Index: gcc/configure
 ===
 --- gcc/configure       (revision 185372)
 +++ gcc/configure       (working copy)
 @@ -4861,7 +4861,7 @@ fi
  { $as_echo $as_me:${as_lineno-$LINENO}: result: 
 $acx_cv_cc_gcc_supports_ada 5
  $as_echo $acx_cv_cc_gcc_supports_ada 6; }

 -if test x$GNATBIND != xno  test x$GNATMAKE != xno  test 
 x$acx_cv_cc_gcc_supports_ada != xno; then
 +if test x$GNATBIND != xno  test x$GNATMAKE != xno  test 
 x$acx_cv_cc_gcc_supports_ada != xno; then
   have_gnat=yes
  else
   have_gnat=no
 @@ -11480,6 +11480,12 @@ esac


  cat confdefs.h _ACEOF
 +#define FRPLUGINSONAME ${host_function_reordering_plugin_soname}
 +_ACEOF
 +
 +
 +
 +cat confdefs.h _ACEOF
  #define LTOPLUGINSONAME ${host_lto_plugin_soname}
  _ACEOF

 @@ -17572,7 +17578,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext _LT_EOF
 -#line 17575 configure
 +#line 17581 configure
  #include confdefs.h

  #if HAVE_DLFCN_H
 @@ -17678,7 +17684,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat  conftest.$ac_ext _LT_EOF
 -#line 17681 configure
 +#line 17687 configure
  #include confdefs.h

  #if HAVE_DLFCN_H
 Index: gcc/final.c
 ===
 --- gcc/final.c (revision 185372)
 +++ gcc/final.c (working copy)
 @@ -4421,9 +4421,9 @@ rest_of_handle_final (void)
                                decl_fini_priority_lookup
                                  (current_function_decl));

 -  /* With -fcallgraph-profiles-sections, add .gnu.callgraph.text section
 +  /* With -freorder-functions=, add .gnu.callgraph.text section
      for storing profiling information. */
 -  if (flag_callgraph_profiles_sections
 +  if (flag_reorder_functions  1
        flag_profile_use
        cgraph_node (current_function_decl) != NULL
        (cgraph_node (current_function_decl))-callees != NULL)
 Index: gcc/gcc.c
 ===
 --- gcc/gcc.c   (revision 185372)
 +++ gcc/gcc.c   (working copy)
 @@ -663,6 +663,9 @@ proper position among the other output files.  */
     -plugin-opt=-fresolution=%u.res \
     
 %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} \
     }PLUGIN_COND_CLOSE \
 +    %{freorder-functions=*: \
 +    -plugin %(func_reorder_linker_plugin_file) \
 +    

Re: [C++ Patch] PR 44783

2012-03-14 Thread Jason Merrill

OK.

Jason