Re: Porting problem again
Anders Magnusson <ragge <at> ludd.ltu.se>
2009-12-31 09:25:30 GMT
Peter Kuschnerus wrote:
> Anders Magnusson <ragge <at> ludd.ltu.se> writes:
>> Peter Kuschnerus wrote:
>> 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.
> 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
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.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