Jochen Wilhelmy
2010-Apr-08 13:27 UTC
[LLVMdev] Using LLVM with clang for a homebrew kernel
Hi! In the llvm-doc is the following: Also, since many platforms define their ABIs in terms of C, and since LLVM is lower-level than C, front-ends currently must emit platform-specific IR in order to have the result conform to the platform ABI. Can you give an example for this except system calls (which e.g. on windows use a different calling convention)? If you write your own operating system then how does llvm-IR depend on the ABI? -Jochen
On Thursday 08 April 2010 08:27:20 Jochen Wilhelmy wrote:> Hi! > > In the llvm-doc is the following: > > Also, since many platforms define their ABIs in terms of C, and since > LLVM is lower-level than C, front-ends currently must emit > platform-specific IR in order to have the result conform to the platform > ABI. > > Can you give an example for this except system calls (which e.g. on > windows use > a different calling convention)? > If you write your own operating system then how does llvm-IR depend on > the ABI?varargs is the poster boy. Right now llvm proper only has support for some pieces of varargs translation on x86_64. Frontends handle the bulk of the work. I hope to add some more code in this area relatively soon. Of course, anything having to do with Fortran is done completely by the frontend as there is no standard ABI for that language. -Dave
andreas at galauner.de
2010-Apr-08 23:27 UTC
[LLVMdev] Using LLVM with clang for a homebrew kernel
It's no problem for me to write platform specific code. In fact I have to. I also don't bother recompiling my code for another target platform. The only thing I need is to select the target platform, LLVM should emit binary code for. I'm going to place my HAL (so all of the platform dependent stuff in terms of code written in C(++) and ASM) in some static library that can be linked with my kernel code, but that's just to put a line between those two layers for me as a programmer. The platform specific code is written in C++ and some Assembly. It's the compiler's job to create correct C(++) code for the platform and mine to create correct assembler code which conforms to the ABI of my platform. Currently I don't have much code. It's just a small kernel with some memory management and half of a scheduler. I just wanted to play with LLVM a bit and thought about compiling this code with LLVM instead of GCC. That's all. I don't even want to use any LLVM Bitcode in it. I just want to use LLVM as a compiler. The only reason why I'm asking on this mailing list is that I didn't find any documentation about how to use LLVM as a standalone cross-compiler in terms of "compile this code for ARM and put it into a mach-o file, please." Andreas On Thu, 08 Apr 2010 15:27:20 +0200, Jochen Wilhelmy <j.wilhelmy at arcor.de> wrote:> Hi! > > In the llvm-doc is the following: > > Also, since many platforms define their ABIs in terms of C, and since > LLVM is lower-level than C, front-ends currently must emit > platform-specific IR in order to have the result conform to the platform> ABI. > > Can you give an example for this except system calls (which e.g. on > windows use > a different calling convention)? > If you write your own operating system then how does llvm-IR depend on > the ABI? > > -Jochen > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev