Minor refactoring
This commit is contained in:
committed by
Sergey Bogolepov
parent
b8e31c2f6b
commit
a3c7dc8919
+6
-7
@@ -629,10 +629,6 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
}.toMap()
|
}.toMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shouldExportFunction(descriptor: FunctionDescriptor) =
|
|
||||||
descriptor.usedAnnotation
|
|
||||||
|| (context.isWasmTarget && descriptor.isExportedForCppRuntime())
|
|
||||||
|
|
||||||
override fun visitFunction(declaration: IrFunction) {
|
override fun visitFunction(declaration: IrFunction) {
|
||||||
context.log{"visitFunction : ${ir2string(declaration)}"}
|
context.log{"visitFunction : ${ir2string(declaration)}"}
|
||||||
val body = declaration.body
|
val body = declaration.body
|
||||||
@@ -659,14 +655,17 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val descriptor = declaration.descriptor
|
||||||
|
|
||||||
if (shouldExportFunction(declaration.descriptor)) {
|
// Preserve symbol from deletion if needed
|
||||||
context.llvm.usedFunctions.add(codegen.llvmFunction(declaration.descriptor))
|
if (descriptor.usedAnnotation
|
||||||
|
|| (context.isWasmTarget && descriptor.isExportedForCppRuntime())) {
|
||||||
|
context.llvm.usedFunctions += codegen.llvmFunction(descriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.shouldVerifyBitCode())
|
if (context.shouldVerifyBitCode())
|
||||||
verifyModule(context.llvmModule!!,
|
verifyModule(context.llvmModule!!,
|
||||||
"${declaration.descriptor.containingDeclaration}::${ir2string(declaration)}")
|
"${descriptor.containingDeclaration}::${ir2string(declaration)}")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun IrFunction.location(line: Int, column:Int) =
|
private fun IrFunction.location(line: Int, column:Int) =
|
||||||
|
|||||||
Reference in New Issue
Block a user