From owner-freebsd-toolchain@FreeBSD.ORG Sat Jan 12 11:56:41 2013 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 97BBD8E1; Sat, 12 Jan 2013 11:56:41 +0000 (UTC) (envelope-from theraven@theravensnest.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) by mx1.freebsd.org (Postfix) with ESMTP id 4810A2C0; Sat, 12 Jan 2013 11:56:40 +0000 (UTC) Received: from [192.168.0.2] (cpc10-cmbg15-2-0-cust123.5-4.cable.virginmedia.com [86.30.246.124]) (authenticated bits=0) by theravensnest.org (8.14.5/8.14.5) with ESMTP id r0CBuU1c001928 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Sat, 12 Jan 2013 11:56:33 GMT (envelope-from theraven@theravensnest.org) Subject: Re: LLVM Image Activator Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <50E9BC2D.7000302@freebsd.org> Date: Sat, 12 Jan 2013 11:56:24 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <7ADA6363-E714-42E7-82FA-BDE6C64C75A9@theravensnest.org> References: <50E9BC2D.7000302@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.1278) Cc: freebsd-toolchain@freebsd.org, freebsd-arch@freebsd.org X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2013 11:56:41 -0000 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 > _______________________________________________ > 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"