mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: add a lazy_property_getter flag to SILFunction
It is set on getter-functions for lazy properties.
This commit is contained in:
@@ -118,6 +118,13 @@ class SILFunction
|
||||
public:
|
||||
using BlockListType = llvm::iplist<SILBasicBlock>;
|
||||
|
||||
// For more information see docs/SIL.rst
|
||||
enum class Purpose : uint8_t {
|
||||
None,
|
||||
GlobalInit,
|
||||
LazyPropertyGetter
|
||||
};
|
||||
|
||||
private:
|
||||
friend class SILBasicBlock;
|
||||
friend class SILModule;
|
||||
@@ -183,6 +190,8 @@ private:
|
||||
/// should use weak linking.
|
||||
AvailabilityContext Availability;
|
||||
|
||||
Purpose specialPurpose = Purpose::None;
|
||||
|
||||
/// This is the number of uses of this SILFunction inside the SIL.
|
||||
/// It does not include references from debug scopes.
|
||||
unsigned RefCount = 0;
|
||||
@@ -806,6 +815,8 @@ public:
|
||||
void setEffectsKind(EffectsKind E) {
|
||||
EffectsKindAttr = unsigned(E);
|
||||
}
|
||||
|
||||
Purpose getSpecialPurpose() const { return specialPurpose; }
|
||||
|
||||
/// Get this function's global_init attribute.
|
||||
///
|
||||
@@ -819,8 +830,13 @@ public:
|
||||
/// generated from a global variable access. Note that the initialization
|
||||
/// function itself does not need this attribute. It is private and only
|
||||
/// called within the addressor.
|
||||
bool isGlobalInit() const { return GlobalInitFlag; }
|
||||
void setGlobalInit(bool isGI) { GlobalInitFlag = isGI; }
|
||||
bool isGlobalInit() const { return specialPurpose == Purpose::GlobalInit; }
|
||||
|
||||
bool isLazyPropertyGetter() const {
|
||||
return specialPurpose == Purpose::LazyPropertyGetter;
|
||||
}
|
||||
|
||||
void setSpecialPurpose(Purpose purpose) { specialPurpose = purpose; }
|
||||
|
||||
/// Return whether this function has a foreign implementation which can
|
||||
/// be emitted on demand.
|
||||
|
||||
Reference in New Issue
Block a user