This is the mail archive of the
mailing list for the GCC project.
Re: Porting GCC troubles : about register window
- From: chen haibo <chbchb1130 at yahoo dot com dot cn>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 30 Sep 2003 21:12:54 +0800 (CST)
- Subject: Re: Porting GCC troubles : about register window
--- Hans-Peter Nilsson <email@example.com> 的正文：> On
Tue, 30 Sep 2003, [gb2312] chen haibo wrote:
> > > > But the call depth did exceed 16, then I
> > > > should reserve all the registers to memory or
> > > set
> > > > per time,and in my porting,I must each time to
> > > > judge if the call depth exceeds 16.
> > >
> > --- Hans-Peter Nilsson <firstname.lastname@example.org>
> 的正文：> On
> > > I presume the register set pointer is a hidden
> > > register, not
> > > accessible from a program.
> > >
> > Yes,the register set pointer is part of a special
> > register,say psw,and I can set it through some
> > instructions.
> So you can test it in the function prologue (that
> the compiler
> emits before the actual code in the function)?
> > > >I think it is a
> > > > very trouble thing,I wonder if the GCC porting
> > > > mechanics has any interface to deal with it or
> > > any
> > > > one know how to solve the problem.Wait for
> > > help,Thanks all!
> > >
> > > Nothing other than the obvious: pass the call
> > > as one of
> > > the function parameters.
> > But I don't think it pratical to force programmer
> > write a function with its call depth as a
> > and when we encounter a recursive function,we can
> > even know the exactly what the call depth is.
> You're writing the compiler. The point is that the
> doesn't do it; the *compiler* does it as part of the
> function-call ABI, and the system that starts the
> program or the
> startup code initializes it (and the function
> prologue when the
> register set is moved to memory).
> But I think it'd be better if checking the depth is
> done by
> looking at the special register in the function
> > I have seen that the INCOMING_REGNO,OUTGOING_REGNO
> > LOCAL_REGNO macro is used for register window,but
> > don't find it rather useful for my situation.
> Those are mainly for mapping register numbers
> between caller and
> callee, used when passing parameters.
I have roughly picked your point,I should set the
register set pointer(I have refered to psw) to zero
each time a program start,and add some instruction in
the function prologue to test whether the psw exceed
16,if if exceed,then I would reserve all the register
to memory and reset some flags.But it will need some
redundant instructions in each function,thus too much
execution overhead and increased code size.maybe it is
not endurable for an embeded processor,but it seems
that I have no choice.^_^
thank you very much!
> brgds, H-P
Do You Yahoo!?