[K/N] Re-enable lowering prerequisites
This commit is contained in:
committed by
Space Team
parent
4c11f6ff30
commit
c828ac6167
+59
-59
@@ -278,25 +278,39 @@ private val testProcessorPhase = createFileLoweringPhase(
|
|||||||
description = "Unit test processor"
|
description = "Unit test processor"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val delegationPhase = createFileLoweringPhase(
|
||||||
|
lowering = ::PropertyDelegationLowering,
|
||||||
|
name = "Delegation",
|
||||||
|
description = "Delegation lowering",
|
||||||
|
prerequisite = setOf(volatilePhase)
|
||||||
|
)
|
||||||
|
|
||||||
|
private val functionReferencePhase = createFileLoweringPhase(
|
||||||
|
lowering = ::FunctionReferenceLowering,
|
||||||
|
name = "FunctionReference",
|
||||||
|
description = "Function references lowering",
|
||||||
|
prerequisite = setOf(delegationPhase, localFunctionsPhase) // TODO: make weak dependency on `testProcessorPhase`
|
||||||
|
)
|
||||||
|
|
||||||
private val enumWhenPhase = createFileLoweringPhase(
|
private val enumWhenPhase = createFileLoweringPhase(
|
||||||
::NativeEnumWhenLowering,
|
::NativeEnumWhenLowering,
|
||||||
name = "EnumWhen",
|
name = "EnumWhen",
|
||||||
description = "Enum when lowering",
|
description = "Enum when lowering",
|
||||||
// prerequisite = setOf(enumConstructorsPhase, functionReferencePhase)
|
prerequisite = setOf(enumConstructorsPhase, functionReferencePhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val enumClassPhase = createFileLoweringPhase(
|
private val enumClassPhase = createFileLoweringPhase(
|
||||||
::EnumClassLowering,
|
::EnumClassLowering,
|
||||||
name = "Enums",
|
name = "Enums",
|
||||||
description = "Enum classes lowering",
|
description = "Enum classes lowering",
|
||||||
// prerequisite = setOf(enumConstructorsPhase, functionReferencePhase, enumWhenPhase) // TODO: make weak dependency on `testProcessorPhase`
|
prerequisite = setOf(enumConstructorsPhase, functionReferencePhase, enumWhenPhase) // TODO: make weak dependency on `testProcessorPhase`
|
||||||
)
|
)
|
||||||
|
|
||||||
private val enumUsagePhase = createFileLoweringPhase(
|
private val enumUsagePhase = createFileLoweringPhase(
|
||||||
::EnumUsageLowering,
|
::EnumUsageLowering,
|
||||||
name = "EnumUsage",
|
name = "EnumUsage",
|
||||||
description = "Enum usage lowering",
|
description = "Enum usage lowering",
|
||||||
// prerequisite = setOf(enumConstructorsPhase, functionReferencePhase, enumClassPhase)
|
prerequisite = setOf(enumConstructorsPhase, functionReferencePhase, enumClassPhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -304,7 +318,7 @@ private val singleAbstractMethodPhase = createFileLoweringPhase(
|
|||||||
::NativeSingleAbstractMethodLowering,
|
::NativeSingleAbstractMethodLowering,
|
||||||
name = "SingleAbstractMethod",
|
name = "SingleAbstractMethod",
|
||||||
description = "Replace SAM conversions with instances of interface-implementing classes",
|
description = "Replace SAM conversions with instances of interface-implementing classes",
|
||||||
// prerequisite = setOf(functionReferencePhase)
|
prerequisite = setOf(functionReferencePhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val builtinOperatorPhase = createFileLoweringPhase(
|
private val builtinOperatorPhase = createFileLoweringPhase(
|
||||||
@@ -314,18 +328,54 @@ private val builtinOperatorPhase = createFileLoweringPhase(
|
|||||||
prerequisite = setOf(defaultParameterExtentPhase, singleAbstractMethodPhase, enumWhenPhase)
|
prerequisite = setOf(defaultParameterExtentPhase, singleAbstractMethodPhase, enumWhenPhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val inlinePhase = createFileLoweringPhase(
|
||||||
|
lowering = { context: NativeGenerationState ->
|
||||||
|
object : FileLoweringPass {
|
||||||
|
override fun lower(irFile: IrFile) {
|
||||||
|
FunctionInlining(context.context, NativeInlineFunctionResolver(context.context, context)).lower(irFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name = "Inline",
|
||||||
|
description = "Functions inlining",
|
||||||
|
prerequisite = setOf(lowerBeforeInlinePhase, arrayConstructorPhase, extractLocalClassesFromInlineBodies)
|
||||||
|
)
|
||||||
|
|
||||||
|
private val interopPhase = createFileLoweringPhase(
|
||||||
|
lowering = ::InteropLowering,
|
||||||
|
name = "Interop",
|
||||||
|
description = "Interop lowering",
|
||||||
|
prerequisite = setOf(inlinePhase, localFunctionsPhase, functionReferencePhase)
|
||||||
|
)
|
||||||
|
|
||||||
private val varargPhase = createFileLoweringPhase(
|
private val varargPhase = createFileLoweringPhase(
|
||||||
::VarargInjectionLowering,
|
::VarargInjectionLowering,
|
||||||
name = "Vararg",
|
name = "Vararg",
|
||||||
description = "Vararg lowering",
|
description = "Vararg lowering",
|
||||||
// prerequisite = setOf(functionReferencePhase, defaultParameterExtentPhase, interopPhase, functionsWithoutBoundCheck)
|
prerequisite = setOf(functionReferencePhase, defaultParameterExtentPhase, interopPhase, functionsWithoutBoundCheck)
|
||||||
|
)
|
||||||
|
|
||||||
|
private val coroutinesPhase = createFileLoweringPhase(
|
||||||
|
lowering = { context: NativeGenerationState ->
|
||||||
|
object : FileLoweringPass {
|
||||||
|
override fun lower(irFile: IrFile) {
|
||||||
|
NativeSuspendFunctionsLowering(context).lower(irFile)
|
||||||
|
AddContinuationToNonLocalSuspendFunctionsLowering(context.context).lower(irFile)
|
||||||
|
NativeAddContinuationToFunctionCallsLowering(context.context).lower(irFile)
|
||||||
|
AddFunctionSupertypeToSuspendFunctionLowering(context.context).lower(irFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name = "Coroutines",
|
||||||
|
description = "Coroutines lowering",
|
||||||
|
prerequisite = setOf(localFunctionsPhase, finallyBlocksPhase, kotlinNothingValueExceptionPhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val typeOperatorPhase = createFileLoweringPhase(
|
private val typeOperatorPhase = createFileLoweringPhase(
|
||||||
::TypeOperatorLowering,
|
::TypeOperatorLowering,
|
||||||
name = "TypeOperators",
|
name = "TypeOperators",
|
||||||
description = "Type operators lowering",
|
description = "Type operators lowering",
|
||||||
// prerequisite = setOf(coroutinesPhase)
|
prerequisite = setOf(coroutinesPhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val bridgesPhase = createFileLoweringPhase(
|
private val bridgesPhase = createFileLoweringPhase(
|
||||||
@@ -335,14 +385,14 @@ private val bridgesPhase = createFileLoweringPhase(
|
|||||||
},
|
},
|
||||||
name = "Bridges",
|
name = "Bridges",
|
||||||
description = "Bridges building",
|
description = "Bridges building",
|
||||||
// prerequisite = setOf(coroutinesPhase)
|
prerequisite = setOf(coroutinesPhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val autoboxPhase = createFileLoweringPhase(
|
private val autoboxPhase = createFileLoweringPhase(
|
||||||
::Autoboxing,
|
::Autoboxing,
|
||||||
name = "Autobox",
|
name = "Autobox",
|
||||||
description = "Autoboxing of primitive types",
|
description = "Autoboxing of primitive types",
|
||||||
// prerequisite = setOf(bridgesPhase, coroutinesPhase)
|
prerequisite = setOf(bridgesPhase, coroutinesPhase)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val expressionBodyTransformPhase = createFileLoweringPhase(
|
private val expressionBodyTransformPhase = createFileLoweringPhase(
|
||||||
@@ -392,7 +442,7 @@ private val exportInternalAbiPhase = createFileLoweringPhase(
|
|||||||
internal val ReturnsInsertionPhase = createFileLoweringPhase(
|
internal val ReturnsInsertionPhase = createFileLoweringPhase(
|
||||||
name = "ReturnsInsertion",
|
name = "ReturnsInsertion",
|
||||||
description = "Returns insertion for Unit functions",
|
description = "Returns insertion for Unit functions",
|
||||||
//prerequisite = setOf(autoboxPhase, coroutinesPhase, enumClassPhase), TODO: if there are no files in the module, this requirement fails.
|
prerequisite = setOf(autoboxPhase, coroutinesPhase, enumClassPhase), // TODO: if there are no files in the module, this requirement fails.
|
||||||
lowering = ::ReturnsInsertionLowering,
|
lowering = ::ReturnsInsertionLowering,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -420,33 +470,6 @@ internal val UnboxInlinePhase = createFileLoweringPhase(
|
|||||||
lowering = ::UnboxInlineLowering,
|
lowering = ::UnboxInlineLowering,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val inlinePhase = createFileLoweringPhase(
|
|
||||||
lowering = { context: NativeGenerationState ->
|
|
||||||
object : FileLoweringPass {
|
|
||||||
override fun lower(irFile: IrFile) {
|
|
||||||
FunctionInlining(context.context, NativeInlineFunctionResolver(context.context, context)).lower(irFile)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
name = "Inline",
|
|
||||||
description = "Functions inlining",
|
|
||||||
// prerequisite = setOf(lowerBeforeInlinePhase, arrayConstructorPhase, extractLocalClassesFromInlineBodies)
|
|
||||||
)
|
|
||||||
|
|
||||||
private val delegationPhase = createFileLoweringPhase(
|
|
||||||
lowering = ::PropertyDelegationLowering,
|
|
||||||
name = "Delegation",
|
|
||||||
description = "Delegation lowering"
|
|
||||||
// prerequisite = setOf(volatilePhase)
|
|
||||||
)
|
|
||||||
|
|
||||||
private val functionReferencePhase = createFileLoweringPhase(
|
|
||||||
lowering = ::FunctionReferenceLowering,
|
|
||||||
name = "FunctionReference",
|
|
||||||
description = "Function references lowering",
|
|
||||||
// prerequisite = setOf(delegationPhase, localFunctionsPhase) // TODO: make weak dependency on `testProcessorPhase`
|
|
||||||
)
|
|
||||||
|
|
||||||
private val inventNamesForLocalClasses = createFileLoweringPhase(
|
private val inventNamesForLocalClasses = createFileLoweringPhase(
|
||||||
lowering = ::NativeInventNamesForLocalClasses,
|
lowering = ::NativeInventNamesForLocalClasses,
|
||||||
name = "InventNamesForLocalClasses",
|
name = "InventNamesForLocalClasses",
|
||||||
@@ -469,29 +492,6 @@ private val objectClassesPhase = createFileLoweringPhase(
|
|||||||
description = "Object classes lowering"
|
description = "Object classes lowering"
|
||||||
)
|
)
|
||||||
|
|
||||||
private val coroutinesPhase = createFileLoweringPhase(
|
|
||||||
lowering = { context: NativeGenerationState ->
|
|
||||||
object : FileLoweringPass {
|
|
||||||
override fun lower(irFile: IrFile) {
|
|
||||||
NativeSuspendFunctionsLowering(context).lower(irFile)
|
|
||||||
AddContinuationToNonLocalSuspendFunctionsLowering(context.context).lower(irFile)
|
|
||||||
NativeAddContinuationToFunctionCallsLowering(context.context).lower(irFile)
|
|
||||||
AddFunctionSupertypeToSuspendFunctionLowering(context.context).lower(irFile)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
name = "Coroutines",
|
|
||||||
description = "Coroutines lowering",
|
|
||||||
// prerequisite = setOf(localFunctionsPhase, finallyBlocksPhase, kotlinNothingValueExceptionPhase)
|
|
||||||
)
|
|
||||||
|
|
||||||
private val interopPhase = createFileLoweringPhase(
|
|
||||||
lowering = ::InteropLowering,
|
|
||||||
name = "Interop",
|
|
||||||
description = "Interop lowering",
|
|
||||||
// prerequisite = setOf(inlinePhase, localFunctionsPhase, functionReferencePhase)
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun PhaseEngine<NativeGenerationState>.getAllLowerings() = listOfNotNull<AbstractNamedCompilerPhase<NativeGenerationState, IrFile, IrFile>>(
|
private fun PhaseEngine<NativeGenerationState>.getAllLowerings() = listOfNotNull<AbstractNamedCompilerPhase<NativeGenerationState, IrFile, IrFile>>(
|
||||||
removeExpectDeclarationsPhase,
|
removeExpectDeclarationsPhase,
|
||||||
stripTypeAliasDeclarationsPhase,
|
stripTypeAliasDeclarationsPhase,
|
||||||
|
|||||||
Reference in New Issue
Block a user