From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p7QCTrWZ032702 for ; Fri, 26 Aug 2011 14:29:53 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiAHALSQV07Lzuai/2dsb2JhbABCmH+PGXeBQAEBBAE6RAsLEjQ9DA6ICwS7LoZMBKQs X-IronPort-AV: E=Sophos;i="4.68,285,1312149600"; d="scan'208";a="106720952" Received: from hendrix.mega-nerd.net ([203.206.230.162]) by mail4-smtp-sop.national.inria.fr with ESMTP; 26 Aug 2011 14:29:46 +0200 Received: from hendrix.mnn (hendrix.mnn [192.168.200.99]) by hendrix.mega-nerd.net (Postfix) with SMTP id D5198106D3D for ; Fri, 26 Aug 2011 22:29:43 +1000 (EST) Date: Fri, 26 Aug 2011 22:29:43 +1000 From: Erik de Castro Lopo To: caml-list@inria.fr Message-Id: <20110826222943.1e28a3c110f9da2a871db261@mega-nerd.com> In-Reply-To: References: <93199F3B-E9CF-4D93-9B2B-BAAB03F4FC08@googlemail.com> <4EF51F29-D437-4F6F-9C91-DBEA3D4C3EB8@googlemail.com> <1314218451.3496.42.camel@thinkpad> <11577B43-4270-4BA4-AA77-7FDEFB4B563B@googlemail.com> <1314267668.3496.62.camel@thinkpad> Reply-To: caml-list@inria.fr Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 3.2.0beta2 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Linear Scan Register Allocator for ocamlopt/ocamlnat Pierre-Alexandre Voye wrote: > I have a stupid question : I wonder if it would not be a bad idea that Ocaml > output C code and let gcc do its work, so compile code with good > performances in a lot of architecture ? Gcc is able to do autovectorization > (SSE, MMX, Larabee in the futur, etc...), very specific processor > optimization, etc... > But maybe it's a stupid idea ? I have some experience in thie area. I work on the DDC compiler [0] a compiler for a strict by default (optionally lazy) evaluation dialect of Haskell. When I joined the project the compiler had a working compile via C backend, to which I added an LLVM backend [1]. Executables compiled via the LLVM backend (even without exploring any of the LLVM optimisation passes) were faster than the same executables compiled via C (gcc -O2). I suspect this is because the generated C code was nothing like the C code people write and the GCC is only good at optimising idiomatic C code. I highly recommend LLVM as a compiler backend. HTH, Erik [0] http://disciple.ouroborus.net/ [1] http://www.mega-nerd.com/erikd/Blog/CodeHacking/DDC/index.html -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/