%align directive and @align64

This commit is contained in:
Irmen de Jong
2024-10-26 20:13:45 +02:00
parent 9317cf8a35
commit c9535049c8
31 changed files with 137 additions and 173 deletions
@@ -234,6 +234,7 @@ class IRCodeGen(
chunk += IRInstruction(Opcode.BREAKPOINT)
listOf(chunk)
}
is PtAlign -> TODO("ir support for inline %align")
is PtConditionalBranch -> translate(node)
is PtInlineAssembly -> listOf(IRInlineAsmChunk(null, node.assembly, node.isIR, null))
is PtIncludeBinary -> listOf(IRInlineBinaryChunk(null, readBinaryData(node), null))
@@ -254,7 +255,7 @@ class IRCodeGen(
is PtBool,
is PtArray,
is PtBlock,
is PtDefer -> throw AssemblyError("defer should have been transformed")
is PtDefer -> throw AssemblyError("should have been transformed")
is PtString -> throw AssemblyError("should not occur as separate statement node ${node.position}")
is PtSub -> throw AssemblyError("nested subroutines should have been flattened ${node.position}")
else -> TODO("missing codegen for $node")
@@ -1675,6 +1676,7 @@ class IRCodeGen(
is PtNop -> { /* nothing */ }
is PtAssignment, is PtAugmentedAssign -> { /* global variable initialization is done elsewhere */ }
is PtVariable, is PtConstant, is PtMemMapped -> { /* vars should be looked up via symbol table */ }
is PtAlign -> TODO("ir support for inline %align")
is PtSub -> {
val sub = IRSubroutine(child.name, translate(child.parameters), child.returntype, child.position)
for (subchild in child.children) {
+10 -10
View File
@@ -48,7 +48,7 @@ class TestVmCodeGen: FunSpec({
"pi",
DataType.UBYTE,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
PtNumber(DataType.UBYTE, 0.0, Position.DUMMY),
null,
Position.DUMMY
@@ -57,7 +57,7 @@ class TestVmCodeGen: FunSpec({
"particleX",
DataType.ARRAY_UB,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
null,
3u,
Position.DUMMY
@@ -66,7 +66,7 @@ class TestVmCodeGen: FunSpec({
"particleDX",
DataType.ARRAY_UB,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
null,
3u,
Position.DUMMY
@@ -75,7 +75,7 @@ class TestVmCodeGen: FunSpec({
"xx",
DataType.WORD,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
PtNumber(DataType.WORD, 1.0, Position.DUMMY),
null,
Position.DUMMY
@@ -159,7 +159,7 @@ class TestVmCodeGen: FunSpec({
"f1",
DataType.FLOAT,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
null,
null,
Position.DUMMY
@@ -230,7 +230,7 @@ class TestVmCodeGen: FunSpec({
"f1",
DataType.FLOAT,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
null,
null,
Position.DUMMY
@@ -297,7 +297,7 @@ class TestVmCodeGen: FunSpec({
"f1",
DataType.FLOAT,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
null,
null,
Position.DUMMY
@@ -352,7 +352,7 @@ class TestVmCodeGen: FunSpec({
"sb1",
DataType.BYTE,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
null,
null,
Position.DUMMY
@@ -423,7 +423,7 @@ class TestVmCodeGen: FunSpec({
"sb1",
DataType.BYTE,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
null,
null,
Position.DUMMY
@@ -490,7 +490,7 @@ class TestVmCodeGen: FunSpec({
"ub1",
DataType.UBYTE,
ZeropageWish.DONTCARE,
PtVariable.Alignment.NONE,
0u,
null,
null,
Position.DUMMY