How "arm_gen_constant" Function In arm.c works?
Prashant Purohit
prashantpurohit025@gmail.com
Wed Mar 3 05:16:00 GMT 2010
Hi Ian,
Thanks for the reply.
>I'm not sure I understand the question. When you say "how we decide
>these constants in that function," to which constants are you
>referring?
Sorry for not mentioning my question clearly.
I mean to say, as we can not generate all the constants from 8 bit
rotation scheme supported in ARM architecture, I just wanted to know the
logic behind that function which generates one Mov and one Add/Sub
instruction if that constant is not being generated by rotation scheme
alone.
e:g : suppose, the immediate constant is 1234 then that function will do
it as
mov r3, #1232
add r3, r3, #2 (In case of ARM)
Please tell me, how it splits that constant in to 1232 and 2.
>Some ARM instructions let you shift and rotate operands before
>applying them. The arm_gen_constant function is so complicated
>because it is looking for different ways to exploit that fact in order
>to generate the constants in the fewest instructions. The function is
>also considering the context in which the constant is used--this is
>the code parameter--since that permits some further optimizations.
>To understand what this code is doing, first get a clear understanding
>of the ARM architecture. Then consider how to most efficiently
>implement various operations using constants.
Yes, I am well aware about ARM architecture and so only asked the logic of
"arm_gen_constant" function.
Please, let me know if any one know it.
Thanks & Regards,
Prashant.
--
View this message in context: http://old.nabble.com/How-%22arm_gen_constant%22-Function-In-arm.c-works--tp27753882p27764440.html
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list