aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-07-20 23:34:29 +0100
committerMichael Williamson <mike@zwobble.org>2023-07-20 23:36:01 +0100
commit88f7aecdecf5a4e2d4f4f243aa2517129a191b25 (patch)
treef32d369114f99e80834e406e7dcabd435b3d6667 /src/main/java
parentfceeffe7558fc4cbab8d2d5062ad6cf2930ce850 (diff)
Change local-copy to more general local-store
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java8
-rw-r--r--src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioInstruction.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioLocalStore.java (renamed from src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioLocalCopy.java)7
4 files changed, 11 insertions, 10 deletions
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java
index f85d97a1..aca3f71c 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java
@@ -7,7 +7,7 @@ import org.pcollections.PVector;
import org.shedlang.compiler.backends.llvm.NameAllocator;
import org.shedlang.compiler.patio.ast.*;
import org.shedlang.compiler.patio.ast.instructions.PatioInstruction;
-import org.shedlang.compiler.patio.ast.instructions.PatioLocalCopy;
+import org.shedlang.compiler.patio.ast.instructions.PatioLocalStore;
import org.shedlang.compiler.patio.ast.operands.PatioLocalRef;
import org.shedlang.compiler.patio.ast.types.PatioDataLayout;
import org.shedlang.compiler.patio.ast.types.PatioType;
@@ -244,7 +244,7 @@ public record PatioCodeGenContext(
var result = this.functionContext.temporaryPop();
return new PatioCodeGenContext(this.compilationUnitContext, result.context)
- .addInstruction(new PatioLocalCopy(target, result.value, source));
+ .addInstruction(new PatioLocalStore(target, result.value, source));
}
public PatioCodeGenContext temporaryPush(PatioLocalRef value) {
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 8edf1464..bfdbac89 100644
--- a/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java
+++ b/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java
@@ -174,11 +174,11 @@ public class PatioSerializer {
operandToTree(intToDataPtr.value())
);
- case PatioLocalCopy localCopy ->
+ case PatioLocalStore localStore ->
treeList(
- treeIdentifier("local-copy"),
- operandToTree(localCopy.target()),
- operandToTree(localCopy.value())
+ treeIdentifier("local-store"),
+ operandToTree(localStore.target()),
+ operandToTree(localStore.value())
);
case PatioMemoryLoad memoryLoad ->
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 88b47962..c18afbd1 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 PatioAlloc, PatioCallPointer, PatioDataPtrGet, PatioDataPtrToInt, PatioFunctionPointerGet, PatioIf, PatioIntAdd, PatioIntGet, PatioIntToDataPtr, PatioLocalCopy, PatioMemoryLoad, PatioMemoryStore, PatioReturn {
+public sealed interface PatioInstruction permits PatioAlloc, PatioCallPointer, PatioDataPtrGet, PatioDataPtrToInt, PatioFunctionPointerGet, PatioIf, PatioIntAdd, PatioIntGet, PatioIntToDataPtr, PatioLocalStore, PatioMemoryLoad, PatioMemoryStore, PatioReturn {
Source source();
}
diff --git a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioLocalCopy.java b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioLocalStore.java
index 34d5bbaa..22939cd5 100644
--- a/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioLocalCopy.java
+++ b/src/main/java/org/shedlang/compiler/patio/ast/instructions/PatioLocalStore.java
@@ -1,14 +1,15 @@
package org.shedlang.compiler.patio.ast.instructions;
import org.shedlang.compiler.patio.ast.operands.PatioLocalRef;
+import org.shedlang.compiler.patio.ast.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
/**
- * Copy the given value into the target local.
+ * Store the given value in the target local.
*/
-public record PatioLocalCopy(
+public record PatioLocalStore(
PatioLocalRef target,
- PatioLocalRef value,
+ PatioOperand value,
Source source
) implements PatioInstruction {
}