I would like to know the following about LLVM's Compiler-RT project: from what program is it invoked. To my understanding, Compiler-RT is a collection of functions that handle instructions in LLVM that don't really have hardware counterparts (is there more to it than this?). So if I use division in LLVM, it should be replaced by an appropriate Compiler-RT function. First, if this is not correct, please correct me!
Second, I am curious as to who generates the Compiler-RT usage. Is it Clang or is it LLVM directly. Could I write a different front-end to LLVM and would LLVM automatically handle the use of Compiler-RT when appropriate?
As we're exploring bringing up a C/C++ runtime on our system, I'd like to share a very helpful resource for those using clang/llvm: compiler-rt. Compiler-rt is an LLVM project that provides implementations of various builtin functions for a variety of architectures.
Clang can be configured to use one of several different linkers: GNU ld. GNU gold. LLVM's lld.
DESCRIPTION. The clang executable is actually a small driver which controls the overall execution of other tools such as the compiler, assembler and linker.
Both your assertions are correct. A LLVM backend has to map LLVM IR to native target-specific instructions. If an instruction is not supported natively, it has to be replaced (legalized). You can see this taking place in TargetLowering, which directly maps to runtime functions in the Compiler RT.
The front end is not involved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With