<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
I was sitting around thinking about making web applications, especially PHP based ones, perform better. While PHP has come a long way since its initial releases, it could still benefit from LLVM style "whole program" optimization.  So, I had this radical idea.  What if we built a PHP front end for LLVM so PHP programs could be LLVMized. What if we also built a i386 ELF front end so that we could factor in Apache and its various modules? That is, we build an LLVM front end that reads an executable or shared object in ELF format for an i386 processor (or whatever) and produces LLVM bytecode for it?  Then, all of Apache and PHP and the PHP programs could be optimized into single running application.<BR>
<BR>
While I think this is cool, I don't think the translation would work. While it might be technically possible to find an LLVM expression for each i386 instruction, the result might not be semantically meaningful and therefore not easily subject to optimization. <BR>
<BR>
My question is: am I right about reverse engineering for optimization like this, or could it work?<BR>
<BR>
(The practical  thing to do would be to compile Apache/PHP/modules from their C/C++ sources using llvmgcc, but that's just not radical enough to mention :)<BR>
<BR>
Reid.
</BODY>
</HTML>