From c796f48cdf66aafaca202515848422e56aa0ef05 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 1 Oct 2023 17:27:45 +0100 Subject: Remove alloc-stack instruction --- .../compiler/backends/llvm/LlvmPatioCodeGen.java | 4 ---- .../compiler/backends/wasm/WasmPatioCodeGen.java | 4 ---- .../org/shedlang/compiler/patio/ast/PatioSerializer.java | 7 ------- .../compiler/patio/ast/instructions/PatioAllocStack.java | 16 ---------------- .../patio/ast/instructions/PatioInstruction.java | 2 +- 5 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAllocStack.java (limited to 'src/main/java') diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java index 78fb6fb9..167c85be 100644 --- a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java +++ b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java @@ -197,10 +197,6 @@ public class LlvmPatioCodeGen { )); } - case PatioAllocStack patioAllocStack -> { - throw new UnsupportedOperationException(); - } - case PatioBoolToInt patioBoolToInt -> { var targetResult = context.addPatioLocalToLlvmLocal(patioBoolToInt.target()); var target = targetResult.value; diff --git a/src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java b/src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java index 1848f727..dadfa918 100644 --- a/src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java +++ b/src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java @@ -140,10 +140,6 @@ public class WasmPatioCodeGen { yield context; } - case PatioAllocStack patioAllocStack -> { - throw new UnsupportedOperationException(); - } - case PatioBoolToInt patioBoolToInt -> generateOperandToPatioLocal( patioBoolToInt.target(), diff --git a/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java b/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java index 5868ce3e..c8b51f0a 100644 --- a/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java +++ b/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java @@ -140,13 +140,6 @@ public class PatioSerializer { dataLayoutToTree(allocHeap.layout()) ); - case PatioAllocStack allocStack -> - treeList( - treeIdentifier("alloc-stack"), - operandToTree(allocStack.target()), - typeToTree(allocStack.type()) - ); - case PatioBoolToInt boolToInt -> treeList( treeIdentifier("bool-to-int"), diff --git a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAllocStack.java b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAllocStack.java deleted file mode 100644 index e94accd1..00000000 --- a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAllocStack.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.shedlang.compiler.patio.ast.instructions; - -import org.shedlang.compiler.patio.ast.operands.PatioLocalRef; -import org.shedlang.compiler.patio.ast.types.PatioType; -import org.shedlang.compiler.sources.Source; - -/** - * Allocate space on the stack for the given type, and store the pointer - * to the allocated memory in the target local. - */ -public record PatioAllocStack( - PatioLocalRef target, - PatioType type, - Source source -) implements PatioInstruction { -} diff --git a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java index 0c8d5721..f68f752e 100644 --- a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java +++ b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java @@ -2,6 +2,6 @@ package org.shedlang.compiler.patio.ast.instructions; import org.shedlang.compiler.sources.Source; -public sealed interface PatioInstruction permits PatioAllocHeap, PatioAllocStack, PatioBoolToInt, PatioCall, PatioCallPointer, PatioDataPtrToInt, PatioIf, PatioIntAdd, PatioIntEquals, PatioIntNotEqual, PatioIntSub, PatioIntToBool, PatioIntToDataPtr, PatioLocalStore, PatioLoop, PatioLoopBreak, PatioLoopContinue, PatioMemoryLoad, PatioMemoryStore, PatioReturn, PatioVarLoad, PatioVarStore { +public sealed interface PatioInstruction permits PatioAllocHeap, PatioBoolToInt, PatioCall, PatioCallPointer, PatioDataPtrToInt, PatioIf, PatioIntAdd, PatioIntEquals, PatioIntNotEqual, PatioIntSub, PatioIntToBool, PatioIntToDataPtr, PatioLocalStore, PatioLoop, PatioLoopBreak, PatioLoopContinue, PatioMemoryLoad, PatioMemoryStore, PatioReturn, PatioVarLoad, PatioVarStore { Source source(); } -- cgit v1.2.3