Date: Sat, 12 Jan 2013 11:56:24 +0000 From: David Chisnall <theraven@theravensnest.org> To: Nathan Whitehorn <nwhitehorn@freebsd.org> Cc: freebsd-toolchain@freebsd.org, freebsd-arch@freebsd.org Subject: Re: LLVM Image Activator Message-ID: <7ADA6363-E714-42E7-82FA-BDE6C64C75A9@theravensnest.org> In-Reply-To: <50E9BC2D.7000302@freebsd.org> References: <50E9BC2D.7000302@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Nathan, I'm very interested in making better use of LLVM in our infrastructure. = It would also be nice to be able to integrate this with rtld, so that we = can load shared libraries that contain LLVM IR. Beyond that, there are a few long-term projects that I have in mind: - Run passes that add code for collecting profiling information before = running code invoked in this way. - Recompile on subsequent invocations based on the collected profiling = information. - Specialise installed shared libraries based on the programs that link = to them, so that if foo band bar both link to libbaz, but use it in very = different ways, they get different versions compiled specifically for = them. - Statically compile and cache programs invoked with the JIT, so that = they are very fast on their second run. This would probably want a = periodic job to remove old caches. =20 I have written code in LanguageKit for doing several of these things, = but it would be nicer to have them done at the system level, rather than = at the level of a front end. I'd also like to start using the LLVM JIT for accelerating various other = functions. I have a proof-of-concept JIT for BPF that uses LLVM and I'd = like to extend this to pf/ipf firewall rules. David On 6 Jan 2013, at 18:02, Nathan Whitehorn wrote: > Having LLVM/clang in the base system lets us do some interesting = things > that we couldn't do with GCC. One is that LLVM ships with a JIT for = LLVM > IR as well as components of a toolchain for it (this is what Google's > pNACL uses) and that you can end up producing binary files that are in > IR instead of native code. The IR isn't really cross-platform, but = does > let you do CPU-specific optimizations when executed by the JIT, etc. >=20 > The attached patch causes the LLVM JIT (lli) to be built by default > (adding ~20 seconds to buildworld on my five-year-old laptop) and adds = a > kernel image activator that invokes it when passed LLVM bitcode files. > It's not completely finished (see the XXX comment in the middle), but = it > does work, as follows: >=20 > $ clang -emit-llvm -c -o hw.ll hw.c > $ file hw.ll > hw.ll: LLVM bitcode > $ lli hw.ll > Hello world! > $ chmod a+x hw.ll > $ ./hw.ll > Hello world! > $ >=20 > Is there any interest in having features like this? It seems like this > could provides some interesting possibilities for us and nice > integration from having imported clang into base. > -Nathan > <imgact_llvm.diff>_______________________________________________ > freebsd-toolchain@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to = "freebsd-toolchain-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7ADA6363-E714-42E7-82FA-BDE6C64C75A9>