mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Merge remote-tracking branch 'origin/GT-3506_DeleteDescend'
This commit is contained in:
commit
ea32a11307
1 changed files with 14 additions and 4 deletions
|
@ -93,6 +93,7 @@ void Funcdata::pushMultiequals(BlockBasic *bb)
|
||||||
warningHeader("push_multiequal on block with multiple outputs");
|
warningHeader("push_multiequal on block with multiple outputs");
|
||||||
outblock = (BlockBasic *) bb->getOut(0); // Take first output block. If this is a
|
outblock = (BlockBasic *) bb->getOut(0); // Take first output block. If this is a
|
||||||
// donothing block, it is the only output block
|
// donothing block, it is the only output block
|
||||||
|
int4 outblock_ind = bb->getOutRevIndex(0);
|
||||||
for(iter=bb->beginOp();iter!=bb->endOp();++iter) {
|
for(iter=bb->beginOp();iter!=bb->endOp();++iter) {
|
||||||
origop = *iter;
|
origop = *iter;
|
||||||
if (origop->code() != CPUI_MULTIEQUAL) continue;
|
if (origop->code() != CPUI_MULTIEQUAL) continue;
|
||||||
|
@ -103,6 +104,15 @@ void Funcdata::pushMultiequals(BlockBasic *bb)
|
||||||
for(citer=origvn->beginDescend();citer!=origvn->endDescend();++citer) {
|
for(citer=origvn->beginDescend();citer!=origvn->endDescend();++citer) {
|
||||||
PcodeOp *op = *citer;
|
PcodeOp *op = *citer;
|
||||||
if ((op->code()==CPUI_MULTIEQUAL)&&(op->getParent()==outblock)) {
|
if ((op->code()==CPUI_MULTIEQUAL)&&(op->getParent()==outblock)) {
|
||||||
|
bool deadEdge = true; // Check for reference to origvn NOT thru the dead edge
|
||||||
|
for(int4 i=0;i<op->numInput();++i) {
|
||||||
|
if (i == outblock_ind) continue; // Not going thru dead edge
|
||||||
|
if (op->getIn(i) == origvn) { // Reference to origvn
|
||||||
|
deadEdge = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (deadEdge) {
|
||||||
if ((origvn->getAddr() == op->getOut()->getAddr())&&origvn->isAddrTied())
|
if ((origvn->getAddr() == op->getOut()->getAddr())&&origvn->isAddrTied())
|
||||||
// If origvn is addrtied and feeds into a MULTIEQUAL at same address in outblock
|
// If origvn is addrtied and feeds into a MULTIEQUAL at same address in outblock
|
||||||
// Then any use of origvn beyond outblock that did not go thru this MULTIEQUAL must have
|
// Then any use of origvn beyond outblock that did not go thru this MULTIEQUAL must have
|
||||||
|
@ -110,6 +120,7 @@ void Funcdata::pushMultiequals(BlockBasic *bb)
|
||||||
neednewunique = true;
|
neednewunique = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
needreplace = true;
|
needreplace = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +152,6 @@ void Funcdata::pushMultiequals(BlockBasic *bb)
|
||||||
|
|
||||||
// Replace obsolete origvn with replacevn
|
// Replace obsolete origvn with replacevn
|
||||||
int4 i;
|
int4 i;
|
||||||
int4 outblock_ind = bb->getOutRevIndex(0);
|
|
||||||
list<PcodeOp *>::iterator titer = origvn->descend.begin();
|
list<PcodeOp *>::iterator titer = origvn->descend.begin();
|
||||||
while(titer != origvn->descend.end()) {
|
while(titer != origvn->descend.end()) {
|
||||||
PcodeOp *op = *titer++;
|
PcodeOp *op = *titer++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue