Prashant Purohit <prashantpurohit025@xxxxxxxxx> writes: > As ARM has only 8 bit for immediate value, "arm_gen_constant" > function in "arm.c" is used to generate those value which are not generated > by 8-bit rotation scheme in ARM Processor. > > But my question is how we decide these constants in that function & > how that function proceed or work (i.e the logic behind generating those > constants) as I am not able to get it by just looking at the code. > > Please, help me by giving some more description about how the > function works? 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? 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. Ian