<div>I have load / store instructions that require accumulator.</div>
<div>So a store looks like..</div>
<div> </div>
<div>   mov 3, acc</div>
<div>   st acc, addr</div>
<div> </div>
<div>I have specified "acc" as a separate register class containing only one register which is the "acc".</div>
<div>The instr patterns are then splitted into:</div>
<div> </div>
<div>   set imm:$src, ACCClass:$dst  (generating the "mov" above)</div>
<div>   set ACCClass:$src, mem:$dst  (generating the "st" above)</div>
<div> </div>
<div> </div>
<div>The problem with the generated code is incorrectly assuming that value in "acc" is still live.</div>
<div>for example, for code like below</div>
<div> </div>
<div>   a = 3;</div>
<div>   b = 4;</div>
<div>   c = 3;</div>
<div> </div>
<div> </div>
<div>it generates:</div>
<div> </div>
<div>  mov 3, acc</div>
<div>  st  acc, @a</div>
<div>  mov 4, acc</div>
<div>  st acc, @b</div>
<div>  st acc, @c    (Wrong)</div>
<div> </div>
<div> </div>
<div>When I use the GPRRegs, which has more regs, the code is ok.</div>
<div>is it because I still haven't implemented the stack/frame related routines and the value in acc is getting spilled to stack and reloaded? </div>
<div> </div>
<div>   </div>