This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to know source language in backend


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]