<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Sean,
<div><br>
</div>
<div>Have you looked at inheriting from llvm:SelectionDAGISel for your target, invoking runOnMachineFunction to perform</div>
<div>ISEL, then post processing <span style="font-size: 10pt;">the output by finding the cases where -1 is synthesized then used and replacing the uses</span></div>
<div><span style="font-size: 10pt;">of the synthesized -1 with the register wired to -1?</span></div>
<div><br>
</div>
<div>The MIPS backend takes this approach for dealing with the zero register, see MipSEISelDAGToDAG.cpp for reference.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Simon<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF382613" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> llvm-dev [llvm-dev-bounces@lists.llvm.org] on behalf of Sean Silva via llvm-dev [llvm-dev@lists.llvm.org]<br>
<b>Sent:</b> Friday, December 22, 2017 5:22 AM<br>
<b>To:</b> llvm-dev<br>
<b>Subject:</b> [llvm-dev] Canonical way to handle zero registers?<br>
</font><br>
</div>
<div></div>
<div>
<div dir="auto">I looked around the codebase and didn't see anything that obviously looked like the natural place to turn constant zero immediates into zero-registers (i.e. registers that always return zero when read). Right now we are expanding them in ISelLowering::LowerOperation
 but that seems too early.
<div dir="auto"><br>
</div>
<div dir="auto">The specific issue I'm hitting is that we have a register that reads as -1 and so when we replace -1 too early with this register, the standard "not" pattern (xor x, -1) will fail to match to "not".</div>
<div dir="auto"><br>
</div>
<div dir="auto">Thanks,</div>
<div dir="auto">Sean Silva</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>