Split LINK_STAGE phase into OBJECT_FILES and LINKER sub-phases,
to be able to measure lcc/lto time separately from ld time.
This commit is contained in:
committed by
alexander-gorshenev
parent
e197573e3e
commit
2071414079
+1
-1
@@ -87,7 +87,7 @@ public fun runTopLevelPhases(konanConfig: KonanConfig, environment: KotlinCoreEn
|
||||
}
|
||||
}
|
||||
|
||||
phaser.phase(KonanPhase.LINKER) {
|
||||
phaser.phase(KonanPhase.LINK_STAGE) {
|
||||
LinkStage(context).linkStage()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -34,7 +34,9 @@ enum class KonanPhase(val description: String,
|
||||
/* ... ... */ RTTI("RTTI Generation"),
|
||||
/* ... ... */ CODEGEN("Code Generation"),
|
||||
/* ... ... */ METADATOR("Metadata Generation"),
|
||||
/* */ LINKER("Link Stage");
|
||||
/* */ LINK_STAGE("Link stage"),
|
||||
/* ... */ OBJECT_FILES("Bitcode to object file"),
|
||||
/* ... */ LINKER("Linker");
|
||||
|
||||
val prerequisite = prerequisite.toSet()
|
||||
}
|
||||
@@ -61,7 +63,7 @@ object KonanPhases {
|
||||
verbose?.forEach { phases[known(it)]!!.verbose = true }
|
||||
|
||||
if (get(NOLINK) ?: false ) {
|
||||
KonanPhase.LINKER.enabled = false
|
||||
KonanPhase.LINK_STAGE.enabled = false
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
||||
+14
-8
@@ -262,16 +262,22 @@ internal class LinkStage(val context: Context) {
|
||||
fun linkStage() {
|
||||
context.log("# Compiler root: ${distribution.konanHome}")
|
||||
|
||||
val bitcodeFiles = listOf<BitcodeFile>(emitted, distribution.start, distribution.runtime,
|
||||
distribution.launcher) + libraries
|
||||
val bitcodeFiles = listOf<BitcodeFile>(emitted, distribution.start,
|
||||
distribution.runtime, distribution.launcher) + libraries
|
||||
|
||||
val objectFiles = if (optimize) {
|
||||
listOf( llvmLto(bitcodeFiles ) )
|
||||
} else {
|
||||
bitcodeFiles.map{ it -> llvmLlc(it) }
|
||||
var objectFiles: List<String> = listOf()
|
||||
|
||||
val phaser = PhaseManager(context)
|
||||
phaser.phase(KonanPhase.OBJECT_FILES) {
|
||||
objectFiles = if (optimize) {
|
||||
listOf( llvmLto(bitcodeFiles ) )
|
||||
} else {
|
||||
bitcodeFiles.map{ it -> llvmLlc(it) }
|
||||
}
|
||||
}
|
||||
phaser.phase(KonanPhase.LINKER) {
|
||||
val executable = link(objectFiles)
|
||||
}
|
||||
|
||||
val executable = link(objectFiles)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user