16#ifndef LLVM_LIB_TRANSFORMS_OBJCARC_PTRSTATE_H
17#define LLVM_LIB_TRANSFORMS_OBJCARC_PTRSTATE_H
34class BundledRetainClaimRVs;
35class ProvenanceAnalysis;
#define LLVM_ATTRIBUTE_UNUSED
This file defines the SmallPtrSet class.
LLVM Basic Block Representation.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
LLVM Value Representation.
A cache of MDKinds used by various ARC optimizations.
This is similar to BasicAliasAnalysis, and it uses many of the same techniques, except it uses specia...
This class summarizes several per-pointer runtime properties which are propagated through the flow gr...
bool KnownPositiveRefCount
True if the reference count is known to be incremented.
unsigned char Seq
The current position in the sequence.
void SetCFGHazardAfflicted(const bool NewValue)
RRInfo RRI
Unidirectional information about the current sequence.
void ClearReverseInsertPts()
void SetKnownPositiveRefCount()
bool IsTailCallRelease() const
bool HasKnownPositiveRefCount() const
void InsertReverseInsertPt(Instruction *I)
bool HasReverseInsertPts() const
const RRInfo & GetRRInfo() const
void SetTailCallRelease(const bool NewValue)
void ClearKnownPositiveRefCount()
bool IsCFGHazardAfflicted() const
const MDNode * GetReleaseMetadata() const
void SetReleaseMetadata(MDNode *NewValue)
void InsertCall(Instruction *I)
void ResetSequenceProgress(Sequence NewSeq)
void SetSeq(Sequence NewSeq)
void SetKnownSafe(const bool NewValue)
void ClearSequenceProgress()
bool Partial
True if we've seen an opportunity for partial RR elimination, such as pushing calls into a CFG triang...
bool IsTrackingImpreciseReleases() const
This class implements an extremely fast bulk output stream that can only output to a stream.
@ BasicBlock
Various leaf nodes.
raw_ostream & operator<<(raw_ostream &OS, const ARCInstKind Class)
ARCInstKind
Equivalence classes of instructions in the ARC Model.
Sequence
A sequence of states that a pointer may go through in which an objc_retain and objc_release are actua...
@ S_CanRelease
foo(x) – x could possibly see a ref count decrement.
@ S_Retain
objc_retain(x).
@ S_Stop
code motion is stopped.
@ S_MovableRelease
objc_release(x), !clang.imprecise_release.
This is an optimization pass for GlobalISel generic memory operations.
bool HandlePotentialAlterRefCount(Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class)
bool InitBottomUp(ARCMDKindCache &Cache, Instruction *I)
(Re-)Initialize this bottom up pointer returning true if we detected a pointer with nested releases.
BottomUpPtrState()=default
bool MatchWithRetain()
Return true if this set of releases can be paired with a release.
void HandlePotentialUse(BasicBlock *BB, Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class)
Unidirectional information about either a retain-decrement-use-release sequence or release-use-decrem...
bool KnownSafe
After an objc_retain, the reference count of the referenced object is known to be positive.
SmallPtrSet< Instruction *, 2 > Calls
For a top-down sequence, the set of objc_retains or objc_retainBlocks.
MDNode * ReleaseMetadata
If the Calls are objc_release calls and they all have a clang.imprecise_release tag,...
bool CFGHazardAfflicted
If this is true, we cannot perform code motion but can still remove retain/release pairs.
bool IsTailCallRelease
True of the objc_release calls are all marked with the "tail" keyword.
SmallPtrSet< Instruction *, 2 > ReverseInsertPts
The set of optimal insert positions for moving calls in the opposite sequence.
TopDownPtrState()=default
bool MatchWithRelease(ARCMDKindCache &Cache, Instruction *Release)
Return true if this set of retains can be paired with the given release.
bool InitTopDown(ARCInstKind Kind, Instruction *I)
(Re-)Initialize this bottom up pointer returning true if we detected a pointer with nested releases.
bool HandlePotentialAlterRefCount(Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class, const BundledRetainClaimRVs &BundledRVs)
void HandlePotentialUse(Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class)