<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