mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Performance annotations: add attributes @_noLocks and @_noAllocation
This commit is contained in:
@@ -105,6 +105,12 @@ void SILFunctionBuilder::addFunctionAttributes(
|
||||
if (Attrs.hasAttribute<SILGenNameAttr>() || Attrs.hasAttribute<CDeclAttr>())
|
||||
F->setHasCReferences(true);
|
||||
|
||||
if (Attrs.hasAttribute<NoLocksAttr>()) {
|
||||
F->setPerfConstraints(PerformanceConstraints::NoLocks);
|
||||
} else if (Attrs.hasAttribute<NoAllocationAttr>()) {
|
||||
F->setPerfConstraints(PerformanceConstraints::NoAllocation);
|
||||
}
|
||||
|
||||
// Validate `@differentiable` attributes by calling `getParameterIndices`.
|
||||
// This is important for:
|
||||
// - Skipping invalid `@differentiable` attributes in non-primary files.
|
||||
|
||||
Reference in New Issue
Block a user