mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Unify the implementation of optimization mode in various option classes.
This commit is mostly refactoring.
*) Introduce a new OptimizationMode enum and use that in SILOptions and IRGenOptions
*) Allow the optimization mode also be specified for specific SILFunctions. This is not used in this commit yet and thus still a NFC.
Also, fixes a minor bug: we didn’t run mandatory IRGen passes for functions with @_semantics("optimize.sil.never")
This commit is contained in:
@@ -513,8 +513,7 @@ SILFunction *SILModule::findFunction(StringRef Name, SILLinkage Linkage) {
|
||||
// compilation, simply convert it into an external declaration,
|
||||
// so that a compiled version from the shared library is used.
|
||||
if (F->isDefinition() &&
|
||||
F->getModule().getOptions().Optimization <
|
||||
SILOptions::SILOptMode::Optimize) {
|
||||
!F->getModule().getOptions().shouldOptimize()) {
|
||||
F->convertToDeclaration();
|
||||
}
|
||||
if (F->isExternalDeclaration())
|
||||
@@ -769,8 +768,7 @@ bool SILModule::isOnoneSupportModule() const {
|
||||
|
||||
/// Returns true if it is the optimized OnoneSupport module.
|
||||
bool SILModule::isOptimizedOnoneSupportModule() const {
|
||||
return getOptions().Optimization >= SILOptions::SILOptMode::Optimize &&
|
||||
isOnoneSupportModule();
|
||||
return getOptions().shouldOptimize() && isOnoneSupportModule();
|
||||
}
|
||||
|
||||
void SILModule::setSerializeSILAction(SILModule::ActionCallback Action) {
|
||||
|
||||
Reference in New Issue
Block a user