LLVM-IR, interprocess communication, managing layer

270 views Asked by At

would it be possible to implement a layer managing several running programs on the basis of LLVM-IR?

Background: I have several small programs (which should be coded in IR directly or tranformed from clang to IR). They might get altered on IR level, then should be compiled on/for a given architecture and run there (in parallel). There should be a central instance, which supervises the individuals, possibly spawning new individuals. Interprogram communication should be possible.

Not using IR, i could use c/c++ and some system specific threading/message passing tools.

If I understood correctly, I could translate the code to IR; but if IR is targetagnostic, would'nt this fail? If not this means that there should be IR level tools for inter program communication...

So I'm confused about this. I read through the LLVM documentation but did not get it clear so far. Any hints?

UPDATE:

So far I found a possible (target dependent) solution. On could code the managing layer in clang, using the clang interpreter (jit) approach for the individuals which were 'jitted' and then spawned as threads (e.g. using pthread) by the managing layer.

If I understood correctly, the target specific part enters the IR code as externals. In this sense IR is not platform agnostic, as the resulting IR from a given clang code makes use of the platform specific includes. Using newlib, one gets standard clib functionalities as source, applicable for several targets. So using newlib+clang, the IR is not platform independent, but the process from source to final machine code is flexible (among the available newlib&llvm targets).

Right?

How about generating threads with round-robin type scheduling? I guess this will be platform dependent (e.g. by using pthread).

Right?

0

There are 0 answers