LLVM and gem5


I have modified the LLVM X86 backend by adding some new instructions. I would like to compile my programs using llvm and run them on a CPU simulated by gem5.

I have a few questions regarding this mostly related to the consistency of the machine code generated by llvm and accepted by gem5 (Opcode differences.).

In gem5, OR instructions are supported at opcodes different from llvm opcodes for OR. I am facing similar problems with my new instructions.

I would like to run my executable generated by llvm on a gem5 simulator.

Any help would be appreciated.

Dear Pratik,

I'm not sure that your question is clear. To my understanding, GEM is a Simics-based CPU emulator that runs standard x86 binaries. Therefore, I'd expect the output of an unmodified LLVM compiler for x86 to run on GEM. The only reason why you'd get output from LLVM that doesn't work on the simulator is if LLVM is configured to generate code for x86 features that GEM doesn't support.

Can you more thoroughly explain the problem that you're having?


John Criswell