Where is the virtual machine located in LLVM?

Note: flagged as community wiki.

Where is the low level virtual machine in LLVM?

I see that we have llvm-g ++ and c-lang, but for me LLVM is something like a Valgrind simulator where instructions are executed on it, and I can write programs to control running code / interrupt when certain conditions / etc occur. ..

Where are tools like this built on LLVM?

Thanks!

+4
source share
2 answers

I think you are looking for QEMU, not LLVM.

The low-level virtual machine in LLVM is that after converting a higher-level C and C ++ input into an internal low-level representation (as a step in the normal compilation process), it can then save this low-level file and execute it on the JIT compiler (which thus acts as a virtual machine). This JIT compiler makes significant optimizations, and therefore I expect that it will be difficult to work in the form that you think about, in particular, it does not follow step-by-step instructions for execution.

QEMU, by contrast, is an open source emulator that performs step-by-step instructions on machine codes. It already contains a certain ability of the tool code to search for certain conditions, since it can connect to GDB and set observation points, etc., which are implemented in QEMU itself.

+4
source

To use LLVM to run x86 code, you must check libCPU or legacy llvm-qemu.

Watch the launch of the x86 _on_ llvm program

+1
source

Source: https://habr.com/ru/post/1306762/


All Articles