This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: How to know source language in backend
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Vikram Singh <vsp1729 at gmail dot com>
- Cc: vikram_sp <vikramforum at yahoo dot com>, fortran at gcc dot gnu dot org
- Date: Thu, 21 Mar 2013 21:16:39 -0700
- Subject: Re: How to know source language in backend
- References: <35200310 dot post at talk dot nabble dot com> <CA+=Sn1k=cm=KPDKZKBxgi5S8tJL_MPn6u3aFYYm7wHS7o9VbQw at mail dot gmail dot com> <CAEhPm73kOJEnB7J1C+c+GjHdcEk2JZjVzfG7F_qbjmLT50OifQ at mail dot gmail dot com>
On Thu, Mar 21, 2013 at 9:11 PM, Vikram Singh <vsp1729@gmail.com> wrote:
>
>
> On Thu, Mar 21, 2013 at 11:09 AM, Andrew Pinski <pinskia@gmail.com> wrote:
>>
>> On Wed, Mar 20, 2013 at 10:29 PM, vikram_sp <vikramforum@yahoo.com> wrote:
>> >
>> > Hi
>> >
>> > In gcc backend code how to know which language are we compiling.
>> > When compiling fortran how do i know in backend code that we are
>> > generating
>> > code for fortran program.
>>
>> Is there a reason for this? For an example with LTO you might be
>> generating code for fortran and C in the same invoking of the backend
>> (even inlined function wise).
>>
>> Thanks,
>> Andrew
>
>
>
> I added fortran to gcc 4.1.2 which was previously having support for c c++
> only for a custom processor. The problem i faced is that in function
> initialize_argument_information()
> n_named_arg is always coming 1. (i do not know why; for x86 it is
> actual_arg+1 etc)
> so in <TARGET>.c in "function_arg()" function the "named" parameter is
> coming 0,
> which is the condition for varargs in the backend. so the parameters are not
> passing
> in registers but on stack.
>
> So i want to check for fortran language to conditionally check in
> function_arg().
> Apart from that is there any target hook that can implement so that
> n_named_arg
> comes correct.
That was a bug in 4.1.2's fortran front-end which was fixed much
later. The problem is the fortran front-end actually was accidentally
using varargs for their function definitions.
It is most likely better to backport that fix than work around in your backend.
Thanks,
Andrew Pinski