This is the mail archive of the
mailing list for the GCC project.
Question on updating DF info during code hoisting
- From: "Bin.Cheng" <amker dot cheng at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 22 Oct 2012 13:57:40 +0800
- Subject: Question on updating DF info during code hoisting
It is possible to have register pressure decreased when hoisting an
expression up in flow graph because of shrunk live range of input
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
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
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?
Again, I am not familiar with DF in GCC, please correct me if I am wrong.
Thanks very much.