Andes Workshop
http://forum.andestech.com/

如何強制使用variable到暫存器裡?
http://forum.andestech.com/viewtopic.php?f=25&t=667
Page 1 of 1

Author:  cindy [ Tue Feb 05, 2013 11:40 am ]
Post subject:  如何強制使用variable到暫存器裡?

請參考這一篇,
http://tigcc.ticalc.org/doc/gnuexts.html#SEC97

我們的暫存器要寫成$r10,(前面加上"$")
例如register int *foo asm ("$r10");
而且要加上-ffixed-reg
Must add -ffixed-reg option to compiler.
For example, -ffixed-\$10 or -ffixed-10.

上述的暫存器不可使用$r0~$r5。

不建議強制一個專屬的暫存器來放變數。
N8的暫存器很少,如果多用掉一個暫存器,會造成可用暫存器更少,導致code size變大。

您可以用另外一種方法,建議編譯器盡量將它放在register裡。(但不保證一定會用)
register int i = 10;

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/