Sorry terminology is fighting language!

by parameter - I mean argument registers - also a stray "use" may have crept in.

Original problem : prolog is saving "live" registers that are not "call used" following normal gcc methods. But in AVR target this will include some argument registers - as not all argument registers are "call used". Function Argument registers do not need to be saved (since callee assumes they are always clobbered).

To solve problem all I need to know is what registers really do contain function arguments. Then I can omit these from prolog saves and fix bug.

DF does not tell me what registers contain function arguments. It marks all possible arguments registers with artificial def (which are known anyway). Unfortunately it is not as simple as counting defs as I had hoped.

So I would then have to go through all chains for "possible" arguments to see if that external def is actually used inside function. This can not be shortcut by looking for just any use - or multiple defs as real argument registers can be re-use inside function.

Is this conclusion correct?

Andy



Seongbae Park (박성배, 朴成培) wrote:
2008/3/1 Andrew Hutchinson <[EMAIL PROTECTED]>:
I'm am still struggling with a good solution that avoids unneeded saves
 of parameter registers.

 To solve problem all I need to know are the registers actually used for
 parameters. Since the caller assumes all of these are clobbered by
 callee - they should never need to be saved.

I'm totally confused what is the problem here.
I thought you were seeing extra callee-save register save/restore in prologue,
but now it sounds like you're seeing extra caller-save register save/restore.
Which one are you trying to solve, and what kind of target is this ?

 DF_REG_DEF_COUNT is showing 1 artificial def for all POTENTIAL parameter
 registers - not just the ones that are really used (since it uses target
 FUNCTION_ARG_REGNO_P to get parameter registers)

You said you wanted to know if there's a def of a register within a function.
For an incoming parameter, there will be one artificial def,
and if there's no other def, it means there's no real def
of the register within the function.

 So the DF artificial defs are useless in trying to find real parameter
 registers.

I don't understand what you mean by this. What do you mean by
"real parameter register" ?

 That seem to require going over all DF chains to work out which
 registers are externally defined. DF does not solve problem for me.

What do you mean by "externally defined" ?
DF may not solve the problem for you,
but now I'm completely lost on what your problem is.

 There has got to be an easier way of finding parameter registers used by
 function.

If you want to find all the uses (use as in reading a register but not
writing to it),
you should look at USE chain, not DEF chain, naturally.

Seongbae

Reply via email to