[K/N] Add option to save unoptimized bitcode

Add `-Xsave-llvm-ir` option that stores LLVM IR text into temporary
directory right after IrToBitcode translation. This is required for
FileCheck-based tests and just helpful during development.
This commit is contained in:
Sergey Bogolepov
2021-09-29 13:48:22 +07:00
committed by Space
parent a1424489b7
commit 7a3f33ad0b
4 changed files with 21 additions and 2 deletions
@@ -175,6 +175,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
arguments.manifestFile ?.let{ put(MANIFEST_FILE, it) }
arguments.runtimeFile ?.let{ put(RUNTIME_FILE, it) }
arguments.temporaryFilesDir?.let { put(TEMPORARY_FILES_DIR, it) }
put(SAVE_LLVM_IR, arguments.saveLlvmIr)
put(LIST_TARGETS, arguments.listTargets)
put(OPTIMIZATION, arguments.optimization)
@@ -255,6 +255,9 @@ 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", description = "Save result of Kotlin IR to LLVM IR translation to the temporary files directory.")
var saveLlvmIr: Boolean = false
@Argument(value = "-Xverify-bitcode", deprecatedName = "--verify_bitcode", description = "Verify llvm bitcode after each method")
var verifyBitCode: Boolean = false