Re: [PATCH, ARM] Switch to EABI version 5 for RTEMS

2011-04-13 Thread Sebastian Huber
On 04/06/2011 07:20 PM, Sebastian Huber wrote:
> On 06/04/11 18:24, Ralf Corsepius wrote:
>> On 04/06/2011 05:20 PM, Sebastian Huber wrote:
>>
>>> there were several requests for ARM Cortex-M support on RTEMS
>>> recently.  The
>>> first step towards this is a suitable ARM tool chain.  I want to use
>>> this event
>>> to clean up the multilibs and switch to the EABI version 5.  The
>>> benefit of
>>> EABI version 5 is that this brings RTEMS more in line with the
>>> primary GCC
>>> platform arm-linux-gnueabi.
>>
>> These patches are not OK with me, because these are widely
>> incompatible to what has been used in RTEMS up today
> 
> Can you please list these incompatibilities.  The RTEMS test suite shows
> no problems with this tool chain.  The GCC test suite looks also good.
[...]

It is not really helpful to claim something without an explanation.  The
missing tool chain for the ARM Cortex architecture blocks RTEMS from further
development on a very important embedded systems platform.  A lot of competing
real time operating systems provide ARM Cortex support for a long time.

Lets look at the GCC test suite results:

RTEMS 4.11, GCC 4.6.0 (EABI)

=== gcc Summary ===

# of expected passes72429
# of unexpected failures200
# of unexpected successes   7
# of expected failures  183
# of unresolved testcases   138
# of unsupported tests  1103

=== g++ Summary ===

# of expected passes25494
# of unexpected failures11
# of unexpected successes   1
# of expected failures  160
# of unsupported tests  427

RTEMS 4.11, GCC 4.6.0 (old ABI)

=== gcc Summary ===

# of expected passes43613
# of unexpected failures15916
# of unexpected successes   8
# of expected failures  181
# of unresolved testcases   11127
# of unsupported tests  1124

=== g++ Summary ===

# of expected passes20709
# of unexpected failures2590
# of expected failures  157
# of unresolved testcases   291
# of unsupported tests  430

RTEMS 4.10, GCC 4.4.5 (old ABI)

=== gcc Summary ===

# of expected passes34293
# of unexpected failures11273
# of expected failures  237
# of unresolved testcases   7878
# of unsupported tests  683

=== g++ Summary ===

# of expected passes15707
# of unexpected failures1726
# of expected failures  155
# of unresolved testcases   26
# of unsupported tests  194

RTEMS 4.9, GCC 4.3.2 (old ABI)

=== gcc Summary ===

# of expected passes47164
# of unexpected failures2070
# of expected failures  97
# of unresolved testcases   92
# of untested testcases 35
# of unsupported tests  792

=== g++ Summary ===

# of expected passes17019
# of unexpected failures52
# of unexpected successes   2
# of expected failures  82
# of unresolved testcases   49
# of unsupported tests  164

The EABI tool chain has by far the best test suite results.

The RTEMS test suite was run with the edb7312 BSP and shows good results.  It
works also on real hardware with the lpc24xx and lpc32xx BSPs.

All ARM BSPs compile and link all tests with the EABI tool chain.

We use the VFP floating point format in all ARM BSPs since 2010-04-30.

All ARM BSPs support the init and fini array sections since 2010-12-03.

The C++ exceptions change from SJLJ to a table based implementation is an
implementation detail.

The required ARM/Thumb interwork is an enhancement.

I don't claim that the switch to the EABI tool chain will be without problems,
but we have to use it to figure this out.  The multilib selection may need
further changes.  I am concerned about the enabled exceptions in some libgcc
functions.

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


Re: [C++ PATCH] Handle correctly ARRAY_REFs from STRING_CST for wchar_t/char{16,32}_t (PR c++/48570)

2011-04-13 Thread Jakub Jelinek
On Tue, Apr 12, 2011 at 07:13:51PM -0400, Jason Merrill wrote:
> On 04/12/2011 01:06 PM, Jakub Jelinek wrote:
> >+ : (unsigned)TREE_STRING_LENGTH (ary)
> >+   * (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (ary)))
> >+  / TYPE_PRECISION (char_type_node)));
> 
> Don't you mean / instead of * here?

You're right, thanks for catching it.  I've added a testcase
for the out of bounds case too.

> Let's also calculate the size
> of the element once rather than here and again later.

Like this?  Bootstrapped/regtested on x86_64-linux and i686-linux:

2011-04-13  Jakub Jelinek  

PR c++/48570
* semantics.c (cxx_eval_array_reference): Handle reading from
wchar_t, char16_t and char32_t STRING_CST.

* g++.dg/cpp0x/constexpr-wstring1.C: New test.
* g++.dg/cpp0x/constexpr-wstring2.C: New test.

--- gcc/cp/semantics.c.jj   2011-04-12 19:43:49.433483082 +0200
+++ gcc/cp/semantics.c  2011-04-13 08:25:07.904796653 +0200
@@ -6279,7 +6279,7 @@ cxx_eval_array_reference (const constexp
   non_constant_p);
   tree index, oldidx;
   HOST_WIDE_INT i;
-  unsigned len;
+  unsigned len, elem_nchars = 1;
   if (*non_constant_p)
 return t;
   oldidx = TREE_OPERAND (t, 1);
@@ -6291,9 +6291,14 @@ cxx_eval_array_reference (const constexp
 return t;
   else if (addr)
 return build4 (ARRAY_REF, TREE_TYPE (t), ary, index, NULL, NULL);
-  len = (TREE_CODE (ary) == CONSTRUCTOR
-? CONSTRUCTOR_NELTS (ary)
-: (unsigned)TREE_STRING_LENGTH (ary));
+  if (TREE_CODE (ary) == CONSTRUCTOR)
+len = CONSTRUCTOR_NELTS (ary);
+  else
+{
+  elem_nchars = (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (ary)))
+/ TYPE_PRECISION (char_type_node));
+  len = (unsigned) TREE_STRING_LENGTH (ary) / elem_nchars;
+}
   if (compare_tree_int (index, len) >= 0)
 {
   if (!allow_non_constant)
@@ -6304,9 +6309,16 @@ cxx_eval_array_reference (const constexp
   i = tree_low_cst (index, 0);
   if (TREE_CODE (ary) == CONSTRUCTOR)
 return VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ary), i)->value;
-  else
+  else if (elem_nchars == 1)
 return build_int_cst (cv_unqualified (TREE_TYPE (TREE_TYPE (ary))),
  TREE_STRING_POINTER (ary)[i]);
+  else
+{
+  tree type = cv_unqualified (TREE_TYPE (TREE_TYPE (ary)));
+  return native_interpret_expr (type, (const unsigned char *)
+ TREE_STRING_POINTER (ary)
+ + i * elem_nchars, elem_nchars);
+}
   /* Don't VERIFY_CONSTANT here.  */
 }
 
--- gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C.jj  2011-04-13 
08:21:23.079513403 +0200
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C 2011-04-13 
08:21:23.079513403 +0200
@@ -0,0 +1,34 @@
+// PR c++/48570
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+extern "C" void abort ();
+constexpr wchar_t foo (int i) { return L"0123"[i]; }
+constexpr char16_t bar (int i) { return u"0123"[i]; }
+constexpr char32_t baz (int i) { return U"0123"[i]; }
+const wchar_t foo0 = foo (0);
+const wchar_t foo1 = foo (1);
+const wchar_t foo2 = foo (2);
+const wchar_t foo3 = foo (3);
+const wchar_t foo4 = foo (4);
+const char16_t bar0 = bar (0);
+const char16_t bar1 = bar (1);
+const char16_t bar2 = bar (2);
+const char16_t bar3 = bar (3);
+const char16_t bar4 = bar (4);
+const char32_t baz0 = baz (0);
+const char32_t baz1 = baz (1);
+const char32_t baz2 = baz (2);
+const char32_t baz3 = baz (3);
+const char32_t baz4 = baz (4);
+
+int
+main ()
+{
+  if (foo0 != L'0' || foo1 != L'1' || foo2 != L'2' || foo3 != L'3' || foo4 != 
L'\0')
+abort ();
+  if (bar0 != u'0' || bar1 != u'1' || bar2 != u'2' || bar3 != u'3' || bar4 != 
u'\0')
+abort ();
+  if (baz0 != U'0' || baz1 != U'1' || baz2 != U'2' || baz3 != U'3' || baz4 != 
U'\0')
+abort ();
+}
--- gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C.jj  2011-04-13 
08:26:01.158764728 +0200
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C 2011-04-13 
08:29:31.321808236 +0200
@@ -0,0 +1,7 @@
+// PR c++/48570
+// { dg-do compile }
+// { dg-options -std=c++0x }
+
+constexpr wchar_t c1 = L"hi"[3];   // { dg-error "out of bound" }
+constexpr char16_t c2 = u"hi"[3];  // { dg-error "out of bound" }
+constexpr char32_t c3 = U"hi"[3];  // { dg-error "out of bound" }


Jakub


Re: [PATCH] add statistics counting to postreload, copy-rename, and math-opts

2011-04-13 Thread Richard Guenther
On Tue, Apr 12, 2011 at 5:09 PM, Nathan Froyd  wrote:
> On Tue, Apr 12, 2011 at 04:54:43PM +0200, Richard Guenther wrote:
>> On Tue, Apr 12, 2011 at 4:51 PM, Nathan Froyd  
>> wrote:
>> > True, but maybe those testcases should be adjusted--per-pass flags,
>> > rather than blindly assuming -O2 includes them.  And it's not clear to
>>
>> It's easier to add things to GCC than to argue removing things ...
>
> And sometimes not even easy to argue for adding things. :)
>
>> > me that the statistics_counter_event infrastructure really helps
>> > catching do-nothing passes, since it doesn't record stats that increment
>> > by zero...
>>
>> Well, if the overall count is zero then nothing was done.
>
> Granted, but that fact should still be recorded.  The situation we have
> today, for something like:
>
> func1: statistic for "statx" was 0
>  - nothing is recorded in the statistics table
> func2: statistic for "statx" was 0
>  - nothing is recorded in the statistics table
> func3: statistic for "statx" was 0
>  - nothing is recorded in the statistics table
> ...
>
> and so forth, is that at the end of the day, the dump file won't even
> include any information about "statx".  If you had some func7387 where
> "statx" was non-zero, you could infer that nothing else happened in the
> previous 7386 functions.  For the case where a pass is truly useless on
> a TU, it's hard to figure out from the statistics dump alone.  And I'd
> argue that it's useful to see explicitly that the pass only helped in 1
> out of 7387 functions, rather than trying to infer it from missing data.

I always use statistics-stats (thus, overall stats, not per function).  The
per function ones omit zero counts during dumping on purpose
(to make the dump smaller).

Richard.

> -Nathan
>


Re: [patch] Split Parse Timevar (issue4378056)

2011-04-13 Thread Richard Guenther
On Tue, Apr 12, 2011 at 9:06 PM, Diego Novillo  wrote:
> On Tue, Apr 12, 2011 at 14:49, Lawrence Crowl  wrote:
>> This patch provides more finer, more precise compile time information.
>> I sent an advisory mail some time ago, and it was good then.  Please
>> confirm for trunk.
>
> The patch looks fine to me, but of course it's Jason the one you need
> an OK from.

Pushing/popping timevars is not free.  What's the compile-time impact of this
change (for -ftime-report, of course) - with small timed regions, does it not
just return garbage because of clock precision issues and overhead of
querying the clock iself?

Richard.


Re: Add debugging functions for cp_parser (issue4389045)

2011-04-13 Thread Richard Guenther
On Wed, Apr 13, 2011 at 2:02 AM,   wrote:
> One oddity, otherwise LGTM.
>
>
> http://codereview.appspot.com/4389045/diff/1/gcc/cp/parser.c
> File gcc/cp/parser.c (right):
>
> http://codereview.appspot.com/4389045/diff/1/gcc/cp/parser.c#newcode375
> gcc/cp/parser.c:375: if (flag)
> This code will never print "false", so why have it?

Can you quote the piece of the patch you are commenting on?

Thanks,
Richard.

> http://codereview.appspot.com/4389045/
>


Re: Implement stack arrays even for unknown sizes

2011-04-13 Thread Paul Richard Thomas
Dear Dominique,

> I think it is the automatic array in the subroutine trisolve. Note that the
> speedup is rather 27->19s and may be darwin specific (slow malloc).

I saw a speed-up of similar order on FC9/x86_64.

I strongly doubt that it is anything to do with the automatic array -
if it is there is an error somewhere, since none of the references to
trisolve need copy-in/copy-out.

>
> Note also that -fstack-arrays prevents some optimizations on
> fatigue: 4.7->7s. This may be related to pr45810.

Has PR45810 converged now?  If I have understood properly, a patch has
been devised that cures the problem and does not cause slow-downs
anywhere else?

Cheers

Paul


Re: [patch i386 mingw g++.dg gcc.dg]: Set -mms-bitfields as default for native windows targets

2011-04-13 Thread Pedro Alves
On Tuesday 12 April 2011 19:53:42, Kai Tietz wrote:
> 2011/4/12 Richard Henderson :
> > On 04/12/2011 05:47 AM, Kai Tietz wrote:
> >> ChangeLog gcc/
> >>
> >>   * config/i386/mingw32.h (TARGET_SUBTARGET_DEFAULT): Add
> >>   MASK_MS_BITFIELD_LAYOUT bit.
> >>
> >> ChangeLog gcc/testsuite
> >>
> >>   * g++.dg/ext/bitfield2.C: Add for i?86/x86_64-*-mingw*
> >>   targets the additional -mno-ms-bitfields and
> >>   -Wno-packed-bitfield-compat options.
> >>   * g++.dg/ext/bitfield3.C: Likewise.
> >>   * g++.dg/ext/bitfield4.C: Likewise.
> >>   * g++.dg/ext/bitfield5.C: Likewise.
> >>   * gcc.dg/bitfld-15.c: Likewise.
> >>   * gcc.dg/bitfld-16.c: Likewise.
> >>   * gcc.dg/bitfld-17.c: Likewise.
> >>   * gcc.dg/bitfld-18.c: Likewise.
> >
> > Ok.
> >
> >
> > r~
> >
> 
> 
> Applied at revision 172336.
> 
> Thanks,
> Kai
> 

This is a default ABI change (IIRC, when the option was
introduced, it was left off as default so to not break the ABI).

Shouldn't we advertise it somewhere?

-- 
Pedro Alves


Re: Implement stack arrays even for unknown sizes

2011-04-13 Thread Richard Guenther
On Wed, Apr 13, 2011 at 11:42 AM, Paul Richard Thomas
 wrote:
> Dear Dominique,
>
>> I think it is the automatic array in the subroutine trisolve. Note that the
>> speedup is rather 27->19s and may be darwin specific (slow malloc).
>
> I saw a speed-up of similar order on FC9/x86_64.
>
> I strongly doubt that it is anything to do with the automatic array -
> if it is there is an error somewhere, since none of the references to
> trisolve need copy-in/copy-out.
>
>>
>> Note also that -fstack-arrays prevents some optimizations on
>> fatigue: 4.7->7s. This may be related to pr45810.
>
> Has PR45810 converged now?  If I have understood properly, a patch has
> been devised that cures the problem and does not cause slow-downs
> anywhere else?

VLAs and malloc based arrays may behave differently with respect to alias
analysis (I'd have to look at some examples).  All effects other than malloc
overhead I would attribute to that.  That said, the general idea of the patch
is sound and I see nothing wrong with it.  Both performance improvements
and regressions are worth looking at - they hint at possible improvements
in the middle-end parts of the compiler.

Richard.

> Cheers
>
> Paul
>


Re: [patch i386 mingw g++.dg gcc.dg]: Set -mms-bitfields as default for native windows targets

2011-04-13 Thread Kai Tietz
2011/4/13 Pedro Alves :
> On Tuesday 12 April 2011 19:53:42, Kai Tietz wrote:
>> 2011/4/12 Richard Henderson :
>> > On 04/12/2011 05:47 AM, Kai Tietz wrote:
>> >> ChangeLog gcc/
>> >>
>> >>       * config/i386/mingw32.h (TARGET_SUBTARGET_DEFAULT): Add
>> >>       MASK_MS_BITFIELD_LAYOUT bit.
>> >>
>> >> ChangeLog gcc/testsuite
>> >>
>> >>       * g++.dg/ext/bitfield2.C: Add for i?86/x86_64-*-mingw*
>> >>       targets the additional -mno-ms-bitfields and
>> >>       -Wno-packed-bitfield-compat options.
>> >>       * g++.dg/ext/bitfield3.C: Likewise.
>> >>       * g++.dg/ext/bitfield4.C: Likewise.
>> >>       * g++.dg/ext/bitfield5.C: Likewise.
>> >>       * gcc.dg/bitfld-15.c: Likewise.
>> >>       * gcc.dg/bitfld-16.c: Likewise.
>> >>       * gcc.dg/bitfld-17.c: Likewise.
>> >>       * gcc.dg/bitfld-18.c: Likewise.
>> >
>> > Ok.
>> >
>> >
>> > r~
>> >
>>
>>
>> Applied at revision 172336.
>>
>> Thanks,
>> Kai
>>
>
> This is a default ABI change (IIRC, when the option was
> introduced, it was left off as default so to not break the ABI).
>
> Shouldn't we advertise it somewhere?
>
> --
> Pedro Alves
>

Yes, I did recently a lot of abi changing for mingw's targets.  They
all will need a nice description (and possible ways to get old default
behavior) in changes.html

I collect them for later.  Or do you mean it should be noted earlier?

Regards,
Kai


Re: [patch i386 mingw g++.dg gcc.dg]: Set -mms-bitfields as default for native windows targets

2011-04-13 Thread Pedro Alves
On Wednesday 13 April 2011 11:43:43, Kai Tietz wrote:
> > This is a default ABI change (IIRC, when the option was
> > introduced, it was left off as default so to not break the ABI).
> >
> > Shouldn't we advertise it somewhere?

> Yes, I did recently a lot of abi changing for mingw's targets.  They
> all will need a nice description (and possible ways to get old default
> behavior) in changes.html
> 
> I collect them for later.  Or do you mean it should be noted earlier?

As long as it's mentioned somewhere before a release, that's fine
with me.

(Though mentioning changes as you do them has better chances of
something not getting forgotten, or in case you end up
unavailable.  Hope not! :-) )

-- 
Pedro Alves


[PING] Fix PR46399 - missing mode promotion for libcall args

2011-04-13 Thread Andreas Krebbel
This fixes a wrong code generation bug for sw DFP:

http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00141.html

Bye,

-Andreas-


Re: Implement stack arrays even for unknown sizes

2011-04-13 Thread Richard Guenther
On Wed, Apr 13, 2011 at 12:38 PM, Richard Guenther
 wrote:
