<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="">Hi,<div class=""><br class=""></div><div class="">I would actually go the other direction, i.e., stick to physical registers but with an infinite number.</div><div class="">The rational is that after register allocation we broke all the nice properties of the pre-alloc virtual registers. For instance, the existing liveness algorithm cannot be used on those virtual registers. On the other hand, all the infrastructure we have in place for physical registers would be suited.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Q.</div><div class=""> <br class=""><div><blockquote type="cite" class=""><div class="">On Dec 9, 2015, at 4:04 PM, Derek Schuff via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Dec 9, 2015 at 3:02 PM Hal Finkel <<a href="mailto:hfinkel@anl.gov" class="">hfinkel@anl.gov</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">----- Original Message -----<br class="">
> From: "Derek Schuff via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="cremed">llvm-dev@lists.llvm.org</a>><br class="">
> To: <a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="cremed">llvm-dev@lists.llvm.org</a><br class="">
> Sent: Wednesday, December 9, 2015 4:31:31 PM<br class="">
> Subject: [llvm-dev] Allowing virtual registers after register allocation<br class="">
><br class="">
><br class="">
> Hi all,<br class="">
> Virtual ISAs such as WebAssembly and NVPTX use infinite virtual<br class="">
> register sets instead of traditional phsyical registers.<br class="">
> PrologEpilogInserter is run after register allocation and asserts<br class="">
> that all virtuals have been allocated but doesn't otherwise depend<br class="">
> on this if scavenging is not needed. We'd like to use the<br class="">
> target-independent PEI code for WebAssembly, so we're proposing a<br class="">
> TargetRegisterInfo hook for targets to indicate that they use<br class="">
> virtual registers in this way (currently called<br class="">
> usesVirtualRegstersAfterRegAlloc(), other suggestions welcome). The<br class="">
> code is at <a href="http://reviews.llvm.org/D15394" rel="noreferrer" target="_blank" class="cremed">http://reviews.llvm.org/D15394</a> and an example of the<br class="">
> intended use for WebAssembly is at <a href="http://reviews.llvm.org/D15344" rel="noreferrer" target="_blank" class="cremed">http://reviews.llvm.org/D15344</a> .<br class="">
><br class="">
<br class="">
I think this makes sense, and generally speaking, I think it will be good for us to have better support for VM targets without fixed-sized register sets.<br class="">
<br class="">
Bikeshedding: usesVirtualRegstersAfterRegAlloc() - Are you actually "allocating" virtual registers, or just using the ones that the infrastructure already provides? </blockquote><div class=""><br class=""></div><div class="">Not exactly; the actual register allocation does nothing (i.e.  WebAssemblyPassConfig::createTargetRegisterAllocator() returns nullptr) and we just use the regular infrastructure virtual registers. However we do run a custom register coloring pass which reduces the total number of virtual registers used.</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is the answer the same for the NVPTX backend?</blockquote><div class=""><br class=""></div><div class="">Yes (at least, they have a null TargetRegisterAllocator too).</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Maybe something like: targetLacksPhysicalRegissters() would be better?<br class=""></blockquote><div class=""><br class=""></div><div class="">Maybe. We actually do have "physical" registers called SP and FP (returned by TargetRegisterInfo::getFrameRegister() and used by some default ISel lowerings and by FrameIndex elimination) but of course they aren't really physical registers either.</div><div class=""><br class=""></div><div class=""> </div></div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>