<div dir="ltr"><div>On Mon, Nov 28, 2016 at 2:43 AM Moritz Angermann <<a href="mailto:moritz@lichtzwerge.de">moritz@lichtzwerge.de</a>> wrote:</div><div>[...]</div><div>> For the llvm code gen in ghc it’s usually the `_fast` suffix functions. See [1] and</div><div>> the `genStore_fast` 30 lines further down.  My bitcode llvm gen follows that file [1],</div><div>> almost identically, as can be seen in [2].  However the `_fast` path is currently</div><div>> disabled.</div><div>> </div><div>> An example of the generated ir for the current llvm backend, and the bitcode backend,</div><div>> (textual ir, via llvm-dis) can be found in [3] and [4] respectively.</div><div><br></div><div>Cool, thanks a lot for the links!</div><div><br></div><div>> > > I don’t know if generating llvm from stg instead of cmm would be a better</div><div>> > > approach, which is what ghcjs and eta do as far as I know.</div><div>> ></div><div>> > Wouldn't a step from STG to LLVM be much harder (LLVM IR is a pretty low-level</div><div>> > representation compared to STG)? There are also a few passes on the Cmm level</div><div>> > that seem necessary, e.g., `cmmLayoutStack`.</div><div><br></div><div>> There is certainly a tradeoff between retaining more high-level information and</div><div>> having to lower them oneself.  If I remember luite correctly, he said he had a similar</div><div>> intermediate format to cmm, just not cmm but something richer, which allows</div><div>> to better target javascript.  The question basically boils down to asking if cmm is</div><div>> too low-level for llvm already; the embedding of wordsizes is an example where I think</div><div>> cmm might be to low-level for llvm.</div><div><br></div><div>Ok, I see. This is quite interesting - I'm wondering if it makes sense to</div><div>collect thought/ideas like that somewhere (e.g., a wiki page with all the issues</div><div>of using current Cmm for LLVM backend, or just adding some comments in the</div><div>code).</div><div><br></div><div>Thanks,</div><div>Michal</div><div><br></div></div>