Review fix
This commit is contained in:
+16
-11
@@ -357,8 +357,13 @@ val toplevelPhase: CompilerPhase<*, Unit, Unit> = namedUnitPhase(
|
|||||||
linkPhase
|
linkPhase
|
||||||
)
|
)
|
||||||
|
|
||||||
internal fun PhaseConfig.switchSoft(phase: AnyNamedPhase, onOff: Boolean) =
|
internal fun PhaseConfig.disableIf(phase: AnyNamedPhase, condition: Boolean) {
|
||||||
switch(phase, enabled.contains(phase) && onOff)
|
if (condition) disable(phase)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun PhaseConfig.disableUnless(phase: AnyNamedPhase, condition: Boolean) {
|
||||||
|
if (!condition) disable(phase)
|
||||||
|
}
|
||||||
|
|
||||||
internal fun PhaseConfig.konanPhasesConfig(config: KonanConfig) {
|
internal fun PhaseConfig.konanPhasesConfig(config: KonanConfig) {
|
||||||
with(config.configuration) {
|
with(config.configuration) {
|
||||||
@@ -368,14 +373,14 @@ internal fun PhaseConfig.konanPhasesConfig(config: KonanConfig) {
|
|||||||
disable(serializeDFGPhase)
|
disable(serializeDFGPhase)
|
||||||
|
|
||||||
// Don't serialize anything to a final executable.
|
// Don't serialize anything to a final executable.
|
||||||
switchSoft(serializerPhase, config.produce == CompilerOutputKind.LIBRARY)
|
disableUnless(serializerPhase, config.produce == CompilerOutputKind.LIBRARY)
|
||||||
switchSoft(dependenciesLowerPhase, config.produce != CompilerOutputKind.LIBRARY)
|
disableIf(dependenciesLowerPhase, config.produce == CompilerOutputKind.LIBRARY)
|
||||||
switchSoft(bitcodePhase, config.produce != CompilerOutputKind.LIBRARY)
|
disableIf(bitcodePhase, config.produce == CompilerOutputKind.LIBRARY)
|
||||||
switchSoft(linkPhase, config.produce.isNativeBinary)
|
disableUnless(linkPhase, config.produce.isNativeBinary)
|
||||||
switchSoft(testProcessorPhase, getNotNull(KonanConfigKeys.GENERATE_TEST_RUNNER) != TestRunnerKind.NONE)
|
disableIf(testProcessorPhase, getNotNull(KonanConfigKeys.GENERATE_TEST_RUNNER) == TestRunnerKind.NONE)
|
||||||
switchSoft(buildDFGPhase, getBoolean(KonanConfigKeys.OPTIMIZATION))
|
disableUnless(buildDFGPhase, getBoolean(KonanConfigKeys.OPTIMIZATION))
|
||||||
switchSoft(devirtualizationPhase, getBoolean(KonanConfigKeys.OPTIMIZATION))
|
disableUnless(devirtualizationPhase, getBoolean(KonanConfigKeys.OPTIMIZATION))
|
||||||
switchSoft(dcePhase, getBoolean(KonanConfigKeys.OPTIMIZATION))
|
disableUnless(dcePhase, getBoolean(KonanConfigKeys.OPTIMIZATION))
|
||||||
switchSoft(verifyBitcodePhase, config.needCompilerVerification || getBoolean(KonanConfigKeys.VERIFY_BITCODE))
|
disableUnless(verifyBitcodePhase, config.needCompilerVerification || getBoolean(KonanConfigKeys.VERIFY_BITCODE))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user