提交 1ac0fbea 编写于 作者: R roland

7087453: PhaseChaitin::yank_if_dead() should handle MachTemp inputs

Summary: PhaseChaitin::yank_if_dead() should be able to handle MachTemp inputs as a special case and yank them.
Reviewed-by: never, kvn
上级 397b334f
......@@ -482,6 +482,7 @@ private:
}
int yank_if_dead( Node *old, Block *current_block, Node_List *value, Node_List *regnd );
int yank( Node *old, Block *current_block, Node_List *value, Node_List *regnd );
int elide_copy( Node *n, int k, Block *current_block, Node_List &value, Node_List &regnd, bool can_change_regs );
int use_prior_register( Node *copy, uint idx, Node *def, Block *current_block, Node_List &value, Node_List &regnd );
bool may_be_copy_of_callee( Node *def ) const;
......
......@@ -72,14 +72,10 @@ bool PhaseChaitin::may_be_copy_of_callee( Node *def ) const {
return i == limit;
}
//------------------------------yank_if_dead-----------------------------------
// Removed an edge from 'old'. Yank if dead. Return adjustment counts to
// iterators in the current block.
int PhaseChaitin::yank_if_dead( Node *old, Block *current_block, Node_List *value, Node_List *regnd ) {
//------------------------------yank-----------------------------------
// Helper function for yank_if_dead
int PhaseChaitin::yank( Node *old, Block *current_block, Node_List *value, Node_List *regnd ) {
int blk_adjust=0;
while (old->outcnt() == 0 && old != C->top()) {
Block *oldb = _cfg._bbs[old->_idx];
oldb->find_remove(old);
// Count 1 if deleting an instruction from the current block
......@@ -90,8 +86,29 @@ int PhaseChaitin::yank_if_dead( Node *old, Block *current_block, Node_List *valu
value->map(old_reg,NULL); // Yank from value/regnd maps
regnd->map(old_reg,NULL); // This register's value is now unknown
}
assert(old->req() <= 2, "can't handle more inputs");
Node *tmp = old->req() > 1 ? old->in(1) : NULL;
return blk_adjust;
}
//------------------------------yank_if_dead-----------------------------------
// Removed an edge from 'old'. Yank if dead. Return adjustment counts to
// iterators in the current block.
int PhaseChaitin::yank_if_dead( Node *old, Block *current_block, Node_List *value, Node_List *regnd ) {
int blk_adjust=0;
while (old->outcnt() == 0 && old != C->top()) {
blk_adjust += yank(old, current_block, value, regnd);
Node *tmp = NULL;
for (uint i = 1; i < old->req(); i++) {
if (old->in(i)->is_MachTemp()) {
Node* machtmp = old->in(i);
assert(machtmp->outcnt() == 1, "expected for a MachTemp");
blk_adjust += yank(machtmp, current_block, value, regnd);
machtmp->disconnect_inputs(NULL);
} else {
assert(tmp == NULL, "can't handle more non MachTemp inputs");
tmp = old->in(i);
}
}
old->disconnect_inputs(NULL);
if( !tmp ) break;
old = tmp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册