I am a newbie to LLVM IR
, and I am trying to simulate some x86 instructions in LLVM IR
.
Here is a simple case:
move %eax, %ebx
However, I didn't find any corresponding mov
opcode after looking at the materials at here and here.
So my question is :
If I want to simulate the mov
opcode using LLVM IR? What should I do?
I am new to LLVM IR
, and probably I would spend a long time on this "simulation" work, what should be the best reference about LLVM IR?
I really appreciate if anyone can give me some help. Thanks!
There is no equivalent to the mov
instruction. LLVM IR is in SSA (Static Single Assignment) form, which means that each register is assigned a value exactly once. There are an unlimited number of (virtual) registers -- each operation creates a new one as needed.
It's unclear what you mean by simulating x86 instructions, but if it suits you, you could allocate memory on the stack for a local variable for each register (using the alloca
instruction), and use the load
and store
instructions to copy values between them.