[K/N] Enable proper LLVM IR dump and verify actions

Also introduce -Xsave-llvm-ir-directory argument
that should be used instead of -Xtemporary-files-dir
as a location for LLVM IR from phases.
Motivation for this change: it is simpler to implement
and unties LLVM actions from the awful TempFiles class.
This commit is contained in:
Sergey Bogolepov
2023-01-24 16:50:24 +02:00
committed by Space Team
parent 0febffedbd
commit 851d84a865
7 changed files with 114 additions and 28 deletions
@@ -279,7 +279,7 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xtemporary-files-dir", deprecatedName = "--temporary_files_dir", valueDescription = "<path>", description = "Save temporary files to the given directory")
var temporaryFilesDir: String? = null
@Argument(value = "-Xsave-llvm-ir-after", description = "Save result of Kotlin IR to LLVM IR translation to the temporary files directory.")
@Argument(value = "-Xsave-llvm-ir-after", description = "Save result of Kotlin IR to LLVM IR translation to -Xsave-llvm-ir-directory.")
var saveLlvmIrAfter: Array<String> = emptyArray()
@Argument(value = "-Xverify-bitcode", deprecatedName = "--verify_bitcode", description = "Verify llvm bitcode after each method")
@@ -408,6 +408,9 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xomit-framework-binary", description = "Omit binary when compiling framework")
var omitFrameworkBinary: Boolean = false
@Argument(value = "-Xsave-llvm-ir-directory", description = "Directory that should contain results of -Xsave-llvm-ir-after=<phase>")
var saveLlvmIrDirectory: String? = null
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> =
super.configureAnalysisFlags(collector, languageVersion).also {
val optInList = it[AnalysisFlags.optIn] as List<*>