<div><span class="Apple-tab-span" style="white-space:pre">      </span>The following is the code fragment after "# *** IR Dump Before Prolog/Epilog Insertion & Frame Finalization ***:".</div><div><i><b><span class="Apple-tab-span" style="white-space:pre">   </span>MOV32mi <fi#2>, 1, %reg0, 0, %reg0, 0<span class="Apple-tab-span" style="white-space:pre"> </span></b></i></div>
<div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>MOV32mr <fi#2>, 1, %reg0, 0, %reg0, %ECX<kill></b></i></div><div><i><b><span class="Apple-tab-span" style="white-space:pre">     </span>%EAX<def> = MOV32rm <fi#2>, 1, %reg0, 0, %reg0</b></i></div>
<div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>MOV32mr %reg0, 1, %reg0, <ga:@one+4>, %reg0, %EAX<kill></b></i></div><div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>%EAX<def> = MOV32rm <fi#2>, 1, %reg0, 0, %reg0</b></i></div>
<div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>ADJCALLSTACKDOWN32 8, %ESP<imp-def,dead>, %EFLAGS<imp-def,dead>, %ESP<imp-use></b></i></div><div><i><b><span class="Apple-tab-span" style="white-space:pre">       </span>%ECX<def> = MOV32rr %ESP</b></i></div>
<div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>MOV32mr %ECX, 1, %reg0, 4, %reg0, %EAX<kill>; mem:ST4[Stack+4]</b></i></div><div><i><b><span class="Apple-tab-span" style="white-space:pre">   </span>MOV32mi %ECX<kill>, 1, %reg0, 0, %reg0, <ga:@.str>; mem:ST4[Stack]</b></i></div>
<div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>CALLpcrel32 <ga:@printf>, %EAX<imp-def>, %ECX<imp-def,dead>, %ESP<imp-use>, ...</b></i></div><div><i><b><span class="Apple-tab-span" style="white-space:pre">        </span>ADJCALLSTACKUP32 8, 0, %ESP<imp-def,dead>, %EFLAGS<imp-def,dead>, %ESP<imp-use></b></i></div>
<div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>MOV32mi <fi#1>, 1, %reg0, 0, %reg0, 0</b></i></div><div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>%ECX<def> = MOV32rm <fi#1>, 1, %reg0, 0, %reg0</b></i></div>
<div><i><b><span class="Apple-tab-span" style="white-space:pre">    </span>MOV32mr <fi#0>, 1, %reg0, 0, %reg0, %ECX<kill></b></i></div><div><i><b><span class="Apple-tab-span" style="white-space:pre">     </span>MOV32mr <fi#3>, 1, %reg0, 0, %reg0, %EAX<kill>; mem:ST4[FixedStack3]</b></i></div>
<div><br></div>It seems the ways to identify read/write are different for virtual registers, and stack objects.<div>For virtual registers, we could use the MachineOperand::isDef() and MachineOperand::isUse.</div><div>For stack objects used for argument-passing (see mem:ST4[Stack] in the example) or return-value (see mem:ST4[FixedStack3]), we could use the MachineMemOperand::IsLoad() and MachineMemOperand::IsStore().</div>
<div>For general stack objects, like the first and second instructions in the example, is there a way for me to identify whether fi#2 is read or written?<br>-- <br>Best regards,<div><br></div><div>Li Qing-An</div><br>
</div>