> On Wed, Apr 13, 2011 at 11:42 AM, Paul Richard Thomas
>  wrote:
>> Dear Dominique,
>>
>>> I think it is the automatic array in the subroutine trisolve. Note that the
>>> speedup is rather 27->19s and may be darwin specific (slow malloc).
>>
>> I saw a speed-up of similar order on FC9/x86_64.
>>
>> I strongly doubt that it is anything to do with the automatic array -
>> if it is there is an error somewhere, since none of the references to
>> trisolve need copy-in/copy-out.
>>
>>>
>>> Note also that -fstack-arrays prevents some optimizations on
>>> fatigue: 4.7->7s. This may be related to pr45810.
>>
>> Has PR45810 converged now?  If I have understood properly, a patch has
>> been devised that cures the problem and does not cause slow-downs
>> anywhere else?
>
> VLAs and malloc based arrays may behave differently with respect to alias
> analysis (I'd have to look at some examples).  All effects other than malloc
> overhead I would attribute to that.  That said, the general idea of the patch
> is sound and I see nothing wrong with it.  Both performance improvements
> and regressions are worth looking at - they hint at possible improvements
> in the middle-end parts of the compiler.

I have opened PR48590 for at least one issue that I see.  It has a very
simple patch which you might want to try ...

Richard.


RX: Do not use SMOVF insn to move blocks of volatile memory.

2011-04-13 Thread Nick Clifton
Hi Guys,

  I am checking in the patch below to the 4.5 branch and mainline
  sources to fix a problem with the RX's SMOVF instruction.  This
  instruction copies blocks of memory, but it always loads and stores
  aligned 32-bit values.  If necessary it will load extra bytes from the
  beginning or end of the destination block in order to be able to write
  back a whole word.  This can be a problem if the destination block is
  in the I/O address space and those extra bytes do not exist or must
  not be read.

  The patch fixes the problem by disabling the use of the SMOVF
  instruction when volatile pointers are involved.  In this case gcc
  will be forced to use another method to copy the data, most likely a
  loop of byte loads and stores.

Cheers
  Nick

PS. I am not applying the patch to the 4.6 branch since it is already
present there.

gcc/ChangeLog
2011-04-13  Nick Clifton  

* config/rx/rx.md (movmemsi): Do not use this pattern when
volatile pointers are involved.

Index: gcc/config/rx/rx.md
===
--- gcc/config/rx/rx.md (revision 170734)
+++ gcc/config/rx/rx.md (working copy)
@@ -1897,6 +1897,14 @@
 rtx addr2 = gen_rtx_REG (SImode, 2);
 rtx len   = gen_rtx_REG (SImode, 3);
 
+/* Do not use when the source or destination are volatile - the SMOVF
+   instruction will read and write in word sized blocks, which may be
+   outside of the valid address range.  */
+if (MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0]))
+  FAIL;
+if (MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))
+  FAIL;
+
 if (REG_P (operands[0]) && (REGNO (operands[0]) == 2
  || REGNO (operands[0]) == 3))
   FAIL;


Re: Add debugging functions for cp_parser (issue4389045)

2011-04-13 Thread Diego Novillo
On Wed, Apr 13, 2011 at 05:25, Richard Guenther
 wrote:
> On Wed, Apr 13, 2011 at 2:02 AM,   wrote:
>> One oddity, otherwise LGTM.
>>
>>
>> http://codereview.appspot.com/4389045/diff/1/gcc/cp/parser.c
>> File gcc/cp/parser.c (right):
>>
>> http://codereview.appspot.com/4389045/diff/1/gcc/cp/parser.c#newcode375
>> gcc/cp/parser.c:375: if (flag)
>> This code will never print "false", so why have it?
>
> Can you quote the piece of the patch you are commenting on?

I'm not sure if that can be controlled.  When you respond to a hunk on
Rietveld, it creates the quote automatically.  Maybe there is a way of
increasing the scope of the quote.  I'll ask.

Diego.


Re: Add debugging functions for cp_parser (issue4389045)

2011-04-13 Thread Richard Guenther
On Wed, Apr 13, 2011 at 2:29 PM, Diego Novillo  wrote:
> On Wed, Apr 13, 2011 at 05:25, Richard Guenther
>  wrote:
>> On Wed, Apr 13, 2011 at 2:02 AM,   wrote:
>>> One oddity, otherwise LGTM.
>>>
>>>
>>> http://codereview.appspot.com/4389045/diff/1/gcc/cp/parser.c
>>> File gcc/cp/parser.c (right):
>>>
>>> http://codereview.appspot.com/4389045/diff/1/gcc/cp/parser.c#newcode375
>>> gcc/cp/parser.c:375: if (flag)
>>> This code will never print "false", so why have it?
>>
>> Can you quote the piece of the patch you are commenting on?
>
> I'm not sure if that can be controlled.  When you respond to a hunk on
> Rietveld, it creates the quote automatically.  Maybe there is a way of
> increasing the scope of the quote.  I'll ask.

Quoting the patch hunk that is associated with the commend would be enough.

Richard.

> Diego.
>


Tweak Negative() documentation in options.texi

2011-04-13 Thread Richard Sandiford
I was looking at a backport of the current linux.opt, and got confused
by the chain of three Negative()s.  I was thinking that saying
"A is Negative(B)" was equivalent to saying A == !B.

This patch is an attempt to clarify the documentation.  Tested with
"make doc", "make html" and "make pdf".  OK to install?

Richard


gcc/
* doc/options.texi (Negative): Explicitly mention that the
Negative chain must be circular.

Index: gcc/doc/options.texi
===
--- gcc/doc/options.texi2011-04-07 09:23:22.0 +0100
+++ gcc/doc/options.texi2011-04-13 13:42:24.0 +0100
@@ -222,6 +222,13 @@ the option name with the leading ``-'' r
 propagate through the @code{Negative} property of the option to be
 turned off.
 
+As a consequence, if you have a group of mutually-exclusive
+options, their @code{Negative} properties should form a circular chain.
+For example, if options @option{-@var{a}}, @option{-@var{b}} and
+@option{-@var{c}} are mutually exclusive, their respective @code{Negative}
+properties should be @samp{Negative(@var{b})}, @samp{Negative(@var{c})}
+and @samp{Negative(@var{a})}.
+
 @item Joined
 @itemx Separate
 The option takes a mandatory argument.  @code{Joined} indicates


Re: Add debugging functions for cp_parser (issue4389045)

2011-04-13 Thread Diego Novillo
On Wed, Apr 13, 2011 at 08:39, Richard Guenther
 wrote:
> On Wed, Apr 13, 2011 at 2:29 PM, Diego Novillo  wrote:
>>
>> I'm not sure if that can be controlled.  When you respond to a hunk on
>> Rietveld, it creates the quote automatically.  Maybe there is a way of
>> increasing the scope of the quote.  I'll ask.
>
> Quoting the patch hunk that is associated with the commend would be enough.

Agreed, but it's easier if double-click DTRT.


Diego.


Re: Tweak Negative() documentation in options.texi

2011-04-13 Thread Joseph S. Myers
On Wed, 13 Apr 2011, Richard Sandiford wrote:

>   * doc/options.texi (Negative): Explicitly mention that the
>   Negative chain must be circular.

OK.

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


Re: [google/integration] Enable lightweight debug checks (issue4408041)

2011-04-13 Thread Diego Novillo
On Wed, Apr 13, 2011 at 01:44, Paul Pluzhnikov  wrote:
> This patch adds lightweight debug checks (if enabled by macros).
>
> To be applied only to google/integration branch.
>
> Tested by bootstrapping and running "make check".
>
>
> 2011-04-12  Paul Pluzhnikov  
>
>        * libstdc++-v3/include/bits/stl_algo.h: Add comparator debug checks
>        when __google_stl_debug_compare is 1.
>        * libstdc++-v3/include/bits/stl_tree.h: Add comparator debug checks
>        when __google_stl_debug_rbtree is 1.

OK.


Diego.


Re: [PATCH 1/7] Simple cgraph_node -> cgraph_get_node conversions

2011-04-13 Thread H.J. Lu
On Wed, Apr 6, 2011 at 4:22 PM, Martin Jambor  wrote:
> Hi,
>
> this patch changes most of current calls to cgraph_node to calls to
> cgraph_get_node.  The function should never return NULL in he contexts
> of the callers below and either the probability is so low that it does
> not warrant an assert (like cgraph_get_node (current_function_decl) or
> the result is immediately dereferenced and so would segfault anyway.
>
> Bootstrapped and tested separately on x86_64-linux without any
> problems, tests on other platforms (together with the other patches)
> in progress.
>
> OK for trunk?
>
> Thanks,
>
> Martin
>
>
> 2011-04-06  Martin Jambor  
>
>        * except.c (set_nothrow_function_flags): Call cgraph_get_node instead
>        of cgraph_node.
>        * final.c (rest_of_clean_state): Likewise.
>        * gimple-iterator.c (update_call_edge_frequencies): Likewise.
>        * passes.c (pass_init_dump_file): Likewise.
>        (execute_all_ipa_transforms): Likewise.
>        (function_called_by_processed_nodes_p): Likewise.
>        * predict.c (maybe_hot_frequency_p): Likewise.
>        (probably_never_executed_bb_p): Likewise.
>        (compute_function_frequency): Likewise.
>        * tree-nested.c (check_for_nested_with_variably_modified): Likewise.
>        (unnest_nesting_tree_1): Likewise.
>        (lower_nested_functions): Likewise.
>        * tree-optimize.c (execute_fixup_cfg): Likewise.
>        (tree_rest_of_compilation): Likewise.
>        * tree-profile.c (gimple_gen_ic_func_profiler): Likewise.
>        * tree-sra.c (ipa_early_sra): Likewise.
>        * tree-ssa-loop-ivopts.c (computation_cost): Likewise.
>        * config/i386/i386.c (ix86_compute_frame_layout): Likewise.
>        * ipa.c (record_cdtor_fn): Likewise.
>        * ipa-inline.c (cgraph_early_inlining): Likewise.
>        (compute_inline_parameters_for_current): Likewise.
>        * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise.
>        * ipa-pure-const.c (local_pure_const): Likewise.
>        * ipa-split.c (split_function): Likewise.
>        (execute_split_functions): Likewise.
>        * cgraphbuild.c (build_cgraph_edges): Likewise.
>        (rebuild_cgraph_edges): Likewise.
>        (cgraph_rebuild_references): Likewise.
>        (remove_cgraph_callee_edges): Likewise.
>        * cgraphunit.c (cgraph_mark_if_needed): Likewise.
>        (verify_cgraph_node): Likewise.
>        (cgraph_analyze_functions): Likewise.
>        (cgraph_preserve_function_body_p): Likewise.
>        (save_inline_function_body): Likewise.
>        (save_inline_function_body): Likewise.
>        * tree-inline.c (copy_bb): Likewise.
>        (optimize_inline_calls): Likewise.
>
>
>

This patch caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48585

-- 
H.J.


Re: [PING] Fix PR46399 - missing mode promotion for libcall args

2011-04-13 Thread Ian Lance Taylor
"Andreas Krebbel"  writes:

> This fixes a wrong code generation bug for sw DFP:
>
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00141.html

Why do we need a new target hook just for libcalls?  Why not just use
the existing TARGET_PROMOTE_FUNCTION_MODE hook?  We could say that for a
libcall functype is passed as NULL.  Only the SH cares about the
function type at all, and it is already prepared to handle NULL.

Ian


[PATCH] PR c++/48574

2011-04-13 Thread Dodji Seketeli
Hello,

Consider this short code snippet:

struct A
{
  virtual void foo();
};

template 
void
bar(T x)
{
  A &b = *x;
  b.foo();
}

When we look at b.foo() during the parsing (in
cp_parser_postfix_expression), 'b.foo()' is (rightfully) considered
non-dependent.  So we go on an build the method call expression.  Then
build_new_method_call wants to know the determine the dynamic type of
'b' and uses fixed_type_or_null for that.

fixed_type_or_null goes to look into the initializer of the reference
variable 'b', which is dependent; and it crashes while trying to poke at
the type of the INDIRECT_REF '*x', which has no type yet (because it's
dependent).

The patch below makes fixed_type_or_null consider that it cannot
determine the dynamic type of a reference variable if its initializer is
dependent.

Tested on x86_64-unknown-linux-gnu against trunk.

gcc/cp/

* class.c (fixed_type_or_null): We cannot determine the dynamic
type of a reference variable if its initializer is dependent.

gcc/testsuite/

* g++.dg/template/dependent-expr7.C: New test case.
---
 gcc/cp/class.c  |8 
 gcc/testsuite/g++.dg/template/dependent-expr7.C |   22 ++
 2 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/template/dependent-expr7.C

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b6aebae..d40c11c 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5944,6 +5944,14 @@ fixed_type_or_null (tree instance, int *nonnull, int 
*cdtorp)
  tree type;
  void **slot;
 
+ if (type_dependent_expression_p (DECL_INITIAL (instance)))
+   {
+ /* The initializer is type dependent so we cannot
+determine the dynamic type of this reference.   */
+ if (nonnull)
+   *nonnull = 0;
+ return NULL_TREE;
+   }
  slot = htab_find_slot (ht, instance, INSERT);
  *slot = instance;
  type = RECUR (DECL_INITIAL (instance));
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr7.C 
b/gcc/testsuite/g++.dg/template/dependent-expr7.C
new file mode 100644
index 000..b246820
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dependent-expr7.C
@@ -0,0 +1,22 @@
+// Origin PR c++/48574
+// { dg-do compile }
+
+struct A
+{
+  virtual void foo();
+};
+
+template 
+void
+bar(T x)
+{
+  A &b = *x;
+  b.foo ();
+}
+
+void
+foo()
+{
+  A a;
+  bar(&a);
+}
-- 
Dodji



Re: [C++0x] Range-based for statements and ADL

2011-04-13 Thread Jason Merrill

On 04/11/2011 04:50 PM, Rodrigo Rivas wrote:

Because the type of the expression must have complete type *only* if
it is an array.


Actually, if it has class type, it must also have a complete type or the 
class member lookup is ill-formed.  And you can't pass an expression of 
void type to a function call.  So we can just unconditionally require a 
complete type.



Well, I just did that, but I'm not sure this is totally correct, I've
just begun to understand finish_call_expr. It works, if only because
I'm the only one using this new code path. Fell free to
revise/change/comment about it.


It looks fine.


+? LOOKUP_NONVIRTUAL : 0),


Except this should be ? LOOKUP_NORMAL|LOOKUP_NORVIRTUAL : LOOKUP_NORMAL. 
 The other calls to build_new_method_call here should be fixed that 
way, too.


Jason


Re: Implement stack arrays even for unknown sizes

2011-04-13 Thread Paul Richard Thomas
Dear Richard and Dominique,

