<div dir="ltr">You can add target specific codegen prepare style passes in PPCPassConfig::addIRPasses(). There's already some PPC specific stuff there.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 6, 2015 at 5:58 PM, Thomas Jablin via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Presently, on PPC64 there is some silliness regarding on constant<br>
boolean values are allocated to registers. Specifically, when crbits<br>
are enabled, these values tend to be allocated to cr registers even<br>
though the calling convention stipulates that they be returned in gp<br>
registers. Additionally, constant booleans tracking control flow<br>
through functions tend to be live for the entire function and<br>
consequently are allocated to non-volatile registers, forcing a<br>
non-volatile cr register to be saved and restored.<br>
<br>
I have created a patch to address this issue<br>
(<a href="http://reviews.llvm.org/differential/diff/36688/" rel="noreferrer" target="_blank">http://reviews.llvm.org/differential/diff/36688/</a>) and would<br>
appreciate some feedback. The pass I implemented is quite simple and<br>
only handles the very specific situation of constant boolean values<br>
passing through PHINode to RetInsts. There is somewhat similar logic<br>
already present in PPCISelLowering.cpp (DAGCombineExtBoolTrunc and<br>
DAGCombineExtBoolTrunc). Originally, I hoped to either add logic to<br>
PPCISelLowering to handle this case or write a new pass encompassing<br>
the PPCISelLowering logic. However, neither design proved viable. The<br>
existing PPCISelLowering functionality is based on SelectionDAGs and<br>
consequently operates on BasicBlock scope, rather than Function-level<br>
scope needed for this pass. The existing PPCISelLowering logic could<br>
not be incorporated into the new LLVM IR level pass, since lowering to<br>
MachineInsts creates new Trunc and Ext operations that are not present<br>
at the LLVM IR level. I feel a little guilty proposing something that<br>
is fairly special purpose, but I don't see a way to generalize the<br>
logic in this pass in a useful way.<br>
<br>
Thanks.<br>
Tom<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>