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

-ffixed-reg option
http://forum.andestech.com/viewtopic.php?f=16&t=896
Page 1 of 1

Author:  cindy [ Tue Oct 21, 2014 10:50 pm ]
Post subject:  -ffixed-reg option

-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 373 times


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


Result:
Attachment:
1.png
1.png [ 29.69 KiB | Viewed 5167 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 5167 times ]


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

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