mirror of
https://github.com/irmen/prog8.git
synced 2025-01-11 13:29:45 +00:00
removed unused option 'keepIR'
This commit is contained in:
parent
c89e6ebfab
commit
d1d0115aed
@ -20,7 +20,6 @@ class CompilationOptions(val output: OutputType,
|
|||||||
var asmQuiet: Boolean = false,
|
var asmQuiet: Boolean = false,
|
||||||
var asmListfile: Boolean = false,
|
var asmListfile: Boolean = false,
|
||||||
var experimentalCodegen: Boolean = false,
|
var experimentalCodegen: Boolean = false,
|
||||||
var keepIR: Boolean = false,
|
|
||||||
var evalStackBaseAddress: UInt? = null,
|
var evalStackBaseAddress: UInt? = null,
|
||||||
var outputDir: Path = Path(""),
|
var outputDir: Path = Path(""),
|
||||||
var symbolDefs: Map<String, String> = emptyMap()
|
var symbolDefs: Map<String, String> = emptyMap()
|
||||||
|
@ -20,7 +20,6 @@ class VmCodeGen(private val program: PtProgram,
|
|||||||
val irCodeGen = IRCodeGen(program, symbolTable, options, errors)
|
val irCodeGen = IRCodeGen(program, symbolTable, options, errors)
|
||||||
val irProgram = irCodeGen.generate()
|
val irProgram = irCodeGen.generate()
|
||||||
|
|
||||||
// no need to check options.keepIR, as the VM file format *is* the IR file.
|
|
||||||
return VmAssemblyProgram(irProgram.name, irProgram)
|
return VmAssemblyProgram(irProgram.name, irProgram)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ private fun compileMain(args: Array<String>): Boolean {
|
|||||||
val startEmulator1 by cli.option(ArgType.Boolean, fullName = "emu", description = "auto-start emulator after successful compilation")
|
val startEmulator1 by cli.option(ArgType.Boolean, fullName = "emu", description = "auto-start emulator after successful compilation")
|
||||||
val startEmulator2 by cli.option(ArgType.Boolean, fullName = "emu2", description = "auto-start alternative emulator after successful compilation")
|
val startEmulator2 by cli.option(ArgType.Boolean, fullName = "emu2", description = "auto-start alternative emulator after successful compilation")
|
||||||
val experimentalCodegen by cli.option(ArgType.Boolean, fullName = "expericodegen", description = "use experimental/alternative codegen")
|
val experimentalCodegen by cli.option(ArgType.Boolean, fullName = "expericodegen", description = "use experimental/alternative codegen")
|
||||||
val keepIR by cli.option(ArgType.Boolean, fullName = "keepIR", description = "keep the IR code file (for targets that use it)")
|
|
||||||
val dontWriteAssembly by cli.option(ArgType.Boolean, fullName = "noasm", description="don't create assembly code")
|
val dontWriteAssembly by cli.option(ArgType.Boolean, fullName = "noasm", description="don't create assembly code")
|
||||||
val dontOptimize by cli.option(ArgType.Boolean, fullName = "noopt", description = "don't perform any optimizations")
|
val dontOptimize by cli.option(ArgType.Boolean, fullName = "noopt", description = "don't perform any optimizations")
|
||||||
val dontReinitGlobals by cli.option(ArgType.Boolean, fullName = "noreinit", description = "don't create code to reinitialize globals on multiple runs of the program (experimental)")
|
val dontReinitGlobals by cli.option(ArgType.Boolean, fullName = "noreinit", description = "don't create code to reinitialize globals on multiple runs of the program (experimental)")
|
||||||
@ -127,7 +126,6 @@ private fun compileMain(args: Array<String>): Boolean {
|
|||||||
quietAssembler == true,
|
quietAssembler == true,
|
||||||
asmListfile == true,
|
asmListfile == true,
|
||||||
experimentalCodegen == true,
|
experimentalCodegen == true,
|
||||||
keepIR == true,
|
|
||||||
compilationTarget,
|
compilationTarget,
|
||||||
evalStackAddr,
|
evalStackAddr,
|
||||||
processedSymbols,
|
processedSymbols,
|
||||||
@ -192,7 +190,6 @@ private fun compileMain(args: Array<String>): Boolean {
|
|||||||
quietAssembler == true,
|
quietAssembler == true,
|
||||||
asmListfile == true,
|
asmListfile == true,
|
||||||
experimentalCodegen == true,
|
experimentalCodegen == true,
|
||||||
keepIR == true,
|
|
||||||
compilationTarget,
|
compilationTarget,
|
||||||
evalStackAddr,
|
evalStackAddr,
|
||||||
processedSymbols,
|
processedSymbols,
|
||||||
|
@ -38,7 +38,6 @@ class CompilerArguments(val filepath: Path,
|
|||||||
val quietAssembler: Boolean,
|
val quietAssembler: Boolean,
|
||||||
val asmListfile: Boolean,
|
val asmListfile: Boolean,
|
||||||
val experimentalCodegen: Boolean,
|
val experimentalCodegen: Boolean,
|
||||||
val keepIR: Boolean,
|
|
||||||
val compilationTarget: String,
|
val compilationTarget: String,
|
||||||
val evalStackBaseAddress: UInt?,
|
val evalStackBaseAddress: UInt?,
|
||||||
val symbolDefs: Map<String, String>,
|
val symbolDefs: Map<String, String>,
|
||||||
@ -81,7 +80,6 @@ fun compileProgram(args: CompilerArguments): CompilationResult? {
|
|||||||
asmQuiet = args.quietAssembler
|
asmQuiet = args.quietAssembler
|
||||||
asmListfile = args.asmListfile
|
asmListfile = args.asmListfile
|
||||||
experimentalCodegen = args.experimentalCodegen
|
experimentalCodegen = args.experimentalCodegen
|
||||||
keepIR = args.keepIR
|
|
||||||
evalStackBaseAddress = args.evalStackBaseAddress
|
evalStackBaseAddress = args.evalStackBaseAddress
|
||||||
outputDir = args.outputDir.normalize()
|
outputDir = args.outputDir.normalize()
|
||||||
symbolDefs = args.symbolDefs
|
symbolDefs = args.symbolDefs
|
||||||
|
@ -33,7 +33,6 @@ private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilat
|
|||||||
quietAssembler = true,
|
quietAssembler = true,
|
||||||
asmListfile = false,
|
asmListfile = false,
|
||||||
experimentalCodegen = false,
|
experimentalCodegen = false,
|
||||||
keepIR = false,
|
|
||||||
compilationTarget = target.name,
|
compilationTarget = target.name,
|
||||||
evalStackBaseAddress = null,
|
evalStackBaseAddress = null,
|
||||||
symbolDefs = emptyMap(),
|
symbolDefs = emptyMap(),
|
||||||
@ -189,8 +188,8 @@ class TestCompilerOnExamplesVirtual: FunSpec({
|
|||||||
val (displayName, filepath) = prepareTestFiles(it, false, target)
|
val (displayName, filepath) = prepareTestFiles(it, false, target)
|
||||||
test(displayName) {
|
test(displayName) {
|
||||||
val src = filepath.readText()
|
val src = filepath.readText()
|
||||||
compileText(target, false, src, writeAssembly = true, keepIR=false) shouldNotBe null
|
compileText(target, false, src, writeAssembly = true) shouldNotBe null
|
||||||
compileText(target, false, src, writeAssembly = true, keepIR=true) shouldNotBe null
|
compileText(target, false, src, writeAssembly = true) shouldNotBe null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -50,7 +50,6 @@ class TestCompilerOptionSourcedirs: FunSpec({
|
|||||||
quietAssembler = true,
|
quietAssembler = true,
|
||||||
asmListfile = false,
|
asmListfile = false,
|
||||||
experimentalCodegen = false,
|
experimentalCodegen = false,
|
||||||
keepIR = false,
|
|
||||||
compilationTarget = Cx16Target.NAME,
|
compilationTarget = Cx16Target.NAME,
|
||||||
evalStackBaseAddress = null,
|
evalStackBaseAddress = null,
|
||||||
symbolDefs = emptyMap(),
|
symbolDefs = emptyMap(),
|
||||||
|
@ -17,7 +17,6 @@ internal fun compileFile(
|
|||||||
outputDir: Path = prog8tests.helpers.outputDir,
|
outputDir: Path = prog8tests.helpers.outputDir,
|
||||||
errors: IErrorReporter? = null,
|
errors: IErrorReporter? = null,
|
||||||
writeAssembly: Boolean = true,
|
writeAssembly: Boolean = true,
|
||||||
keepIR: Boolean = true,
|
|
||||||
optFloatExpr: Boolean = true
|
optFloatExpr: Boolean = true
|
||||||
) : CompilationResult? {
|
) : CompilationResult? {
|
||||||
val filepath = fileDir.resolve(fileName)
|
val filepath = fileDir.resolve(fileName)
|
||||||
@ -32,7 +31,6 @@ internal fun compileFile(
|
|||||||
quietAssembler = true,
|
quietAssembler = true,
|
||||||
asmListfile = false,
|
asmListfile = false,
|
||||||
experimentalCodegen = false,
|
experimentalCodegen = false,
|
||||||
keepIR = keepIR,
|
|
||||||
platform.name,
|
platform.name,
|
||||||
evalStackBaseAddress = null,
|
evalStackBaseAddress = null,
|
||||||
symbolDefs = emptyMap(),
|
symbolDefs = emptyMap(),
|
||||||
@ -53,12 +51,11 @@ internal fun compileText(
|
|||||||
sourceText: String,
|
sourceText: String,
|
||||||
errors: IErrorReporter? = null,
|
errors: IErrorReporter? = null,
|
||||||
writeAssembly: Boolean = true,
|
writeAssembly: Boolean = true,
|
||||||
keepIR: Boolean = true,
|
|
||||||
optFloatExpr: Boolean = true
|
optFloatExpr: Boolean = true
|
||||||
) : CompilationResult? {
|
) : CompilationResult? {
|
||||||
val filePath = outputDir.resolve("on_the_fly_test_" + sourceText.hashCode().toUInt().toString(16) + ".p8")
|
val filePath = outputDir.resolve("on_the_fly_test_" + sourceText.hashCode().toUInt().toString(16) + ".p8")
|
||||||
// we don't assumeNotExists(filePath) - should be ok to just overwrite it
|
// we don't assumeNotExists(filePath) - should be ok to just overwrite it
|
||||||
filePath.toFile().writeText(sourceText)
|
filePath.toFile().writeText(sourceText)
|
||||||
return compileFile(platform, optimize, filePath.parent, filePath.name,
|
return compileFile(platform, optimize, filePath.parent, filePath.name,
|
||||||
errors=errors, writeAssembly=writeAssembly, optFloatExpr = optFloatExpr, keepIR=keepIR)
|
errors=errors, writeAssembly=writeAssembly, optFloatExpr = optFloatExpr)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ main {
|
|||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
val othertarget = Cx16Target()
|
val othertarget = Cx16Target()
|
||||||
compileText(othertarget, true, src, writeAssembly = true, keepIR=true) shouldNotBe null
|
compileText(othertarget, true, src, writeAssembly = true) shouldNotBe null
|
||||||
val target = VMTarget()
|
val target = VMTarget()
|
||||||
val result = compileText(target, true, src, writeAssembly = true)!!
|
val result = compileText(target, true, src, writeAssembly = true)!!
|
||||||
val virtfile = result.compilationOptions.outputDir.resolve(result.program.name + ".p8ir")
|
val virtfile = result.compilationOptions.outputDir.resolve(result.program.name + ".p8ir")
|
||||||
@ -162,7 +162,7 @@ skipLABEL:
|
|||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
val othertarget = Cx16Target()
|
val othertarget = Cx16Target()
|
||||||
compileText(othertarget, true, src, writeAssembly = true, keepIR=true) shouldNotBe null
|
compileText(othertarget, true, src, writeAssembly = true) shouldNotBe null
|
||||||
val target = VMTarget()
|
val target = VMTarget()
|
||||||
val result = compileText(target, true, src, writeAssembly = true)!!
|
val result = compileText(target, true, src, writeAssembly = true)!!
|
||||||
val virtfile = result.compilationOptions.outputDir.resolve(result.program.name + ".p8ir")
|
val virtfile = result.compilationOptions.outputDir.resolve(result.program.name + ".p8ir")
|
||||||
@ -205,7 +205,7 @@ main {
|
|||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
val othertarget = Cx16Target()
|
val othertarget = Cx16Target()
|
||||||
compileText(othertarget, true, src, writeAssembly = true, keepIR=true) shouldNotBe null
|
compileText(othertarget, true, src, writeAssembly = true) shouldNotBe null
|
||||||
|
|
||||||
val target = VMTarget()
|
val target = VMTarget()
|
||||||
val result = compileText(target, false, src, writeAssembly = true)!!
|
val result = compileText(target, false, src, writeAssembly = true)!!
|
||||||
@ -232,7 +232,7 @@ main {
|
|||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
val othertarget = Cx16Target()
|
val othertarget = Cx16Target()
|
||||||
compileText(othertarget, true, src, writeAssembly = true, keepIR=true) shouldNotBe null
|
compileText(othertarget, true, src, writeAssembly = true) shouldNotBe null
|
||||||
|
|
||||||
val target = VMTarget()
|
val target = VMTarget()
|
||||||
val result = compileText(target, false, src, writeAssembly = true)!!
|
val result = compileText(target, false, src, writeAssembly = true)!!
|
||||||
@ -260,7 +260,7 @@ mylabel:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
val othertarget = Cx16Target()
|
val othertarget = Cx16Target()
|
||||||
compileText(othertarget, true, src, writeAssembly = true, keepIR=true) shouldNotBe null
|
compileText(othertarget, true, src, writeAssembly = true) shouldNotBe null
|
||||||
|
|
||||||
val target = VMTarget()
|
val target = VMTarget()
|
||||||
val result = compileText(target, false, src, writeAssembly = true)!!
|
val result = compileText(target, false, src, writeAssembly = true)!!
|
||||||
|
@ -166,9 +166,6 @@ One or more .p8 module files
|
|||||||
``-asmlist``
|
``-asmlist``
|
||||||
Generate an assembler listing file as well.
|
Generate an assembler listing file as well.
|
||||||
|
|
||||||
``-keepIR``
|
|
||||||
Keep the IR code in a file (for targets that use it).
|
|
||||||
|
|
||||||
``-expericodegen``
|
``-expericodegen``
|
||||||
Use experimental code generation backend (*incomplete*).
|
Use experimental code generation backend (*incomplete*).
|
||||||
|
|
||||||
|
@ -42,8 +42,7 @@ class RequestParser : Take {
|
|||||||
symbolDefs = emptyMap(),
|
symbolDefs = emptyMap(),
|
||||||
quietAssembler = false,
|
quietAssembler = false,
|
||||||
asmListfile = false,
|
asmListfile = false,
|
||||||
experimentalCodegen = false,
|
experimentalCodegen = false
|
||||||
keepIR = false
|
|
||||||
)
|
)
|
||||||
val compilationResult = compileProgram(args)
|
val compilationResult = compileProgram(args)
|
||||||
return RsJson(Jsonding())
|
return RsJson(Jsonding())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user