[LLVMdev] Handling of built-in functions
daniel at zuster.org
Mon Jul 20 00:11:23 PDT 2009
I'm not the right person to answer your question, but since no one
else took it: I believe this is a situation where the backend would
typically emit a call the the compiler's runtime library (e.g.,
While it isn't currently completely wired up, we do have our own
compiler runtime library available under the compiler-rt project in
the LLVM repo.
On Thu, Jul 16, 2009 at 2:07 AM, Javier Martinez<javier at jmartinez.org> wrote:
> I'm trying to add support in my back end for certain functions that are
> seen as built-in by the target. Some of these functions can be
> implemented in a) LLVM, and some in b) the native target language.
> My approach to case a) is to write the built-in function implementation
> in C, compile it to LLVM using Clang, link it to the module that uses it
> and finally add a pass to inline it. The last two steps can be made
> inside a ModulePass. The definition of TargetMachine allows for any pass
> manager deriving form BasicPass to be passed to AddPassesToEmitFile.
> However, I see that llc uses a FunctionPassManager for all the passes. A
> (module)PassManager is used only if the target implements
> AddPassesToEmitWholeFile but the comments on the base class discourage
> this path. Am I approaching the problem the wrong way?
> I haven't worked much on case b) but my idea was to use a similar
> approach but instead of writing the built-in function implementation in
> straight C an asm block would be used to insert the code. Does this make
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev