long long int i=57745158985; #the C code
0000000000100004: li r7,13
0000000000100008: lis r8,29153
000000000010000c: ori r8,r8,0x3349
0000000000100010: stw r7,24(rsp)
0000000000100014: stw r8,28(rsp)
0000000000100018: lfd fp0,24(rsp)
000000000010001c: stfd fp0,8(rsp)
Hello, when I disassemble the CodeWarrior c code, this code comes up. In the code, offset is given to the registers. I don't understand why the given offsets are 24, 28, and 8. How does it determine this? Would it work if it assigned any other value?
This depends on the ABI for your platform and architecture.
Assuming your platform is the PowerPC e500 Application Binary Interface. The register in question (rsp) is the stack pointer. Those offsets are references to within the functions stack frame. To understand the stack frame of a function you need to consult the ABI.
If you look at Section 2.3 The Stack Frame of 1 you will see the layout for a functions stack frame. That is what the compiler is targeting when those offsets like 24 and 28 are being determined.