> VLAs and malloc based arrays may behave differently with respect to alias
> analysis (I'd have to look at some examples).  All effects other than malloc

- hmmm, yes.  I was forgetting what might happen with inlining.  It's
not evident, is it?

> overhead I would attribute to that.  That said, the general idea of the patch
> is sound and I see nothing wrong with it.  Both performance improvements
> and regressions are worth looking at - they hint at possible improvements
> in the middle-end parts of the compiler.

I absolutely agree.  I realise my input to this thread is possibly a
bit negative but this is far from my reaction to the general idea and
what is evidently within our reach.

Cheers

Paul


Re: [PING] Fix PR46399 - missing mode promotion for libcall args

2011-04-13 Thread Andreas Krebbel
On 04/13/2011 03:31 PM, Ian Lance Taylor wrote:
> "Andreas Krebbel"  writes:
> 
>> This fixes a wrong code generation bug for sw DFP:
>>
>> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00141.html
> 
> Why do we need a new target hook just for libcalls?  Why not just use
> the existing TARGET_PROMOTE_FUNCTION_MODE hook?  We could say that for a
> libcall functype is passed as NULL.  Only the SH cares about the
> function type at all, and it is already prepared to handle NULL.

But in order to preserve current behaviour all targets defining the hook then 
would have
to be modified not to do any promotions if funtype is NULL.  As I understand it 
a target
usually does not want the normal promotions for libcalls since libcalls follow 
their own ABI.

-Andreas-


Re: [C++ PATCH] Handle correctly ARRAY_REFs from STRING_CST for wchar_t/char{16,32}_t (PR c++/48570)

2011-04-13 Thread Jason Merrill

OK.

Jason


Re: [PATCH 3/6] Allow jumps in epilogues

2011-04-13 Thread Bernd Schmidt
On 04/11/2011 07:10 PM, Richard Henderson wrote:
> Ok.

Did you receive my reply to this message from earlier today? It doesn't
seem to have made it to gcc-patches yet.


Bernd


Re: [PATCH] PR c++/48574

2011-04-13 Thread Jason Merrill

On 04/13/2011 09:40 AM, Dodji Seketeli wrote:

+ if (type_dependent_expression_p (DECL_INITIAL (instance)))
+   {
+ /* The initializer is type dependent so we cannot
+determine the dynamic type of this reference.   */
+ if (nonnull)
+   *nonnull = 0;
+ return NULL_TREE;
+   }


*nonnull should still be true in this case; even if we don't know what 
the reference refers to, we can still assume that it refers to 
something.  Otherwise OK.


Jason


Re: [PATCH] PR c++/48574

2011-04-13 Thread Jakub Jelinek
On Wed, Apr 13, 2011 at 10:17:25AM -0400, Jason Merrill wrote:
> On 04/13/2011 09:40 AM, Dodji Seketeli wrote:
> >+  if (type_dependent_expression_p (DECL_INITIAL (instance)))
> >+{
> >+  /* The initializer is type dependent so we cannot
> >+ determine the dynamic type of this reference.   */
> >+  if (nonnull)
> >+*nonnull = 0;
> >+  return NULL_TREE;
> >+}
> 
> *nonnull should still be true in this case; even if we don't know
> what the reference refers to, we can still assume that it refers to
> something.  Otherwise OK.

Then

--- gcc/cp/class.c.jj   2011-04-12 19:43:49.0 +0200
+++ gcc/cp/class.c  2011-04-13 15:23:07.463670993 +0200
@@ -5939,6 +5939,7 @@ fixed_type_or_null (tree instance, int *
 itself.  */
  if (TREE_CODE (instance) == VAR_DECL
  && DECL_INITIAL (instance)
+ && !type_dependent_expression_p (DECL_INITIAL (instance))
  && !htab_find (ht, instance))
{
  tree type;

would be shorter, after that if it returns NULL_TREE.

Jakub


Re: [PATCH] PR c++/48574

2011-04-13 Thread Jason Merrill

On 04/13/2011 10:23 AM, Jakub Jelinek wrote:

Then

--- gcc/cp/class.c.jj   2011-04-12 19:43:49.0 +0200
+++ gcc/cp/class.c  2011-04-13 15:23:07.463670993 +0200
@@ -5939,6 +5939,7 @@ fixed_type_or_null (tree instance, int *
 itself.  */
  if (TREE_CODE (instance) == VAR_DECL
&&  DECL_INITIAL (instance)
+   &&  !type_dependent_expression_p (DECL_INITIAL (instance))
&&  !htab_find (ht, instance))
{
  tree type;

would be shorter, after that if it returns NULL_TREE.


Yep.

Jason


Re: [PATCH 3/6] Allow jumps in epilogues

2011-04-13 Thread Richard Henderson
On 04/13/2011 05:38 AM, Bernd Schmidt wrote:
> This bootstraps and tests ok on i686-linux. However, there is work left
> to be done. Can I take you up on your offer to work with me on this?
> This still requires the i386 output_set_got which I think I can cope
> with, but the ia64 backend does a number of things with unwinding that I
> don't understand. Also, I'll be away the next two weeks - if you arrive
> at a complete version during that time it would be great if you could
> commit it.

Ok, I'll put this on my to-do list.

> One thing to note is that it seems surprisingly hard to make
> -freorder-blocks-and-partition do anything interesting. There's one C++
> testcase (partition2.C I think) which I used to debug this code, but
> other than that I haven't really found anything that actually generates
> two nonempty partitions.

Yeah, while I was working on dwarf line numbers recently, I found that
just about the only thing that would produce anything interesting was
a profiled bootstrap.


r~


[Patch, Fortran] PR 18918: Build + install libcaf_single.a

2011-04-13 Thread Tobias Burnus

Hello all, hi Ralf and Jorge,

The attached patch causes libgfortran/ also to build 
libgfortran/caf/single.c, which will be installed as 
$PREFIX/.../target-triplet/gcc-version/libcaf_single.a.


Build and tested on x86-64-linux.
OK for the trunk?

 * * *

As a possible enhancement, one could also automatically build mpi.c 
using AX_MPI. However, one needs to think about whether one should - and 
if so, when the build should be enabled. (Cf. 
http://www.gnu.org/software/autoconf-archive/ax_mpi.html and 
http://gcc.gnu.org/ml/fortran/2011-03/msg4.html)  -- One issue I see 
is that one might end up using the wrong libcaf_mpi if one automatically 
compiles mpi.c and places it into the lib*/gcc// 
directory.


 * * *

Regarding the test suite: I think I will add an extra directory - such 
as gfortran.dg/coarray -, in which by default the files are compiled/run 
with the flag -fcoarray=single and -fcoarray=lib -lcaf_single. 
Optionally, one additionally tests -fcoarray=lib with some 
parallelization library (e.g. libcaf_mpi.a). That will happen if some 
variable is set; the setting happens via site.exp and can be overridden 
by some environment variables.


 * * *

Regarding the comments by Ralf and Jorge/Lisandro:

My idea was to either not build libcaf_mpi - or only with the default 
MPI compiler (cf. AX_MPI above) and only statically. The current plan is 
to make building libcaf_mpi simple such that an interested (Linux) 
distributor or a system admin or a user can simply compile it with their 
favourite compiler - cf. http://gcc.gnu.org/wiki/CoarrayLib. If a system 
admin or user prefers it, they can also build a shared library (.so, .dll).


The reason that a static libcaf_mpi is should be sufficient is that 
there is typically only a single MPI installed on a system; if one wants 
to use a different one - e.g. on a different system - one can simply 
relink. Only for the special case that one wants to easily switch the 
MPI library, one needs a dynamic library. However, that's a very special 
case - thus the burden of creating a shared library can be put on the admin.



Regarding Ralf's "I think one of the most important things is that you 
allow to override both the running of mpif90 and the mpiexec commands":


I think your comment that's with regards to the test suite and I concur.

I am not sure whether one should have a default value. While "mpiexec -n 
2" will usually work, compiling is more difficult: Calling "mpif90" will 
usually invoke the compiler specified when building mpif90 - and not the 
just build gfortran/f951; but the latter should be tested when making 
"make check-gfortran". Thus, I think one probably should add a 
$FCFLAGS/$LDFLAGS options which contains the value of "mpif90 -show" (or 
however it is called in your MPI implementation). I therefore think one 
should have two or three site.exp/environment settings: The compile/link 
flags and the run command.


Regarding "qsub", "msub" or "llrun": I assume most testers will use 
mpiexec directly, which will then typcially use 2 to 4 local processes 
(shared-memory MPI). Using a queuing system is more complicated as the 
submit commands will typically return before the completion of the job 
and the output will typically be written into a file. I think one could 
work around that by writing a mpiexec replacement wrapper which submits 
the job and cats the output to stdout/stderr. One also might need to 
adjust the timeout settings. Hence, I think queued processing will 
probably not be done for "make check-gfortran" but only manually - using 
either the dg-run programs or some other test or real-world coarray 
program. But with a wrapper, it should work.



Ralf: "The MPI implementations I know all have pairwise incompatible ABIs"

Well, as written above, the ABI of the coarray program is defined and 
independent from the MPI ABI - thus the difference is only in libcaf. 
Therefore, if libcaf is dynamically linked, switching the MPI 
implementation and simultaneously libcaf_mpi.so should work. But as 
written above, I think that is something the distributor/admin/user 
should do and not GCC itself.


(Lisandro/George:) 'A dynamic library "libcaf_mpi.so" is not linked with 
MPI, but uses the dlopen() and dlsym(), to load and access the contents 
of a specific "MPI-linked" dynamic library 
"libcaf_mpi_{mpich2|openmpi|other}.so". This way "libcaf_mpi.so" does 
not depend on any MPI implementation'


I think that's overengineered. Having a simple libcaf_mpi.a in the path 
- e.g. in the $MPI/lib directory - should be the best for most typical 
usage. Having at the same location a libcaf_mpi.so will even allow 
dynamic switching. I think the main usage for a dynamically linked 
version is for closed-source software.


(Side note: I have never switched the MPI implementation on the same 
system and I have simply recompiled the whole program on different systems.)


Tobias
2011-04-13  Tobias Burnus  

	PR fortran/18918
	* Makefile.am: Buil

C++ PATCH for c++/48581 (sfinae failure with ADL in default template arg)

2011-04-13 Thread Jason Merrill
We can't decide that a lookup has failed while we're still in template 
context, as phase 2 lookup might find it.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit bf1635b662fb30ac7dc03b292bb52943c4dccc18
Author: Jason Merrill 
Date:   Tue Apr 12 13:59:07 2011 -0400

* pt.c (tsubst_copy_and_build) [CALL_EXPR]: Don't complain about
unqualified lookup failing if we're still in a template.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 208ff2b..3356e75 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -12938,7 +12938,8 @@ tsubst_copy_and_build (tree t,
&& !any_type_dependent_arguments_p (call_args))
  function = perform_koenig_lookup (function, call_args, false);
 
-   if (TREE_CODE (function) == IDENTIFIER_NODE)
+   if (TREE_CODE (function) == IDENTIFIER_NODE
+   && !processing_template_decl)
  {
unqualified_name_lookup_error (function);
release_tree_vector (call_args);
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae13.C 
b/gcc/testsuite/g++.dg/cpp0x/sfinae13.C
new file mode 100644
index 000..465df2d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae13.C
@@ -0,0 +1,20 @@
+// PR c++/48581
+// { dg-options -std=c++0x }
+
+template
+T&& create();
+
+template()))
+>
+auto f(int) -> char;
+
+template
+auto f(...) -> char (&)[2];
+
+struct S {};
+void foo(S);
+
+static_assert(sizeof(f(0)) == 1, "Error"); // (#)
+
+int main() {}


Re: [PING] Fix PR46399 - missing mode promotion for libcall args

2011-04-13 Thread Ian Lance Taylor
Andreas Krebbel  writes:

> On 04/13/2011 03:31 PM, Ian Lance Taylor wrote:
>> "Andreas Krebbel"  writes:
>> 
>>> This fixes a wrong code generation bug for sw DFP:
>>>
>>> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00141.html
>> 
>> Why do we need a new target hook just for libcalls?  Why not just use
>> the existing TARGET_PROMOTE_FUNCTION_MODE hook?  We could say that for a
>> libcall functype is passed as NULL.  Only the SH cares about the
>> function type at all, and it is already prepared to handle NULL.
>
> But in order to preserve current behaviour all targets defining the hook then 
> would have
> to be modified not to do any promotions if funtype is NULL.  As I understand 
> it a target
> usually does not want the normal promotions for libcalls since libcalls 
> follow their own ABI.

In the good old days libcalls followed their own ABI, but that is no
longer really true.  E.g., you are talking about functions in
libdecnumber, which are written in C, and follow the ordinary C ABI.  In
general gcc has been moving away from libcall-specific code and moving
toward treating libcalls and ordinary functions the same.

If there are cases where promoting is different between ordinary
libcalls and functions, those cases are most likely bugs.  The only
cases where it would not be a bug would be targets which provide libgcc
functions written in assembler.  So look at those to see if any
behaviour would change.

Ian


Re: [PATCH 3/6] Allow jumps in epilogues

2011-04-13 Thread Jakub Jelinek
On Wed, Apr 13, 2011 at 07:44:26AM -0700, Richard Henderson wrote:
> Yeah, while I was working on dwarf line numbers recently, I found that
> just about the only thing that would produce anything interesting was
> a profiled bootstrap.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48253#c1

is what I've been using when I touched dwarf2out recently.

Jakub


Re: [PATCH] PR c++/48574

2011-04-13 Thread Dodji Seketeli
Jason Merrill  writes:

> On 04/13/2011 10:23 AM, Jakub Jelinek wrote:
>> Then
>>
>> --- gcc/cp/class.c.jj2011-04-12 19:43:49.0 +0200
>> +++ gcc/cp/class.c   2011-04-13 15:23:07.463670993 +0200
>> @@ -5939,6 +5939,7 @@ fixed_type_or_null (tree instance, int *
>>   itself.  */
>>if (TREE_CODE (instance) == VAR_DECL
>>  &&  DECL_INITIAL (instance)
>> +&&  !type_dependent_expression_p (DECL_INITIAL (instance))
>>  &&  !htab_find (ht, instance))
>>  {
>>tree type;
>>
>> would be shorter, after that if it returns NULL_TREE.
>
> Yep.

Thanks I am committing this then.

-- 
Dodji

commit 9ff90e47bafaab67e0c41aa5341a2424726db8a8
Author: Dodji Seketeli 
Date:   Wed Apr 13 12:30:51 2011 +0200

PR c++/48574

gcc/cp/

* class.c (fixed_type_or_null): We cannot determine the dynamic
type of a reference variable if its initializer is dependent.

gcc/testsuite/

* g++.dg/template/dependent-expr7.C: New test case.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b6aebae..3216068 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5939,6 +5939,7 @@ fixed_type_or_null (tree instance, int *nonnull, int 
*cdtorp)
 itself.  */
  if (TREE_CODE (instance) == VAR_DECL
  && DECL_INITIAL (instance)
+ && !type_dependent_expression_p (DECL_INITIAL (instance))
  && !htab_find (ht, instance))
{
  tree type;
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr7.C 
b/gcc/testsuite/g++.dg/template/dependent-expr7.C
new file mode 100644
index 000..b246820
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dependent-expr7.C
@@ -0,0 +1,22 @@
+// Origin PR c++/48574
+// { dg-do compile }
+
+struct A
+{
+  virtual void foo();
+};
+
+template 
+void
+bar(T x)
+{
+  A &b = *x;
+  b.foo ();
+}
+
+void
+foo()
+{
+  A a;
+  bar(&a);
+}


Re: [PATCH 3/6] Allow jumps in epilogues

2011-04-13 Thread Bernd Schmidt
On 04/13/2011 04:14 PM, Bernd Schmidt wrote:
> On 04/11/2011 07:10 PM, Richard Henderson wrote:
>> Ok.
> 
> Did you receive my reply to this message from earlier today? It doesn't
> seem to have made it to gcc-patches yet.

Since gcc-patches appears to have dropped the message, I'll resend it in
three parts.

There are three patches here, but they must be applied together (things
will mostly work otherwise, but I expect -freorder-blocks-and-partition
is broken in the intermediate stages). Below is the ChangeLog for the
entire set, and the first of the patches. This is just a new version of
the previously posted 002-scanfirst patch, now changed to delete the CFI
notes afterwards in order to avoid -fcompare-debug failures.


Bernd

* target.def (dwarf_handle_frame_unspec): Remove label argument.
* doc/tm.texi: Regenerate.
* tree.h (dwarf2out_cfi_label, dwarf2out_def_cfa,
dwarf2out_window_save, dwarf2out_reg_save, dwarf2out_return_save,
dwarf2out_return_reg, dwarf2out_reg_save_reg): Don't declare.
* final.c (final_start_function): Call
dwarf2out_frame_debug_after_prologue.
(final_scan_insn): Don't call dwarf2out_frame_debug for anything.
Handle NOTE_INSN_CFI and NOTE_INSN_CFI_LABEL.
(final): Delete these notes.
* insn-notes.def (CFI, CFI_LABEL): New.
* jump.c (addr_vec_p): New function.
* dwarf2out.c (cfi_insn): New static variable.
(dwarf2out_cfi_label): Remove force argument. All callers changed.
Only generate the label, don't emit it.
(dwarf2out_maybe_emit_cfi_label): New function.

(add_fde_cfi): Remove label argument.  All callers changed.  Remove
most code; leave a condition to either emit a CFI insn, or add the
CFI to the FDE CFI vector.
(add_cie_cfi): New static function.
(add_cfi): Remove function.
(old_cfa): New static variable.
(cfa_remember): Remove static variable.
(dwarf2out_def_cfa): Replace label argument with a bool for_cie
argument.  All callers changed.  Don't use lookup_cfa; use and
update the global old_cfa variable.  Call add_fde_cfi or add_cie_cfi
at the end.
(reg_save): Replace label argument with a bool.  All callers changed.
Call add_fde_cfi or add_cie_cfi at the end.
(dwarf2out_reg_save, dwarf2out_return_save, dwarf2out_return_reg,
dwarf2out_args_szie, dwarf2out_stack_adjust, dwarf2out_reg_save_reg,
dwarf2out_frame_debug_def_cfa, dwarf2out_frame_debug_cfa_offset,
dwarf2out_frame_debug_cfa_register, dwarf2out_frame_debug_cfa_restore,
dwarf2out_frame_debug_cfa_expression, dwarf2out_frame_debug_expr):
Remove label argument.  All callers changed.
(barrier_args_size): Remove variable.
(compute_barrier_args_size_1, compute_barrier_args_size): Remove
functions.
(dwarf2out_notice_stack_adjust): Don't handle barriers.
(last_reg_save_label): Remove variable.  All sets and uses removed.
(cfi_label_required_p, add_cfis_to_fde): New static functions.
(dwarf2out_frame_debug_restore_state): Simply add the new CFI.
(dwarf2out_frame_debug): Set cfi_insn, and clear it.  Don't call
dwarf2out_flush_queued_reg_saves at the top.
(dwarf2out_frame_debug_init): Initialize old_cfa.
(copy_cfi_vec_parts): New static function.
(jump_target_info): New struct type.
(dwarf2out_cfi_begin_epilogue): Remove.
(save_point_p, record_current_state, maybe_record_jump_target,
vec_is_prefix_of, append_extra_cfis, debug_cfi_vec, switch_note_p,
scan_until_barrier, find_best_starting_point): New static functions.
(dwarf2out_frame_debug_after_prologue): New function.
(dwarf2out_emit_cfi): New function.
(output_cfi_directive): New FILE argument.  All callers changed.
Avoid some paths if it is not asm_out_file; otherwise print to it.
(output_all_cfis): Remove function.
(output_cfis): Remove do_cfi_asm arg.  All callers changed.  Never
call output_cfi_directive.
(dwarf2out_frame_init): Initialize old_cfa.
(dwarf2out_switch_text_section): Don't initialize dw_fde_current_label.
Don't call output_all_cfis.
* dwarf2out.h (dwarf2out_cfi_label, dwarf2out_def_cfa,
dwarf2out_window_save, dwarf2out_reg_save, dwarf2out_return_save,
dwarf2out_return_reg, dwarf2out_reg_save_reg, dwarf2out_emit_cfi,
dwarf2out_frame_debug_after_prologue): Declare.
(dwarf2out_cfi_begin_epilogue, dwarf2out_frame_debug_restore_state):
Don't declare.
(struct dw_cfi_struct): Add forward declaration.
* rtl.h (union rtunion_def): Add rt_cfi member.
(XCFI, XCCFI, NOTE_CFI, NOTE_LABEL_NUMBER): New macros.
(addr_vec_p): Declare.
* config/sparc/sparc.c (sparc_dwarf_handle_frame_unspec): Remove
 

Re: [PATCH 3/6] Allow jumps in epilogues

2011-04-13 Thread Bernd Schmidt
The second part is a new patch, which reduces the amount of different
code paths we can take in add_fde_cfi, as this was becoming
unmanageable. The concept is to first emit just the CFI notes, in all
cases. Later, after we're done producing the CFI insns we need, another
pass over the rtl adds the necessary labels and set_loc/advance_loc
CFIs. One consequence of this is that def_cfa_1 can no longer use
lookup_cfa, so it just compares to an old_cfa variable instead. This
also requires target-specific changes as some ports use
dwarf2out_cfi_label. An (untested) example of the necessary changes is
in config/arm.


Bernd
---
 config/arm/arm.c |5 
 config/ia64/ia64.c   |6 
 config/sparc/sparc.c |7 
 config/vax/vax.c |2 
 dwarf2out.c  |  467 ---
 dwarf2out.h  |   32 +++
 final.c  |5 
 target.def   |2 
 tree.h   |   31 ---
 9 files changed, 270 insertions(+), 287 deletions(-)

Index: gcc/config/arm/arm.c
===
--- gcc.orig/config/arm/arm.c
+++ gcc/config/arm/arm.c
@@ -19977,18 +19977,19 @@ thumb_pushpop (FILE *f, unsigned long ma
 
   if (push && pushed_words && dwarf2out_do_frame ())
 {
-  char *l = dwarf2out_cfi_label (false);
   int pushed_mask = real_regs;
 
+  dwarf2out_maybe_emit_cfi_label ();
+
   *cfa_offset += pushed_words * 4;
-  dwarf2out_def_cfa (l, SP_REGNUM, *cfa_offset);
+  dwarf2out_def_cfa (SP_REGNUM, *cfa_offset);
 
   pushed_words = 0;
   pushed_mask = real_regs;
   for (regno = 0; regno <= 14; regno++, pushed_mask >>= 1)
{
  if (pushed_mask & 1)
-   dwarf2out_reg_save (l, regno, 4 * pushed_words++ - *cfa_offset);
+   dwarf2out_reg_save (regno, 4 * pushed_words++ - *cfa_offset);
}
 }
 }
@@ -20997,10 +20998,9 @@ thumb1_output_function_prologue (FILE *f
 the stack pointer.  */
   if (dwarf2out_do_frame ())
{
- char *l = dwarf2out_cfi_label (false);
-
+ dwarf2out_maybe_emit_cfi_label ();
  cfa_offset = cfa_offset + crtl->args.pretend_args_size;
- dwarf2out_def_cfa (l, SP_REGNUM, cfa_offset);
+ dwarf2out_def_cfa (SP_REGNUM, cfa_offset);
}
 }
 
@@ -21046,10 +21046,10 @@ thumb1_output_function_prologue (FILE *f
 
   if (dwarf2out_do_frame ())
{
- char *l = dwarf2out_cfi_label (false);
+ dwarf2out_maybe_emit_cfi_label ();
 
  cfa_offset = cfa_offset + 16;
- dwarf2out_def_cfa (l, SP_REGNUM, cfa_offset);
+ dwarf2out_def_cfa (SP_REGNUM, cfa_offset);
}
 
   if (l_mask)
@@ -22749,7 +22749,7 @@ arm_except_unwind_info (struct gcc_optio
stack alignment.  */
 
 static void
-arm_dwarf_handle_frame_unspec (const char *label, rtx pattern, int index)
+arm_dwarf_handle_frame_unspec (rtx pattern, int index)
 {
   rtx unspec = SET_SRC (pattern);
   gcc_assert (GET_CODE (unspec) == UNSPEC);
@@ -22760,8 +22760,7 @@ arm_dwarf_handle_frame_unspec (const cha
   /* ??? We should set the CFA = (SP & ~7).  At this point we haven't
  put anything on the stack, so hopefully it won't matter.
  CFA = SP will be correct after alignment.  */
-  dwarf2out_reg_save_reg (label, stack_pointer_rtx,
-  SET_DEST (pattern));
+  dwarf2out_reg_save_reg (stack_pointer_rtx, SET_DEST (pattern));
   break;
 default:
   gcc_unreachable ();
Index: gcc/config/ia64/ia64.c
===
--- gcc.orig/config/ia64/ia64.c
+++ gcc/config/ia64/ia64.c
@@ -330,7 +330,7 @@ static enum machine_mode ia64_promote_fu
 static void ia64_trampoline_init (rtx, tree, rtx);
 static void ia64_override_options_after_change (void);
 
-static void ia64_dwarf_handle_frame_unspec (const char *, rtx, int);
+static void ia64_dwarf_handle_frame_unspec (rtx, int);
 static tree ia64_builtin_decl (unsigned, bool);
 
 static reg_class_t ia64_preferred_reload_class (rtx, reg_class_t);
@@ -9710,9 +9710,7 @@ ia64_dwarf2out_def_steady_cfa (rtx insn,
processing.  The real CFA definition is set up above.  */
 
 static void
-ia64_dwarf_handle_frame_unspec (const char * ARG_UNUSED (label),
-   rtx ARG_UNUSED (pattern),
-   int index)
+ia64_dwarf_handle_frame_unspec (rtx ARG_UNUSED (pattern), int index)
 {
   gcc_assert (index == UNSPECV_ALLOC);
 }
Index: gcc/config/sparc/sparc.c
===
--- gcc.orig/config/sparc/sparc.c
+++ gcc/config/sparc/sparc.c
@@ -454,7 +454,7 @@ static unsigned int sparc_function_arg_b
 const_tree);
 static int sparc_arg_partial_bytes (CUMULATIVE_ARGS *,
enum machine_mode, tree, bool);
-static void sparc_dwarf_handle_frame_unspec (const cha

Re: [PATCH 3/6] Allow jumps in epilogues

2011-04-13 Thread Bernd Schmidt
The final part, an updated version of the old 004-dw2cfg patch. This
does much better placement of remember/restore; in almost all cases the
code is identical to what we currently generate, modulo minor
differences around the PROLOGUE_END label. I've made it emit queued
register saves before PROLOGUE_END so that we can use the state there
for forced labels.


Bernd
Index: gcc/dwarf2out.c
===
--- gcc.orig/dwarf2out.c
+++ gcc/dwarf2out.c
@@ -465,12 +465,11 @@ static void initial_return_save (rtx);
 static HOST_WIDE_INT stack_adjust_offset (const_rtx, HOST_WIDE_INT,
  HOST_WIDE_INT);
 static void output_cfi (dw_cfi_ref, dw_fde_ref, int);
-static void output_cfi_directive (dw_cfi_ref);
+static void output_cfi_directive (FILE *, dw_cfi_ref);
 static void output_call_frame_info (int);
 static void dwarf2out_note_section_used (void);
 static bool clobbers_queued_reg_save (const_rtx);
 static void dwarf2out_frame_debug_expr (rtx);
-static void dwarf2out_cfi_begin_epilogue (rtx);
 static void dwarf2out_frame_debug_restore_state (void);
 
 /* Support for complex CFA locations.  */
@@ -823,9 +822,6 @@ new_cfi (void)
 /* The insn after which a new CFI note should be emitted.  */
 static rtx cfi_insn;
 
-/* True if remember_state should be emitted before following CFI directive.  */
-static bool emit_cfa_remember;
-
 /* True if any CFI directives were emitted at the current insn.  */
 static bool any_cfis_emitted;
 
@@ -868,28 +864,34 @@ dwarf2out_maybe_emit_cfi_label (void)
 }
 }
 
+static void
+add_cfa_remember (void)
+{
+  dw_cfi_ref cfi_remember;
+
+  /* Emit the state save.  */
+  cfi_remember = new_cfi ();
+  cfi_remember->dw_cfi_opc = DW_CFA_remember_state;
+  add_fde_cfi (cfi_remember);
+}
+
+/* Nonnull if add_fde_cfi should not just emit a NOTE_INSN_CFI, but
+   also add the CFI to this vector.  */
+static cfi_vec *cfi_insn_vec;
+
 /* Add CFI to the current fde at the PC value indicated by LABEL if specified,
or to the CIE if LABEL is NULL.  */
 
 static void
 add_fde_cfi (dw_cfi_ref cfi)
 {
-  if (emit_cfa_remember)
-{
-  dw_cfi_ref cfi_remember;
-
-  /* Emit the state save.  */
-  emit_cfa_remember = false;
-  cfi_remember = new_cfi ();
-  cfi_remember->dw_cfi_opc = DW_CFA_remember_state;
-  add_fde_cfi (cfi_remember);
-}
-
   any_cfis_emitted = true;
   if (cfi_insn != NULL)
 {
   cfi_insn = emit_note_after (NOTE_INSN_CFI, cfi_insn);
   NOTE_CFI (cfi_insn) = cfi;
+  if (cfi_insn_vec != NULL)
+   VEC_safe_push (dw_cfi_ref, gc, *cfi_insn_vec, cfi);
 }
   else
 {
@@ -980,12 +982,6 @@ static dw_cfa_location old_cfa;
from the CFA.  */
 static dw_cfa_location cfa_store;
 
-/* The current save location around an epilogue.  */
-static dw_cfa_location cfa_remember;
-
-/* Like cfa_remember, but a copy of old_cfa.  */
-static dw_cfa_location old_cfa_remember;
-
 /* The running total of the size of arguments pushed onto the stack.  */
 static HOST_WIDE_INT args_size;
 
@@ -1339,179 +1335,6 @@ stack_adjust_offset (const_rtx pattern, 
   return offset;
 }
 
-/* Precomputed args_size for CODE_LABELs and BARRIERs preceeding them,
-   indexed by INSN_UID.  */
-
-static HOST_WIDE_INT *barrier_args_size;
-
-/* Helper function for compute_barrier_args_size.  Handle one insn.  */
-
-static HOST_WIDE_INT
-compute_barrier_args_size_1 (rtx insn, HOST_WIDE_INT cur_args_size,
-VEC (rtx, heap) **next)
-{
-  HOST_WIDE_INT offset = 0;
-  int i;
-
-  if (! RTX_FRAME_RELATED_P (insn))
-{
-  if (prologue_epilogue_contains (insn))
-   /* Nothing */;
-  else if (GET_CODE (PATTERN (insn)) == SET)
-   offset = stack_adjust_offset (PATTERN (insn), cur_args_size, 0);
-  else if (GET_CODE (PATTERN (insn)) == PARALLEL
-  || GET_CODE (PATTERN (insn)) == SEQUENCE)
-   {
- /* There may be stack adjustments inside compound insns.  Search
-for them.  */
- for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
-   if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET)
- offset += stack_adjust_offset (XVECEXP (PATTERN (insn), 0, i),
-cur_args_size, offset);
-   }
-}
-  else
-{
-  rtx expr = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX);
-
-  if (expr)
-   {
- expr = XEXP (expr, 0);
- if (GET_CODE (expr) == PARALLEL
- || GET_CODE (expr) == SEQUENCE)
-   for (i = 1; i < XVECLEN (expr, 0); i++)
- {
-   rtx elem = XVECEXP (expr, 0, i);
-
-   if (GET_CODE (elem) == SET && !RTX_FRAME_RELATED_P (elem))
- offset += stack_adjust_offset (elem, cur_args_size, offset);
- }
-   }
-}
-
-#ifndef STACK_GROWS_DOWNWARD
-  offset = -offset;
-#endif
-
-  cur_args_size += offset;
-  if (cur_args_size < 0)
-

Re: [trans-mem] PR 47952 Re: weak aliases, .tm_clone_table, and binutils confusion

2011-04-13 Thread Patrick Marlier

About this line of my patch for aliases:
DECL_WEAK (tm_alias) = DECL_WEAK (alias->decl);
You can reproduce it with the same testcase, looking at these symbols:

.weak   _ZNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base

.globl
_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base

The clone version should be also weak.


Ping to this?
I know that is not causing a big problem but I think the clone should be 
coherent with the original.


Should I fill another PR just for this? (even if obvious).

Patrick Marlier.


RFA: Add makefile for cross-configuration torture test

2011-04-13 Thread Joern Rennecke

Global patches that affect various configurations in various ways tend to
break configurations.  People usually make an effort with global search and
replace, but all too often some details are overlooked (or simply mistyped).

This Makefile is supposed to give coverage of all the main configure targets
and notable variants that enable different config files.
Each target is configured, using --enable-werror-always, and then we attempt
to build 'all-gcc'.  configuration and make output is collected in a 'log'
directory.
This is based on config-list.mk in the pr46489-20101227-branch, but with
configurations removed that have been recently removed or obsoleted.
This leaves 193 configurations, of which 23 currently appear to be broken
(according to a test run on gcc20).  These are:

alpha-dec-osf5.1
am33_2.0-linux
arm-freebsd6
arm-wince-pe
avr-elf
avr-rtems
i586-netware --with-ld=../scripts/nwld
i686-openbsd3.0
i686-pc-msdosdjgpp
i686-wrs-vxworksae
iq2000-elf
lm32-elf
lm32-rtems
lm32-uclinux
m68k-openbsd
microblaze-elf
microblaze-linux
mips-openbsd
mn10300-elf
powerpc-wrs-vxworksae
rs6000-ibm-aix5.2.0
rs6000-ibm-aix5.3.0
rs6000-ibm-aix6.0
2010-04-13  Joern Rennecke  

* config-list.mk: New file.

Index: contrib/config-list.mk
===
--- contrib/config-list.mk  (revision 0)
+++ contrib/config-list.mk  (revision 0)
@@ -0,0 +1,92 @@
+# Run tests covering all config.gcc cases.
+host_options='--with-mpc=/opt/cfarm/mpc' # gcc10
+# Make sure you have a recent enough gcc (with ada support) in your path so
+# that --enable-werror-always will work.
+# To use, create a sibling directory to the gcc sources and cd into this.
+# Use -j / -l make arguments and nice to assure a smooth resource-efficient
+# load on the build machine, e.g. for 24 cores:
+# svn co svn://gcc.gnu.org/svn/gcc/branches/foo-branch gcc
+# mkdir multi-mk; cd multi-mk
+# nohup nice make -j25 -l36 -f ../gcc/contrib/config-list.mk > make.out 2>&1 &
+#
+# v850e1-elf is rejected by config.sub
+LIST = alpha-linux-gnu alpha-freebsd6 alpha-netbsd alpha-openbsd \
+  alpha-dec-osf5.1 alpha64-dec-vms alpha-dec-vms am33_2.0-linux \
+  arm-wrs-vxworks arm-freebsd6 arm-netbsdelf arm-linux \
+  arm-linux-androideabi arm-uclinux_eabi arm-ecos-elf arm-eabi \
+  arm-symbianelf arm-rtems arm-elf arm-wince-pe avr-rtems avr-elf \
+  bfin-elf bfin-uclinux bfin-linux-uclibc bfin-rtems bfin-openbsd \
+  cris-elf cris-linux crisv32-elf crisv32-linux fido-elf \
+  fr30-elf frv-elf frv-linux h8300-elf h8300-rtems hppa-linux-gnu \
+  hppa-linux-gnuOPT-enable-sjlj-exceptions=yes hppa64-linux-gnu \
+  hppa2.0-hpux10.1 hppa64-hpux11.3 \
+  hppa64-hpux11.0OPT-enable-sjlj-exceptions=yes hppa2.0-hpux11.9 \
+  i686-pc-linux-gnu i686-apple-darwin i686-apple-darwin9 i686-apple-darwin10 \
+  i486-freebsd4 i686-freebsd6 i686-kfreebsd-gnu \
+  i686-netbsdelf9 i686-knetbsd-gnu i686-openbsd i686-openbsd3.0 \
+  i686-elf i686-kopensolaris-gnu i686-symbolics-gnu i686-pc-msdosdjgpp \
+  i686-lynxos i586-netwareOPT-with-ld=SCRIPTSnwld i686-nto-qnx \
+  i686-rtems i686-solaris2.10 i686-wrs-vxworks \
+  i686-wrs-vxworksae \
+  i686-cygwinOPT-enable-threads=yes i686-mingw32crt ia64-elf \
+  ia64-freebsd6 ia64-linux ia64-hpux ia64-hp-vms iq2000-elf lm32-elf \
+  lm32-rtems lm32-uclinux m32c-rtems m32c-elf m32r-elf m32rle-elf m32r-rtems \
+  m32r-linux m32rle-linux m68k-elf m68k-netbsdelf \
+  m68k-openbsd m68k-uclinux m68k-linux m68k-rtems \
+  mcore-elf mep-elf microblaze-linux microblaze-elf \
+  mips-sgi-irix6.5OPT-with-stabsOPT-enable-threads=posix mips-netbsd \
+  mips64el-st-linux-gnu mips64octeon-linux mipsisa64r2-linux \
+  mipsisa32r2-linux-gnu mips-openbsd mipsisa64r2-sde-elf mipsisa32-elfoabi \
+  mipsisa64-elfoabi mipsisa64r2el-elf mipsisa64sr71k-elf mipsisa64sb1-elf \
+  mipsel-elf mips64-elf mips64vr-elf mips64orion-elf mips-rtems \
+  mips-wrs-vxworks mipstx39-elf mmix-knuth-mmixware mn10300-elf moxie-elf \
+  moxie-uclinux moxie-rtems pdp11-aout picochip-elf powerpc-darwin8 \
+  powerpc-darwin7 powerpc64-darwin powerpc-freebsd6 powerpc-netbsd \
+  powerpc-eabispe powerpc-eabisimaltivec powerpc-eabisim ppc-elf \
+  powerpc-eabialtivec powerpc-xilinx-eabi powerpc-eabi \
+  powerpc-rtems4.11OPT-enable-threads=yes powerpc-linux_spe \
+  powerpc-linux_paired powerpc64-linux_altivec \
+  powerpc-wrs-vxworks powerpc-wrs-vxworksae powerpc-lynxos powerpcle-elf \
+  powerpcle-eabisim powerpcle-eabi rs6000-ibm-aix4.3 rs6000-ibm-aix5.1.0 \
+  rs6000-ibm-aix5.2.0 rs6000-ibm-aix5.3.0 rs6000-ibm-aix6.0 \
+  rx-elf s390-linux-gnu s390x-linux-gnu s390x-ibm-tpf sh-elf \
+  shle-linux sh-netbsdelf sh-superh-elf sh5el-netbsd sh64-netbsd sh64-linux \
+  sh64-elfOPT-with-newlib sh-rtems sh-wrs-vxworks sparc-elf \
+  sparc-leon-elf sparc-rtems sparc-linux-gnu \
+  sparc-leon3-linux-gnuOPT-enable-target=all sparc-netbsdelf \
+  
sparc64-sun-solaris2.10OPT-with-gnu-ldOPT-with-gnu-asOPT-enable-threads=posix \
+  sparc-wrs-vxworks spar

[committed] Fix __float128 OpenMP atomics in 32-bit cc1 (PR middle-end/48591)

2011-04-13 Thread Jakub Jelinek
Hi!

In 32-bit cc1 on i?86-linux the attached testcases ICE, because
built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_16] is NULL.
There is no such integer type, but __float128 has that size.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk and 4.6.

2011-04-13  Jakub Jelinek  

PR middle-end/48591
* omp-low.c (expand_omp_atomic_fetch_op): Return false if decl is
NULL.
(expand_omp_atomic_pipeline): Return false if cmpxchg is NULL.

* gcc.dg/gomp/pr48591.c: New test.

* testsuite/libgomp.c/pr48591.c: New test.

--- gcc/omp-low.c.jj2011-01-06 10:03:53.0 +0100
+++ gcc/omp-low.c   2011-04-13 14:36:55.0 +0200
@@ -5005,6 +5005,8 @@ expand_omp_atomic_fetch_op (basic_block 
 return false;
 
   decl = built_in_decls[base + index + 1];
+  if (decl == NULL_TREE)
+return false;
   itype = TREE_TYPE (TREE_TYPE (decl));
 
   if (direct_optab_handler (optab, TYPE_MODE (itype)) == CODE_FOR_nothing)
@@ -5056,6 +5058,8 @@ expand_omp_atomic_pipeline (basic_block 
   edge e;
 
   cmpxchg = built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_N + index + 1];
+  if (cmpxchg == NULL_TREE)
+return false;
   type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
   itype = TREE_TYPE (TREE_TYPE (cmpxchg));
 
--- gcc/testsuite/gcc.dg/gomp/pr48591.c.jj  2011-04-13 14:44:41.0 
+0200
+++ gcc/testsuite/gcc.dg/gomp/pr48591.c 2011-04-13 14:46:46.0 +0200
@@ -0,0 +1,22 @@
+/* PR middle-end/48591 */
+/* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-options "-fopenmp" } */
+
+extern void abort (void);
+
+int
+main ()
+{
+  __float128 f = 0.0;
+  int i;
+  #pragma omp parallel for reduction(+:f)
+for (i = 0; i < 128; i++)
+  f += 0.5Q;
+  if (f != 64.0Q)
+abort ();
+  #pragma omp atomic
+f += 8.5Q;
+  if (f != 72.5Q)
+abort ();
+  return 0;
+}
--- libgomp/testsuite/libgomp.c/pr48591.c.jj2011-04-13 14:51:00.0 
+0200
+++ libgomp/testsuite/libgomp.c/pr48591.c   2011-04-13 14:51:14.0 
+0200
@@ -0,0 +1,22 @@
+/* PR middle-end/48591 */
+/* { dg-do run { target i?86-*-linux* x86_64-*-linux* ia64-*-linux* } } */
+/* { dg-options "-fopenmp" } */
+
+extern void abort (void);
+
+int
+main ()
+{
+  __float128 f = 0.0;
+  int i;
+  #pragma omp parallel for reduction(+:f)
+for (i = 0; i < 128; i++)
+  f += 0.5Q;
+  if (f != 64.0Q)
+abort ();
+  #pragma omp atomic
+f += 8.5Q;
+  if (f != 72.5Q)
+abort ();
+  return 0;
+}

Jakub


[PATCH][ARM] New testcases for NEON

2011-04-13 Thread Andrew Stubbs

Hi,

This old patch has been carried in the CodeSourcery toolchain for some 
time now. It just adds a few new testcases for vectorization.


OK?

Andrew
2008-12-03  Daniel Jacobowitz  

	gcc/testsuite/
	* gcc.dg/vect/vect-shift-3.c, gcc.dg/vect/vect-shift-4.c: New.
	* lib/target-supports.exp (check_effective_target_vect_shift_char): New
	function.

--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-shift-3.c
@@ -0,0 +1,37 @@
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+#define N 32
+
+unsigned short dst[N] __attribute__((aligned(N)));
+unsigned short src[N] __attribute__((aligned(N)));
+
+__attribute__ ((noinline))
+void array_shift(void)
+{
+  int i;
+  for (i = 0; i < N; i++)
+dst[i] = src[i] >> 3;
+}
+
+int main()
+{
+  volatile int i;
+  check_vect ();
+
+  for (i = 0; i < N; i++)
+src[i] = i << 3;
+
+  array_shift ();
+
+  for (i = 0; i < N; i++)
+if (dst[i] != i)
+  abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-shift-4.c
@@ -0,0 +1,37 @@
+/* { dg-require-effective-target vect_shift_char } */
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+#define N 32
+
+unsigned char dst[N] __attribute__((aligned(N)));
+unsigned char src[N] __attribute__((aligned(N)));
+
+__attribute__ ((noinline))
+void array_shift(void)
+{
+  int i;
+  for (i = 0; i < N; i++)
+dst[i] = src[i] >> 3;
+}
+
+int main()
+{
+  volatile int i;
+  check_vect ();
+
+  for (i = 0; i < N; i++)
+src[i] = i << 3;
+
+  array_shift ();
+
+  for (i = 0; i < N; i++)
+if (dst[i] != i)
+  abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2310,6 +2310,26 @@ proc check_effective_target_vect_shift_scalar { } {
 }
 
 
+# Return 1 if the target supports hardware vector shift operation for char.
+
+proc check_effective_target_vect_shift_char { } {
+global et_vect_shift_char_saved
+
+if [info exists et_vect_shift_char_saved] {
+	verbose "check_effective_target_vect_shift_char: using cached result" 2
+} else {
+	set et_vect_shift_char_saved 0
+	if { ([istarget powerpc*-*-*]
+ && ![istarget powerpc-*-linux*paired*])
+	 || [check_effective_target_arm32] } {
+	   set et_vect_shift_char_saved 1
+	}
+}
+
+verbose "check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
+return $et_vect_shift_char_saved
+}
+
 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
 #
 # This can change for different subtargets so do not cache the result.


[PATCH 6/n, i386]: Merge SSE and AVX patterns using "enable" attribute.

2011-04-13 Thread Uros Bizjak
Hello!

Attached patches converts "Parallel integral element swizzling"
section of sse.md.

2011-04-13  Uros Bizjak  

* config/i386/sse.md (pinsrbits): Remove.
(sse2_packsswb): Merge with *avx_packsswb.
(sse2_packssdw): Merge with *avx_packssdw.
(sse2_packuswb): Merge with *avx_packuswb.
(vec_interleave_highv16qi): Merge with *avx_interleave_highv16qi.
(vec_interleave_lowv16qi): Merge with *avx_interleave_lowv16qi.
(vec_interleave_highv8hi): Merge with *avx_interleave_highv8hi.
(vec_interleave_lowv8hi): Merge with *avx_interleave_lowv8hi.
(vec_interleave_highv4si): Merge with *avx_interleave_highv4si.
(vec_interleave_lowv4si): Merge with *avx_interleave_lowv4si.
(*sse4_1_pinsrb): Merge with *avx_pinsr.
(*sse2_pinsrw): Merge with *avx_pinsr.
(*sse4_1_pinsrd): Merge with *avx_pinsr.
(*sse4_1_pinsrq): Merge with *avx_pinsrq.
(sse2_loadld): Merge with *avx_loadld.
(*vec_extractv2di_1_rex64): Merge with *vec_extractv2di_1_rex64_avx.
(*vec_extractv2di_1_sse2): Merge with *vec_extractv2di_1_avx.
(*vec_concatv2si_sse4_1): Merge with *vec_concatv2si_avx.
(*vec_concatv2di_rex64_sse4_1): Merge with *vec_concatv2di_rex64_avx.
(vec_concatv2di): Merge with *vec_concatv2di_avx.

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

Uros.
Index: sse.md
===
--- sse.md  (revision 172297)
+++ sse.md  (working copy)
@@ -180,9 +180,6 @@
 (define_mode_attr blendbits
   [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
 
-;; Mapping of immediate bits for pinsr instructions
-(define_mode_attr pinsrbits [(V16QI "32768") (V8HI "128") (V4SI "8")])
-
 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
 
 ;
@@ -5971,110 +5968,63 @@
   DONE;
 })
 
-(define_insn "*avx_packsswb"
-  [(set (match_operand:V16QI 0 "register_operand" "=x")
-   (vec_concat:V16QI
- (ss_truncate:V8QI
-   (match_operand:V8HI 1 "register_operand" "x"))
- (ss_truncate:V8QI
-   (match_operand:V8HI 2 "nonimmediate_operand" "xm"]
-  "TARGET_AVX"
-  "vpacksswb\t{%2, %1, %0|%0, %1, %2}"
-  [(set_attr "type" "sselog")
-   (set_attr "prefix" "vex")
-   (set_attr "mode" "TI")])
-
 (define_insn "sse2_packsswb"
-  [(set (match_operand:V16QI 0 "register_operand" "=x")
+  [(set (match_operand:V16QI 0 "register_operand" "=x,x")
(vec_concat:V16QI
  (ss_truncate:V8QI
-   (match_operand:V8HI 1 "register_operand" "0"))
+   (match_operand:V8HI 1 "register_operand" "0,x"))
  (ss_truncate:V8QI
-   (match_operand:V8HI 2 "nonimmediate_operand" "xm"]
+   (match_operand:V8HI 2 "nonimmediate_operand" "xm,xm"]
   "TARGET_SSE2"
-  "packsswb\t{%2, %0|%0, %2}"
-  [(set_attr "type" "sselog")
-   (set_attr "prefix_data16" "1")
+  "@
+   packsswb\t{%2, %0|%0, %2}
+   vpacksswb\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "isa" "noavx,avx")
+   (set_attr "type" "sselog")
+   (set_attr "prefix_data16" "1,*")
+   (set_attr "prefix" "orig,vex")
(set_attr "mode" "TI")])
 
-(define_insn "*avx_packssdw"
-  [(set (match_operand:V8HI 0 "register_operand" "=x")
-   (vec_concat:V8HI
- (ss_truncate:V4HI
-   (match_operand:V4SI 1 "register_operand" "x"))
- (ss_truncate:V4HI
-   (match_operand:V4SI 2 "nonimmediate_operand" "xm"]
-  "TARGET_AVX"
-  "vpackssdw\t{%2, %1, %0|%0, %1, %2}"
-  [(set_attr "type" "sselog")
-   (set_attr "prefix" "vex")
-   (set_attr "mode" "TI")])
-
 (define_insn "sse2_packssdw"
-  [(set (match_operand:V8HI 0 "register_operand" "=x")
+  [(set (match_operand:V8HI 0 "register_operand" "=x,x")
(vec_concat:V8HI
  (ss_truncate:V4HI
-   (match_operand:V4SI 1 "register_operand" "0"))
+   (match_operand:V4SI 1 "register_operand" "0,x"))
  (ss_truncate:V4HI
-   (match_operand:V4SI 2 "nonimmediate_operand" "xm"]
+   (match_operand:V4SI 2 "nonimmediate_operand" "xm,xm"]
   "TARGET_SSE2"
-  "packssdw\t{%2, %0|%0, %2}"
-  [(set_attr "type" "sselog")
-   (set_attr "prefix_data16" "1")
+  "@
+   packssdw\t{%2, %0|%0, %2}
+   vpackssdw\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "isa" "noavx,avx")
+   (set_attr "type" "sselog")
+   (set_attr "prefix_data16" "1,*")
+   (set_attr "prefix" "orig,vex")
(set_attr "mode" "TI")])
 
-(define_insn "*avx_packuswb"
-  [(set (match_operand:V16QI 0 "register_operand" "=x")
-   (vec_concat:V16QI
- (us_truncate:V8QI
-   (match_operand:V8HI 1 "register_operand" "x"))
- (us_truncate:V8QI
-   (match_operand:V8HI 2 "nonimmediate_operand" "xm"]
-  "TARGET_AVX"
-  "vpackuswb\t{%2, %1, %0|%0, %1, %2}"
-  [(set_attr "type" "sselog")
-   (set_attr "prefix" "vex")
-   (set_attr "mode" "TI")])
-

Re: RFA: Add makefile for cross-configuration torture test

2011-04-13 Thread Rainer Orth
Joern Rennecke  writes:

> Global patches that affect various configurations in various ways tend to
> break configurations.  People usually make an effort with global search and
> replace, but all too often some details are overlooked (or simply mistyped).
>
> This Makefile is supposed to give coverage of all the main configure targets
> and notable variants that enable different config files.
> Each target is configured, using --enable-werror-always, and then we attempt
> to build 'all-gcc'.  configuration and make output is collected in a 'log'
> directory.
> This is based on config-list.mk in the pr46489-20101227-branch, but with
> configurations removed that have been recently removed or obsoleted.
> This leaves 193 configurations, of which 23 currently appear to be broken
> (according to a test run on gcc20).  These are:
>
> alpha-dec-osf5.1

Would you care to report the kind of breakage you found?  This may
simply be a case of mips-t* only being buildable native (PR
target/3746) and gas/gld not supporting the target.

Thanks.
Rainer

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


Added myself to MAINTAINERS

2011-04-13 Thread Georg-Johann Lay
Added myself to MAINTAINERS.

Please update your MAINTAINERS file.

Johann


Index: ChangeLog
===
--- ChangeLog   (Revision 172381)
+++ ChangeLog   (Revision 172382)
@@ -1,3 +1,7 @@
+2011-04-13  Georg-Johann Lay  
+
+   * MAINTAINERS (Write After Approval): Add myself.
+
 2011-04-12  Yufeng Zhang  

* MAINTAINERS (Write After Approval): Add myself.
Index: MAINTAINERS
===
--- MAINTAINERS (Revision 172381)
+++ MAINTAINERS (Revision 172382)
@@ -407,6 +407,7 @@ Rask Ingemann Lambertsenccc94453@vip.
 Asher Langton  langt...@llnl.gov
 Chris Lattner  sa...@nondot.org
 Terry Laurenzo tlaure...@gmail.com
+Georg-Johann Lay   a...@gjlay.de
 Marc Lehmann   p...@goof.com
 James Lemkejwle...@juniper.net
 Kriang Lerdsuwanakij   lerds...@users.sourceforge.net


Re: [pph/libcpp] Allow include callback to not read the file (issue4388057)

2011-04-13 Thread Tom Tromey
> "Diego" == Diego Novillo  writes:

Diego> During pph processing, when we find an included file that we are going
Diego> to instantiate from an image, we don't want libcpp to stack and read
Diego> it.

Diego> I've implemented this by allowing the 'include' callback to return a
Diego> boolean value.  If it returns true, then we call _cpp_stack_include.
Diego> Otherwise, the file is ignored.

Diego> Tom, I believe this is the right approach, but I'm not sure.  It does
Diego> what I want, though.

It seems reasonable enough to me.

Tom


Re: [pph/libcpp] Allow include callback to not read the file (issue4388057)

2011-04-13 Thread Tom Tromey
> "Diego" == Diego Novillo  writes:

Lawrence> This change is not source compatible with existing code using
Lawrence> the callbacks (which may not be in the gcc svn).  Perhaps a new
Lawrence> callback is needed?

Diego> Well, it only changes the return value for the callback.  Existing
Diego> users do not really need to be changed.

Diego> I don't think we want a new callback.  The callback would do exactly
Diego> what cb.include does.

My grep shows 2 places that set this: c-family/c-ppoutput.c and
fortran/cpp.c.  It seems like it would be simple to just update those
two functions to account for the type change.

Tom


Re: RFA: Add makefile for cross-configuration torture test

2011-04-13 Thread Joern Rennecke

Quoting Rainer Orth :


alpha-dec-osf5.1


Would you care to report the kind of breakage you found?  This may
simply be a case of mips-t* only being buildable native (PR
target/3746) and gas/gld not supporting the target.


Yes, that's what it is.

gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall  
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes  
-Wmissing-format-attribute -pedantic -Wno-long-long  
-Wno-variadic-macros -Wno-overlength-strings -Werror  
-Wold-style-definition -Wc++-compat -fno-common -Wno-error  
-DHAVE_CONFIG_H -I. -I. -I../../../gcc/gcc -I../../../gcc/gcc/.  
-I../../../gcc/gcc/../include -I../../../gcc/gcc/../libcpp/include  
-I/opt/cfarm/mpc/include  -I../../../gcc/gcc/../libdecnumber  
-I../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
../../../gcc/gcc/mips-tfile.c -o mips-tfile.o
../../../gcc/gcc/mips-tfile.c:672:24: fatal error: mips/a.out.h: No  
such file or directory

compilation terminated.

If you have access to the gcc compile farm, you can read the individual
results in gcc20.fsffrance.org:/home/amylaar/pr46489/apr12/multi2/log


Re: RFA: Add makefile for cross-configuration torture test

2011-04-13 Thread Joseph S. Myers
On Wed, 13 Apr 2011, Joern Rennecke wrote:

> This is based on config-list.mk in the pr46489-20101227-branch, but with
> configurations removed that have been recently removed or obsoleted.

On the whole I think the obsolete but not yet removed targets should be 
included in the list with --enable-obsolete, to be removed from it if they 
are actually removed from GCC.  We know that Interix targets are broken, 
but the other obsolete targets might still build.

> This leaves 193 configurations, of which 23 currently appear to be broken
> (according to a test run on gcc20).  These are:

Do these all have issues filed (marked as blocking PR 47093 or 44756 as 
applicable, and with any target maintainer CC:ed)?

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


[Committed][AVR]: PR target/45263: Don't use r20 around calls of __tablejump_elpm__

2011-04-13 Thread Georg-Johann Lay
PR target/45263
* config/avr/libgcc.S (__do_global_ctors, __do_global_dtors): Don't use
r20 around calls of __tablejump_elpm__

http://gcc.gnu.org/viewcvs?view=revision&revision=172384
http://gcc.gnu.org/viewcvs?view=revision&revision=172385




Index: config/avr/libgcc.S
===
--- config/avr/libgcc.S	(Revision 172258)
+++ config/avr/libgcc.S	(Arbeitskopie)
@@ -791,22 +791,22 @@ __do_clear_bss:
 #if defined(__AVR_HAVE_RAMPZ__)
 __do_global_ctors:
 	ldi	r17, hi8(__ctors_start)
-	ldi	r16, hh8(__ctors_start)
 	ldi	r28, lo8(__ctors_end)
 	ldi	r29, hi8(__ctors_end)
-	ldi	r20, hh8(__ctors_end)
+	ldi	r16, hh8(__ctors_end)
 	rjmp	.L__do_global_ctors_start
 .L__do_global_ctors_loop:
 	sbiw	r28, 2
-	sbc r20, __zero_reg__
+	sbc r16, __zero_reg__
 	mov_h	r31, r29
 	mov_l	r30, r28
-	out __RAMPZ__, r20
+	out __RAMPZ__, r16
 	XCALL	__tablejump_elpm__
 .L__do_global_ctors_start:
 	cpi	r28, lo8(__ctors_start)
 	cpc	r29, r17
-	cpc	r20, r16
+	ldi	r24, hh8(__ctors_start)
+	cpc	r16, r24
 	brne	.L__do_global_ctors_loop
 #else
 __do_global_ctors:
@@ -832,22 +832,22 @@ __do_global_ctors:
 #if defined(__AVR_HAVE_RAMPZ__)
 __do_global_dtors:
 	ldi	r17, hi8(__dtors_end)
-	ldi	r16, hh8(__dtors_end)
 	ldi	r28, lo8(__dtors_start)
 	ldi	r29, hi8(__dtors_start)
-	ldi	r20, hh8(__dtors_start)
+	ldi	r16, hh8(__dtors_start)
 	rjmp	.L__do_global_dtors_start
 .L__do_global_dtors_loop:
 	sbiw	r28, 2
-	sbc r20, __zero_reg__
+	sbc r16, __zero_reg__
 	mov_h	r31, r29
 	mov_l	r30, r28
-	out __RAMPZ__, r20
+	out __RAMPZ__, r16
 	XCALL	__tablejump_elpm__
 .L__do_global_dtors_start:
 	cpi	r28, lo8(__dtors_end)
 	cpc	r29, r17
-	cpc	r20, r16
+	ldi	r24, hh8(__dtors_end)
+	cpc	r16, r24
 	brne	.L__do_global_dtors_loop
 #else
 __do_global_dtors:


RFA: patch for PR48455

2011-04-13 Thread Vladimir Makarov
The following patch should improve code size which degradation for arm 
is reported on


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48455

Is it ok to commit?  The patch was successfully bootstrapped on x86-64 
and i686 with H.J.'s autotester options.


2011-04-13  Vladimir Makarov 

PR rtl-optimization/48455
* ira-costs.c (find_costs_and_classes): Use i_mem_cost instead of
`temp_costs->mem_cost'.





Index: ira-costs.c
===
--- ira-costs.c (revision 172376)
+++ ira-costs.c (working copy)
@@ -1646,44 +1646,44 @@
  for (k = cost_classes_ptr->num - 1; k >= 0; k--)
{
  add_cost = a_costs[k];
  if (add_cost > 0 && INT_MAX - add_cost < i_costs[k])
i_costs[k] = INT_MAX;
  else
i_costs[k] += add_cost;
}
  add_cost = COSTS (costs, a_num)->mem_cost;
  if (add_cost > 0 && INT_MAX - add_cost < i_mem_cost)
i_mem_cost = INT_MAX;
  else
i_mem_cost += add_cost;
 #ifdef FORBIDDEN_INC_DEC_CLASSES
  if (in_inc_dec[a_num])
inc_dec_p = true;
 #endif
}
}
  if (equiv_savings < 0)
-   temp_costs->mem_cost = -equiv_savings;
+   i_mem_cost = -equiv_savings;
  else if (equiv_savings > 0)
{
- temp_costs->mem_cost = 0;
+ i_mem_cost = 0;
  for (k = cost_classes_ptr->num - 1; k >= 0; k--)
i_costs[k] += equiv_savings;
}
 
  best_cost = (1 << (HOST_BITS_PER_INT - 2)) - 1;
  best = ALL_REGS;
  alt_class = NO_REGS;
  /* Find best common class for all allocnos with the same
 regno.  */
  for (k = 0; k < cost_classes_ptr->num; k++)
{
  rclass = cost_classes[k];
  /* Ignore classes that are too small for this operand or
 invalid for an operand that was auto-incremented.  */
  if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)]
 #ifdef FORBIDDEN_INC_DEC_CLASSES
  || (inc_dec_p && forbidden_inc_dec_class[rclass])
 #endif
 #ifdef CANNOT_CHANGE_MODE_CLASS
  || invalid_mode_change_p (i, (enum reg_class) rclass)


Re: RFA: patch for PR48455

2011-04-13 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 04/13/11 11:09, Vladimir Makarov wrote:
> The following patch should improve code size which degradation for arm
> is reported on
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48455
> 
> Is it ok to commit?  The patch was successfully bootstrapped on x86-64
> and i686 with H.J.'s autotester options.
> 
> 2011-04-13  Vladimir Makarov 
> 
> PR rtl-optimization/48455
> * ira-costs.c (find_costs_and_classes): Use i_mem_cost instead of
> `temp_costs->mem_cost'.
OK.
jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNpdmPAAoJEBRtltQi2kC78cUIAKd41H7LfANsVOH5tuY/ZmR9
X7aRad0exevCKhRYuGBfKtZHJ1OHCvOTHxOr6Xvak/BUNuMkuZPaazc5c4rg1HRc
Fo43AM+NuxLHvNWi+gvN4sY1fhrGjYquwu5TNQ7TM26Njvbb1s1JwQtUEdly02yg
HDwSqxqurAfkAD3xrE2+sOUF/WfbE4DFS/OKCqCLr8AnQPXYu8dqA3QRjqoSuBcB
3sd0x/gTplMaJUk/B+B8xrxlOSZSooRCYp3SQhsvEWTUdhNCAYrrh2HDC26H4H9P
Uusc8PHnolU0JL5onwN/mGqu2+mrgJ8Z4Xbc2cSAMnOlf6ATQhpdcTvFUeFA7Rw=
=cfcO
-END PGP SIGNATURE-


Re: [build] Avoid ld -v error message with Sun ld on SPARC

2011-04-13 Thread Rainer Orth
David Miller  writes:

> From: Rainer Orth 
> Date: Tue, 12 Apr 2011 15:00:53 +0200
>
>> On Solaris 10, as assembles the test just fine, but ld cannot deal with
>> gas 2.21 output:
>> 
>> ld: fatal: relocation error: R_SPARC_GOTDATA_HIX22: file gotdata.o: symbol 
>> : offset 0xff370163 is non-aligned
>> ld: fatal: relocation error: R_SPARC_GOTDATA_LOX10: file gotdata.o: symbol 
>> : offset 0xff370167 is non-aligned
>> ld: fatal: file gotdata: creation interrupted: Error 0
>
> Really strange error message, could you see if adding something as simply as
> ".align 4" after the ".text" in the test assembler makes this go away?

yep, that does the trick.

>> Ok for mainline?
>
> I'm fine with this patch, we can try to attack the above problem 
> independently.

Thanks, installed.

Rainer

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


Re: [pph/libcpp] Allow include callback to not read the file (issue4388057)

2011-04-13 Thread Diego Novillo
On Wed, Apr 13, 2011 at 12:21, Tom Tromey  wrote:
>> "Diego" == Diego Novillo  writes:
>
> Lawrence> This change is not source compatible with existing code using
> Lawrence> the callbacks (which may not be in the gcc svn).  Perhaps a new
> Lawrence> callback is needed?
>
> Diego> Well, it only changes the return value for the callback.  Existing
> Diego> users do not really need to be changed.
>
> Diego> I don't think we want a new callback.  The callback would do exactly
> Diego> what cb.include does.
>
> My grep shows 2 places that set this: c-family/c-ppoutput.c and
> fortran/cpp.c.  It seems like it would be simple to just update those
> two functions to account for the type change.

Oh, right.  Here I was thinking of users outside of gcc, but of course
there aren't those.  I'll fix the calls in the existing front ends.


Diego.


Re: [build] Avoid ld -v error message with Sun ld on SPARC

2011-04-13 Thread David Miller
From: Rainer Orth 
Date: Wed, 13 Apr 2011 19:16:32 +0200

> David Miller  writes:
> 
>> From: Rainer Orth 
>> Date: Tue, 12 Apr 2011 15:00:53 +0200
>>
>>> On Solaris 10, as assembles the test just fine, but ld cannot deal with
>>> gas 2.21 output:
>>> 
>>> ld: fatal: relocation error: R_SPARC_GOTDATA_HIX22: file gotdata.o: symbol 
>>> : offset 0xff370163 is non-aligned
>>> ld: fatal: relocation error: R_SPARC_GOTDATA_LOX10: file gotdata.o: symbol 
>>> : offset 0xff370167 is non-aligned
>>> ld: fatal: file gotdata: creation interrupted: Error 0
>>
>> Really strange error message, could you see if adding something as simply as
>> ".align 4" after the ".text" in the test assembler makes this go away?
> 
> yep, that does the trick.
> 
>>> Ok for mainline?
>>
>> I'm fine with this patch, we can try to attack the above problem 
>> independently.
> 
> Thanks, installed.

Thanks Rainer, if you cons up a patch to add the ".align" directive I'll ACK
that as well.


Re: [pph] Test PPH include at global scope. (issue4399041)

2011-04-13 Thread dnovillo

On 2011/04/12 21:40:10, Lawrence Crowl wrote:

Add a test to ensure that PPH files are #included at global scope.
Initially, this test is XFAIL, as it's a low priority error.



Index: gcc/testsuite/ChangeLog.pph



2011-04-12  Lawrence Crowl  



* g++.dg/pph/y2smother.cc: New.


OK.


Diego.

http://codereview.appspot.com/4399041/


Re: [PATCH, ARM] Switch to EABI version 5 for RTEMS

2011-04-13 Thread Joel Sherrill

On 04/13/2011 03:38 AM, Sebastian Huber wrote:

On 04/06/2011 07:20 PM, Sebastian Huber wrote:

On 06/04/11 18:24, Ralf Corsepius wrote:

On 04/06/2011 05:20 PM, Sebastian Huber wrote:


there were several requests for ARM Cortex-M support on RTEMS
recently.  The
first step towards this is a suitable ARM tool chain.  I want to use
this event
to clean up the multilibs and switch to the EABI version 5.  The
benefit of
EABI version 5 is that this brings RTEMS more in line with the
primary GCC
platform arm-linux-gnueabi.

These patches are not OK with me, because these are widely
incompatible to what has been used in RTEMS up today

Can you please list these incompatibilities.  The RTEMS test suite shows
no problems with this tool chain.  The GCC test suite looks also good.

[...]

It is not really helpful to claim something without an explanation.  The
missing tool chain for the ARM Cortex architecture blocks RTEMS from further
development on a very important embedded systems platform.  A lot of competing
real time operating systems provide ARM Cortex support for a long time.

Lets look at the GCC test suite results:


Wow!  The improvement is fantastic.

These would impact only new release branches of RTEMS and
we are months away from a new release branch.  If something
breaks, now if the time to find it out.


RTEMS 4.11, GCC 4.6.0 (EABI)

=== gcc Summary ===

# of expected passes72429
# of unexpected failures200
# of unexpected successes   7
# of expected failures  183
# of unresolved testcases   138
# of unsupported tests  1103

=== g++ Summary ===

# of expected passes25494
# of unexpected failures11
# of unexpected successes   1
# of expected failures  160
# of unsupported tests  427

RTEMS 4.11, GCC 4.6.0 (old ABI)

=== gcc Summary ===

# of expected passes43613
# of unexpected failures15916
# of unexpected successes   8
# of expected failures  181
# of unresolved testcases   11127
# of unsupported tests  1124

=== g++ Summary ===

# of expected passes20709
# of unexpected failures2590
# of expected failures  157
# of unresolved testcases   291
# of unsupported tests  430

RTEMS 4.10, GCC 4.4.5 (old ABI)

=== gcc Summary ===

# of expected passes34293
# of unexpected failures11273
# of expected failures  237
# of unresolved testcases   7878
# of unsupported tests  683

=== g++ Summary ===

# of expected passes15707
# of unexpected failures1726
# of expected failures  155
# of unresolved testcases   26
# of unsupported tests  194

RTEMS 4.9, GCC 4.3.2 (old ABI)

=== gcc Summary ===

# of expected passes47164
# of unexpected failures2070
# of expected failures  97
# of unresolved testcases   92
# of untested testcases 35
# of unsupported tests  792

=== g++ Summary ===

# of expected passes17019
# of unexpected failures52
# of unexpected successes   2
# of expected failures  82
# of unresolved testcases   49
# of unsupported tests  164

The EABI tool chain has by far the best test suite results.

The RTEMS test suite was run with the edb7312 BSP and shows good results.  It
works also on real hardware with the lpc24xx and lpc32xx BSPs.

All ARM BSPs compile and link all tests with the EABI tool chain.

We use the VFP floating point format in all ARM BSPs since 2010-04-30.

All ARM BSPs support the init and fini array sections since 2010-12-03.

The C++ exceptions change from SJLJ to a table based implementation is an
implementation detail.

The required ARM/Thumb interwork is an enhancement.

I don't claim that the switch to the EABI tool chain will be without problems,
but we have to use it to figure this out.  The multilib selection may need
further changes.  I am concerned about the enabled exceptions in some libgcc
functions.




--
Joel Sherrill, Ph.D. Director of Research&  Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available (256) 722-9985




Re: [PATCH] add statistics counting to postreload, copy-rename, and math-opts

2011-04-13 Thread Nathan Froyd
On Wed, Apr 13, 2011 at 11:07:15AM +0200, Richard Guenther wrote:
> On Tue, Apr 12, 2011 at 5:09 PM, Nathan Froyd  
> wrote:
> > Granted, but that fact should still be recorded.  The situation we have
> > today, for something like:
> >
> > func1: statistic for "statx" was 0
> >  - nothing is recorded in the statistics table
> > func2: statistic for "statx" was 0
> >  - nothing is recorded in the statistics table
> > func3: statistic for "statx" was 0
> >  - nothing is recorded in the statistics table
> > ...
> >
> > and so forth, is that at the end of the day, the dump file won't even
> > include any information about "statx".  If you had some func7387 where
> > "statx" was non-zero, you could infer that nothing else happened in the
> > previous 7386 functions.  For the case where a pass is truly useless on
> > a TU, it's hard to figure out from the statistics dump alone.  And I'd
> > argue that it's useful to see explicitly that the pass only helped in 1
> > out of 7387 functions, rather than trying to infer it from missing data.
> 
> I always use statistics-stats (thus, overall stats, not per function).  The
> per function ones omit zero counts during dumping on purpose
> (to make the dump smaller).

I didn't know about statistics-stats (or didn't realize that's what the
code was trying to do), that's useful.  And it looks like all the
statistics dumping things omit zero counts on purpose, not just the
per-function ones.

But that has no bearing on the point above: zero counts are not even
*recorded* today.  E.g. if you apply the patch upthread, grab a random C
file, compile it with -O2/3 -fdump-statistics/-stats, and examine the
dump file, you might not even know that new statistics counters have
been added.  Taking out the checks to avoid printing zero counts doesn't
help either, because the data simply doesn't get recorded.  This
infrastructure makes it somewhat difficult to figure out, in an
automated way from the dump file alone, whether passes are actually
doing anything.

Enough grousing.  I'm assuming turning on accumulation and dumping of
zero counts always would be frowned upon; would it be acceptable to turn
accumulation and dumping of zero counts if -details is given?

-Nathan


Re: [PATCH 5/6] Add line map statistics to -fmem-report output

2011-04-13 Thread Dodji Seketeli
Hello,

Gabriel Dos Reis  writes:

> On Fri, Dec 10, 2010 at 5:11 AM, Dodji Seketeli  wrote:
> > This patch adds statistics about the memory consumption of line maps
> > to the output of -fmem-report. It has been useful in trying to reduce
> > the memory consumption of the macro maps support.
> >
> > Tested on x86_64-unknown-linux-gnu against trunk.
> >
> > gcc/
> >        * input.c (SCALE, STAT_LABEL, FORMAT_AMOUNT): New macros.
> >        (dump_line_table_statistics): Define new function.
> >        * input.h (dump_line_table_statistics): Declare new function.
> >        * toplev.c (dump_memory_report): Call dump_line_table_statistics.
>
> Can we give these `1024' some meaningfull symbolic names?
> SCALE is a bit a vague -- one has to look into its body to
> understand what it is doing, which defeats the purpose of abstraction.
> Also, those macro should be documented.

Agreed.  Done.

I have one additional question, though.  I actually copied these macros
from tree-flow.h; there are copied all over the place, by the way.  I
guess it would be good to have them defined at only on place.  But
where?  Ideally it would be header suitable to included both by input.c
and pretty much everything else.  Would input.h be good enough?
everywhere.  I guess this would be a separate patch independent from
this macro location business.

>
> Finally, this:
>
> > +  linemap_get_statistics (line_table,
> > +                         &num_ordinary_maps_allocated,
> > +                         &num_ordinary_maps_used,
> > +                         &ordinary_maps_allocated_size,
> > +                         &ordinary_maps_used_size,
> > +                         &num_macro_maps_used,
> > +                         ¯o_maps_used_size,
> > +                         ¯o_maps_locations_size,
> > +                         &duplicated_maps_locations_size,
> > +                         &total_allocated_map_size,
> > +                         &total_used_map_size);
>
> is a too impressive paramater list :-)
> Could you use a structure to package all monster?

Sure.  Done in the patch below.

>
> > +void linemap_get_statistics (struct line_maps *set,
> > +                            size_t *, size_t *,
> > +                            size_t *, size_t *,
> > +                            size_t *, size_t *,
> > +                            size_t *, size_t *,
> > +                            size_t *, size_t *);
>
> same here.

Fixed in the patch below as well.

Thank you for the review, and sorry for my late reply.

-- 
Dodji

gcc/
* input.c (SCALE, STAT_LABEL, FORMAT_AMOUNT): New macros.
(dump_line_table_statistics): Define new function.
* input.h (dump_line_table_statistics): Declare new function.
* toplev.c (dump_memory_report): Call dump_line_table_statistics.

libcpp/
* line-map.h (linemap_get_statistics): Declare ...
* line-map.c (linemap_get_statistics):  ... new function.

diff --git a/gcc/input.c b/gcc/input.c
index 29e4de1..8701e4d 100644
--- a/gcc/input.c
+++ b/gcc/input.c
@@ -61,3 +61,74 @@ expand_location (source_location loc)
 }
   return xloc;
 }
+
+#define ONE_K 1024
+#define ONE_M ONE_K * ONE_K
+
+/* Display a number as an integer multiple of either:
+   - 1024, if said integer is >= to 10 K (in base 2)
+   - 1024 * 1024, if said integer is >= 10 M in (base 2)
+ */
+#define SCALE(x) ((unsigned long) ((x) < 10 * ONE_K \
+ ? (x) \
+ : ((x) < 10 * ONE_M \
+? (x) / ONE_K \
+: (x) / (ONE_M
+
+/* For a given integer, display either:
+   - the character 'k', if the number is higher than 10 K (in base 2)
+ but strictly lower than 10 M (in base 2)
+   - the character 'M' if the number is higher than 10 M (in base2)
+   - the charcter ' ' if the number is strictly lower  than 10 K  */
+#define STAT_LABEL(x) ((x) < 10 * ONE_K ? ' ' : ((x) < 10 * ONE_M ? 'k' : 'M'))
+
+/* Display an integer amount as multiple of 1K or 1M (in base 2à).
+   Display the correct unit (either k, M, or ' ') after the amout, as
+   well.  */
+#define FORMAT_AMOUNT(size) SCALE (size), STAT_LABEL (size)
+
+/* Dump statistics to stderr about the memory usage of the line_table
+   set of line maps.  */
+
+void
+dump_line_table_statistics (void)
+{
+  struct linemap_stats s;
+
+  memset (&s, 0, sizeof (s));
+
+  linemap_get_statistics (line_table, &s);
+
+  fprintf (stderr, "\nLine Table allocations during the compilation 
process\n");
+  fprintf (stderr, "Total allocated maps size:   %5lu%c\n",
+  SCALE (s.total_allocated_map_size),
+  STAT_LABEL (s.total_allocated_map_size));
+  fprintf (stderr, "Total used maps size:%5lu%c\n",
+  SCALE (s.total_used_map_size),
+  STAT_LABEL (s.total_used_map_size));
+  fprintf (stderr, "Ordinary map used size:  %5lu%c\n",
+  SCALE (s.ordinary_maps_used_size),
+  STAT_LABEL (s.ordinary

Re: [Committed][AVR]: PR target/45263: Don't use r20 around calls of __tablejump_elpm__

2011-04-13 Thread Eric Botcazou
>   PR target/45263
>   * config/avr/libgcc.S (__do_global_ctors, __do_global_dtors): Don't use
>   r20 around calls of __tablejump_elpm__
>
> http://gcc.gnu.org/viewcvs?view=revision&revision=172384
> http://gcc.gnu.org/viewcvs?view=revision&revision=172385

Please do not post useless messages.  Once a patch has been approved on the 
list, just install it.  See http://gcc.gnu.org/svnwrite.html

-- 
Eric Botcazou


New Swedish PO file for 'gcc' (version 4.6.0)

2011-04-13 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.6.0.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.




C++ PATCH for c++/48594 (failure with overloaded ->* in template)

2011-04-13 Thread Jason Merrill
The code in build_offset_ref_from_tree was assuming that any ->* 
involved calling a bound pointer to member function.  But that's not 
necessarily the case: it could be calling a pointer to function or 
functor by way of a pointer to data member or overloaded ->* operator.


Tested x86_64-pc-linux-gnu, applying to trunk and 4.6.
commit f97457d26c50790378457509461df06d5e8dbbdc
Author: Jason Merrill 
Date:   Wed Apr 13 14:45:47 2011 -0400

PR c++/48594
* decl2.c (build_offset_ref_call_from_tree): Fix calling a functor
or pointer to (non-member) function.

diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 5b6f6ed..882bbf9 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4081,10 +4081,13 @@ build_offset_ref_call_from_tree (tree fn, VEC(tree,gc) 
**args)
 parameter.  That must be done before the FN is transformed
 because we depend on the form of FN.  */
   make_args_non_dependent (*args);
-  object = build_non_dependent_expr (object);
-  if (TREE_CODE (fn) == DOTSTAR_EXPR)
-   object = cp_build_addr_expr (object, tf_warning_or_error);
-  VEC_safe_insert (tree, gc, *args, 0, object);
+  if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
+   {
+ object = build_non_dependent_expr (object);
+ if (TREE_CODE (fn) == DOTSTAR_EXPR)
+   object = cp_build_addr_expr (object, tf_warning_or_error);
+ VEC_safe_insert (tree, gc, *args, 0, object);
+   }
   /* Now that the arguments are done, transform FN.  */
   fn = build_non_dependent_expr (fn);
 }
@@ -4103,7 +4106,10 @@ build_offset_ref_call_from_tree (tree fn, VEC(tree,gc) 
**args)
   VEC_safe_insert (tree, gc, *args, 0, object_addr);
 }
 
-  expr = cp_build_function_call_vec (fn, args, tf_warning_or_error);
+  if (CLASS_TYPE_P (TREE_TYPE (fn)))
+expr = build_op_call (fn, args, tf_warning_or_error);
+  else
+expr = cp_build_function_call_vec (fn, args, tf_warning_or_error);
   if (processing_template_decl && expr != error_mark_node)
 expr = build_min_non_dep_call_vec (expr, orig_fn, orig_args);
 
diff --git a/gcc/testsuite/g++.dg/template/operator11.C 
b/gcc/testsuite/g++.dg/template/operator11.C
new file mode 100644
index 000..8d6b77a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/operator11.C
@@ -0,0 +1,25 @@
+// PR c++/48594
+// Test for uses of (X->*Y)() that don't actually involve a
+// pointer to member function.
+
+struct A { } a;
+struct B { } b;
+struct C * cp;
+
+struct Func { void operator()(); };
+Func operator->* (A, int);
+
+typedef void (*pfn)();
+pfn operator->* (B, int);
+
+pfn C::*cpfn;
+Func C::*cfunc;
+
+template 
+void f()
+{
+  (a->*1)();
+  (b->*1)();
+  (cp->*cpfn)();
+  (cp->*cfunc)();
+}


ObjC: remove temporary tree list used when calling objc_declare_class()

2011-04-13 Thread Nicola Pero
This patch removes another case of temporary tree chains from the ObjC
compiler.  When the parser finds a

 @class NSArray;

declaration, it would call objc_declare_class() passing as argument 
a temporary tree list containing the identifier.  This tree list is
created, used for the function call, then discarded.  Btw, this made
some sense when you have a list with multiple identifiers, as in

 @class NSArray, NSString;

as they are all passed in the same linked list.

it is still cleaner and more efficient to call objc_declare_class() for each
identifier, as opposed to creating a temporary tree list, populating it with
the identifiers, then calling objc_declare_class() which then iterates
over the temporary tree list to read the identifiers, and then the list
gets thrown away.

The patch speeds things up but the effect is very small; the GNUstep system
headers do contain about 800 @class declarations or so, so the patch typically
saves something like 1k allocations or so when compiling a file.  That is
probably a 0.05% speedup (order of magnitude).  But we get rid of a the tree 
list. :-)

The ObjC++ parser needed a bit of changes, but while changing it I also
made the ObjC++ parsing code almost identical to the ObjC one, which simplifies
maintenance.

Ok to commit ?

Thanks

Index: c-family/ChangeLog
===
--- c-family/ChangeLog  (revision 172360)
+++ c-family/ChangeLog  (working copy)
@@ -1,3 +1,7 @@
+2011-04-13  Nicola Pero  
+
+   * stub-objc.c (objc_declare_class): Updated argument name.
+
 2011-04-12  Nathan Froyd  
 
* c-common.h (c_common_init_ts): Declare.
Index: c-family/stub-objc.c
===
--- c-family/stub-objc.c(revision 172360)
+++ c-family/stub-objc.c(working copy)
@@ -110,7 +110,7 @@ objc_declare_alias (tree ARG_UNUSED (alias), tree
 }
 
 void
-objc_declare_class (tree ARG_UNUSED (list))
+objc_declare_class (tree ARG_UNUSED (identifier))
 {
 }
 
Index: objc/ChangeLog
===
--- objc/ChangeLog  (revision 172360)
+++ objc/ChangeLog  (working copy)
@@ -1,5 +1,12 @@
 2011-04-13  Nicola Pero  
 
+   * objc-act.c (objc_declare_class): Changed to take a single
+   identifier as argument instead of a tree list.  This means callers
+   don't have to build temporary tree lists to call this function.
+   (synth_module_prologue): Updated calls to objc_declare_class.
+   
+2011-04-13  Nicola Pero  
+
* objc-act.c (build_keyword_selector): Use get_identifier_with_length
instead of get_identifier.
 
Index: objc/objc-act.c
===
--- objc/objc-act.c (revision 172360)
+++ objc/objc-act.c (working copy)
@@ -2953,7 +2953,7 @@ synth_module_prologue (void)
 
   /* Forward-declare '@interface Protocol'.  */
   type = get_identifier (PROTOCOL_OBJECT_CLASS_NAME);
-  objc_declare_class (tree_cons (NULL_TREE, type, NULL_TREE));
+  objc_declare_class (type);
   objc_protocol_type = build_pointer_type (xref_tag (RECORD_TYPE, type));
 
   /* Declare receiver type used for dispatching messages to 'super'.  */
@@ -2985,7 +2985,7 @@ synth_module_prologue (void)
   if (!constant_string_class_name)
 constant_string_class_name = runtime.default_constant_string_class_name;
   constant_string_id = get_identifier (constant_string_class_name);
-  objc_declare_class (tree_cons (NULL_TREE, constant_string_id, NULL_TREE));
+  objc_declare_class (constant_string_id);
 
   /* Pre-build the following entities - for speed/convenience.  */
   self_id = get_identifier ("self");
@@ -3360,48 +3360,42 @@ objc_declare_alias (tree alias_ident, tree class_i
 }
 
 void
-objc_declare_class (tree ident_list)
+objc_declare_class (tree identifier)
 {
-  tree list;
 #ifdef OBJCPLUS
   if (current_namespace != global_namespace) {
 error ("Objective-C declarations may only appear in global scope");
   }
 #endif /* OBJCPLUS */
 
-  for (list = ident_list; list; list = TREE_CHAIN (list))
+  if (! objc_is_class_name (ident))
 {
-  tree ident = TREE_VALUE (list);
-
-  if (! objc_is_class_name (ident))
+  tree record = lookup_name (ident), type = record;
+  
+  if (record)
{
- tree record = lookup_name (ident), type = record;
-
- if (record)
+ if (TREE_CODE (record) == TYPE_DECL)
+   type = DECL_ORIGINAL_TYPE (record)
+ ? DECL_ORIGINAL_TYPE (record)
+ : TREE_TYPE (record);
+ 
+ if (!TYPE_HAS_OBJC_INFO (type)
+ || !TYPE_OBJC_INTERFACE (type))
{
- if (TREE_CODE (record) == TYPE_DECL)
-   type = DECL_ORIGINAL_TYPE (record)
-   ? DECL_ORIGINAL_TYPE (record)
-   : TREE_TYPE (record);
-
- if (!TYPE_HAS_O

Re: [patch] Split Parse Timevar (issue4378056)

2011-04-13 Thread Lawrence Crowl
On 4/13/11, Richard Guenther  wrote:
> On Apr 12, 2011 Diego Novillo  wrote:
> > On Apr 12, 2011 Lawrence Crowl  wrote:
> > > This patch provides more finer, more precise compile time
> > > information.  I sent an advisory mail some time ago, and it
> > > was good then.  Please confirm for trunk.
> >
> > The patch looks fine to me, but of course it's Jason the one
> > you need an OK from.
>
> Pushing/popping timevars is not free.  What's the compile-time
> impact of this change (for -ftime-report, of course) - with small
> timed regions, does it not just return garbage because of clock
> precision issues and overhead of querying the clock iself?

I don't think there is any significant compile-time impact.

* The new phase timevars cover so much execution time as to have
unnoticible overhead.

* The new parser sub-timevars cover significant parsing work:
function body, struct body, enum body, template instantiation,
and overload resolution.  With the exception of enum bodies, all
are pretty heavyweight.  The overhead might grow from unnoticible
to insignificant.

* In some cases, the patch replaces a push/pop with a start/stop.
The performance difference between those routines is very small.

* Most other timevar calls have not changed, they are doing what
they did before, so no new overhead is introduced.

* The remaining calls were redundant, and the patch removes them,
so some existing overhead is removed.

-- 
Lawrence Crowl


Re: RFA: Add makefile for cross-configuration torture test

2011-04-13 Thread Joern Rennecke

Quoting "Joseph S. Myers" :


I think Interix and SCORE should be included, but probably only one of
Solaris 8 and Solaris 9 needs to be included for each of x86 and SPARC
since the targets don't appear significantly different - so no need to
include Solaris 8 at all if you include Solaris 9 for both x86 and SPARC.


All right, amended patch attached.


It's up to the people who volunteered to maintain Interix and SCORE to get
them into a state that builds cleanly - and you can make sure they are
CC:ed on the relevant bugs and point out that without fixes the targets
will be removed later in 4.7 development.


Bug 47096 already exists for the Interix failure; no Interix maintainer is
listed in MAINTAINERS.
I've filed Bug 48595 for score-elf.
2010-04-13  Joern Rennecke  

* config-list.mk: New file.

Index: contrib/config-list.mk
===
--- contrib/config-list.mk  (revision 0)
+++ contrib/config-list.mk  (revision 0)
@@ -0,0 +1,93 @@
+# Run tests covering all config.gcc cases.
+host_options='--with-mpc=/opt/cfarm/mpc' # gcc10
+# Make sure you have a recent enough gcc (with ada support) in your path so
+# that --enable-werror-always will work.
+# To use, create a sibling directory to the gcc sources and cd into this.
+# Use -j / -l make arguments and nice to assure a smooth resource-efficient
+# load on the build machine, e.g. for 24 cores:
+# svn co svn://gcc.gnu.org/svn/gcc/branches/foo-branch gcc
+# mkdir multi-mk; cd multi-mk
+# nohup nice make -j25 -l36 -f ../gcc/contrib/config-list.mk > make.out 2>&1 &
+#
+# v850e1-elf is rejected by config.sub
+LIST = alpha-linux-gnu alpha-freebsd6 alpha-netbsd alpha-openbsd \
+  alpha-dec-osf5.1 alpha64-dec-vms alpha-dec-vms am33_2.0-linux \
+  arm-wrs-vxworks arm-freebsd6 arm-netbsdelf arm-linux \
+  arm-linux-androideabi arm-uclinux_eabi arm-ecos-elf arm-eabi \
+  arm-symbianelf arm-rtems arm-elf arm-wince-pe avr-rtems avr-elf \
+  bfin-elf bfin-uclinux bfin-linux-uclibc bfin-rtems bfin-openbsd \
+  cris-elf cris-linux crisv32-elf crisv32-linux fido-elf \
+  fr30-elf frv-elf frv-linux h8300-elf h8300-rtems hppa-linux-gnu \
+  hppa-linux-gnuOPT-enable-sjlj-exceptions=yes hppa64-linux-gnu \
+  hppa2.0-hpux10.1 hppa64-hpux11.3 \
+  hppa64-hpux11.0OPT-enable-sjlj-exceptions=yes hppa2.0-hpux11.9 \
+  i686-pc-linux-gnu i686-apple-darwin i686-apple-darwin9 i686-apple-darwin10 \
+  i486-freebsd4 i686-freebsd6 i686-kfreebsd-gnu \
+  i686-netbsdelf9 i686-knetbsd-gnu i686-openbsd i686-openbsd3.0 \
+  i686-elf i686-kopensolaris-gnu i686-symbolics-gnu i686-pc-msdosdjgpp \
+  i686-lynxos i586-netwareOPT-with-ld=SCRIPTSnwld i686-nto-qnx \
+  i686-rtems i686-solaris2.10 i686-wrs-vxworks \
+  i686-wrs-vxworksae \
+  i686-cygwinOPT-enable-threads=yes i686-mingw32crt ia64-elf \
+  ia64-freebsd6 ia64-linux ia64-hpux ia64-hp-vms iq2000-elf lm32-elf \
+  lm32-rtems lm32-uclinux m32c-rtems m32c-elf m32r-elf m32rle-elf m32r-rtems \
+  m32r-linux m32rle-linux m68k-elf m68k-netbsdelf \
+  m68k-openbsd m68k-uclinux m68k-linux m68k-rtems \
+  mcore-elf mep-elf microblaze-linux microblaze-elf \
+  mips-sgi-irix6.5OPT-with-stabsOPT-enable-threads=posix mips-netbsd \
+  mips64el-st-linux-gnu mips64octeon-linux mipsisa64r2-linux \
+  mipsisa32r2-linux-gnu mips-openbsd mipsisa64r2-sde-elf mipsisa32-elfoabi \
+  mipsisa64-elfoabi mipsisa64r2el-elf mipsisa64sr71k-elf mipsisa64sb1-elf \
+  mipsel-elf mips64-elf mips64vr-elf mips64orion-elf mips-rtems \
+  mips-wrs-vxworks mipstx39-elf mmix-knuth-mmixware mn10300-elf moxie-elf \
+  moxie-uclinux moxie-rtems pdp11-aout picochip-elf powerpc-darwin8 \
+  powerpc-darwin7 powerpc64-darwin powerpc-freebsd6 powerpc-netbsd \
+  powerpc-eabispe powerpc-eabisimaltivec powerpc-eabisim ppc-elf \
+  powerpc-eabialtivec powerpc-xilinx-eabi powerpc-eabi \
+  powerpc-rtems4.11OPT-enable-threads=yes powerpc-linux_spe \
+  powerpc-linux_paired powerpc64-linux_altivec \
+  powerpc-wrs-vxworks powerpc-wrs-vxworksae powerpc-lynxos powerpcle-elf \
+  powerpcle-eabisim powerpcle-eabi rs6000-ibm-aix4.3 rs6000-ibm-aix5.1.0 \
+  rs6000-ibm-aix5.2.0 rs6000-ibm-aix5.3.0 rs6000-ibm-aix6.0 \
+  rx-elf s390-linux-gnu s390x-linux-gnu s390x-ibm-tpf sh-elf \
+  shle-linux sh-netbsdelf sh-superh-elf sh5el-netbsd sh64-netbsd sh64-linux \
+  sh64-elfOPT-with-newlib sh-rtems sh-wrs-vxworks sparc-elf \
+  sparc-leon-elf sparc-rtems sparc-linux-gnu \
+  sparc-leon3-linux-gnuOPT-enable-target=all sparc-netbsdelf \
+  
sparc64-sun-solaris2.10OPT-with-gnu-ldOPT-with-gnu-asOPT-enable-threads=posix \
+  sparc-wrs-vxworks sparc64-elf sparc64-rtems sparc64-linux sparc64-freebsd6 \
+  sparc64-netbsd sparc64-openbsd spu-elf v850e-elf v850-elf vax-linux-gnu \
+  vax-netbsdelf vax-openbsd x86_64-apple-darwin \
+  x86_64-pc-linux-gnuOPT-with-fpmath=avx \
+  x86_64-elfOPT-with-fpmath=sse x86_64-freebsd6 x86_64-netbsd \
+  x86_64-knetbsd-gnu x86_64-w64-mingw32 \
+  x86_64-mingw32OPT-enable-sjlj-exceptions=yes xstormy16-elf xten

Re: RFA: Add makefile for cross-configuration torture test

2011-04-13 Thread Joseph S. Myers
On Wed, 13 Apr 2011, Joern Rennecke wrote:

> > It's up to the people who volunteered to maintain Interix and SCORE to get
> > them into a state that builds cleanly - and you can make sure they are
> > CC:ed on the relevant bugs and point out that without fixes the targets
> > will be removed later in 4.7 development.
> 
> Bug 47096 already exists for the Interix failure; no Interix maintainer is
> listed in MAINTAINERS.
> I've filed Bug 48595 for score-elf.

The person who volunteered for Interix is Douglas B Rupp .

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


Re: RFA: Add makefile for cross-configuration torture test

2011-04-13 Thread Douglas B Rupp

On 4/13/2011 3:10 PM, Joseph S. Myers wrote:

The person who volunteered for Interix is Douglas B Rupp.


I'm still good for it.

--Doug




More of ipa-inline housekeeping

2011-04-13 Thread Jan Hubicka
Hi,
this patch moves inline_summary from field in cgraph_node into its own on side
datastructure. This moves it from arcane decision of mine to split all IPA data
into global/local datas stored in common datastructure into the scheme we
developed for new IPA passes some time ago.

The advantage is that the code is more contained and less spread across the
compiler. We also make cgraph_node smaller and dumps more compact that never
hurts.

While working on it I noticed that Richi's patch to introduce cgraph_edge
times/sizes is bit iffy in computing data when they are missing in the
datastructure. Also it computes incomming edge costs instead of outgoing that
leads to fact that not all edges gets their info computed for IPA inliner
(think of newly discovered direct calls or IPA merging).

I fixed this on the and added sanity check that the fields are initialized.
This has shown problem with early inliner iteration fixed thusly and fact that
early inliner is attempting to compute overall growth at a time the inline
parameters are not computed for functions not visited by early optimizations
yet. We previously agreed that early inliner should not try to do that (as this
leads to early inliner inlining functions called once that should be deferred
for later consieration).  I just hope it won't cause benchmarks to
regress too much ;)

Having place to pile inline analysis info in, there is more to cleanup. The
cgraph_local/cgraph_global fields probably should go and the stuff from global
info should go into inline_summary datastructure, too (the lifetimes are
essentially the same so there is no need for the split).  I will handle this
incrementally.

Bootstrapped/regtested x86_64-linux with slightly modified version of the patch.
Re-testing with final version and intend to commit the patch tomorrow.

Honza

* cgraph.c (dump_cgraph_node): Do not dump inline summaries.
* cgraph.h (struct inline_summary): Move to ipa-inline.h
(cgraph_local_info): Remove inline_summary.
* ipa-cp.c: Include ipa-inline.h.
(ipcp_cloning_candidate_p, ipcp_estimate_growth,
ipcp_estimate_cloning_cost, ipcp_insert_stage): Use inline_summary
accesor.
* lto-cgraph.c (lto_output_node): Do not stream inline summary.
(input_overwrite_node): Do not set inline summary.
(input_node): Do not stream inline summary.
* ipa-inline.c (cgraph_decide_inlining): Dump inline summaries.
(cgraph_decide_inlining_incrementally): Do not try to estimate overall
growth; we do not have inline parameters computed for that anyway.
(cgraph_early_inlining): After inlining compute call_stmt_sizes.
* ipa-inline.h (struct inline_summary): Move here from ipa-inline.h
(inline_summary_t): New type and VECtor.
(debug_inline_summary, dump_inline_summaries): Declare.
(inline_summary): Use VOCtor.
(estimate_edge_growth): Kill hack computing call stmt size directly.
* lto-section-in.c (lto_section_name): Add inline section.
* ipa-inline-analysis.c: Include lto-streamer.h
(node_removal_hook_holder, node_duplication_hook_holder): New holders
(inline_node_removal_hook, inline_node_duplication_hook): New functions.
(inline_summary_vec): Define.
(inline_summary_alloc, dump_inline_summary, debug_inline_summary,
dump_inline_summaries): New functions.
(estimate_function_body_sizes): Properly compute size/time of outgoing 
calls.
(compute_inline_parameters): Alloc inline_summary; do not compute 
size/time
of incomming calls.
(estimate_edge_time): Avoid missing time summary hack.
(inline_read_summary): Read inline summary info.
(inline_write_summary): Write inline summary info.
(inline_free_summary): Free all hooks and inline summary vector.
* lto-streamer.h: Add LTO_section_inline_summary section.
* Makefile.in (ipa-cp.o, ipa-inline-analysis.o): Update dependencies.
* ipa.c (cgraph_remove_unreachable_nodes): Fix dump file formating.

* lto.c: Include ipa-inline.h
(add_cgraph_node_to_partition, undo_partition): Use inline_summary 
accessor.
(ipa_node_duplication_hook): Fix declaration.
* Make-lang.in (lto.o): Update dependencies.
Index: cgraph.c
===
--- cgraph.c(revision 172396)
+++ cgraph.c(working copy)
@@ -1876,22 +1876,6 @@ dump_cgraph_node (FILE *f, struct cgraph
   if (node->count)
 fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x",
 (HOST_WIDEST_INT)node->count);
-  if (node->local.inline_summary.self_time)
-fprintf (f, " %i time, %i benefit", node->local.inline_summary.self_time,
-   
node->local.inline_summary.time_inlining_benefit);
-  if (node->global.time && node->global.time
-  != node->local.inline_summary.self_time)
-fprintf 

FDO usability patch -- cfg and lineno checksum

2011-04-13 Thread Xinliang David Li
Hi,  in current FDO implementation, the source file version used in
profile-generate needs to strictly match the version used in
profile-use -- simple formating changes will invalidate the profile
data (use of it will lead to compiler error or ICE). There are two
main problems that lead to the weakness:

1) the function checksum is computed based on line number and number
of basic blocks -- this means any line number change will invalidate
the profile data. In fact, line number should play very minimal role
in profile matching decision. Another problem is that number of basic
blocks is also not a good indicator whether CFG matches or not.
2) cgraph's pid is used as the key to find the matching profile data
for a function. If there is any new function added, or if the order of
the functions changes, the profile data is invalidated.

The attached is a patch from google that improves this.
1) function checksum is split into two parts: lineno checksum and cfg checksum
2) function assembler name is used in profile hashing.

Bootstrapped and regression tested on x86_64/linux.

Ok for trunk?

Thanks,

David

 2011-04-13  Xinliang David Li  

* tree.c (crc32_byte): New function.
* tree.h (crc32_byte): New function.
* gcov.c (function_info): Add new fields.
(read_graph_file): Handle new fields.
(read_count_file): Handle name.
* gcov-io.c (gcov_string_length): New function.
(gcov_write_words): Bug fix.
(gcov_read_words): Bug fix.
* gcov-io.h: New interfaces.
* profile.c (get_exec_counts): New parameter.
(compute_branch_probablilities): New parameter.
(compute_value_histogram): New parameter.
(branch_prob): Pass cfg_checksum.
* coverage.c (get_const_string_type): New function.
(hash_counts_entry_hash): Use string hash.
(hash_counts_entry_eq): Use string compare.
(htab_counts_entry_del): Delete name.
(read_count_file): Add handling of cfg checksum.
(get_coverage_counts): New parameter.
(xstrdup_mask_random): New function.
(coverage_compute_lineno_checksum): New function.
(coverage_compute_cfg_checksum): New function.
(coverage_begin_output): New parameter.
(coverage_end_function): New parameter.
(build_fn_info_type): Build new fields.
(build_fn_info_value): Build new field values.
* coverage.h: Interface changes.
* libgcov.c (gcov_exit): Dump new fields.
* gcov_dump.c (tag_function): Print new fields.
Index: tree.c
===
--- tree.c	(revision 172385)
+++ tree.c	(working copy)
@@ -8508,14 +8508,12 @@ dump_tree_statistics (void)
 
 #define FILE_FUNCTION_FORMAT "_GLOBAL__%s_%s"
 
-/* Generate a crc32 of a string.  */
+/* Generate a crc32 of a byte.  */
 
 unsigned
-crc32_string (unsigned chksum, const char *string)
+crc32_byte (unsigned chksum, char byte)
 {
-  do
-{
-  unsigned value = *string << 24;
+  unsigned value = (unsigned) byte << 24;
   unsigned ix;
 
   for (ix = 8; ix--; value <<= 1)
@@ -8526,6 +8524,18 @@ crc32_string (unsigned chksum, const cha
  	  chksum <<= 1;
  	  chksum ^= feedback;
   	}
+  return chksum;
+}
+
+
+/* Generate a crc32 of a string.  */
+
+unsigned
+crc32_string (unsigned chksum, const char *string)
+{
+  do
+{
+  chksum = crc32_byte (chksum, *string);
 }
   while (*string++);
   return chksum;
@@ -8549,8 +8559,10 @@ clean_symbol_name (char *p)
   *p = '_';
 }
 
-/* Generate a name for a special-purpose function function.
+/* Generate a name for a special-purpose function.
The generated name may need to be unique across the whole link.
+   Changes to this function may also require corresponding changes to
+   xstrdup_mask_random.
TYPE is some string to identify the purpose of this function to the
linker or collect2; it must start with an uppercase letter,
one of:
Index: tree.h
===
--- tree.h	(revision 172385)
+++ tree.h	(working copy)
@@ -4997,6 +4997,7 @@ inlined_function_outer_scope_p (const_tr
 
 /* In tree.c */
 extern unsigned crc32_string (unsigned, const char *);
+extern unsigned crc32_byte (unsigned, char);
 extern void clean_symbol_name (char *);
 extern tree get_file_function_name (const char *);
 extern tree get_callee_fndecl (const_tree);
Index: gcov.c
===
--- gcov.c	(revision 172385)
+++ gcov.c	(working copy)
@@ -54,6 +54,13 @@ along with Gcov; see the file COPYING3. 
some places we make use of the knowledge of how profile.c works to
select particular algorithms here.  */
 
+/* The code validates that the profile information read in corresponds
+   to the code currently being compiled.  Rather than checking for
+   identical files, the code below computes a checksum on the CFG
+   (based on the order of ba

Re: FDO usability patch -- cfg and lineno checksum

2011-04-13 Thread Xinliang David Li
This was contributed by:

2011-04-13  Neil Vachharajani  

On Wed, Apr 13, 2011 at 3:25 PM, Xinliang David Li  wrote:
> Hi,  in current FDO implementation, the source file version used in
> profile-generate needs to strictly match the version used in
> profile-use -- simple formating changes will invalidate the profile
> data (use of it will lead to compiler error or ICE). There are two
> main problems that lead to the weakness:
>
> 1) the function checksum is computed based on line number and number
> of basic blocks -- this means any line number change will invalidate
> the profile data. In fact, line number should play very minimal role
> in profile matching decision. Another problem is that number of basic
> blocks is also not a good indicator whether CFG matches or not.
> 2) cgraph's pid is used as the key to find the matching profile data
> for a function. If there is any new function added, or if the order of
> the functions changes, the profile data is invalidated.
>
> The attached is a patch from google that improves this.
> 1) function checksum is split into two parts: lineno checksum and cfg checksum
> 2) function assembler name is used in profile hashing.
>
> Bootstrapped and regression tested on x86_64/linux.
>
> Ok for trunk?
>
> Thanks,
>
> David
>
>  2011-04-13  Xinliang David Li  
>
>        * tree.c (crc32_byte): New function.
>        * tree.h (crc32_byte): New function.
>        * gcov.c (function_info): Add new fields.
>        (read_graph_file): Handle new fields.
>        (read_count_file): Handle name.
>        * gcov-io.c (gcov_string_length): New function.
>        (gcov_write_words): Bug fix.
>        (gcov_read_words): Bug fix.
>        * gcov-io.h: New interfaces.
>        * profile.c (get_exec_counts): New parameter.
>        (compute_branch_probablilities): New parameter.
>        (compute_value_histogram): New parameter.
>        (branch_prob): Pass cfg_checksum.
>        * coverage.c (get_const_string_type): New function.
>        (hash_counts_entry_hash): Use string hash.
>        (hash_counts_entry_eq): Use string compare.
>        (htab_counts_entry_del): Delete name.
>        (read_count_file): Add handling of cfg checksum.
>        (get_coverage_counts): New parameter.
>        (xstrdup_mask_random): New function.
>        (coverage_compute_lineno_checksum): New function.
>        (coverage_compute_cfg_checksum): New function.
>        (coverage_begin_output): New parameter.
>        (coverage_end_function): New parameter.
>        (build_fn_info_type): Build new fields.
>        (build_fn_info_value): Build new field values.
>        * coverage.h: Interface changes.
>        * libgcov.c (gcov_exit): Dump new fields.
>        * gcov_dump.c (tag_function): Print new fields.
>


ObjC: remove temporary tree list used when calling objc_declare_protocols()

2011-04-13 Thread Nicola Pero
This patch cleans up objc_declare_protocols() to avoid having to create
temporary tree chains just to perform the function call (in the same way
as my other patch cleaned up objc_declare_class()).

Ok to commit ?

Thanks

PS: This patch has no measurable effect on compilation speed in my tests
because the GNUstep codebase almost never uses the protocol forward-declaration
syntax "@protocol X;".  Another codebase that use it extensively may see
some tiny benefit.


Index: gcc/c-family/c-objc.h
===
--- gcc/c-family/c-objc.h   (revision 172399)
+++ gcc/c-family/c-objc.h   (working copy)
@@ -52,7 +52,7 @@ extern int objc_is_public (tree, tree);
 extern tree objc_is_id (tree);
 extern void objc_declare_alias (tree, tree);
 extern void objc_declare_class (tree);
-extern void objc_declare_protocols (tree, tree);
+extern void objc_declare_protocol (tree, tree);
 extern tree objc_build_message_expr (tree, tree);
 extern tree objc_finish_message_expr (tree, tree, tree, tree*);
 extern tree objc_build_selector_expr (location_t, tree);
Index: gcc/c-family/ChangeLog
===
--- gcc/c-family/ChangeLog  (revision 172399)
+++ gcc/c-family/ChangeLog  (working copy)
@@ -1,3 +1,9 @@
+2011-04-13  Nicola Pero  
+
+   * stub-objc.c (objc_declare_protocols): Renamed to
+   objc_declare_protocol.
+   * c-objc.h: Likewise.
+   
 2011-04-12  Nathan Froyd  
 
* c-common.h (c_common_init_ts): Declare.
Index: gcc/c-family/stub-objc.c
===
--- gcc/c-family/stub-objc.c(revision 172399)
+++ gcc/c-family/stub-objc.c(working copy)
@@ -115,7 +115,7 @@ objc_declare_class (tree ARG_UNUSED (list))
 }
 
 void
-objc_declare_protocols (tree ARG_UNUSED (list), tree ARG_UNUSED (attributes))
+objc_declare_protocol (tree ARG_UNUSED (name), tree ARG_UNUSED (attributes))
 {
 }
 
Index: gcc/objc/ChangeLog
===
--- gcc/objc/ChangeLog  (revision 172399)
+++ gcc/objc/ChangeLog  (working copy)
@@ -1,5 +1,12 @@
 2011-04-13  Nicola Pero  
 
+   * objc-act.c (objc_declare_protocols): Renamed to
+   objc_declare_protocol.  Changed first argument to be an identifier
+   instead of a tree chain of identifiers, so that callers don't have
+   to create a temporary tree chain.
+
+2011-04-13  Nicola Pero  
+
* objc-act.c (build_keyword_selector): Use get_identifier_with_length
instead of get_identifier.
 
Index: gcc/objc/objc-act.c
===
--- gcc/objc/objc-act.c (revision 172399)
+++ gcc/objc/objc-act.c (working copy)
@@ -7869,9 +7869,8 @@ lookup_protocol (tree ident, bool warn_if_deprecat
they are already declared or defined, the function has no effect.  */
 
 void
-objc_declare_protocols (tree names, tree attributes)
+objc_declare_protocol (tree name, tree attributes)
 {
-  tree list;
   bool deprecated = false;
 
 #ifdef OBJCPLUS
@@ -7896,29 +7895,25 @@ void
}
 }
 
-  for (list = names; list; list = TREE_CHAIN (list))
+  if (lookup_protocol (name, /* warn if deprecated */ false,
+  /* definition_required */ false) == NULL_TREE)
 {
-  tree name = TREE_VALUE (list);
-
-  if (lookup_protocol (name, /* warn if deprecated */ false,
-  /* definition_required */ false) == NULL_TREE)
+  tree protocol = make_node (PROTOCOL_INTERFACE_TYPE);
+  
+  TYPE_LANG_SLOT_1 (protocol)
+   = make_tree_vec (PROTOCOL_LANG_SLOT_ELTS);
+  PROTOCOL_NAME (protocol) = name;
+  PROTOCOL_LIST (protocol) = NULL_TREE;
+  add_protocol (protocol);
+  PROTOCOL_DEFINED (protocol) = 0;
+  PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
+  
+  if (attributes)
{
- tree protocol = make_node (PROTOCOL_INTERFACE_TYPE);
-
- TYPE_LANG_SLOT_1 (protocol)
-   = make_tree_vec (PROTOCOL_LANG_SLOT_ELTS);
- PROTOCOL_NAME (protocol) = name;
- PROTOCOL_LIST (protocol) = NULL_TREE;
- add_protocol (protocol);
- PROTOCOL_DEFINED (protocol) = 0;
- PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
- 
- if (attributes)
-   {
- TYPE_ATTRIBUTES (protocol) = attributes;
- if (deprecated)
-   TREE_DEPRECATED (protocol) = 1;
-   }
+ /* TODO: Do we need to store the attributes here ? */
+ TYPE_ATTRIBUTES (protocol) = attributes;
+ if (deprecated)
+   TREE_DEPRECATED (protocol) = 1;
}
 }
 }
Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 172399)
+++ gcc/ChangeLog   (working copy)
@@ -1,3 +1,8 @@
+2011-04-13  Nicola Pero  
+
+   * c-parser.c (c_parser_objc_protocol_definition)

Re: ObjC: remove temporary tree list used when calling objc_declare_class()

2011-04-13 Thread Mike Stump
On Apr 13, 2011, at 1:52 PM, Nicola Pero wrote:
> This patch removes another case of temporary tree chains from the ObjC
> compiler.

> Ok to commit ?

Ok.


Re: ObjC: remove temporary tree list used when calling objc_declare_protocols()

2011-04-13 Thread Mike Stump
On Apr 13, 2011, at 3:57 PM, Nicola Pero wrote:
> This patch cleans up objc_declare_protocols() to avoid having to create
> temporary tree chains just to perform the function call (in the same way
> as my other patch cleaned up objc_declare_class()).
> 
> Ok to commit ?

Ok.


Go patch committed: Use backend interface for go and defer statements

2011-04-13 Thread Ian Lance Taylor
This patch to the Go frontend uses the backend interface for go and
defer statements.  To make that work, I changed the defer stack variable
from a tree to an Expression.  This in turn required a bit of patching
to ensure that the variable is created before it is used.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian


2011-04-13  Ian Lance Taylor  

* Make-lang.in (go/gogo-tree.o): depend on $(GO_RUNTIME_H).


Index: gcc/go/Make-lang.in
===
--- gcc/go/Make-lang.in	(revision 172396)
+++ gcc/go/Make-lang.in	(working copy)
@@ -262,7 +262,7 @@ go/go-dump.o: go/gofrontend/go-dump.cc $
 go/gogo-tree.o: go/gofrontend/gogo-tree.cc $(GO_SYSTEM_H) $(TOPLEV_H) \
 	$(TREE_H) $(GIMPLE_H) tree-iterator.h $(CGRAPH_H) langhooks.h \
 	convert.h output.h $(DIAGNOSTIC_H) $(GO_TYPES_H) \
-	$(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) $(GO_GOGO_H)
+	$(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) $(GO_RUNTIME_H) $(GO_GOGO_H)
 go/gogo.o: go/gofrontend/gogo.cc $(GO_SYSTEM_H) $(GO_C_H) \
 	go/gofrontend/go-dump.h $(GO_LEX_H) $(GO_TYPES_H) $(GO_STATEMENTS_H) \
 	$(GO_EXPRESSIONS_H) go/gofrontend/dataflow.h $(GO_RUNTIME_H) \
Index: gcc/go/gofrontend/gogo.cc
===
--- gcc/go/gofrontend/gogo.cc	(revision 172396)
+++ gcc/go/gofrontend/gogo.cc	(working copy)
@@ -2884,6 +2884,29 @@ Function::determine_types()
 this->block_->determine_types();
 }
 
+// Get a pointer to the variable holding the defer stack for this
+// function, making it if necessary.  At least at present, the value
+// of this variable is not used.  However, a pointer to this variable
+// is used as a marker for the functions on the defer stack associated
+// with this function.  Doing things this way permits inlining a
+// function which uses defer.
+
+Expression*
+Function::defer_stack(source_location location)
+{
+  Type* t = Type::make_pointer_type(Type::make_void_type());
+  if (this->defer_stack_ == NULL)
+{
+  Expression* n = Expression::make_nil(location);
+  this->defer_stack_ = Statement::make_temporary(t, n, location);
+  this->defer_stack_->set_is_address_taken();
+}
+  Expression* ref = Expression::make_temporary_reference(this->defer_stack_,
+			 location);
+  Expression* addr = Expression::make_unary(OPERATOR_AND, ref, location);
+  return Expression::make_unsafe_cast(t, addr, location);
+}
+
 // Export the function.
 
 void
Index: gcc/go/gofrontend/gogo.h
===
--- gcc/go/gofrontend/gogo.h	(revision 172393)
+++ gcc/go/gofrontend/gogo.h	(working copy)
@@ -17,6 +17,7 @@ class Typed_identifier_list;
 class Function_type;
 class Expression;
 class Statement;
+class Temporary_statement;
 class Block;
 class Function;
 class Bindings;
@@ -977,7 +978,7 @@ class Function
   return_value(Gogo*, Named_object*, source_location, tree* stmt_list) const;
 
   // Get a tree for the variable holding the defer stack.
-  tree
+  Expression*
   defer_stack(source_location);
 
   // Export the function.
@@ -1033,9 +1034,10 @@ class Function
   Labels labels_;
   // The function decl.
   tree fndecl_;
-  // A variable holding the defer stack variable.  This is NULL unless
-  // we actually need a defer stack.
-  tree defer_stack_;
+  // The defer stack variable.  A pointer to this variable is used to
+  // distinguish the defer stack for one function from another.  This
+  // is NULL unless we actually need a defer stack.
+  Temporary_statement* defer_stack_;
   // True if the result variables are named.
   bool results_are_named_;
   // True if this function calls the predeclared recover function.
Index: gcc/go/gofrontend/statements.cc
===
--- gcc/go/gofrontend/statements.cc	(revision 172396)
+++ gcc/go/gofrontend/statements.cc	(working copy)
@@ -1718,17 +1718,39 @@ class Simplify_thunk_traverse : public T
 {
  public:
   Simplify_thunk_traverse(Gogo* gogo)
-: Traverse(traverse_blocks),
-  gogo_(gogo)
+: Traverse(traverse_functions | traverse_blocks),
+  gogo_(gogo), function_(NULL)
   { }
 
   int
+  function(Named_object*);
+
+  int
   block(Block*);
 
  private:
+  // General IR.
   Gogo* gogo_;
+  // The function we are traversing.
+  Named_object* function_;
 };
 
+// Keep track of the current function while looking for thunks.
+
+int
+Simplify_thunk_traverse::function(Named_object* no)
+{
+  gcc_assert(this->function_ == NULL);
+  this->function_ = no;
+  int t = no->func_value()->traverse(this);
+  this->function_ = NULL;
+  if (t == TRAVERSE_EXIT)
+return t;
+  return TRAVERSE_SKIP_COMPONENTS;
+}
+
+// Look for thunks in a block.
+
 int
 Simplify_thunk_traverse::block(Block* b)
 {
@@ -1739,7 +1761,7 @@ Simplify_thunk_traverse::block(Block* b)
   Thunk_statement* stat = b->statements()->back()->thunk_statement();
   if (stat == NULL)
 

[PATCH 7/n, i386]: Merge SSE and AVX patterns using "enable" attribute.

2011-04-13 Thread Uros Bizjak
Hello!

Attached patch converts " Miscellaneous" and "SSSE3 instructions"
sections of sse.md.

2011-04-12  Uros Bizjak  

* config/i386/sse.md (*sse2_uavgv16qi3): Merge with *avx_uavgv16qi3.
(*sse2_uavgv8hi3): Merge with *avx_uavgv8hi3.
(sse2_psadbw): Merge with *avx_psadbw.
(ssse3_phaddwv8hi3): Merge with *avx_phaddwv8hi3.
(ssse3_phadddv4si3): Merge with *avx_phadddv4si3.
(ssse3_phaddswv8hi3): Merge with *avx_phaddswv8hi3.
(ssse3_phsubwv8hi3): Merge with *avx_phsubwv8hi3.
(ssse3_phsubdv4si3): Merge with *avx_phsubdv4si3.
(ssse3_phsubswv8hi3): Merge with *avx_phsubswv8hi3.
(ssse3_pmaddubsw128): Merge with *avx_pmaddubsw128.
(*ssse3_pmulhrswv8hi3): Merge with *avx_pmulhrswv8hi3.
(ssse3_pshufbv16qi3): Merge with *avx_pshufbv16qi3.
(ssse3_psign3): Merge with *avx_psign3.
(ssse3_palignrti): Merge with *avx_palignrti.

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

Uros.
Index: sse.md
===
--- sse.md  (revision 172365)
+++ sse.md  (working copy)
@@ -7015,41 +7015,16 @@
   "TARGET_SSE2"
   "ix86_fixup_binary_operands_no_copy (PLUS, V16QImode, operands);")
 
-(define_insn "*avx_uavgv16qi3"
-  [(set (match_operand:V16QI 0 "register_operand" "=x")
-   (truncate:V16QI
- (lshiftrt:V16HI
-   (plus:V16HI
- (plus:V16HI
-   (zero_extend:V16HI
- (match_operand:V16QI 1 "nonimmediate_operand" "%x"))
-   (zero_extend:V16HI
- (match_operand:V16QI 2 "nonimmediate_operand" "xm")))
- (const_vector:V16QI [(const_int 1) (const_int 1)
-  (const_int 1) (const_int 1)
-  (const_int 1) (const_int 1)
-  (const_int 1) (const_int 1)
-  (const_int 1) (const_int 1)
-  (const_int 1) (const_int 1)
-  (const_int 1) (const_int 1)
-  (const_int 1) (const_int 1)]))
-   (const_int 1]
-  "TARGET_AVX && ix86_binary_operator_ok (PLUS, V16QImode, operands)"
-  "vpavgb\t{%2, %1, %0|%0, %1, %2}"
-  [(set_attr "type" "sseiadd")
-   (set_attr "prefix" "vex")
-   (set_attr "mode" "TI")])
-
 (define_insn "*sse2_uavgv16qi3"
-  [(set (match_operand:V16QI 0 "register_operand" "=x")
+  [(set (match_operand:V16QI 0 "register_operand" "=x,x")
(truncate:V16QI
  (lshiftrt:V16HI
(plus:V16HI
  (plus:V16HI
(zero_extend:V16HI
- (match_operand:V16QI 1 "nonimmediate_operand" "%0"))
+ (match_operand:V16QI 1 "nonimmediate_operand" "%0,x"))
(zero_extend:V16HI
- (match_operand:V16QI 2 "nonimmediate_operand" "xm")))
+ (match_operand:V16QI 2 "nonimmediate_operand" "xm,xm")))
  (const_vector:V16QI [(const_int 1) (const_int 1)
   (const_int 1) (const_int 1)
   (const_int 1) (const_int 1)
@@ -7060,9 +7035,13 @@
   (const_int 1) (const_int 1)]))
(const_int 1]
   "TARGET_SSE2 && ix86_binary_operator_ok (PLUS, V16QImode, operands)"
-  "pavgb\t{%2, %0|%0, %2}"
-  [(set_attr "type" "sseiadd")
-   (set_attr "prefix_data16" "1")
+  "@
+   pavgb\t{%2, %0|%0, %2}
+   vpavgb\t{%2, %1, %0|%0, %1, %2}"
+  [(set_attr "isa" "noavx,avx")
+   (set_attr "type" "sseiadd")
+   (set_attr "prefix_data16" "1,*")
+   (set_attr "prefix" "orig,vex")
(set_attr "mode" "TI")])
 
 (define_expand "sse2_uavgv8hi3"
@@ -7083,71 +7062,47 @@
   "TARGET_SSE2"
   "ix86_fixup_binary_operands_no_copy (PLUS, V8HImode, operands);")
 
-(define_insn "*avx_uavgv8hi3"
-  [(set (match_operand:V8HI 0 "register_operand" "=x")
-   (truncate:V8HI
- (lshiftrt:V8SI
-   (plus:V8SI
- (plus:V8SI
-   (zero_extend:V8SI
- (match_operand:V8HI 1 "nonimmediate_operand" "%x"))
-   (zero_extend:V8SI
- (match_operand:V8HI 2 "nonimmediate_operand" "xm")))
- (const_vector:V8HI [(const_int 1) (const_int 1)
- (const_int 1) (const_int 1)
- (const_int 1) (const_int 1)
- (const_int 1) (const_int 1)]))
-   (const_int 1]
-  "TARGET_AVX && ix86_binary_operator_ok (PLUS, V8HImode, operands)"
-  "vpavgw\t{%2, %1, %0|%0, %1, %2}"
-  [(set_attr "type" "sseiadd")
-   (set_attr "prefix" "vex")
-   (set_attr "mode" "TI")])
-
 (define_insn "*sse2_uavgv8hi3"
-  [(set (match_operand:V8HI 0 "register_operand" "=x")
+  [(set (match_operand:V8HI 0 "register_operand" "=x,x")
(truncate:V8HI
  (lshiftrt:V8SI
(plus:V8SI
  (plus

Re: RFA: Add makefile for cross-configuration torture test

2011-04-13 Thread Ralf Wildenhues
Hi Joern,

* Joern Rennecke wrote on Wed, Apr 13, 2011 at 11:02:27PM CEST:
> 2010-04-13  Joern Rennecke  
> 
> * config-list.mk: New file.

> --- contrib/config-list.mk(revision 0)
> +++ contrib/config-list.mk(revision 0)

> +all: $(LIST)
> +
> +.PHONEY: make-log-dir make-script-dir

.PHONEY is phony, it should be .PHONY instead.  SCNR.

> +empty=
> +
> +#Check for the presence of the MAINTAINERS file to make sure we are in a
> +#suitable current working direcrory.

directory.

> +make-log-dir: ../gcc/MAINTAINERS
> + mkdir log
> +
> +# The 'ix86-netware --with-ld=nwld' configuration needs a nwld executable to
> +# configure.  See PR47104.
> +make-script-dir:
> + mkdir scripts
> + echo ld $* > scripts/nwld
> + chmod u+x scripts/nwld
> +
> +$(LIST): make-log-dir make-script-dir
> + -mkdir $@
> + (cd $@ && \
> + ../../gcc/configure \
> + --target=$(subst SCRIPTS,`pwd`/../scripts/,$(subst OPT,$(empty) -,$@)) \
> + --enable-werror-always ${host_options} --enable-languages=all,ada,go) \
> + > log/$@-config.out 2>&1
> + -$(MAKE) -C $@ all-gcc > log/$@-make.out 2>&1 && rm -r $@

Can you separate the configure and the build steps into separate make
targets so that one can run one but not the other?  Or would that have
adverse effects on the load pattern (it might, due to the way make
orders scheduling of jobs)?  Would be nice to have 'all-gcc' abstracted
into a make variable too, so it could be reused for other purposes.
Please use rm -rf instead of rm -r.

Thank you!
Ralf