1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

IR: Separate out helper: resolveAfterOperandChange(), NFC

llvm-svn: 225654
This commit is contained in:
Duncan P. N. Exon Smith 2015-01-12 19:14:15 +00:00
parent 7fbc7db604
commit 566445f0e7
2 changed files with 19 additions and 15 deletions

View File

@ -762,6 +762,7 @@ private:
void handleChangedOperand(void *Ref, Metadata *New);
void resolve();
void resolveAfterOperandChange(Metadata *Old, Metadata *New);
};
/// \brief Forward declaration of metadata.

View File

@ -449,6 +449,22 @@ void GenericMDNode::resolve() {
Uses->resolveAllUses();
}
void GenericMDNode::resolveAfterOperandChange(Metadata *Old, Metadata *New) {
assert(SubclassData32 != 0 && "Expected unresolved operands");
// Check if the last unresolved operand has just been resolved; if so,
// resolve this as well.
if (isOperandUnresolved(Old)) {
if (!isOperandUnresolved(New)) {
if (!--SubclassData32)
resolve();
}
} else {
// Operands shouldn't become unresolved.
assert(isOperandUnresolved(New) && "Operand just became unresolved");
}
}
void GenericMDNode::resolveCycles() {
if (isResolved())
return;
@ -546,21 +562,8 @@ void GenericMDNode::handleChangedOperand(void *Ref, Metadata *New) {
if (I == Store.end()) {
Store.insert(this);
if (!isResolved()) {
assert(SubclassData32 != 0 && "Expected unresolved operands");
// Check if the last unresolved operand has just been resolved; if so,
// resolve this as well.
if (isOperandUnresolved(Old)) {
if (!isOperandUnresolved(New)) {
if (!--SubclassData32)
resolve();
}
} else {
// Operands shouldn't become unresolved.
assert(isOperandUnresolved(New) && "Operand just became unresolved");
}
}
if (!isResolved())
resolveAfterOperandChange(Old, New);
return;
}