<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">llvm uses three different representations until machine code is emitted:</div><div class=""><br class=""></div><div class="">- the llvm language as specified in the llvm manuals, we usually call that IR</div><div class="">- the selection DAG</div><div class="">- machine code, which is often called MI</div><div class=""><br class=""></div><div class="">llvm currently only has infrastructure to serialize the first one. Register allocation only makes sense on the MI representation (before that we have no knowledge about register class or constraints, let alone which machine instructions will be used). Unfortunately MI cannot be serialized at the moment, although I think Alex Lorenz is currently working on adding this.</div><div class=""><br class=""></div><div class="">- Matthias</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 12, 2015, at 11:00 AM, kartikram3 <<a href="mailto:kartikram3@gmail.com" class="">kartikram3@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class="">Hello all,<br class=""> <br class=""></div> I am trying to use the LLVM libraries to do register allocation on LLVM IR code -- and output IR as the result.<br class=""></div>There are two problems that arise when we try this : <br class=""><br class=""></div>a. The LLVM backend requires that one goes through all the steps sequentially namely<br class=""> <br class=""></div> -- Instruction selection<br class=""></div> -- Scheduling and Formation<br class=""></div> -- SSA-based machine code optimizations<br class=""></div> -- Register allocations <br class=""><br class=""><br class=""> ...<br class=""><br class=""><br class=""></div> -- Code emission<br class=""><br class=""></div>Is it possible to emit IR from the 1st 3 stages and then do register allocation on it ?<br class=""></div>Normally, we would emit assembly based on the machine/ISA specifications during<br class=""></div>instruction selection.<br class=""><br class=""></div>b. I have llvm IR in the form of a DAG already. This was obtained by using the llvm;;parseIRFile<br class=""></div>function. I am not sure how to provide this ISA as an input to the backend phases as they<br class=""></div>seem to accept all kinds of other objects. <br class=""><br class=""></div><div class="">Are there any llvm functions that accept a DAG as input so that we can do register allocation on it <br class=""></div><div class="">subsequently ? <br class=""><br class=""><br class=""></div><div class="">Note : This might look like a weird thing to do, but I want to do simulations on IR and getting a <br class=""></div><div class="">register-allocated IR is useful for that purpose.<br class=""></div></div>
<br class=""><hr align="left" width="300" class="">
View this message in context: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.1065342.n5.nabble.com_Register-2DAllocation-2Don-2DIR-2Dtp82414.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=2OblNhBarTDXhb_DrXgPBErQpK4kzZPCqObSAYnWrNw&s=tieOG_IuhO0b9Eri02OVFdSWvkr0zlhF0WFyiUI1zkc&e=" class="">Register Allocation on IR</a><br class="">
Sent from the <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.1065342.n5.nabble.com_LLVM-2DDev-2Df3.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=2OblNhBarTDXhb_DrXgPBErQpK4kzZPCqObSAYnWrNw&s=Juy7RgBEqqIruJdLOsZMOwtOx_WfBU0iRbkQOe9TEOM&e=" class="">LLVM - Dev mailing list archive</a> at <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__Nabble.com&d=AwMFAg&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=3yatz6_Fmrx2R-JOqXKvXKyb7sg5jeaG-4USl_KVoNU&s=WxOo2qTNgQzeDGJPmoHlfinOPXTC8Zasp6ThNBZRIS0&e=" class="">Nabble.com</a>.<br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class=""></div></blockquote></div><br class=""></body></html>