public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Porting GCC troubles : about register window
@ 2003-09-28 20:42 chen haibo
  2003-09-28 21:25 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 6+ messages in thread
From: chen haibo @ 2003-09-28 20:42 UTC (permalink / raw)
  To: gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 886 bytes --]

Hi!
   I plan to port GCC for a new processor which has 16
sets of registers(8 in each set).Since only one 
set is visible at any time so that I can omit the
register protection if the depth the call is not
exceed 16.But the call depth did exceed 16, then I
should reserve all the registers to memory or each set
per time,and in my porting,I must each time to 
judge if the call depth exceeds 16.I think it is a
very trouble thing,I wonder if the GCC porting
mechanics has any interface to deal with it or if any
one know how to solve the problem.Wait for help,Thanks all!

_________________________________________________________
Do You Yahoo!? 
ÆôÓõçÓÊÕʺţ¬Áì»áÑÅ»¢Í¨[ÉíÁÙÆä¾³ÁĵçÓ°]µÄ¶¯¸Ð÷ÈÁ¦£¬»¹ÓÐÍøÂçÉãÏñÍ·+ÑÅ»¢Í¨ÊÕÒô»úµÈÄãÀ´ÄÃ
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.messenger.yahoo.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Porting GCC troubles : about register window
  2003-09-28 20:42 Porting GCC troubles : about register window chen haibo
@ 2003-09-28 21:25 ` Hans-Peter Nilsson
  2003-09-30  7:29   ` chen haibo
  0 siblings, 1 reply; 6+ messages in thread
From: Hans-Peter Nilsson @ 2003-09-28 21:25 UTC (permalink / raw)
  To: chen haibo; +Cc: gcc

On Sun, 28 Sep 2003, [gb2312] chen haibo wrote:
>    I plan to port GCC for a new processor which has 16
> sets of registers(8 in each set).Since only one
> set is visible at any time so that I can omit the
> register protection if the depth the call is not
> exceed 16.

Sounds like register windows, like sparc.

> But the call depth did exceed 16, then I
> should reserve all the registers to memory or each set
> per time,and in my porting,I must each time to
> judge if the call depth exceeds 16.

I presume the register set pointer is a hidden register, not
accessible from a program.

>I think it is a
> very trouble thing,I wonder if the GCC porting
> mechanics has any interface to deal with it or if any
> one know how to solve the problem.Wait for help,Thanks all!

Nothing other than the obvious: pass the call depth as one of
the function parameters.

brgds, H-P

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Porting GCC troubles : about register window
  2003-09-28 21:25 ` Hans-Peter Nilsson
@ 2003-09-30  7:29   ` chen haibo
  2003-09-30  7:42     ` Hans-Peter Nilsson
  0 siblings, 1 reply; 6+ messages in thread
From: chen haibo @ 2003-09-30  7:29 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 1880 bytes --]

 --- Hans-Peter Nilsson <hp@bitrange.com> µÄÕýÎÄ£º> On
Sun, 28 Sep 2003, [gb2312] chen haibo wrote:
> >    I plan to port GCC for a new processor which
> has 16
> > sets of registers(8 in each set).Since only one
> > set is visible at any time so that I can omit the
> > register protection if the depth the call is not
> > exceed 16.
> 
> Sounds like register windows, like sparc.
Yes,But sparc only has one uniform set of registers.
> 
> > But the call depth did exceed 16, then I
> > should reserve all the registers to memory or each
> set
> > per time,and in my porting,I must each time to
> > judge if the call depth exceeds 16.
> 
> 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 special
instructions.
> >I think it is a
> > very trouble thing,I wonder if the GCC porting
> > mechanics has any interface to deal with it or if
> any
> > one know how to solve the problem.Wait for
> help,Thanks all!
> 
> Nothing other than the obvious: pass the call depth
> as one of
> the function parameters.
> 
But I don't think it pratical to force programmer to 
write a function with its call depth as a parameter 
and when we encounter a recursive function,we can not 
even know the exactly what the call depth is.
I have seen that the INCOMING_REGNO,OUTGOING_REGNO and
LOCAL_REGNO macro is used for register window,but I
don't find it rather useful for my situation.
waiting for your help!
thanks!
> brgds, H-P
>  


_________________________________________________________
Do You Yahoo!? 
ÆôÓõçÓÊÕʺţ¬Áì»áÑÅ»¢Í¨[ÉíÁÙÆä¾³ÁĵçÓ°]µÄ¶¯¸Ð÷ÈÁ¦£¬»¹ÓÐÍøÂçÉãÏñÍ·+ÑÅ»¢Í¨ÊÕÒô»úµÈÄãÀ´ÄÃ
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.messenger.yahoo.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Porting GCC troubles : about register window
  2003-09-30  7:29   ` chen haibo
