"Guo, Xuepeng" <xuepeng....@intel.com> writes:

> Thanks for your comments. It's not exactly the entire basic
> block. It should be from the current RTL to the end of the current
> basic block. As you know GCC will optimize "addl %ebx, %eax" to
> "leal (%ebx, %eax), %eax" to avoid the flag register dependency
> through a splitter in i386.md at split2 stage. But for my target, if
> the destination register of ADD actually holds non-address operand,
> which means "%eax" won't be used in MEM of the following RTL, this
> optimization will incur two cycles penalty. So I need to check
> whether the destination of ADD holds an address operands to decide
> whether split ADD to LEA.

I gather that you are using basic block as a proxy for the next use of
the register, as the next use could presumably be after a branch
statement.

You could probably get many uses very simply by checking the
REG_POINTER flag.  It's not 100% reliable, but it's normally set on a
register which is used as a pointer.

Otherwise you could use the dataflow framework to find the uses of the
register, but that may be too expensive since you can't easily control
the whole pass.

Otherwise you will indeed have to write your own walker.  This is easy
to write using for_each_rtx.

Ian

Reply via email to