[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    Re: Porting problem again
From:       Anders Magnusson <ragge () ludd ! ltu ! se>
Date:       2009-12-31 9:25:30
Message-ID: 4B3C6E0A.9060102 () ludd ! ltu ! se
[Download RAW message or body]

Peter Kuschnerus wrote:
> Anders Magnusson <ragge <at> ludd.ltu.se> writes:
>
>   
>> Peter Kuschnerus wrote:
>>     
>>> Hello,
>>>
>>>   
>>>       
>> Hi,
>>
>> you sent your mail from a not-subscribed-address, and I didn't see it
>> until now.  Anyway;
>>
>>     
>>> In my ISA the concept of function-linkage is that way,
>>> that cleanup of args is not done by the caller,
>>> but by the called function at return.
>>>
>>> For fixed number of args, there is no problem.
>>> For variable number of args, a hidden argument is to be added,
>>> which contains the number of actual args,
>>> so that the called function has the information 
>>> to do the cleanup correctly.
>>>
>>> I try to implement the adding of that hidden argument
>>> in the routine "funcode" of module code.c.
>>> But there I have the problem to findout,
>>> whether the call is with ellipsis or without.
>>>
>>> Is there an easy way to check this in this routine ?
>>> Please, any hint would help !
>>>   
>>>       
>> It's not so easy as just a flag set, but the code stuff below does what 
>> you want.
>> It's cut from bfcode() in amd64.  The prototype argument types are stored in
>> an array al, and if the last entry is TELLIPSIS it is varargs.  Note 
>> that it skips
>> extra args in the case of structs/unions/arrays.
>>
>>     
> Hi,
> this codefragment accesses the prototype information of
> the function being within.
>
> But the prototype of a function to be called,
> is another issue.
>   
> I need that data in lastcall and zzzcode.
> But I have the impression that this data is not avalable there.
>   
You can use the same principle for finding the prototype info, just 
search for
a CALL node late in pass1.  Then use the field n_flags in the CALL node to
send info about this to pass2.   This must be done last in pass1, look 
at how the
mangle() function in i386/local.c is implemented.

> Instead I did find it in clocal case CALL
> al = p->n_df[0].dfun
>
> But there I must save it for later use in lastcall.
> For saving I used the field of call-node: n_qual
> It seems to be unused.
> I saw it only used in some other arch for counting of arg space.
> If unused is true, it is a solution of my problem.
The n_qual field stores information about const/volatile and should not be
(re-)used until after all optimizing code is called.  Use the flags 
field instead.

-- Ragge
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic