[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Parallella Community • View topic - Register usage questions

Register usage questions

Register usage questions

Postby cmcconnell » Fri Sep 19, 2014 12:09 pm

Colin.
cmcconnell
 
Posts: 99
Joined: Thu May 22, 2014 6:58 pm

Re: Register usage questions

Postby notzed » Sat Sep 20, 2014 2:16 am

Your assumptions pretty much match my understanding.

Some other things I found whilst looking into exactly the same problem:

- I think fixed and call-used have some limitations. I played with one or the other and found they didn't do exactly what I told them to all the time, although i'm sorry i can't recall the details.
- There is also the ability to limit the compiler to using only the first 32-registers: -mhalf-reg-file.
- You can assign global or local variables to fixed registers within a compilation unit. This removes them from the register pool but leaves them available as that value. gcc manual: 6.44 Variables in Specified Registers, e.g. register int *foo asm ("r5"); I'm pretty sure I tested this with -mhalf-reg-file and the upper 32 registers can still be used.
- (i'm sure you're aware, but ...) Remember all execution paths executed need to be compiled with the same options, i.e. libc, elib, etc.

A combination of -mhalf-reg-file and specific global registers in r32+ might be the easiest way to see if it's worth looking into further for your application.

You might have better luck or more patience but in the end I just gave up fighting with the compiler and didn't really feel like moving everything to what is effectively a new abi. Usually when I thought i had something some code change would break it. And I just wasn't seeing the gains that would justify the effort compared to simply re-arranging the code such that each leaf function does a batch of work at a time which makes the the invocation and setup costs insignificant, and often the inner loop more efficient. LDS is only 1 cycle away so batching overheads can be small.

If the function is small and doesn't take long to execute then an inline C function will probably beat it no matter how optimised it is in isolation because not only does it save the function invocation entirely it can be scheduled fairly freely amongst the caller's other work. You can try inline asm for the same effect but i've found it's just another compiler fight I kept losing.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: Register usage questions

Postby cmcconnell » Tue Sep 23, 2014 2:16 am

Thanks for that.

One further query - Registers R28 - R31 : 'Reserved for constants'. I'm wondering just what that means in practice.

If my code path does not call into any library code that may expect R28-R31 to contain their predefined constants, then can I treat them just like regular 'callee saved' registers?

So long as I restore their values when I'm done, there doesn't seem to be a reason not to use them.
Colin.
cmcconnell
 
Posts: 99
Joined: Thu May 22, 2014 6:58 pm

Re: Register usage questions

Postby notzed » Tue Sep 23, 2014 7:41 am

They could be potentially used by any interrupt code but if you're not using any (or write your own in asm) I don't think it should matter; but a future sdk and/or gcc might make use of them more. Then again it should only matter in compiled C, or calling C, or with C ISRs.

From what I could tell about 6 months ago r28 is the only one "assigned" so far, and its intended use is for a segment pointer to allow for relocatable code. But at that time I don't think gcc was fully using it. One will also probably be used to implement thread-local-storage, although tbh i think the unix thread/process model is a pretty poor fit for the hardware.

I presume anything like this is "unsupported" - although who knows what that means at the best of times.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia


Return to Assembly

Who is online

Users browsing this forum: No registered users and 4 guests