Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For what and from where is Compiler-RT invoked?

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?

like image 569
Jonathan Gallagher Avatar asked Sep 05 '13 19:09

Jonathan Gallagher


People also ask

What is compiler-rt in LLVM?

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.

What linker does clang use?

Clang can be configured to use one of several different linkers: GNU ld. GNU gold. LLVM's lld.

Does clang include a linker?

DESCRIPTION. The clang executable is actually a small driver which controls the overall execution of other tools such as the compiler, assembler and linker.


1 Answers

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.

like image 114
Wolfgang Kuehn Avatar answered Oct 26 '22 10:10

Wolfgang Kuehn