Jan,

> > > - in assembler functions, either inline or externally linked, the
> > > assumption is, that no register may be trashed. Correct?
> >
> > This is correct for naked functions or inline assembly
> > inside non-naked C functions with surrounding C
> > statements.
> >
> > If however you write a function completely in assembly
> > and start its name with an underscore, you can make a C
> > prototype (without the underscore) for it and call it.
> > The caller will save the registers around the call
> > (unless you use --callee-saves).
> 
> This is great. Where is the docs? :-)
> I mean chapter 3.13, this should be in bold as the first line, shouldn't it.
> 
> OK OK I know this is OS so I am supposed to update it myself...
> 
> OK, please tell me how.

IMO you're not supposed to do anything, but help sure is 
welcome. The SDCC manual is written using LYX. If you 
use 1.4 be sure to save as backward compatible with 1.3. 
The file to change is sdccman.lyx in the doc directory 
of the source tree. After updating you can create a 
patch file (with context) and upload it in the patch 
tracker.

> > Also if you use inline assembly inside a non-naked C
> > function without any C statements I doubt any register
> > will be used. Best check the generated asm though.
> 
> I don't understand. Is it not my choice what resources will I use in MY
> inline-assembly functions?

Sure it's your choice, just like it's the compilers 
choice to use what IT likes for the surround C code. But 
it's your responsibility that your resource usage does 
not clash with the compilers. Example: if you put inline 
assembly inside a for loop, make sure you don't destroy 
the loop counter. A non-naked function with atleast one 
parameter might also "receive" that parameter from DPTR, 
B, A into registers or into xdata when using --model-
large and destroy DPTR and A along the way. That's why I 
advise to check!

> > > - on the other hand, DPTR, ACC, B may be freely thrashed (provided the
> > > return type is void). Correct?
> >
> > Yes, these are at your disposal.
> 
> Thank you, it's very generous. :-)
> I think this should go into the docs, too.
> 
> > > - therefore, for a register intensive application, I'd like to swap
> > > register banks as a least processing-expensive solution. My 
> > > assumption is, that in the declaration, I'd add the "using" attribute 
> > > (with the appropriate
> > > bank number), together with "naked". I assume, that I still need to 
> > > provide the
> > > switching code upon entry/exit on my own; but the compiler is aware that 
> > > the
> > > register bank is in usage and will not assign it to iram/dram/stack or
> > > otherwise. Correct?
> >
> > Yes, that's correct. If you do not use naked the
> > switching will be done for you (by the caller!).
> 
> Oh, very convenient. An another line into the docs...
> 
> Thank you for your help again.
> 
> Jan

You're welcome.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to