Andes Workshop

It is currently Tue Sep 17, 2019 6:25 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 如何強制使用variable到暫存器裡?
PostPosted: Tue Feb 05, 2013 11:40 am 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
請參考這一篇,
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;


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group