aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-10-01 17:27:45 +0100
committerMichael Williamson <mike@zwobble.org>2023-10-01 17:27:45 +0100
commitc796f48cdf66aafaca202515848422e56aa0ef05 (patch)
tree3dd87277a55b0180644f313be29d76843e566e5d /src/main/java
parent3ff9c7c74c904dc3ff71040be3df206c9d67d33a (diff)
Remove alloc-stack instruction
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGen.java4
-rw-r--r--src/main/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGen.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java7
-rw-r--r--src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAllocStack.java16
-rw-r--r--src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java2
5 files changed, 1 insertions, 32 deletions
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();
}