Andes Workshop

It is currently Wed Jun 28, 2017 2:33 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: -ffixed-reg option
PostPosted: Tue Oct 21, 2014 10:50 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
-ffixed-reg
Treat the register named reg as a fixed register; generated code should never refer to it (except perhaps as a stack pointer, frame pointer or in some other fixed role).
GCC Manual ยง 3.18 Options for Code Generation Conventions


Reference:
http://stackoverflow.com/questions/2114 ... c-variable

Please import the attachment which have 2 samples test0 and test1.
Attachment:
test0_1.zip [28.26 KiB]
Downloaded 120 times


test0: original project
test1: with compiler options -ffixed-$r1 -ffixed-$r2
Attachment:
2.png
2.png [ 18.87 KiB | Viewed 1514 times ]


Result:
Attachment:
1.png
1.png [ 29.69 KiB | Viewed 1514 times ]


Note:
Becuase $r0 is the return value. We can avoid to use $r0.
In the the following sample, we use option "-ffixed-$r0".
But the return value is still in $r0.
Attachment:
3.png
3.png [ 16.85 KiB | Viewed 1514 times ]


Attachment:
test2.zip [14.09 KiB]
Downloaded 109 times


Top
 Profile  
 
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