[K/N][codegen] Slightly refactored invocation of CAdapterGenerator
This commit is contained in:
+3
@@ -36,6 +36,9 @@ val KonanConfig.isFinalBinary: Boolean get() = when (this.produce) {
|
||||
CompilerOutputKind.FRAMEWORK -> !omitFrameworkBinary
|
||||
}
|
||||
|
||||
val CompilerOutputKind.isNativeLibrary: Boolean
|
||||
get() = this == CompilerOutputKind.DYNAMIC || this == CompilerOutputKind.STATIC
|
||||
|
||||
val CompilerOutputKind.involvesBitcodeGeneration: Boolean
|
||||
get() = this != CompilerOutputKind.LIBRARY
|
||||
|
||||
|
||||
-5
@@ -346,11 +346,6 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config) {
|
||||
|
||||
var referencedFunctions: Set<IrFunction>? = null
|
||||
|
||||
val isNativeLibrary: Boolean by lazy {
|
||||
val kind = config.configuration.get(KonanConfigKeys.PRODUCE)
|
||||
kind == CompilerOutputKind.DYNAMIC || kind == CompilerOutputKind.STATIC
|
||||
}
|
||||
|
||||
internal val stdlibModule
|
||||
get() = this.builtIns.any.module
|
||||
|
||||
|
||||
+3
-4
@@ -95,10 +95,8 @@ internal val objCExportPhase = konanUnitPhase(
|
||||
|
||||
internal val buildCExportsPhase = konanUnitPhase(
|
||||
op = {
|
||||
if (this.isNativeLibrary) {
|
||||
this.cAdapterGenerator = CAdapterGenerator(this).also {
|
||||
it.buildExports(this.symbolTable!!)
|
||||
}
|
||||
this.cAdapterGenerator = CAdapterGenerator(this).also {
|
||||
it.buildExports(this.symbolTable!!)
|
||||
}
|
||||
},
|
||||
name = "BuildCExports",
|
||||
@@ -481,6 +479,7 @@ internal fun PhaseConfig.konanPhasesConfig(config: KonanConfig) {
|
||||
disableUnless(saveAdditionalCacheInfoPhase, config.produce.isCache && config.lazyIrForCaches)
|
||||
disableUnless(finalizeCachePhase, config.produce.isCache)
|
||||
disableUnless(exportInternalAbiPhase, config.produce.isCache)
|
||||
disableUnless(buildCExportsPhase, config.produce.isNativeLibrary)
|
||||
disableIf(backendCodegen, config.produce == CompilerOutputKind.LIBRARY || config.omitFrameworkBinary || config.produce == CompilerOutputKind.PRELIMINARY_CACHE)
|
||||
disableUnless(checkExternalCallsPhase, getBoolean(KonanConfigKeys.CHECK_EXTERNAL_CALLS))
|
||||
disableUnless(rewriteExternalCallsCheckerGlobals, getBoolean(KonanConfigKeys.CHECK_EXTERNAL_CALLS))
|
||||
|
||||
+1
-1
@@ -443,7 +443,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
overrideRuntimeGlobals()
|
||||
appendLlvmUsed("llvm.used", context.llvm.usedFunctions + context.llvm.usedGlobals)
|
||||
appendLlvmUsed("llvm.compiler.used", context.llvm.compilerUsedGlobals)
|
||||
if (context.isNativeLibrary) {
|
||||
if (context.config.produce.isNativeLibrary) {
|
||||
appendCAdapters()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user