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"
|
||||
|
||||
using namespace llvm;
|
||||
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) {
|
||||
case S_None:
|
||||
return OS << "S_None";
|
||||
|
@ -91,6 +93,28 @@ bool RRInfo::Merge(const RRInfo &Other) {
|
|||
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) {
|
||||
Seq = MergeSeqs(GetSeq(), Other.GetSeq(), TopDown);
|
||||
KnownPositiveRefCount &= Other.KnownPositiveRefCount;
|
||||
|
|
|
@ -134,34 +134,18 @@ public:
|
|||
RRI.CFGHazardAfflicted = NewValue;
|
||||
}
|
||||
|
||||
void SetKnownPositiveRefCount() {
|
||||
DEBUG(dbgs() << "Setting Known Positive.\n");
|
||||
KnownPositiveRefCount = true;
|
||||
}
|
||||
|
||||
void ClearKnownPositiveRefCount() {
|
||||
DEBUG(dbgs() << "Clearing Known Positive.\n");
|
||||
KnownPositiveRefCount = false;
|
||||
}
|
||||
void SetKnownPositiveRefCount();
|
||||
void ClearKnownPositiveRefCount();
|
||||
|
||||
bool HasKnownPositiveRefCount() const { return KnownPositiveRefCount; }
|
||||
|
||||
void SetSeq(Sequence NewSeq) {
|
||||
DEBUG(dbgs() << "Old: " << Seq << "; New: " << NewSeq << "\n");
|
||||
Seq = NewSeq;
|
||||
}
|
||||
void SetSeq(Sequence NewSeq);
|
||||
|
||||
Sequence GetSeq() const { return static_cast<Sequence>(Seq); }
|
||||
|
||||
void ClearSequenceProgress() { ResetSequenceProgress(S_None); }
|
||||
|
||||
void ResetSequenceProgress(Sequence NewSeq) {
|
||||
DEBUG(dbgs() << "Resetting sequence progress.\n");
|
||||
SetSeq(NewSeq);
|
||||
Partial = false;
|
||||
RRI.clear();
|
||||
}
|
||||
|
||||
void ResetSequenceProgress(Sequence NewSeq);
|
||||
void Merge(const PtrState &Other, bool TopDown);
|
||||
|
||||
void InsertCall(Instruction *I) { RRI.Calls.insert(I); }
|
||||
|
|
Loading…
Reference in New Issue