mirror of
https://github.com/irmen/prog8.git
synced 2026-04-19 20:16:51 +00:00
IR support for instructions operating on cpu regs
This commit is contained in:
@@ -24,8 +24,7 @@ class AssemblyProgram(override val name: String, private val allocations: Variab
|
||||
println("write code to $outfile")
|
||||
outfile.bufferedWriter().use { out ->
|
||||
allocations.asVmMemory().forEach { (name, alloc) ->
|
||||
out.write("; ${name.joinToString(".")}\n")
|
||||
out.write(alloc + "\n")
|
||||
out.write("var ${name.joinToString(".")} $alloc\n")
|
||||
}
|
||||
out.write("------PROGRAM------\n")
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class VariableAllocator(private val st: SymbolTable, private val program: PtProg
|
||||
}
|
||||
else -> throw InternalCompilerException("weird dt")
|
||||
}
|
||||
mm.add(Pair(variable.scopedName, "$location $typeStr $value"))
|
||||
mm.add(Pair(variable.scopedName, "@$location $typeStr $value"))
|
||||
}
|
||||
for (variable in st.allMemMappedVariables) {
|
||||
val location = allocations.getValue(variable.scopedName)
|
||||
@@ -100,7 +100,7 @@ class VariableAllocator(private val st: SymbolTable, private val program: PtProg
|
||||
in ArrayDatatypes -> (1..variable.length!!).joinToString(",") { "0" }
|
||||
else -> throw InternalCompilerException("weird dt for mem mapped var")
|
||||
}
|
||||
mm.add(Pair(variable.scopedName, "$location $typeStr $value"))
|
||||
mm.add(Pair(variable.scopedName, "@$location $typeStr $value"))
|
||||
}
|
||||
return mm
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user