Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/Transforms/IPO/Attributor.h
Show First 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | struct Attributor { | ||||
/// IR already contains the information they would deduce. The most important | /// IR already contains the information they would deduce. The most important | ||||
/// reason for this is the single interface, the one of the abstract attribute | /// reason for this is the single interface, the one of the abstract attribute | ||||
/// instance, which can be queried without the need to look at the IR in | /// instance, which can be queried without the need to look at the IR in | ||||
/// various places. | /// various places. | ||||
void identifyDefaultAbstractAttributes( | void identifyDefaultAbstractAttributes( | ||||
Function &F, InformationCache &InfoCache, | Function &F, InformationCache &InfoCache, | ||||
DenseSet</* Attribute::AttrKind */ unsigned> *Whitelist = nullptr); | DenseSet</* Attribute::AttrKind */ unsigned> *Whitelist = nullptr); | ||||
/// Check \p Pred on all function call sites. | |||||
/// | |||||
/// This method will evaluate \p Pred on call sites and return | |||||
/// true if \p Pred holds in every call sites. However, this is only possible | |||||
/// all call sites are known, hence the function has internal linkage. | |||||
bool checkForAllCallSites(Function &F, std::function<bool(CallSite)> &Pred, | |||||
jdoerfert: No newline and "sites" in the first line. | |||||
bool RequireAllCallSites); | |||||
private: | private: | ||||
/// The set of all abstract attributes. | /// The set of all abstract attributes. | ||||
///{ | ///{ | ||||
using AAVector = SmallVector<AbstractAttribute *, 64>; | using AAVector = SmallVector<AbstractAttribute *, 64>; | ||||
AAVector AllAbstractAttributes; | AAVector AllAbstractAttributes; | ||||
///} | ///} | ||||
/// A nested map to lookup abstract attributes based on the anchored value and | /// A nested map to lookup abstract attributes based on the anchored value and | ||||
▲ Show 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | struct AANoUnwind : public AbstractAttribute { | ||||
AANoUnwind(Value &V, InformationCache &InfoCache) | AANoUnwind(Value &V, InformationCache &InfoCache) | ||||
: AbstractAttribute(V, InfoCache) {} | : AbstractAttribute(V, InfoCache) {} | ||||
/// See AbstractAttribute::getAttrKind()/ | /// See AbstractAttribute::getAttrKind()/ | ||||
Attribute::AttrKind getAttrKind() const override { return ID; } | Attribute::AttrKind getAttrKind() const override { return ID; } | ||||
static constexpr Attribute::AttrKind ID = Attribute::NoUnwind; | static constexpr Attribute::AttrKind ID = Attribute::NoUnwind; | ||||
/// Returns true if nounwind is assumed. | /// Returns true if nounwind is assumed. | ||||
copy and past comment, also above jdoerfert: copy and past comment, also above | |||||
virtual bool isAssumedNoUnwind() const = 0; | virtual bool isAssumedNoUnwind() const = 0; | ||||
/// Returns true if nounwind is known. | /// Returns true if nounwind is known. | ||||
virtual bool isKnownNoUnwind() const = 0; | virtual bool isKnownNoUnwind() const = 0; | ||||
}; | }; | ||||
struct AANoSync : public AbstractAttribute { | struct AANoSync : public AbstractAttribute { | ||||
/// An abstract interface for all nosync attributes. | /// An abstract interface for all nosync attributes. | ||||
AANoSync(Value &V, InformationCache &InfoCache) | AANoSync(Value &V, InformationCache &InfoCache) | ||||
: AbstractAttribute(V, InfoCache) {} | : AbstractAttribute(V, InfoCache) {} | ||||
/// See AbstractAttribute::getAttrKind(). | /// See AbstractAttribute::getAttrKind(). | ||||
Attribute::AttrKind getAttrKind() const override { return ID; } | Attribute::AttrKind getAttrKind() const override { return ID; } | ||||
static constexpr Attribute::AttrKind ID = | static constexpr Attribute::AttrKind ID = | ||||
Attribute::AttrKind(Attribute::NoSync); | Attribute::AttrKind(Attribute::NoSync); | ||||
/// Returns true if "nosync" is assumed. | /// Returns true if "nosync" is assumed. | ||||
virtual bool isAssumedNoSync() const = 0; | virtual bool isAssumedNoSync() const = 0; | ||||
/// Returns true if "nosync" is known. | /// Returns true if "nosync" is known. | ||||
virtual bool isKnownNoSync() const = 0; | virtual bool isKnownNoSync() const = 0; | ||||
}; | }; | ||||
/// An abstract interface for all nonnull attributes. | |||||
struct AANonNull : public AbstractAttribute { | |||||
/// See AbstractAttribute::AbstractAttribute(...). | |||||
AANonNull(Value &V, InformationCache &InfoCache) | |||||
: AbstractAttribute(V, InfoCache) {} | |||||
/// See AbstractAttribute::AbstractAttribute(...). | |||||
AANonNull(Value *AssociatedVal, Value &AnchoredValue, | |||||
InformationCache &InfoCache) | |||||
: AbstractAttribute(AssociatedVal, AnchoredValue, InfoCache) {} | |||||
/// Return true if we assume that the underlying value is nonnull. | |||||
virtual bool isAssumedNonNull() const = 0; | |||||
/// Return true if we know that underlying value is nonnull. | |||||
virtual bool isKnownNonNull() const = 0; | |||||
/// See AbastractState::getAttrKind(). | |||||
Attribute::AttrKind getAttrKind() const override { return ID; } | |||||
/// The identifier used by the Attributor for this class of attributes. | |||||
static constexpr Attribute::AttrKind ID = Attribute::NonNull; | |||||
}; | |||||
} // end namespace llvm | } // end namespace llvm | ||||
#endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H | #endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H |
No newline and "sites" in the first line.