How do assembly compilers compile instructions like:
mov eax, [bx+si]
or
mov eax, [ebp + 4*eax - 40]
disclaimer: I'm still fairly new to this stuff.
I'm having trouble understanding from my current level of knowledge. I have exhausted google but can't find explanations on how it compiles; just on what it does. Because from my current understanding it can't be a predetermined calculation.
Is this generating a specific, different, opcode and then passing in the pieces and the CPU handles this automagically for it? If so I've missed this in all the x86 references I've found; or am maybe not looking for the right thing or what I expect the references to show it as.
Or is it injecting a bunch of instructions at compile time to do the math just before the instruction itself? Although, from reading various sources that use this technique to perform certain multiplication operations quicker than calling MUL(something along the lines of mov eax, [eax*4 + eax] (forgive me if I'm remembering that wrong) being equivalent to multiplying by 5 but quicker). It has lead me to believe this cannot be how it is handled.
I also have failed to find a good guide/read on the compilation process of x86 assembly. Only resources on programming in it. So if anyone knows any good resources let me know. :)
Thanks!