[LLVMdev] Inline Assembly

Jeff Cohen jeffc at jolt-lang.org
Mon Sep 13 09:50:11 PDT 2004


On Mon, 13 Sep 2004 11:40:48 -0500
John Criswell <criswell at cs.uiuc.edu> wrote:

> Reid Spencer wrote:
> > In order to get to the next stage with LLVM (like compiling a kernel) we
> > need to allow "pass through" of inline assembly so things like device
> > drivers, interrupt vectors, etc. can be written. While this feature
> > breaks the "pure" LLVM IR, I don't see any way around it. 
> 
> The approach you suggest might work, although the code generator will 
> need to know not to tromp on your registers, I guess.

It's worse than just knowing what registers are used by inlined
assembler.  You want the inline assembler to be able to reference local
and global variables and function arguments.  Plus, you have to be able
to handle transfers of control inside the inlined assembler, such as a
return, a branch to a label defined outside of the inlined assembler, or
even calls to other functions (to properly handle inter-procedural
optimzation).  It can get quite messy.  It will be a lot of work to do
it as well as gcc or Microsoft's compiler.




More information about the llvm-dev mailing list