[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <49F27032.7050703@garzik.org>
Date: Fri, 24 Apr 2009 22:06:42 -0400
From: Jeff Garzik <jeff@...zik.org>
To: LKML <linux-kernel@...r.kernel.org>, linux-sparse@...r.kernel.org
CC: Ingo Molnar <mingo@...e.hu>, Al Viro <viro@...IV.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH] sparse LLVM backend (was Re: [rfc] built-in native compiler
for Linux?)
(resent -- the mail monster apparently ate the first one)
Just to make this crazy thread even crazier, I have successfully gotten
sparse to create a valid x86-64 object file from C source code (...which
I then executed).
The attached patch adds a code generator backend to sparse, that
generates LLVM bitcode. This bitcode can then be converted to ELF .o
files using standard tools -- see instructions in the header of s2l.c.
Do I expect this to be used in the kernel? Not really. I'm just doing
this for fun, to add a compiler backend to sparse. It was pretty easy
to get integer and logical operations going.
The work is based on compile-i386; as it turns out, LLVM's bitcode can
be made type-aware, so I wanted to see how things would turn out
generating code at a higher level. Given the higher-level constructs, I
didn't feel the need to bother with linearized form.
Caveats...
- don't stray too far from simple, integer types
- bitfields caused explosions, but you knew that anyway
Cheers all,
Jeff
View attachment "patch" of type "text/plain" (51365 bytes)
Powered by blists - more mailing lists