Function-level optimization attributes.

For now these are underscored attributes, i.e. compiler internal attributes:
@_optimize(speed)
@_optimize(size)
@_optimize(none)

Those attributes override the command-line specified optimization mode for a specific function.
The @_optimize(none) attribute is equivalent to the already existing @_semantics("optimize.sil.never") attribute
This commit is contained in:
Erik Eckstein
2017-11-07 10:48:34 -08:00
parent 8f9361a1b3
commit 8033476b64
28 changed files with 322 additions and 32 deletions

View File

@@ -2236,6 +2236,14 @@ void Serializer::writeDeclAttribute(const DeclAttribute *DA) {
return;
}
case DAK_Optimize: {
auto *theAttr = cast<OptimizeAttr>(DA);
auto abbrCode = DeclTypeAbbrCodes[OptimizeDeclAttrLayout::Code];
OptimizeDeclAttrLayout::emitRecord(Out, ScratchRecord, abbrCode,
(unsigned)theAttr->getMode());
return;
}
case DAK_Effects: {
auto *theAttr = cast<EffectsAttr>(DA);
auto abbrCode = DeclTypeAbbrCodes[EffectsDeclAttrLayout::Code];