<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Hi Folks --<br><br>Let me go ahead and pose a question similar to the one Joachim poses below. I too am trying to evaluate whether LLVM will be of use to me in building a compiler and garbage collection mechanism for a byte code vm that I have built. Although there are multiple types of code that can be created with this system, all of them eventually translate to execution of one or more of these byte codes -- with the exception of stuff that's coded directly in Intel assembly language (which I understand can be output as is and left untouched by the LLVM compiler if desired). There's about 32 core op codes that constitute the basic instruction set and I can envision mapping each of these to some sequence of LLVM IR. There's also a whole lot more "extended opcodes" that are executed by the same core instruction execution loop but which are coded using the built-in Intel assembler and added dynamically by the system. I could envision also going to the trouble of mapping each of these to a sequence of LLVM IR instructions and then being able to emit a series of LLVM IR sequences purely based on the sequence of vm opcodes encountered in a scan of code compiled for the vm. <br><br>I'm hoping that such a product could then be submitted to all the LLVM optimizations and result in better Intel assembly code generation than what I have hand-coded myself (in my implementations of either the core or the extended opcodes -- and especially in the intel code sequences resulting from the use of these opcodes in sequences together). So first question is simply to ask for a validation of this thinking and whether such a strategy seems feasible.<br><br>The second question pertains to this discussion thread. If at the end of the day, all I am trying to do is compile for an 80x86 platform (although ideally hoping to target Windows, Linux and the Mac) and don't need to target multiple processors, then LLVM should add significant value for me if the answer to the first question is that it is a sound and sensible strategy. And most of the discussion in this thread about platform-specific issues shouldn't apply if I only have one processor type to target. Am I thinking about this correctly?<br><br>Any insights from some of you old hands would be greatly appreciated. <br><br>Thanks.<br><br>Mike<br><br><br><pre>Message: 1<br>Date: Wed, 05 Oct 2011 17:10:36 -0500<br>From: greened@obbligato.org (David A. Greene)<br>Subject: Re: [LLVMdev] LLVM IR is a compiler IR<br>To: Joachim Durchholz <jo@durchholz.org><br>Cc: llvmdev@cs.uiuc.edu<br>Message-ID: <nngk48j5btv.fsf@transit.us.cray.com><br>Content-Type: text/plain; charset=us-ascii<br> <br>Joachim Durchholz <jo@durchholz.org> writes:<br> <br>> Now that the dust begins to settle... I'm wondering whether LLVM is for me.<br>><br>> I'm working on something that can be used to create software for <br>> different environments: C/C++, JVM, CLR, Parrot, etc.<br>> I.e. one language for different environments, but not write once, run <br>> anywhere.<br>><br>> Now what would be the role of LLVM in such an infrastructure?<br>> Just backend for C/C++ linkage, and I should go and look elsewhere for <br>> JVM/CLR/whateverVM?<br>> Should I look into LLVM subprojects? Which ones?<br> <br>It depends on what you want to do with the IR. If you want to create<br>object files, LLVM is great. You just need to map the semantics of the<br>various HLLs onto the LLVM IR language, as with any translator. For any<br>kind of code-generator-ish thing, it's hard to beat LLVM IR, IMHO.<br> <br>If you want to JIT, then some of LLVM IR's limitations will impact the<br>speed of code generation, as Dan outlined.<br> <br>If you want to do fancy transformations that use or analyze high-level<br>language semantics, LLVM IR may not be right for you, as most of that<br>information is lost by the time the code has been converted to LLVM IR.<br> <br> -Dave<br> <br> <br></pre><br> </div></body>
</html>