mirror of
https://github.com/irmen/prog8.git
synced 2026-04-19 04:17:08 +00:00
added '-keepIR' option to save the IR file if it's generated.
This commit is contained in:
@@ -21,11 +21,14 @@ class VmCodeGen(private val program: PtProgram,
|
||||
val irCodeGen = IRCodeGen(program, symbolTable, options, errors)
|
||||
val irProgram = irCodeGen.generate()
|
||||
|
||||
// TODO only write IR file if option is set to do so
|
||||
// create IR file on disk and read it back.
|
||||
IRFileWriter(irProgram).writeFile()
|
||||
val irProgram2 = IRFileReader(options.outputDir, irProgram.name).readFile()
|
||||
return VmAssemblyProgram(irProgram2.name, irProgram2)
|
||||
return if(options.keepIR) {
|
||||
//create IR file on disk and read it back.
|
||||
IRFileWriter(irProgram).writeFile()
|
||||
val irProgram2 = IRFileReader(options.outputDir, irProgram.name).readFile()
|
||||
VmAssemblyProgram(irProgram2.name, irProgram2)
|
||||
} else {
|
||||
VmAssemblyProgram(irProgram.name, irProgram)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user