<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi James,</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 22, 2016, at 3:15 PM, James Knight <<a href="mailto:jyknight@google.com" class="">jyknight@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Jan 22, 2016, at 5:36 PM, Quentin Colombet via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""><br class="">Hi,<br class=""><br class="">I would like your opinions on the contract we have between the LLVM IR and the backends.<br class=""><br class=""><br class="">* Context *<br class=""><br class="">Right now, the backends are supposed to be able to perform instruction selection on any valid LLVM IR.<br class="">Although this is *not* something I want to change for GlobalISel, I thought I brought that up on the mailing list to discuss the implications.<br class=""><br class="">In particular, in the past, some people mentioned that they wanted to do (some part of) the legalization on LLVM IR. This may impact the contract we have between LLVM IR inputs and the backends and I would like to clarify that.<br class=""><br class=""><br class="">* Feedback Needed *<br class=""><br class="">1. In your opinion where does a “backend" start?<br class=""><br class="">For instance, does a backend starts at llc or at ISel?<br class=""><br class=""><br class="">2. Where does this contract apply?<br class=""><br class="">For instance, is it at the start of the backend or at ISel (assuming those two definitions are different).<br class=""><br class=""><br class="">* Implications *<br class=""><br class="">Personally, I consider the backend starts at isel time and that the contract should remain what it is currently: being able to select any valid LLVM IR. I.e., this means we cannot rely on any LLVM IR legalization without changing the contract.<br class=""><br class="">Thoughts?<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Your definition seems not to be how LLVM currently works -- at least AFAICT. There are a bunch of backend-specific IR passes now -- is it not the case that most backends would fail to work if you disabled those? E.g. AtomicExpandPass, and the various passes added by addPassesToHandleExceptions? Aren't those required?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>Good question and I don’t know!</div><div>That’s why this RFC is useful :).</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I'm also not sure why it'd be a useful definition to have.</span></div></blockquote><div><br class=""></div><div>Is for testing purposes. Basically, I am less interested into what comes into the backend than what comes to the ISel of the backend.</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> What purpose would be served by requiring that a backend is not allowed to use an IR->IR pass for part of its legalization?</span></div></blockquote><div><br class=""></div><div>I am not saying the backend could not do that, I am saying that whatever we do, ISel should still support legalization. In other words, having an IR to IR legal is redundant if the contract is ISel should support any valid IR.</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> Isn't that invisible to the outside world? Why would it matter -- as long as the set of backend-specific IR->IR passes, plus ISel, accomplishes the desired outcome, who cares how the work is split up?</span></div></blockquote><br class=""></div><div>I care :).</div><div>I want a clear contract on what ISel will have as input, again for testing purposes.</div><div><br class=""></div><div>Thanks,</div><div>-Quentin</div><br class=""></body></html>