Add predicates to check if a SILModule is representing the (optimized) OnoneSupport

It is cleaner to use these predicates rather than checking for a complex condition in different places.
This commit is contained in:
Roman Levenstein
2017-09-29 10:59:06 -07:00
parent a8083a08eb
commit fb0761d97a
4 changed files with 20 additions and 4 deletions

View File

@@ -18,6 +18,7 @@
#include "swift/SIL/FormalLinkage.h"
#include "swift/SIL/SILDebugScope.h"
#include "swift/SIL/SILModule.h"
#include "swift/Strings.h"
#include "Linker.h"
#include "swift/SIL/SILVisitor.h"
#include "swift/SIL/SILValue.h"
@@ -750,3 +751,14 @@ bool SILModule::isNoReturnBuiltinOrIntrinsic(Identifier Name) {
return true;
}
}
/// Returns true if it is the OnoneSupport module.
bool SILModule::isOnoneSupportModule() const {
return getSwiftModule()->getName().str() == SWIFT_ONONE_SUPPORT;
}
/// Returns true if it is the optimized OnoneSupport module.
bool SILModule::isOptimizedOnoneSupportModule() const {
return getOptions().Optimization >= SILOptions::SILOptMode::Optimize &&
isOnoneSupportModule();
}