mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Performance annotations: add attributes @_noLocks and @_noAllocation
This commit is contained in:
@@ -60,6 +60,12 @@ enum IsExactSelfClass_t {
|
||||
IsExactSelfClass,
|
||||
};
|
||||
|
||||
enum class PerformanceConstraints : uint8_t {
|
||||
None = 0,
|
||||
NoAllocation = 1,
|
||||
NoLocks = 2,
|
||||
};
|
||||
|
||||
class SILSpecializeAttr final {
|
||||
friend SILFunction;
|
||||
public:
|
||||
@@ -232,6 +238,8 @@ private:
|
||||
|
||||
Purpose specialPurpose = Purpose::None;
|
||||
|
||||
PerformanceConstraints perfConstraints = PerformanceConstraints::None;
|
||||
|
||||
/// This is the number of uses of this SILFunction inside the SIL.
|
||||
/// It does not include references from debug scopes.
|
||||
unsigned RefCount = 0;
|
||||
@@ -813,6 +821,12 @@ public:
|
||||
OptMode = unsigned(mode);
|
||||
}
|
||||
|
||||
PerformanceConstraints getPerfConstraints() const { return perfConstraints; }
|
||||
|
||||
void setPerfConstraints(PerformanceConstraints perfConstr) {
|
||||
perfConstraints = perfConstr;
|
||||
}
|
||||
|
||||
/// \returns True if the function is optimizable (i.e. not marked as no-opt),
|
||||
/// or is raw SIL (so that the mandatory passes still run).
|
||||
bool shouldOptimize() const;
|
||||
|
||||
Reference in New Issue
Block a user