public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Checking for the Programming Language inside GCC
@ 2009-04-28 18:57 Shobaki, Ghassan
  2009-04-28 20:23 ` Basile STARYNKEVITCH
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Shobaki, Ghassan @ 2009-04-28 18:57 UTC (permalink / raw)
  To: gcc

Hi,

In some optimization passes it may be useful to know the programming
language that we are compiling. Is there a way to get that information
in the middle end and back end?

Thanks in advance!
-Ghassan

  

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Checking for the Programming Language inside GCC
  2009-04-28 18:57 Checking for the Programming Language inside GCC Shobaki, Ghassan
@ 2009-04-28 20:23 ` Basile STARYNKEVITCH
  2009-04-28 21:52   ` Tobias Burnus
  2009-04-28 20:51 ` Andrew Haley
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Basile STARYNKEVITCH @ 2009-04-28 20:23 UTC (permalink / raw)
  To: Shobaki, Ghassan; +Cc: gcc

Shobaki, Ghassan wrote:
> In some optimization passes it may be useful to know the programming
> language that we are compiling. Is there a way to get that information
> in the middle end and back end?

I am not sure that would be a good idea. In fact you are suggesting that 
the intermediate representation[s] (ie Gimple) is not intermediate 
enough, since you need something more (like the source language).

And there might be some scenarii where making a programming language 
dependent optimization is wrong. Consider for example compiling with 
your GCC the output of the old f2c (fortran to C) translator. Would you 
consider that being C or Fortran?

I would believe you should at least explain what exactly are the 
language dependent optimizations you are thinking of (is it for matrix 
code in Fortran vs C?).

Still, I tend to believe that if you really need some language specific 
information, that would be better settled in the long term thru an 
evolution or enhancement of the middle end representations...

Regards.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Checking for the Programming Language inside GCC
  2009-04-28 18:57 Checking for the Programming Language inside GCC Shobaki, Ghassan
  2009-04-28 20:23 ` Basile STARYNKEVITCH
@ 2009-04-28 20:51 ` Andrew Haley
  2009-07-20 23:12   ` Running a Single GCC Test Case Shobaki, Ghassan
  2009-04-28 21:19 ` Checking for the Programming Language inside GCC Joe Buck
  2009-04-28 22:49 ` Richard Guenther
  3 siblings, 1 reply; 8+ messages in thread
From: Andrew Haley @ 2009-04-28 20:51 UTC (permalink / raw)
  To: Shobaki, Ghassan; +Cc: gcc

Shobaki, Ghassan wrote:

> In some optimization passes it may be useful to know the programming
> language that we are compiling. Is there a way to get that information
> in the middle end and back end?

Hmm.  I would rather that the amount of language-specific optimization
were kept to an absolute minimum.  I maintain the Java front-end, and
the fact that the optimizers I use work the same way for C makes me
very happy.  I wouldn't do it if I were you.  Better to find a way to
describe what you need to do in a langauge-independent form.

Andrew.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Checking for the Programming Language inside GCC
  2009-04-28 18:57 Checking for the Programming Language inside GCC Shobaki, Ghassan
  2009-04-28 20:23 ` Basile STARYNKEVITCH
  2009-04-28 20:51 ` Andrew Haley
@ 2009-04-28 21:19 ` Joe Buck
  2009-04-28 22:49 ` Richard Guenther
  3 siblings, 0 replies; 8+ messages in thread
From: Joe Buck @ 2009-04-28 21:19 UTC (permalink / raw)
  To: Shobaki, Ghassan; +Cc: gcc

On Tue, Apr 28, 2009 at 10:50:52AM -0700, Shobaki, Ghassan wrote:
> In some optimization passes it may be useful to know the programming
> language that we are compiling. Is there a way to get that information
> in the middle end and back end?

Is that really a good idea?  If a particular optimization, on the same
middle-end structure, is valid in one language and not in another,
that would suggest a problem with the implementation.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Checking for the Programming Language inside GCC
  2009-04-28 20:23 ` Basile STARYNKEVITCH
