forked from OSchip/llvm-project
parent
da0204d05f
commit
d45907bd38
|
@ -7,12 +7,14 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#define DEBUG_TYPE "objc-arc-ptr-state"
|
||||||
|
#include "llvm/Support/Debug.h"
|
||||||
#include "PtrState.h"
|
#include "PtrState.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::objcarc;
|
using namespace llvm::objcarc;
|
||||||
|
|
||||||
raw_ostream &operator<<(raw_ostream &OS, const Sequence S) {
|
raw_ostream &llvm::objcarc::operator<<(raw_ostream &OS, const Sequence S) {
|
||||||
switch (S) {
|
switch (S) {
|
||||||
case S_None:
|
case S_None:
|
||||||
return OS << "S_None";
|
return OS << "S_None";
|
||||||
|
@ -91,6 +93,28 @@ bool RRInfo::Merge(const RRInfo &Other) {
|
||||||
return Partial;
|
return Partial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PtrState::SetKnownPositiveRefCount() {
|
||||||
|
DEBUG(dbgs() << "Setting Known Positive.\n");
|
||||||
|
KnownPositiveRefCount = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PtrState::ClearKnownPositiveRefCount() {
|
||||||
|
DEBUG(dbgs() << "Clearing Known Positive.\n");
|
||||||
|
KnownPositiveRefCount = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PtrState::SetSeq(Sequence NewSeq) {
|
||||||
|
DEBUG(dbgs() << "Old: " << Seq << "; New: " << NewSeq << "\n");
|
||||||
|
Seq = NewSeq;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PtrState::ResetSequenceProgress(Sequence NewSeq) {
|
||||||
|
DEBUG(dbgs() << "Resetting sequence progress.\n");
|
||||||
|
SetSeq(NewSeq);
|
||||||
|
Partial = false;
|
||||||
|
RRI.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void PtrState::Merge(const PtrState &Other, bool TopDown) {
|
void PtrState::Merge(const PtrState &Other, bool TopDown) {
|
||||||
Seq = MergeSeqs(GetSeq(), Other.GetSeq(), TopDown);
|
Seq = MergeSeqs(GetSeq(), Other.GetSeq(), TopDown);
|
||||||
KnownPositiveRefCount &= Other.KnownPositiveRefCount;
|
KnownPositiveRefCount &= Other.KnownPositiveRefCount;
|
||||||
|
|
|
@ -134,34 +134,18 @@ public:
|
||||||
RRI.CFGHazardAfflicted = NewValue;
|
RRI.CFGHazardAfflicted = NewValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetKnownPositiveRefCount() {
|
void SetKnownPositiveRefCount();
|
||||||
DEBUG(dbgs() << "Setting Known Positive.\n");
|
void ClearKnownPositiveRefCount();
|
||||||
KnownPositiveRefCount = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearKnownPositiveRefCount() {
|
|
||||||
DEBUG(dbgs() << "Clearing Known Positive.\n");
|
|
||||||
KnownPositiveRefCount = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HasKnownPositiveRefCount() const { return KnownPositiveRefCount; }
|
bool HasKnownPositiveRefCount() const { return KnownPositiveRefCount; }
|
||||||
|
|
||||||
void SetSeq(Sequence NewSeq) {
|
void SetSeq(Sequence NewSeq);
|
||||||
DEBUG(dbgs() << "Old: " << Seq << "; New: " << NewSeq << "\n");
|
|
||||||
Seq = NewSeq;
|
|
||||||
}
|
|
||||||
|
|
||||||
Sequence GetSeq() const { return static_cast<Sequence>(Seq); }
|
Sequence GetSeq() const { return static_cast<Sequence>(Seq); }
|
||||||
|
|
||||||
void ClearSequenceProgress() { ResetSequenceProgress(S_None); }
|
void ClearSequenceProgress() { ResetSequenceProgress(S_None); }
|
||||||
|
|
||||||
void ResetSequenceProgress(Sequence NewSeq) {
|
void ResetSequenceProgress(Sequence NewSeq);
|
||||||
DEBUG(dbgs() << "Resetting sequence progress.\n");
|
|
||||||
SetSeq(NewSeq);
|
|
||||||
Partial = false;
|
|
||||||
RRI.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Merge(const PtrState &Other, bool TopDown);
|
void Merge(const PtrState &Other, bool TopDown);
|
||||||
|
|
||||||
void InsertCall(Instruction *I) { RRI.Calls.insert(I); }
|
void InsertCall(Instruction *I) { RRI.Calls.insert(I); }
|
||||||
|
|
Loading…
Reference in New Issue