This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: extract register input, output and operator from rtl right before peepholes


Liu Haibin <liu.haibin@gmail.com> writes:

> I'd doing some coding right before peephole2 pass. I'd like to have a
> function that takes rtl as input and returns the values of register
> inputs, register output and operator. For example,
> 
> input:
> (insn 496 34 29 1 (set (reg/f:SI 3 r3 [235])
>         (plus:SI (reg/f:SI 3 r3 [235])
>             (const_int 4 [0x4]))) 20 {addsi3} (insn_list:REG_DEP_ANTI 28 (nil))
>     (nil))
> returns:
> inputs: r3, 4. ouput r3. operator: plus.
> 
> I know sched_analyze() in sched-deps.c builds the dependencies in
> basic blocks and hope I can find some useful functions there. I
> roughly went through the code and didn't really understand.
> 
> Because the rtl's are right before peephole2, they're much processed,
> which makes things easier. I hope I can find some existing function to
> use instead of using something like REGNO(XEXP(SET_SRC(PATTERN(x)),
> 0)). I believe sched-deps.c has something useful. Can someone help on
> this?

You can't pull out a single operator in the general case, since there
can be more than one.  For an obvious example, consider a multiply/add
instruction.

You can iterate over all the subexpressions by using for_each_rtx on
the PATTERN of the insn.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]