@ 2003-09-30  7:42     ` Hans-Peter Nilsson
  2003-09-30 15:33       ` chen haibo
  0 siblings, 1 reply; 6+ messages in thread
From: Hans-Peter Nilsson @ 2003-09-30  7:42 UTC (permalink / raw)
  To: chen haibo; +Cc: gcc

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 each
> > set
> > > per time,and in my porting,I must each time to
> > > judge if the call depth exceeds 16.
> >
>  --- Hans-Peter Nilsson <hp@bitrange.com> µÄÕýÎÄ£º> 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 special
> 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 if
> > any
> > > one know how to solve the problem.Wait for
> > help,Thanks all!
> >
> > Nothing other than the obvious: pass the call depth
> > as one of
> > the function parameters.
>
> But I don't think it pratical to force programmer to
> write a function with its call depth as a parameter
> and when we encounter a recursive function,we can not
> even know the exactly what the call depth is.

You're writing the compiler.  The point is that the *programmer*
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 prologue.

> I have seen that the INCOMING_REGNO,OUTGOING_REGNO and
> LOCAL_REGNO macro is used for register window,but I
> don't find it rather useful for my situation.

Those are mainly for mapping register numbers between caller and
callee, used when passing parameters.

brgds, H-P

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Porting GCC troubles : about register window
  2003-09-30  7:42     ` Hans-Peter Nilsson
@ 2003-09-30 15:33       ` chen haibo
  2003-09-30 17:42         ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: chen haibo @ 2003-09-30 15:33 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 2906 bytes --]

 --- Hans-Peter Nilsson <hp@bitrange.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
> each
> > > set
> > > > per time,and in my porting,I must each time to
> > > > judge if the call depth exceeds 16.
> > >
> >  --- Hans-Peter Nilsson <hp@bitrange.com>
> µÄÕýÎÄ£º> 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
> special
> > 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
> if
> > > any
> > > > one know how to solve the problem.Wait for
> > > help,Thanks all!
> > >
> > > Nothing other than the obvious: pass the call
> depth
> > > as one of
> > > the function parameters.
> >
> > But I don't think it pratical to force programmer
> to
> > write a function with its call depth as a
> parameter
> > and when we encounter a recursive function,we can
> not
> > even know the exactly what the call depth is.
> 
> You're writing the compiler.  The point is that the
> *programmer*
> 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
> prologue.
> 
> > I have seen that the INCOMING_REGNO,OUTGOING_REGNO
> and
> > LOCAL_REGNO macro is used for register window,but
> I
> > 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!? 
ÆôÓõçÓÊÕʺţ¬Áì»áÑÅ»¢Í¨[ÉíÁÙÆä¾³ÁĵçÓ°]µÄ¶¯¸Ð÷ÈÁ¦£¬»¹ÓÐÍøÂçÉãÏñÍ·+ÑÅ»¢Í¨ÊÕÒô»úµÈÄãÀ´ÄÃ
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.messenger.yahoo.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Porting GCC troubles : about register window
  2003-09-30 15:33       ` chen haibo
@ 2003-09-30 17:42         ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2003-09-30 17:42 UTC (permalink / raw)
  To: chen haibo; +Cc: Hans-Peter Nilsson, gcc

On Tue, Sep 30, 2003 at 09:12:54PM +0800, chen haibo wrote:
> But it will need some redundant instructions in each function, thus too much
> execution overhead and increased code size.

This is why Sparc traps on register stack full, and the kernel
saves the registers and frees the register window entries.



r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-09-30 16:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-28 20:42 Porting GCC troubles : about register window chen haibo
2003-09-28 21:25 ` Hans-Peter Nilsson
2003-09-30  7:29   ` chen haibo
2003-09-30  7:42     ` Hans-Peter Nilsson
2003-09-30 15:33       ` chen haibo
2003-09-30 17:42         ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).