<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri, sans-serif">
I am working on a machine with a special register class which here I will call<span style="mso-spacerun:yes"> 
</span>Xrc containing registers X0..Xk. <o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri, sans-serif">
Some instructions implicitly reference X0. I am modeling this with a pseudo instruction that makes that reference explicit and created a register class X0rc which just contains X0.
<span style="mso-spacerun:yes"> </span>This seems to work fine and SelectionDAG introduces copies between the two register classes where I would expect them.<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri, sans-serif">
The problem I face is that MachineCSE::PerformTrivialCopyPropagation eliminates these copies and effectively changes the register class for the output register of unconstrained instructions to be X0rc. This is done so aggressively that I end up with multiple
 overlapping live ranges and so values are constantly being spilled and reloaded. Also, it creates situations where multiple operands of an instruction are bound to this class and so register allocation fails.<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri, sans-serif">
What is the preferred way to handle this kind of situation? <span style="mso-spacerun:yes">
 </span><o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri, sans-serif">
Thanks<o:p> </o:p></p>
<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri, sans-serif">
david<o:p> </o:p></p>
<br>
</div>
</body>
</html>