-ffixed-regTreat 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 ConventionsReference:
http://stackoverflow.com/questions/2114 ... c-variablePlease import the attachment which have 2 samples test0 and test1.
Attachment:
test0_1.zip [28.26 KiB]
Downloaded 1226 times
test0: original project
test1: with compiler options -ffixed-$r1 -ffixed-$r2
Attachment:
2.png [ 18.87 KiB | Viewed 11989 times ]
Result:
Attachment:
1.png [ 29.69 KiB | Viewed 11989 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 [ 16.85 KiB | Viewed 11989 times ]
Attachment:
test2.zip [14.09 KiB]
Downloaded 1277 times