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 Line(s) | 150 | struct Attributor { | |||
---|---|---|---|---|---|
258 | /// IR already contains the information they would deduce. The most important | 258 | /// IR already contains the information they would deduce. The most important | ||
259 | /// reason for this is the single interface, the one of the abstract attribute | 259 | /// reason for this is the single interface, the one of the abstract attribute | ||
260 | /// instance, which can be queried without the need to look at the IR in | 260 | /// instance, which can be queried without the need to look at the IR in | ||
261 | /// various places. | 261 | /// various places. | ||
262 | void identifyDefaultAbstractAttributes( | 262 | void identifyDefaultAbstractAttributes( | ||
263 | Function &F, InformationCache &InfoCache, | 263 | Function &F, InformationCache &InfoCache, | ||
264 | DenseSet</* Attribute::AttrKind */ unsigned> *Whitelist = nullptr); | 264 | DenseSet</* Attribute::AttrKind */ unsigned> *Whitelist = nullptr); | ||
265 | 265 | | |||
266 | /// Check \p Pred on all function call sites. | ||||
267 | /// | ||||
268 | /// This method will evaluate \p Pred on call sites and return | ||||
269 | /// true if \p Pred holds in every call sites. However, this is only possible | ||||
270 | /// all call sites are known, hence the function has internal linkage. | ||||
271 | bool checkForAllCallSites(Function &F, std::function<bool(CallSite)> &Pred, | ||||
jdoerfert: No newline and "sites" in the first line. | |||||
272 | bool RequireAllCallSites); | ||||
273 | | ||||
266 | private: | 274 | private: | ||
267 | /// The set of all abstract attributes. | 275 | /// The set of all abstract attributes. | ||
268 | ///{ | 276 | ///{ | ||
269 | using AAVector = SmallVector<AbstractAttribute *, 64>; | 277 | using AAVector = SmallVector<AbstractAttribute *, 64>; | ||
270 | AAVector AllAbstractAttributes; | 278 | AAVector AllAbstractAttributes; | ||
271 | ///} | 279 | ///} | ||
272 | 280 | | |||
273 | /// A nested map to lookup abstract attributes based on the anchored value and | 281 | /// A nested map to lookup abstract attributes based on the anchored value and | ||
▲ Show 20 Lines • Show All 404 Lines • ▼ Show 20 Line(s) | 684 | struct AANoUnwind : public AbstractAttribute { | |||
678 | AANoUnwind(Value &V, InformationCache &InfoCache) | 686 | AANoUnwind(Value &V, InformationCache &InfoCache) | ||
679 | : AbstractAttribute(V, InfoCache) {} | 687 | : AbstractAttribute(V, InfoCache) {} | ||
680 | 688 | | |||
681 | /// See AbstractAttribute::getAttrKind()/ | 689 | /// See AbstractAttribute::getAttrKind()/ | ||
682 | Attribute::AttrKind getAttrKind() const override { return ID; } | 690 | Attribute::AttrKind getAttrKind() const override { return ID; } | ||
683 | 691 | | |||
684 | static constexpr Attribute::AttrKind ID = Attribute::NoUnwind; | 692 | static constexpr Attribute::AttrKind ID = Attribute::NoUnwind; | ||
685 | 693 | | |||
686 | /// Returns true if nounwind is assumed. | 694 | /// Returns true if nounwind is assumed. | ||
Done Replycopy and past comment, also above jdoerfert: copy and past comment, also above | |||||
687 | virtual bool isAssumedNoUnwind() const = 0; | 695 | virtual bool isAssumedNoUnwind() const = 0; | ||
688 | 696 | | |||
689 | /// Returns true if nounwind is known. | 697 | /// Returns true if nounwind is known. | ||
690 | virtual bool isKnownNoUnwind() const = 0; | 698 | virtual bool isKnownNoUnwind() const = 0; | ||
691 | }; | 699 | }; | ||
692 | 700 | | |||
693 | struct AANoSync : public AbstractAttribute { | 701 | struct AANoSync : public AbstractAttribute { | ||
694 | /// An abstract interface for all nosync attributes. | 702 | /// An abstract interface for all nosync attributes. | ||
695 | AANoSync(Value &V, InformationCache &InfoCache) | 703 | AANoSync(Value &V, InformationCache &InfoCache) | ||
696 | : AbstractAttribute(V, InfoCache) {} | 704 | : AbstractAttribute(V, InfoCache) {} | ||
697 | 705 | | |||
698 | /// See AbstractAttribute::getAttrKind(). | 706 | /// See AbstractAttribute::getAttrKind(). | ||
699 | Attribute::AttrKind getAttrKind() const override { return ID; } | 707 | Attribute::AttrKind getAttrKind() const override { return ID; } | ||
700 | 708 | | |||
701 | static constexpr Attribute::AttrKind ID = | 709 | static constexpr Attribute::AttrKind ID = | ||
702 | Attribute::AttrKind(Attribute::NoSync); | 710 | Attribute::AttrKind(Attribute::NoSync); | ||
703 | 711 | | |||
704 | /// Returns true if "nosync" is assumed. | 712 | /// Returns true if "nosync" is assumed. | ||
705 | virtual bool isAssumedNoSync() const = 0; | 713 | virtual bool isAssumedNoSync() const = 0; | ||
706 | 714 | | |||
707 | /// Returns true if "nosync" is known. | 715 | /// Returns true if "nosync" is known. | ||
708 | virtual bool isKnownNoSync() const = 0; | 716 | virtual bool isKnownNoSync() const = 0; | ||
709 | }; | 717 | }; | ||
710 | 718 | | |||
719 | /// An abstract interface for all nonnull attributes. | ||||
720 | struct AANonNull : public AbstractAttribute { | ||||
721 | | ||||
722 | /// See AbstractAttribute::AbstractAttribute(...). | ||||
723 | AANonNull(Value &V, InformationCache &InfoCache) | ||||
724 | : AbstractAttribute(V, InfoCache) {} | ||||
725 | | ||||
726 | /// See AbstractAttribute::AbstractAttribute(...). | ||||
727 | AANonNull(Value *AssociatedVal, Value &AnchoredValue, | ||||
728 | InformationCache &InfoCache) | ||||
729 | : AbstractAttribute(AssociatedVal, AnchoredValue, InfoCache) {} | ||||
730 | | ||||
731 | /// Return true if we assume that the underlying value is nonnull. | ||||
732 | virtual bool isAssumedNonNull() const = 0; | ||||
733 | | ||||
734 | /// Return true if we know that underlying value is nonnull. | ||||
735 | virtual bool isKnownNonNull() const = 0; | ||||
736 | | ||||
737 | /// See AbastractState::getAttrKind(). | ||||
738 | Attribute::AttrKind getAttrKind() const override { return ID; } | ||||
739 | | ||||
740 | /// The identifier used by the Attributor for this class of attributes. | ||||
741 | static constexpr Attribute::AttrKind ID = Attribute::NonNull; | ||||
742 | }; | ||||
711 | } // end namespace llvm | 743 | } // end namespace llvm | ||
712 | 744 | | |||
713 | #endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H | 745 | #endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H |
No newline and "sites" in the first line.