<div>Thanks Evan. </div>
<div>I checked into and found that it is spilling the "acc" to stack slot and reloading it later.</div>
<div>How do I tell it to rematerialize constants into "acc" rather than to spill / reload the "acc".<br> </div>
<div> </div>
<div>Thanks,</div>
<div>sanjiv<br> </div>
<div><span class="gmail_quote">On 1/18/08, <b class="gmail_sendername">Evan Cheng</b> <<a href="mailto:evan.cheng@apple.com">evan.cheng@apple.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>On Jan 17, 2008, at 4:12 AM, Sanjiv Gupta wrote:<br><br>> I have load / store instructions that require accumulator.
<br>> So a store looks like..<br>><br>>    mov 3, acc<br>>    st acc, addr<br>><br>> I have specified "acc" as a separate register class containing only<br>> one register which is the "acc".
<br>> The instr patterns are then splitted into:<br>><br>>    set imm:$src, ACCClass:$dst  (generating the "mov" above)<br>>    set ACCClass:$src, mem:$dst  (generating the "st" above)<br>>
<br>><br>> The problem with the generated code is incorrectly assuming that<br>> value in "acc" is still live.<br>> for example, for code like below<br>><br>>    a = 3;<br>>    b = 4;<br>>    c = 3;
<br>><br>><br>> it generates:<br>><br>>   mov 3, acc<br>>   st  acc, @a<br>>   mov 4, acc<br>>   st acc, @b<br>>   st acc, @c    (Wrong)<br>><br>><br>> When I use the GPRRegs, which has more regs, the code is ok.
<br>> is it because I still haven't implemented the stack/frame related<br>> routines and the value in acc is getting spilled to stack and<br>> reloaded?<br><br>It's very hard to tell what's going on without having access to your
<br>backend. If you dump out the machineinstrs just before register<br>allocation and again after allocation but before spiller rewrite<br>(VirtRegMap.cpp), it might be easier to see where things started going<br>wrong.<br>
<br>Evan<br><br>><br>><br>> _______________________________________________<br>> LLVM Developers mailing list<br>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">
http://llvm.cs.uiuc.edu</a><br>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br><br>_______________________________________________<br>LLVM Developers mailing list
<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
</a><br></blockquote></div><br>