aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-07-20 14:04:22 +0100
committerMichael Williamson <mike@zwobble.org>2023-07-20 14:04:22 +0100
commit8ae1e2dad3d43a75874e7cbb479601b5abae3b78 (patch)
tree5668b4d94f3f4c5d4f040f538aef69227caef647 /src/main/java
parent1d947a749a5772b25c30cad1c8e3f8ec6d7b22ca (diff)
Pass data layout to alloc
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAlloc.java11
2 files changed, 9 insertions, 4 deletions
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 9447ab14..c38851f7 100644
--- a/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java
+++ b/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java
@@ -73,7 +73,7 @@ public class PatioSerializer {
treeList(
treeIdentifier("alloc"),
localRefToTree(alloc.target()),
- treeInt(alloc.bytes())
+ dataLayoutToTree(alloc.layout())
);
case PatioCallPointer callPointer ->
diff --git a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAlloc.java b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAlloc.java
index 5dad5de6..279ae0db 100644
--- a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAlloc.java
+++ b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioAlloc.java
@@ -1,11 +1,16 @@
package org.shedlang.compiler.patio.ast.instructions;
import org.shedlang.compiler.patio.ast.PatioLocalRef;
+import org.shedlang.compiler.patio.ast.types.PatioDataLayout;
import org.shedlang.compiler.sources.Source;
/**
- * Allocate the given number of bytes, and store the pointer to the allocated
- * memory in the target local.
+ * Allocate space for the given data layout, and store the pointer to the
+ * allocated memory in the target local.
*/
-public record PatioAlloc(PatioLocalRef target, int bytes, Source source) implements PatioInstruction {
+public record PatioAlloc(
+ PatioLocalRef target,
+ PatioDataLayout layout,
+ Source source
+) implements PatioInstruction {
}