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]

Question on updating DF info during code hoisting


Hi,
It is possible to have register pressure decreased when hoisting an
expression up in flow graph because of shrunk live range of input
register operands.
To accurately simulating the change of register pressure, I have to
check the change of live range of input operands during hoisting. For
example, to hoist "x+y" through a basic block B up in flow graph, I
have to:
1. Check whether x/y is in DF_LR_OUT(B), it yes, the live range won't be shrunk.
2. Check whether x/y is referred by any other insns in B, if yes, the
live range won't be shrunk. Basically I have two methods to do this:
    a) Iterate over insns in B reversely, checking whether x/y is
referred by the insn.
    b) Iterate over all references of x/y(using
DF_REG_USE_CHAIN(REGNO(x/y))), checking whether the reference is made
in B.

Method A) is simple, but I guess it would be expensive and I am
thinking about using method B).

The problem is code hoisting itself create/modify/delete insns in
basic block, I have to update DF cache info each time an expression is
hoisted thus the info can be used to check the change of live range
when hoisting other expressions later.

Though not familiar with DF in GCC, I think I can use
df_insn_delete/df_insn_rescan to update DF caches for newly
modified/deleted instructions. What I am not sure are:
1. Basically I only need to update the reference information(i.e.,
DF_REG_USE_CHAIN(REGNO(x/y))) for each input operand and don't need to
update global DF_LR_IN/OUT information(because this will be done
manually when trying to hoist an expression). Could this be done in
current DF infrastructure?
2. I did not find any DF interface to calculate reference information
for newly created insn, so how could I do this?

Any advice?
Again, I am not familiar with DF in GCC, please correct me if I am wrong.

Thanks very much.
-- 
Best Regards.


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