Speed up large file compilation. (#308)

This commit is contained in:
Nikolay Igotti
2017-03-07 13:40:25 +03:00
committed by GitHub
parent 9845b589ea
commit 526c0dc924
4 changed files with 8 additions and 7 deletions
@@ -59,7 +59,7 @@ public class K2NativeCompilerArguments extends CommonCompilerArguments {
@Argument(value = "verify_descriptors", description = "Verify descriptor tree")
public boolean verifyDescriptors;
@Argument(value = "verify_bitcode", description = "Verify llvm bitcode")
@Argument(value = "verify_bitcode", description = "Verify llvm bitcode after each method")
public boolean verifyBitCode;
@Argument(value = "enable", description = "Enable backend phase")
@@ -106,7 +106,7 @@ internal class SpecialDescriptorsFactory(val context: Context) {
}
}
internal final class Context(val config: KonanConfig) : KonanBackendContext() {
internal class Context(val config: KonanConfig) : KonanBackendContext() {
var moduleDescriptor: ModuleDescriptor? = null
@@ -92,9 +92,9 @@ internal class PhaseManager(val context: Context) {
if (shouldVerifyIr()) {
verifyIr()
}
if (shouldVerifyBitCode()) {
verifyBitCode()
}
// We always verify bitcode to prevent hard to debug bugs.
verifyBitCode()
if (shouldPrintDescriptors()) {
printDescriptors()
@@ -64,7 +64,7 @@ internal fun verifyModule(llvmModule: LLVMModuleRef, current: String = "") {
// TODO: use LLVMDisposeMessage() on errorRef, once possible in interop.
if (LLVMVerifyModule(
llvmModule, LLVMVerifierFailureAction.LLVMPrintMessageAction, errorRef.ptr) == 1) {
if (current.length > 0)
if (current.isNotEmpty())
println("Error in ${current}")
LLVMDumpModule(llvmModule)
throw Error("Invalid module");
@@ -513,7 +513,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid
codegen.epilogue()
verifyModule(context.llvmModule!!,
if (context.shouldVerifyBitCode())
verifyModule(context.llvmModule!!,
"${declaration.descriptor.containingDeclaration}::${ir2string(declaration)}")
}