[IR] Removed DFG serializer

This commit is contained in:
Igor Chevdar
2020-07-09 17:28:58 +05:00
parent 46f3348b27
commit 2f35bbec41
4 changed files with 6 additions and 1353 deletions
@@ -458,8 +458,6 @@ internal val bitcodePhase = NamedCompilerPhase(
description = "LLVM Bitcode generation",
lower = contextLLVMSetupPhase then
buildDFGPhase then
serializeDFGPhase then
deserializeDFGPhase then
devirtualizationPhase then
dcePhase then
createLLVMDeclarationsPhase then
@@ -524,9 +522,7 @@ internal fun PhaseConfig.disableUnless(phase: AnyNamedPhase, condition: Boolean)
internal fun PhaseConfig.konanPhasesConfig(config: KonanConfig) {
with(config.configuration) {
disable(compileTimeEvaluatePhase)
disable(deserializeDFGPhase)
disable(escapeAnalysisPhase)
disable(serializeDFGPhase)
// Don't serialize anything to a final executable.
disableUnless(serializerPhase, config.produce == CompilerOutputKind.LIBRARY)
@@ -98,18 +98,6 @@ internal val buildDFGPhase = makeKonanModuleOpPhase(
}
)
internal val deserializeDFGPhase = makeKonanModuleOpPhase(
name = "DeserializeDFG",
description = "Data flow graph deserializing",
op = { context, _ ->
context.externalModulesDFG = DFGSerializer.deserialize(
context,
context.moduleDFG!!.symbolTable.privateTypeIndex,
context.moduleDFG!!.symbolTable.privateFunIndex
)
}
)
internal val devirtualizationPhase = makeKonanModuleOpPhase(
name = "Devirtualization",
description = "Devirtualization",
@@ -215,7 +203,7 @@ internal val escapeAnalysisPhase = makeKonanModuleOpPhase(
// Disabled by default !!!!
name = "EscapeAnalysis",
description = "Escape analysis",
prerequisite = setOf(buildDFGPhase, deserializeDFGPhase), // TODO: Requires devirtualization.
prerequisite = setOf(buildDFGPhase, devirtualizationPhase),
op = { context, _ ->
context.externalModulesDFG?.let { externalModulesDFG ->
val callGraph = CallGraphBuilder(
@@ -240,15 +228,6 @@ internal val localEscapeAnalysisPhase = makeKonanModuleOpPhase(
}
)
internal val serializeDFGPhase = makeKonanModuleOpPhase(
name = "SerializeDFG",
description = "Data flow graph serializing",
prerequisite = setOf(buildDFGPhase), // TODO: Requires escape analysis.
op = { context, _ ->
DFGSerializer.serialize(context, context.moduleDFG!!)
}
)
internal val codegenPhase = makeKonanModuleOpPhase(
name = "Codegen",
description = "Code generation",
@@ -36,6 +36,11 @@ import org.jetbrains.kotlin.ir.visitors.acceptVoid
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.util.OperatorNameConventions
internal class ExternalModulesDFG(val allTypes: List<DataFlowIR.Type.Declared>,
val publicTypes: Map<Long, DataFlowIR.Type.Public>,
val publicFunctions: Map<Long, DataFlowIR.FunctionSymbol.Public>,
val functionDFGs: Map<DataFlowIR.FunctionSymbol, DataFlowIR.Function>)
private fun IrClass.getOverridingOf(function: IrFunction) = (function as? IrSimpleFunction)?.let {
it.allOverriddenFunctions.atMostOne { it.parent == this }
}