@ 2009-04-28 21:52   ` Tobias Burnus
  0 siblings, 0 replies; 8+ messages in thread
From: Tobias Burnus @ 2009-04-28 21:52 UTC (permalink / raw)
  To: Basile STARYNKEVITCH; +Cc: Shobaki, Ghassan, gcc

Basile STARYNKEVITCH wrote:
> Shobaki, Ghassan wrote:
>> In some optimization passes it may be useful to know the programming
>> language that we are compiling. Is there a way to get that information
>> in the middle end and back end?
> 
> I am not sure that would be a good idea. In fact you are suggesting that
> the intermediate representation[s] (ie Gimple) is not intermediate
> enough, since you need something more (like the source language).

I think some kind of optimization behaviour depends on the language
used, but this should be represented in some way in the Gimple and not
via some parsing of the programming language.

One example is "-fcx-fortran-rules" which allows for complex
multiplication and division to follow the Fortran rules - it is used
when compiling the gfortran library, but I think it is also a good
option for several C programs as it goes a middle way between strict
IEEE and maximal optimization.

Another example of language specifics is the handling of parenthesis:
Fortran requires that they are honoured, e.g. for (a/b)/c the
optimization a/(b*c) is not allowed. This is honoured via PAREN_EXPR and
thus there is no need to know the programming language.

Thus I'm in favour of programming language specific optimization - by
having it expressed in the Gimple itself.

Tobias

PS: I think one exception are debugging symbols - there is some language
dependence, but I think no plug-in support is planed for this.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Checking for the Programming Language inside GCC
  2009-04-28 18:57 Checking for the Programming Language inside GCC Shobaki, Ghassan
                   ` (2 preceding siblings ...)
  2009-04-28 21:19 ` Checking for the Programming Language inside GCC Joe Buck
@ 2009-04-28 22:49 ` Richard Guenther
  3 siblings, 0 replies; 8+ messages in thread
From: Richard Guenther @ 2009-04-28 22:49 UTC (permalink / raw)
  To: Shobaki, Ghassan; +Cc: gcc

On Tue, Apr 28, 2009 at 7:50 PM, Shobaki, Ghassan
<Ghassan.Shobaki@amd.com> wrote:
> Hi,
>
> In some optimization passes it may be useful to know the programming
> language that we are compiling. Is there a way to get that information
> in the middle end and back end?

There is no way that should be used in new code.

Richard.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Running a Single GCC Test Case
  2009-04-28 20:51 ` Andrew Haley
@ 2009-07-20 23:12   ` Shobaki, Ghassan
  2009-07-20 23:23     ` Manuel López-Ibáñez
  0 siblings, 1 reply; 8+ messages in thread
From: Shobaki, Ghassan @ 2009-07-20 23:12 UTC (permalink / raw)
  To: gcc

Hi,

Is there a way to run a single test from the GCC test suite under
gcc/testsuite? 
I could not find the answer in
http://gcc.gnu.org/install/test.html and the google searches I tried did
not yield anything useful.

More specifically, if I want to run a test case like
"gcc/testsuite/gcc.target/i386/sse5-fma.c", how do I run just that
particular test case? Based on what I read in the above document, I
tried to do something like this:

make check RUNTESTFLAGS="gcc.target/i386/sse-fma.c"

but that did not work. Any idea how this can be done? 

Thanks
-Ghassan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Running a Single GCC Test Case
  2009-07-20 23:12   ` Running a Single GCC Test Case Shobaki, Ghassan
@ 2009-07-20 23:23     ` Manuel López-Ibáñez
  0 siblings, 0 replies; 8+ messages in thread
From: Manuel López-Ibáñez @ 2009-07-20 23:23 UTC (permalink / raw)
  To: Shobaki, Ghassan; +Cc: gcc

2009/7/21 Shobaki, Ghassan <Ghassan.Shobaki@amd.com>:
> Hi,
>
> Is there a way to run a single test from the GCC test suite under
> gcc/testsuite?
> I could not find the answer in
> http://gcc.gnu.org/install/test.html and the google searches I tried did
> not yield anything useful.

It is written in that page, although it could be more explicit.

<quote>
Likewise, in order to run only the g++ “old-deja” tests in the
testsuite with filenames matching `9805*', you would use

         make check-g++ RUNTESTFLAGS="old-deja.exp=9805* other-options"
</quote>

So basically, you need to specify the appropriate .exp file and then
part of the filename. This should do what you want:

make check-gcc RUNTESTFLAGS=i386.exp=sse5-fma.c

Patches to the above webpage to make it clearer are welcome!

Cheers,

Manuel.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-07-20 23:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-28 18:57 Checking for the Programming Language inside GCC Shobaki, Ghassan
2009-04-28 20:23 ` Basile STARYNKEVITCH
2009-04-28 21:52   ` Tobias Burnus
2009-04-28 20:51 ` Andrew Haley
2009-07-20 23:12   ` Running a Single GCC Test Case Shobaki, Ghassan
2009-07-20 23:23     ` Manuel López-Ibáñez
2009-04-28 21:19 ` Checking for the Programming Language inside GCC Joe Buck
2009-04-28 22:49 ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).