mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
IR: Use SubclassData32 directly, NFC
Simplify some logic by accessing `SubclassData32` directly instead of relying on API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225653 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
095ca8f493
commit
b8e8faf480
@ -761,9 +761,6 @@ public:
|
||||
private:
|
||||
void handleChangedOperand(void *Ref, Metadata *New);
|
||||
|
||||
bool hasUnresolvedOperands() const { return SubclassData32; }
|
||||
void incrementUnresolvedOperands() { ++SubclassData32; }
|
||||
void decrementUnresolvedOperands() { --SubclassData32; }
|
||||
void resolve();
|
||||
};
|
||||
|
||||
|
@ -228,8 +228,7 @@ void ReplaceableMetadataImpl::resolveAllUses(bool ResolveUsers) {
|
||||
continue;
|
||||
if (OwnerMD->isResolved())
|
||||
continue;
|
||||
OwnerMD->decrementUnresolvedOperands();
|
||||
if (!OwnerMD->hasUnresolvedOperands())
|
||||
if (!--OwnerMD->SubclassData32)
|
||||
OwnerMD->resolve();
|
||||
}
|
||||
}
|
||||
@ -418,12 +417,15 @@ GenericMDNode::GenericMDNode(LLVMContext &C, ArrayRef<Metadata *> Vals,
|
||||
return;
|
||||
|
||||
// Check whether any operands are unresolved, requiring re-uniquing.
|
||||
unsigned NumUnresolved = 0;
|
||||
for (const auto &Op : operands())
|
||||
if (isOperandUnresolved(Op))
|
||||
incrementUnresolvedOperands();
|
||||
NumUnresolved += unsigned(isOperandUnresolved(Op));
|
||||
|
||||
if (!NumUnresolved)
|
||||
return;
|
||||
|
||||
if (hasUnresolvedOperands())
|
||||
ReplaceableUses.reset(new ReplaceableMetadataImpl);
|
||||
SubclassData32 = NumUnresolved;
|
||||
}
|
||||
|
||||
GenericMDNode::~GenericMDNode() {
|
||||
@ -545,12 +547,13 @@ void GenericMDNode::handleChangedOperand(void *Ref, Metadata *New) {
|
||||
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)) {
|
||||
decrementUnresolvedOperands();
|
||||
if (!hasUnresolvedOperands())
|
||||
if (!--SubclassData32)
|
||||
resolve();
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user