Open CarolEidt opened 8 years ago
gtSetEvalOrder()
, we do still call into genCreateAddrMode
from gtMarkAddrMode
. It's also called by gtGetIndNodeCost
and gtSetMultiOpOrder
which are called by gtSetEvalOrder()
.Lowering::SetIndirAddrOpCounts
looks to be removed or renamed.GT_OBJ
is gone now.LowerAdd
:#ifdef TARGET_XARCH
if (BlockRange().TryGetUse(node, &use))
{
// If this is a child of an ordinary indir, let the parent handle it.
// If there is a chain of adds, only look at the topmost one.
GenTree* parent = use.User();
if ((!parent->OperIsIndir() || parent->OperIsAtomicOp()) && !parent->OperIs(GT_ADD))
{
TryCreateAddrMode(node, false, parent);
}
}
#endif // TARGET_XARCH
TryCreateAddrMode
will do the analysis to see if it can create an address mode:
// Find out if an addressing mode can be constructed
bool doAddrMode = comp->codeGen->genCreateAddrMode(addr, // address
true, // fold
&rev, // reverse ops
&base, // base addr
&index, // index val
&scale, // scaling
&offset); // displacement
Improvements can still be made here it looks like, though a bit uncertain of how much effort would be needed and the benefit.
There are several issues with the handling of addressing modes:
genCreateAddrMode()
, is invoked multiple times. In RyuJIT (i.e. non-legacy code) this is ingtSetEvalOrder()
and inLowering::SetIndirAddrOpCounts()
. This is not only wasteful, but it is not clear that they are consistent in which nodes are being considered. This means that some nodes might be markedGTF_ADDRMODE_NO_CSE
but not actually become addresing modes, and vice-versa.gtSetEvalOrder()
, but are inLowerAdd()
, as long as they have not been transformed into regular indirections.GT_OBJ
nodes are not considered for addressing modes, although they are also indirections.We should do the analysis once in the front-end and instantiate the addressing modes at that time, and should strongly consider factoring the analysis out from the code generation, which is currently enabled or disabled by an argument to
genCreateAddrMode()
.category:cq theme:big-bets skill-level:expert cost:large