A Question

Hi
I want to use LLVM to automatically generate multithreaded code for execution on multicore processors. My problem is code generation for multicores and concurrency primitives.
Is there any facilities for code generation? How should I start?
Best Regards.

|

Hi
I want to use LLVM to automatically generate multithreaded code for execution on multicore processors. My problem is code generation for multicores and concurrency primitives.
Is there any facilities for code generation? How should I start?
Best Regards.
|

  • |

You’ll need a threading library for your platform. Then create function declarations for the threading functions, call them from your generated code, and off you go. Be sure to link the threading libraries in to your executable.

LLVM does not have anything threading specific in the IR language definition other than the atomic primitives. You can create locks and stuff with those, or use the ones provided by your threading library. LLVM has nothing built in for generating code that knows how to spawn a new thread.