<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I'm sure you found your answer, but I never saw a response on the list. Here's my take.<div><br></div><div>Kill flags are used in a few places after regalloc (postRA scheduling, register scavenging...) to conservatively estimate liveness. Machine verification is intended to confirm that kill flags match liveness. But machine verification isn't currently expected to run after coalescing--you may get an occasional false assertion.<br><div><br></div><div>For register allocators that do lots of live range manipulation and keep live intervals up to date, it may be better to strip the kills and regenerate from the live intervals after allocation. ...maybe a moot point if you're not using live intervals.</div><div><br></div><div>-Andy</div><div><br><div><div>On Oct 29, 2010, at 6:29 AM, Jeff Kunkel wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I am wondering about register allocation when there is a kill flag on the MachineOperand. Do I need to remove the kill flag? </div><div><br></div><div>This code below is just an example from test\CodeGen\X86\xor.ll</div>
<div><br></div><div><br></div># Machine code for function test3:<br>Frame Objects:<br> fi#-2: size=4, align=4, fixed, at location [SP+8]<br> fi#-1: size=4, align=8, fixed, at location [SP+4]<br>Function Live Outs: %EAX<br>
<br>BB#0: derived from LLVM BB %entry<br> %reg16385<def> = MOV32rm <fi#-2>, 1, %reg0, 0, %reg0; mem:LD4[FixedStack-2] GR32:%reg16385<br> %reg16384<def> = MOV32rm <fi#-1>, 1, %reg0, 0, %reg0; mem:LD4[FixedStack-1] GR32:%reg16384<br>
%reg16388<def> = MOV32ri 1; GR32:%reg16388<br> %reg16392<def> = XOR32ri %reg16385, 4294967294, %EFLAGS<imp-def>; GR32:%reg16392,16385<br> %reg16391<def> = AND32rr <b>%reg16392<kill></b>, %reg16384, %EFLAGS<imp-def>; GR32:%reg16391,16392,16384<br>
%reg16389<def> = SHR32ri %reg16391, 1, %EFLAGS<imp-def>; GR32:%reg16389,16391<br> %EAX<def> = COPY %reg16389; GR32:%reg16389<br> RET<br><br>After my reg allocation I have <br><br># After Register Allocation:<br>
# Machine code for function test3:<br>Frame Objects:<br> fi#-2: size=4, align=4, fixed, at location [SP+8]<br> fi#-1: size=4, align=8, fixed, at location [SP+4]<br>Function Live Outs: %EAX<br><br>BB#0: derived from LLVM BB %entry<br>
%EAX<def> = MOV32rm <fi#-2>, 1, %reg0, 0, %reg0; mem:LD4[FixedStack-2]<br> %ECX<def> = MOV32rm <fi#-1>, 1, %reg0, 0, %reg0; mem:LD4[FixedStack-1]<br> %EDX<def> = MOV32ri 1<br>
%EAX<def> = XOR32ri %EAX, 4294967294, %EFLAGS<imp-def><br> %EAX<def> = AND32rr <b>%EAX<kill></b>, %ECX, %EFLAGS<imp-def><br> %EAX<def> = SHR32ri %EAX, 1, %EFLAGS<imp-def><br>
RET
_______________________________________________<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></div></div></body></html>