Performance annotations: add attributes @_noLocks and @_noAllocation

This commit is contained in:
Erik Eckstein
2021-10-21 22:04:27 +02:00
parent 60f3d61031
commit 8229b374b1
16 changed files with 113 additions and 11 deletions

View File

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