SIL: add a lazy_property_getter flag to SILFunction

It is set on getter-functions for lazy properties.
This commit is contained in:
Erik Eckstein
2020-03-12 11:28:46 +01:00
parent 0be8357dcc
commit ae93e60072
15 changed files with 88 additions and 24 deletions

View File

@@ -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.