---------- Forwarded message ---------- From: Abdul Wahid Memon <engrwahidmemon@xxxxxxxxx> Date: Mon, Aug 5, 2013 at 6:12 PM Subject: Re: Extracting operands from rtl instructions To: Chung-Ju Wu <jasonwucj@xxxxxxxxx> Thanks Chung-Ju. But how can I determine the number of operands for any machine instruction? Number of operands do vary for various instructions and there must be some way to determine this number. Regards Abdul On Mon, Aug 5, 2013 at 6:08 PM, Chung-Ju Wu <jasonwucj@xxxxxxxxx> wrote: > 2013/8/4 Abdul Wahid Memon <engrwahidmemon@xxxxxxxxx>: >> Considering the following rtl instructions: >> >> (insn 104 457 458 2 (set (reg/v/f:DI 41 r12 [orig:590 dsth ] [590]) >> (reg:DI 5 di [ dsth ])) foo.c:15 62 {*movdi_internal_rex64} >> (expr_list:REG_DEAD (reg:DI 5 di [ dsth ]) >> (nil))) >> >> Is there any function provided to extract the operands of this >> instructions i.e. di and r12? >> >> Regards >> >> Abdul > > You can use PATTERN(insn) to get inner rtx and then > use XEXP(rtx, i) to extract operands. > > By the way, I suggest you can take a look at GCC Internal > Chapter10: RTL Representation. You will find a lot of useful > information of manipulating RTL stuff. :) > > Best regards, > jasonwucj