Lorenzo Laneve via llvm-dev
2016-May-22 17:31 UTC
[llvm-dev] A "Cross-Platform Runtime Library API" in LLVM IR
My idea is an API where anyone can build a Runtime Library for any backend, including a set of functions people can inline/rename creating functions the frontend can include in the IR. For example implementing a cross-platform runtime function that allocates memory for a new object. (Obviously the library will have to be compiled for each target). I read about compiler-rt but I think it has nothing to do with what I'm thinking about, maybe I'm wrong? If something like this doesn't exist, maybe I can start a little project for LLVM about this
Matthias Braun via llvm-dev
2016-May-22 19:06 UTC
[llvm-dev] A "Cross-Platform Runtime Library API" in LLVM IR
> On May 22, 2016, at 10:31 AM, Lorenzo Laneve via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > My idea is an API where anyone can build a Runtime Library for any backend, including a set of functions people can inline/rename creating functions the frontend can include in the IR. > > For example implementing a cross-platform runtime function that allocates memory for a new object. (Obviously the library will have to be compiled for each target).Memory allocation is usually considered part of libc. There are several libc implementations that target multiple architectures. musl, glibc, newlib, diet libc to name just a few. - Matthias
Lorenzo Laneve via llvm-dev
2016-May-22 19:32 UTC
[llvm-dev] A "Cross-Platform Runtime Library API" in LLVM IR
I know, that's the problem. We can assume all of the system calls as runtime functions: such as I/O, allocations etc. and create a set of function implemented for all the architectures. For example, let's think about the mem allocation again: we can provide a primitive function with the same name for all archs (e.g. __alloc() ) and then people can include this function __alloc() in their libraries, inlining it or even renaming it just to fit the frontend needs. And this can be useful: every backend should implement this set of functions ( __alloc(), __free(), __write()… just for example) so the frontends can build a library with these functions as they want. I don't know if you get me.> On May 22, 2016, at 9:06 PM, Matthias Braun <matze at braunis.de> wrote: > > >> On May 22, 2016, at 10:31 AM, Lorenzo Laneve via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> >> My idea is an API where anyone can build a Runtime Library for any backend, including a set of functions people can inline/rename creating functions the frontend can include in the IR. >> >> For example implementing a cross-platform runtime function that allocates memory for a new object. (Obviously the library will have to be compiled for each target). > Memory allocation is usually considered part of libc. There are several libc implementations that target multiple architectures. musl, glibc, newlib, diet libc to name just a few. > > - Matthias >