<div dir="ltr"><div><div><div><div><div>Hi !!<br><br></div>Im writing a Backend for a 'C' Frontend. <br>I want to implement an instruction that can set a specified bit of a Specified Register. <br><br></div>ex:<br><br></div>Mov R1, 9    ;       //  9 is the bit i want to change<br></div>Set  R2,R1,1   ;        //  modify R2's 9th bit to 1<br><br><br></div><div>Above example shows the expected output<br><br></div><div>I have following Questions:<br></div><div><br>1)  how to tell compiler to use a specific register (R2 in this case) for a given instruction? i cant set it as reserved since i need it to be used in other instructions too. I cant use a "PreRegisterAllocationPass" since the register would be allocated and will become reusable later<br><br></div><div>2) How to access the specified bit of a register ( R2's 9th bit in this case)<br><br></div><div>3) How do i write a 'C' Program for this instruction? i tried using the bitfields in a structure, but it was getting casted in the IR. So,I couldnt access using the structure. <br><br></div><div>Please Tell me some ways to solve above challenges<br><br></div><div>Thanks,<br></div><div>Avinash   <br></div><div><br></div><div><div><div><br><br></div></div></div></div>