remove unused option

This commit is contained in:
Irmen de Jong 2019-01-20 17:50:30 +01:00
parent 2911e357bd
commit ba91ab13d5
2 changed files with 2 additions and 9 deletions

View File

@ -38,13 +38,10 @@ fun main(args: Array<String>) {
private fun compileMain(args: Array<String>) { private fun compileMain(args: Array<String>) {
var startEmu = false var startEmu = false
var asmTrace = false
var moduleFile = "" var moduleFile = ""
for (arg in args) { for (arg in args) {
if(arg=="--emu") if(arg=="--emu")
startEmu = true startEmu = true
else if(arg=="--asmtrace")
asmTrace = true
else if(!arg.startsWith("--")) else if(!arg.startsWith("--"))
moduleFile = arg moduleFile = arg
} }
@ -117,7 +114,7 @@ private fun compileMain(args: Array<String>) {
stackvmFile.close() stackvmFile.close()
println("StackVM program code written to '$stackVmFilename'") println("StackVM program code written to '$stackVmFilename'")
val assembly = AsmGen(compilerOptions, intermediate, heap, asmTrace).compileToAssembly() val assembly = AsmGen(compilerOptions, intermediate, heap).compileToAssembly()
assembly.assemble(compilerOptions) assembly.assemble(compilerOptions)
programname = assembly.name programname = assembly.name
} }
@ -188,7 +185,6 @@ fun determineCompilationOptions(moduleAst: Module): CompilationOptions {
private fun usage() { private fun usage() {
System.err.println("Missing argument(s):") System.err.println("Missing argument(s):")
System.err.println(" [--emu] auto-start the C64 emulator after successful compilation") System.err.println(" [--emu] auto-start the C64 emulator after successful compilation")
System.err.println(" [--asmtrace] print trace output of the AsmGen for debugging purposes")
System.err.println(" [--vm] launch the prog8 virtual machine instead of the compiler") System.err.println(" [--vm] launch the prog8 virtual machine instead of the compiler")
System.err.println(" modulefile main module file to compile") System.err.println(" modulefile main module file to compile")
exitProcess(1) exitProcess(1)

View File

@ -17,7 +17,7 @@ import kotlin.math.abs
class AssemblyError(msg: String) : RuntimeException(msg) class AssemblyError(msg: String) : RuntimeException(msg)
class AsmGen(val options: CompilationOptions, val program: IntermediateProgram, val heap: HeapValues, val trace: Boolean) { class AsmGen(val options: CompilationOptions, val program: IntermediateProgram, val heap: HeapValues) {
private val globalFloatConsts = mutableMapOf<Double, String>() private val globalFloatConsts = mutableMapOf<Double, String>()
private val assemblyLines = mutableListOf<String>() private val assemblyLines = mutableListOf<String>()
private lateinit var block: IntermediateProgram.ProgramBlock private lateinit var block: IntermediateProgram.ProgramBlock
@ -198,9 +198,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
val instructionPatternWindowSize = 8 // increase once patterns occur longer than this. val instructionPatternWindowSize = 8 // increase once patterns occur longer than this.
var processed = 0 var processed = 0
if(trace) println("BLOCK: ${block.scopedname} ${block.address ?: ""}")
for (ins in block.instructions.windowed(instructionPatternWindowSize, partialWindows = true)) { for (ins in block.instructions.windowed(instructionPatternWindowSize, partialWindows = true)) {
if(trace) println("\t${ins[0].toString().trim()}")
if (processed == 0) { if (processed == 0) {
processed = instr2asm(ins) processed = instr2asm(ins)
if (processed == 0) { if (processed == 0) {
@ -210,7 +208,6 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
} }
processed-- processed--
} }
if (trace) println("END BLOCK: ${block.scopedname}")
if(!blk.force_output) if(!blk.force_output)
out("\n\t.pend\n") out("\n\t.pend\n")
} }