aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-01-21 16:04:08 +0000
committerMichael Williamson <mike@zwobble.org>2024-01-21 16:04:08 +0000
commit5a22d7506a26cde1d7e7083c788fff7d067f6f9a (patch)
tree9a5a0e533645a8b8e1e486d3d7dc98a74efdb60e /src/main/java
parentfb732c2caac25b5701c56cfc86be911e03a64a43 (diff)
Rename target to destination in IRs
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java140
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/LlvmIrSerializer.java36
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/LlvmFunctionDeclaration.java4
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAdd.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAlloca.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmBrUnconditional.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmCall.java6
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmGetElementPtr.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIcmp.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIntToPtr.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmLoad.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPhi.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPtrToInt.java4
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmSub.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmTrunc.java4
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmZext.java4
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/operands/LlvmOperandPtrToInt.java2
-rw-r--r--src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java60
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioSerializer.java46
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocHeap.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocStack.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioBoolToInt.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioCall.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioCallPointer.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioCatchClause.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioDataPtrToInt.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioIf.java6
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioInstructionBinaryOperation.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioIntAdd.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioIntEquals.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioIntNotEqual.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioIntSub.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToBool.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToDataPtr.java2
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioLocalStore.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioMemoryLoad.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioSwitch.java6
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioTry.java6
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioVarLoad.java4
-rw-r--r--src/main/java/org/shedlang/compiler/patio/instructions/PatioVarStore.java2
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java166
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java12
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioContext.java4
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java20
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioFunctions.java4
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java8
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java20
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java8
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java4
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java12
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java10
-rw-r--r--src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioVars.java4
52 files changed, 335 insertions, 335 deletions
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java b/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java
index 025dc602..d17b85ac 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java
@@ -317,9 +317,9 @@ public class PatioToLlvm {
var size = sizeResult.value();
context = sizeResult.context();
- var targetResult = context.addPatioLocalToLlvmLocal(patioAllocHeap.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioAllocHeap.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
var offsetResult = offsetOf(
patioAllocHeap.layout(),
@@ -331,7 +331,7 @@ public class PatioToLlvm {
var allocDeclaration = allocDeclaration(context.platformTarget());
yield context.addInstruction(allocDeclaration.call(
- Optional.of(target),
+ Optional.of(destination),
List.of(
size,
offset,
@@ -341,12 +341,12 @@ public class PatioToLlvm {
}
case PatioAllocStack patioAllocStack -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioAllocStack.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioAllocStack.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmAlloca(
- target,
+ destination,
patioDataLayoutToLlvmType(
patioAllocStack.layout(),
context.platformTarget()
@@ -358,12 +358,12 @@ public class PatioToLlvm {
generateInstructions(patioBlock.body(), context);
case PatioBoolToInt patioBoolToInt -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioBoolToInt.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioBoolToInt.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmZext(
- target,
+ destination,
LlvmTypes.INT_1,
patioOperandToLlvmOperand(patioBoolToInt.value(), context),
context.platformTarget().patioIntType()
@@ -371,17 +371,17 @@ public class PatioToLlvm {
}
case PatioCall patioCall -> {
- var target = Optional.<LlvmVariable>empty();
- if (patioCall.target().isPresent()) {
- var targetResult = context.addPatioLocalToLlvmLocal(patioCall.target().get());
- target = Optional.of(targetResult.value());
- context = targetResult.context();
+ var destination = Optional.<LlvmVariable>empty();
+ if (patioCall.destination().isPresent()) {
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioCall.destination().get());
+ destination = Optional.of(destinationResult.value());
+ context = destinationResult.context();
}
var c = context;
yield context.addInstruction(new LlvmCall(
- target,
+ destination,
context.functionNameToReturnType(patioCall.functionName()),
new LlvmVariableGlobal(patioCall.functionName()),
patioCall.args().stream()
@@ -391,15 +391,15 @@ public class PatioToLlvm {
}
case PatioCallPointer patioCallPointer -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioCallPointer.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioCallPointer.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
var c = context;
yield context.addInstruction(new LlvmCall(
- target,
- context.patioLocalToType(patioCallPointer.target()),
+ destination,
+ context.patioLocalToType(patioCallPointer.destination()),
patioOperandToLlvmOperand(patioCallPointer.functionPointer(), context),
patioCallPointer.args().stream()
.map(arg -> patioOperandToLlvmTypedOperand(arg, c))
@@ -408,12 +408,12 @@ public class PatioToLlvm {
}
case PatioDataPtrToInt patioDataPtrToInt -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioDataPtrToInt.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioDataPtrToInt.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmPtrToInt(
- target,
+ destination,
patioOperandToLlvmOperand(patioDataPtrToInt.value(), context),
context.platformTarget().patioIntType()
));
@@ -457,7 +457,7 @@ public class PatioToLlvm {
));
context = generateBranches(
- patioIf.targets(),
+ patioIf.destinations(),
List.of(
Branch.of(ifTrueStartLabel, ifTrueEndLabel, patioIf.trueBody()),
Branch.of(ifFalseStartLabel, ifFalseEndLabel, patioIf.falseBody())
@@ -470,12 +470,12 @@ public class PatioToLlvm {
}
case PatioIntAdd patioIntAdd -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioIntAdd.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioIntAdd.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmAdd(
- target,
+ destination,
context.platformTarget().patioIntType(),
patioOperandToLlvmOperand(patioIntAdd.left(), context),
patioOperandToLlvmOperand(patioIntAdd.right(), context)
@@ -483,12 +483,12 @@ public class PatioToLlvm {
}
case PatioIntEquals patioIntEquals -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioIntEquals.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioIntEquals.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmIcmp(
- target,
+ destination,
LlvmConditionCode.EQ,
context.platformTarget().patioIntType(),
patioOperandToLlvmOperand(patioIntEquals.left(), context),
@@ -497,12 +497,12 @@ public class PatioToLlvm {
}
case PatioIntNotEqual patioIntNotEqual -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioIntNotEqual.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioIntNotEqual.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmIcmp(
- target,
+ destination,
LlvmConditionCode.NE,
context.platformTarget().patioIntType(),
patioOperandToLlvmOperand(patioIntNotEqual.left(), context),
@@ -511,12 +511,12 @@ public class PatioToLlvm {
}
case PatioIntSub patioIntSub -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioIntSub.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioIntSub.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmSub(
- target,
+ destination,
context.platformTarget().patioIntType(),
patioOperandToLlvmOperand(patioIntSub.left(), context),
patioOperandToLlvmOperand(patioIntSub.right(), context)
@@ -524,12 +524,12 @@ public class PatioToLlvm {
}
case PatioIntToBool patioIntToBool -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioIntToBool.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioIntToBool.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmTrunc(
- target,
+ destination,
context.platformTarget().patioIntType(),
patioOperandToLlvmOperand(patioIntToBool.value(), context),
LlvmTypes.INT_1
@@ -537,12 +537,12 @@ public class PatioToLlvm {
}
case PatioIntToDataPtr patioIntToDataPtr -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioIntToDataPtr.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioIntToDataPtr.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield context.addInstruction(new LlvmIntToPtr(
- target,
+ destination,
context.platformTarget().patioIntType(),
patioOperandToLlvmOperand(patioIntToDataPtr.value(), context)
));
@@ -550,7 +550,7 @@ public class PatioToLlvm {
case PatioLocalStore patioLocalStore ->
context.addPatioLocal(
- patioLocalStore.target(),
+ patioLocalStore.destination(),
patioOperandToLlvmOperand(patioLocalStore.value(), context)
);
@@ -585,9 +585,9 @@ public class PatioToLlvm {
context.addTerminatorInstruction(new LlvmBrUnconditional(context.loopStartLabel()));
case PatioMemoryLoad patioMemoryLoad -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioMemoryLoad.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioMemoryLoad.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
var pointerResult = context.allocateLocalName(LlvmCodeGenLocalVariableSpace.TEMPORARY);
var pointer = pointerResult.value();
@@ -604,7 +604,7 @@ public class PatioToLlvm {
));
context = context.addInstruction(new LlvmLoad(
- target,
+ destination,
patioDataOffsetToLlvmType(
patioMemoryLoad.layout(),
patioMemoryLoad.offset(),
@@ -721,7 +721,7 @@ public class PatioToLlvm {
));
context = generateBranches(
- patioSwitch.targets(),
+ patioSwitch.destinations(),
branches,
switchEndLabel,
context
@@ -831,7 +831,7 @@ public class PatioToLlvm {
var catchBodyEndLabel = catchBodyEndLabelResult.value();
context = catchBodyEndLabelResult.context();
- var exceptionValueTargetResult = context.addPatioLocalToLlvmLocal(catchClause.target());
+ var exceptionValueTargetResult = context.addPatioLocalToLlvmLocal(catchClause.destination());
var exceptionValueTarget = exceptionValueTargetResult.value();
context = exceptionValueTargetResult.context();
@@ -874,7 +874,7 @@ public class PatioToLlvm {
));
context = generateBranches(
- try_.targets(),
+ try_.destinations(),
branches,
tryEndLabel,
context
@@ -887,12 +887,12 @@ public class PatioToLlvm {
context.addTerminatorInstruction(new LlvmUnreachable());
case PatioVarLoad patioVarLoad -> {
- var targetResult = context.addPatioLocalToLlvmLocal(patioVarLoad.target());
- var target = targetResult.value();
- context = targetResult.context();
+ var destinationResult = context.addPatioLocalToLlvmLocal(patioVarLoad.destination());
+ var destination = destinationResult.value();
+ context = destinationResult.context();
context = context.addInstruction(new LlvmLoad(
- target,
+ destination,
context.patioLocalToType(patioVarLoad.var()),
context.patioLocalToOperand(patioVarLoad.var())
));
@@ -940,7 +940,7 @@ public class PatioToLlvm {
}
private static PatioToLlvmFunctionContext generateBranches(
- List<PatioLocalRef> targets,
+ List<PatioLocalRef> destinations,
List<Branch> branches,
LlvmVariableLocal endLabel,
PatioToLlvmFunctionContext context
@@ -974,7 +974,7 @@ public class PatioToLlvm {
context = context.startBasicBlock(endLabel);
context = generatePhiInstructions(
- targets,
+ destinations,
phiPredecessors,
context
);
@@ -985,18 +985,18 @@ public class PatioToLlvm {
record PhiPredecessor(PatioBlock block, LlvmVariableLocal label) {}
private static PatioToLlvmFunctionContext generatePhiInstructions(
- List<PatioLocalRef> targets,
+ List<PatioLocalRef> destinations,
List<PhiPredecessor> predecessors,
PatioToLlvmFunctionContext context
) {
- for (var targetIndex = 0; targetIndex < targets.size(); targetIndex++) {
- var patioTarget = targets.get(targetIndex);
+ for (var destinationIndex = 0; destinationIndex < destinations.size(); destinationIndex++) {
+ var patioTarget = destinations.get(destinationIndex);
var llvmTargetResult = context.addPatioLocalToLlvmLocal(patioTarget);
var llvmTarget = llvmTargetResult.value();
context = llvmTargetResult.context();
- var blockTargetIndex = targetIndex;
+ var blockTargetIndex = destinationIndex;
var blockContext = context;
context = context.addInstruction(new LlvmPhi(
llvmTarget,
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/LlvmIrSerializer.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/LlvmIrSerializer.java
index a74287be..ce6d4e9b 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/LlvmIrSerializer.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/LlvmIrSerializer.java
@@ -43,7 +43,7 @@ public class LlvmIrSerializer {
public static void serializeInstruction(LlvmInstruction instruction, Appendable writer) throws IOException {
switch (instruction) {
case LlvmAdd add -> {
- serializeVariable(add.target(), writer);
+ serializeVariable(add.destination(), writer);
writer.append(" = add ");
serializeType(add.type(), writer);
writer.append(" ");
@@ -53,14 +53,14 @@ public class LlvmIrSerializer {
}
case LlvmAlloca alloca -> {
- serializeVariable(alloca.target(), writer);
+ serializeVariable(alloca.destination(), writer);
writer.append(" = alloca ");
serializeType(alloca.type(), writer);
}
case LlvmCall call -> {
- if (call.target().isPresent()) {
- serializeVariable(call.target().get(), writer);
+ if (call.destination().isPresent()) {
+ serializeVariable(call.destination().get(), writer);
writer.append(" = ");
}
writer.append("call ");
@@ -76,7 +76,7 @@ public class LlvmIrSerializer {
writer.append(")");
}
case LlvmGetElementPtr getElementPtr -> {
- serializeVariable(getElementPtr.target(), writer);
+ serializeVariable(getElementPtr.destination(), writer);
writer.append(" = getelementptr ");
serializeType(getElementPtr.pointerType().elementType(), writer);
writer.append(", ptr ");
@@ -87,7 +87,7 @@ public class LlvmIrSerializer {
}
}
case LlvmIcmp icmp -> {
- serializeVariable(icmp.target(), writer);
+ serializeVariable(icmp.destination(), writer);
writer.append(" = icmp ");
serializeConditionCode(icmp.conditionCode(), writer);
writer.append(" ");
@@ -98,7 +98,7 @@ public class LlvmIrSerializer {
serializeOperand(icmp.right(), writer);
}
case LlvmIntToPtr intToPtr -> {
- serializeVariable(intToPtr.target(), writer);
+ serializeVariable(intToPtr.destination(), writer);
writer.append(" = inttoptr ");
serializeType(intToPtr.sourceType(), writer);
writer.append(" ");
@@ -106,14 +106,14 @@ public class LlvmIrSerializer {
writer.append(" to ptr");
}
case LlvmLoad load -> {
- serializeVariable(load.target(), writer);
+ serializeVariable(load.destination(), writer);
writer.append(" = load ");
serializeType(load.type(), writer);
writer.append(", ptr ");
serializeOperand(load.pointer(), writer);
}
case LlvmPhi phi -> {
- serializeVariable(phi.target(), writer);
+ serializeVariable(phi.destination(), writer);
writer.append(" = phi ");
serializeType(phi.type(), writer);
forEachInterspersed(
@@ -129,11 +129,11 @@ public class LlvmIrSerializer {
);
}
case LlvmPtrToInt ptrToInt -> {
- serializeVariable(ptrToInt.target(), writer);
+ serializeVariable(ptrToInt.destination(), writer);
writer.append(" = ptrtoint ptr ");
serializeOperand(ptrToInt.value(), writer);
writer.append(" to ");
- serializeType(ptrToInt.targetType(), writer);
+ serializeType(ptrToInt.destinationType(), writer);
}
case LlvmStore store -> {
writer.append("store ");
@@ -144,7 +144,7 @@ public class LlvmIrSerializer {
serializeOperand(store.pointer(), writer);
}
case LlvmSub sub -> {
- serializeVariable(sub.target(), writer);
+ serializeVariable(sub.destination(), writer);
writer.append(" = sub ");
serializeType(sub.type(), writer);
writer.append(" ");
@@ -153,22 +153,22 @@ public class LlvmIrSerializer {
serializeOperand(sub.right(), writer);
}
case LlvmTrunc trunc -> {
- serializeVariable(trunc.target(), writer);
+ serializeVariable(trunc.destination(), writer);
writer.append(" = trunc ");
serializeType(trunc.sourceType(), writer);
writer.append(" ");
serializeOperand(trunc.value(), writer);
writer.append(" to ");
- serializeType(trunc.targetType(), writer);
+ serializeType(trunc.destinationType(), writer);
}
case LlvmZext zext -> {
- serializeVariable(zext.target(), writer);
+ serializeVariable(zext.destination(), writer);
writer.append(" = zext ");
serializeType(zext.sourceType(), writer);
writer.append(" ");
serializeOperand(zext.value(), writer);
writer.append(" to ");
- serializeType(zext.targetType(), writer);
+ serializeType(zext.destinationType(), writer);
}
}
}
@@ -216,7 +216,7 @@ public class LlvmIrSerializer {
writer.append("ptrtoint (ptr ");
serializeOperand(ptrToInt.operand(), writer);
writer.append(" to ");
- serializeType(ptrToInt.targetType(), writer);
+ serializeType(ptrToInt.destinationType(), writer);
writer.append(")");
}
case LlvmVariable variable -> {
@@ -246,7 +246,7 @@ public class LlvmIrSerializer {
}
case LlvmBrUnconditional br -> {
writer.append("br label ");
- serializeVariable(br.targetLabel(), writer);
+ serializeVariable(br.destinationLabel(), writer);
}
case LlvmReturn returnValue -> {
writer.append("ret ");
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/LlvmFunctionDeclaration.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/LlvmFunctionDeclaration.java
index 3987eb43..51e123e4 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/LlvmFunctionDeclaration.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/LlvmFunctionDeclaration.java
@@ -16,7 +16,7 @@ public record LlvmFunctionDeclaration(
LlvmType returnType,
List<LlvmParam> params
) implements LlvmTopLevelEntity {
- public LlvmCall call(Optional<LlvmVariable> target, List<LlvmOperand> args) {
+ public LlvmCall call(Optional<LlvmVariable> destination, List<LlvmOperand> args) {
var typedArgs = new ArrayList<LlvmTypedOperand>();
for (var argIndex = 0; argIndex < args.size(); argIndex++) {
@@ -25,7 +25,7 @@ public record LlvmFunctionDeclaration(
}
return new LlvmCall(
- target,
+ destination,
returnType,
new LlvmVariableGlobal(name),
typedArgs
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAdd.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAdd.java
index fbd6d0ef..9f1164ca 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAdd.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAdd.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
public record LlvmAdd(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmType type,
LlvmOperand left,
LlvmOperand right
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAlloca.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAlloca.java
index cb9277ad..19902c8f 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAlloca.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmAlloca.java
@@ -4,7 +4,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
public record LlvmAlloca(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmType type
) implements LlvmInstruction {
}
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmBrUnconditional.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmBrUnconditional.java
index 47c6d344..93f33894 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmBrUnconditional.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmBrUnconditional.java
@@ -3,6 +3,6 @@ package org.shedlang.compiler.backends.llvm.ir.ast.instructions;
import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariableLocal;
public record LlvmBrUnconditional(
- LlvmVariableLocal targetLabel
+ LlvmVariableLocal destinationLabel
) implements LlvmTerminatorInstruction {
}
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmCall.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmCall.java
index aa6d9718..5fc7c660 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmCall.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmCall.java
@@ -9,19 +9,19 @@ import java.util.List;
import java.util.Optional;
public record LlvmCall(
- Optional<LlvmVariable> target,
+ Optional<LlvmVariable> destination,
LlvmType returnType,
LlvmOperand functionPointer,
List<LlvmTypedOperand> args
) implements LlvmInstruction {
public LlvmCall(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmType returnType,
LlvmOperand functionPointer,
List<LlvmTypedOperand> args
) {
this(
- Optional.of(target),
+ Optional.of(destination),
returnType,
functionPointer,
args
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmGetElementPtr.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmGetElementPtr.java
index ad9f1ced..292391af 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmGetElementPtr.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmGetElementPtr.java
@@ -8,7 +8,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmTypePointer;
import java.util.List;
public record LlvmGetElementPtr(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmTypePointer pointerType,
LlvmOperand pointer,
List<LlvmTypedOperand> indexes
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIcmp.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIcmp.java
index 01e23385..9d3bd9d1 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIcmp.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIcmp.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
public record LlvmIcmp(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmConditionCode conditionCode,
LlvmType type,
LlvmOperand left,
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIntToPtr.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIntToPtr.java
index 4b0d421b..11a796ef 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIntToPtr.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmIntToPtr.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmTypeScalar;
public record LlvmIntToPtr(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmTypeScalar sourceType,
LlvmOperand value
) implements LlvmInstruction {
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmLoad.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmLoad.java
index 6ca6ed2f..1a1bc92b 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmLoad.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmLoad.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
public record LlvmLoad(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmType type,
LlvmOperand pointer
) implements LlvmInstruction {
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPhi.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPhi.java
index c66f7308..4b69e728 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPhi.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPhi.java
@@ -6,7 +6,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
import java.util.List;
public record LlvmPhi(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmType type,
List<LlvmPhiPair> pairs
) implements LlvmInstruction {
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPtrToInt.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPtrToInt.java
index 784dcb9b..1d121ecc 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPtrToInt.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmPtrToInt.java
@@ -5,8 +5,8 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmTypeScalar;
public record LlvmPtrToInt(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmOperand value,
- LlvmTypeScalar targetType
+ LlvmTypeScalar destinationType
) implements LlvmInstruction {
}
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmSub.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmSub.java
index b5ae1a2a..837b3b2e 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmSub.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmSub.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
public record LlvmSub(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmType type,
LlvmOperand left,
LlvmOperand right
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmTrunc.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmTrunc.java
index 665b8d67..f3a7786d 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmTrunc.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmTrunc.java
@@ -5,9 +5,9 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
public record LlvmTrunc(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmType sourceType,
LlvmOperand value,
- LlvmType targetType
+ LlvmType destinationType
) implements LlvmInstruction {
}
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmZext.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmZext.java
index 7268b5e7..2cd44db9 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmZext.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/instructions/LlvmZext.java
@@ -5,9 +5,9 @@ import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmVariable;
import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
public record LlvmZext(
- LlvmVariable target,
+ LlvmVariable destination,
LlvmType sourceType,
LlvmOperand value,
- LlvmType targetType
+ LlvmType destinationType
) implements LlvmInstruction {
}
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/operands/LlvmOperandPtrToInt.java b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/operands/LlvmOperandPtrToInt.java
index 3d449532..624cced8 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/operands/LlvmOperandPtrToInt.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/ir/ast/operands/LlvmOperandPtrToInt.java
@@ -4,6 +4,6 @@ import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmType;
public record LlvmOperandPtrToInt(
LlvmOperand operand,
- LlvmType targetType
+ LlvmType destinationType
) implements LlvmOperand {
}
diff --git a/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java b/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java
index da089ce1..f22a5c00 100644
--- a/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java
+++ b/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java
@@ -182,7 +182,7 @@ public class PatioToWasm {
patioAllocHeap.gcChildrenCount()
))
.addInstruction(new WasmCall(new WasmFuncName(ALLOC_NAME)))
- .addInstruction(new WasmLocalSet(context.wasmLocalIndex(patioAllocHeap.target())));
+ .addInstruction(new WasmLocalSet(context.wasmLocalIndex(patioAllocHeap.destination())));
yield context;
}
@@ -194,7 +194,7 @@ public class PatioToWasm {
sizeOf(patioAllocStack.layout(), platformTarget)
))
.addInstruction(new WasmCall(new WasmFuncName(STACK_ALLOC_NAME)))
- .addInstruction(new WasmLocalSet(context.wasmLocalIndex(patioAllocStack.target())));
+ .addInstruction(new WasmLocalSet(context.wasmLocalIndex(patioAllocStack.destination())));
yield context;
}
@@ -209,7 +209,7 @@ public class PatioToWasm {
context = context.addInstruction(new WasmI64ExtendI32Unsigned());
}
- context = popIntoPatioLocal(patioBoolToInt.target(), context);
+ context = popIntoPatioLocal(patioBoolToInt.destination(), context);
yield context;
}
@@ -221,8 +221,8 @@ public class PatioToWasm {
context = context.addInstruction(new WasmCall(new WasmFuncName(patioCall.functionName())));
- if (patioCall.target().isPresent()) {
- context = popIntoPatioLocal(patioCall.target().get(), context);
+ if (patioCall.destination().isPresent()) {
+ context = popIntoPatioLocal(patioCall.destination().get(), context);
}
yield context;
@@ -241,7 +241,7 @@ public class PatioToWasm {
var wasmFuncType = new WasmFuncType(
patioOperandsToWasmValueTypes(patioCallPointer.args(), context),
- List.of(patioOperandToWasmValueType(patioCallPointer.target(), context))
+ List.of(patioOperandToWasmValueType(patioCallPointer.destination(), context))
);
context = context.addType(wasmFuncType);
@@ -252,14 +252,14 @@ public class PatioToWasm {
wasmFuncType
));
- context = popIntoPatioLocal(patioCallPointer.target(), context);
+ context = popIntoPatioLocal(patioCallPointer.destination(), context);
yield context;
}
case PatioDataPtrToInt patioDataPtrToInt ->
generateOperandToPatioLocal(
- patioDataPtrToInt.target(),
+ patioDataPtrToInt.destination(),
patioDataPtrToInt.value(),
context
);
@@ -267,7 +267,7 @@ public class PatioToWasm {
case PatioIf patioIf -> {
context = generateOperand(patioIf.condition(), context);
- var wasmBlockType = generateBlockType(patioIf.targets(), context);
+ var wasmBlockType = generateBlockType(patioIf.destinations(), context);
context = context.enterIfInstruction(wasmBlockType);
context = generateBlockBody(patioIf.trueBody(), context);
@@ -277,7 +277,7 @@ public class PatioToWasm {
context = context.exitIfInstruction();
- context = popIntoPatioLocals(patioIf.targets(), context);
+ context = popIntoPatioLocals(patioIf.destinations(), context);
yield context;
}
@@ -317,21 +317,21 @@ public class PatioToWasm {
context = context.addInstruction(new WasmI32WrapI64());
}
- context = popIntoPatioLocal(patioIntToBool.target(), context);
+ context = popIntoPatioLocal(patioIntToBool.destination(), context);
yield context;
}
case PatioIntToDataPtr patioIntToDataPtr ->
generateOperandToPatioLocal(
- patioIntToDataPtr.target(),
+ patioIntToDataPtr.destination(),
patioIntToDataPtr.value(),
context
);
case PatioLocalStore patioLocalStore ->
generateOperandToPatioLocal(
- patioLocalStore.target(),
+ patioLocalStore.destination(),
patioLocalStore.value(),
context
);
@@ -362,7 +362,7 @@ public class PatioToWasm {
context = generateOperand(patioMemoryLoad.pointer(), context);
context = context.addInstruction(wasmIntLoad(
- context.wasmLocalType(patioMemoryLoad.target()),
+ context.wasmLocalType(patioMemoryLoad.destination()),
wasmMemoryArg(
patioMemoryLoad.layout(),
patioMemoryLoad.offset(),
@@ -370,7 +370,7 @@ public class PatioToWasm {
)
));
- context = popIntoPatioLocal(patioMemoryLoad.target(), context);
+ context = popIntoPatioLocal(patioMemoryLoad.destination(), context);
yield context;
}
@@ -413,7 +413,7 @@ public class PatioToWasm {
case PatioSwitch patioSwitch -> {
// TODO: use br_table?
- var wasmBlockType = generateBlockType(patioSwitch.targets(), context);
+ var wasmBlockType = generateBlockType(patioSwitch.destinations(), context);
for (var patioSwitchCase : patioSwitch.cases()) {
context = generateOperand(patioSwitch.value(), context);
@@ -433,7 +433,7 @@ public class PatioToWasm {
context = context.exitIfInstruction();
}
- context = popIntoPatioLocals(patioSwitch.targets(), context);
+ context = popIntoPatioLocals(patioSwitch.destinations(), context);
yield context;
}
@@ -457,13 +457,13 @@ public class PatioToWasm {
for (var catchClause : try_.catchClauses()) {
context = context.enterCatch(new WasmTagName(catchClause.exceptionTypeName()));
- context = popIntoPatioLocal(catchClause.target(), context);
+ context = popIntoPatioLocal(catchClause.destination(), context);
context = generateBlockBody(catchClause.body(), context);
}
context = context.exitTryInstruction();
- context = popIntoPatioLocals(try_.targets(), context);
+ context = popIntoPatioLocals(try_.destinations(), context);
yield context;
}
@@ -473,7 +473,7 @@ public class PatioToWasm {
case PatioVarLoad patioVarLoad -> {
yield generateOperandToPatioLocal(
- patioVarLoad.target(),
+ patioVarLoad.destination(),
patioVarLoad.var(),
context
);
@@ -490,11 +490,11 @@ public class PatioToWasm {
}
private static WasmBlockType generateBlockType(
- List<PatioLocalRef> targets,
+ List<PatioLocalRef> destinations,
Context context
) {
return new WasmBlockType(
- targets.stream()
+ destinations.stream()
.map(patioTarget -> patioOperandToWasmValueType(patioTarget, context))
.toList()
);
@@ -524,33 +524,33 @@ public class PatioToWasm {
context = context.addInstruction(wasmInstruction);
- context = popIntoPatioLocal(patioInstruction.target(), context);
+ context = popIntoPatioLocal(patioInstruction.destination(), context);
return context;
}
private static Context generateOperandToPatioLocal(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand value,
Context context
) {
context = generateOperand(value, context);
- context = popIntoPatioLocal(target, context);
+ context = popIntoPatioLocal(destination, context);
return context;
}
- private static Context popIntoPatioLocal(PatioLocalRef target, Context context) {
- var targetWasmLocalIndex = context.wasmLocalIndex(target);
- return context.addInstruction(new WasmLocalSet(targetWasmLocalIndex));
+ private static Context popIntoPatioLocal(PatioLocalRef destination, Context context) {
+ var destinationWasmLocalIndex = context.wasmLocalIndex(destination);
+ return context.addInstruction(new WasmLocalSet(destinationWasmLocalIndex));
}
private static Context popIntoPatioLocals(
- List<PatioLocalRef> targets,
+ List<PatioLocalRef> destinations,
Context context
) {
- for (var patioTarget : targets.reversed()) {
+ for (var patioTarget : destinations.reversed()) {
context = popIntoPatioLocal(patioTarget, context);
}
return context;
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java b/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java
index ff274bce..be6200e0 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java
@@ -143,14 +143,14 @@ public class PatioSerializer {
case PatioAllocHeap allocHeap ->
treeList(
treeIdentifier("alloc-heap"),
- operandToTree(allocHeap.target()),
+ operandToTree(allocHeap.destination()),
dataLayoutToTree(allocHeap.layout())
);
case PatioAllocStack allocStack ->
treeList(
treeIdentifier("alloc-stack"),
- operandToTree(allocStack.target()),
+ operandToTree(allocStack.destination()),
dataLayoutToTree(allocStack.layout())
);
@@ -160,14 +160,14 @@ public class PatioSerializer {
case PatioBoolToInt boolToInt ->
treeList(
treeIdentifier("bool-to-int"),
- operandToTree(boolToInt.target()),
+ operandToTree(boolToInt.destination()),
operandToTree(boolToInt.value())
);
case PatioCall call ->
treeList(
treeIdentifier("call"),
- optionalOperandToTree(call.target()),
+ optionalOperandToTree(call.destination()),
treeString(call.functionName()),
operandsToTree(call.args())
);
@@ -175,7 +175,7 @@ public class PatioSerializer {
case PatioCallPointer callPointer ->
treeList(
treeIdentifier("call-pointer"),
- operandToTree(callPointer.target()),
+ operandToTree(callPointer.destination()),
operandToTree(callPointer.functionPointer()),
operandsToTree(callPointer.args())
);
@@ -183,14 +183,14 @@ public class PatioSerializer {
case PatioDataPtrToInt dataPtrToInt ->
treeList(
treeIdentifier("data-ptr-to-int"),
- operandToTree(dataPtrToInt.target()),
+ operandToTree(dataPtrToInt.destination()),
operandToTree(dataPtrToInt.value())
);
case PatioIf if_ ->
treeListIndented(
treeIdentifier("if"),
- operandsToTree(if_.targets()),
+ operandsToTree(if_.destinations()),
operandToTree(if_.condition()),
blockToTree(if_.trueBody()),
blockToTree(if_.falseBody())
@@ -199,7 +199,7 @@ public class PatioSerializer {
case PatioIntAdd intAdd ->
treeList(
treeIdentifier("int-add"),
- operandToTree(intAdd.target()),
+ operandToTree(intAdd.destination()),
operandToTree(intAdd.left()),
operandToTree(intAdd.right())
);
@@ -207,7 +207,7 @@ public class PatioSerializer {
case PatioIntEquals intEquals ->
treeList(
treeIdentifier("int-eq"),
- operandToTree(intEquals.target()),
+ operandToTree(intEquals.destination()),
operandToTree(intEquals.left()),
operandToTree(intEquals.right())
);
@@ -215,7 +215,7 @@ public class PatioSerializer {
case PatioIntNotEqual intNotEqual ->
treeList(
treeIdentifier("int-ne"),
- operandToTree(intNotEqual.target()),
+ operandToTree(intNotEqual.destination()),
operandToTree(intNotEqual.left()),
operandToTree(intNotEqual.right())
);
@@ -224,7 +224,7 @@ public class PatioSerializer {
case PatioIntSub intSub ->
treeList(
treeIdentifier("int-sub"),
- operandToTree(intSub.target()),
+ operandToTree(intSub.destination()),
operandToTree(intSub.left()),
operandToTree(intSub.right())
);
@@ -232,21 +232,21 @@ public class PatioSerializer {
case PatioIntToBool intToBool ->
treeList(
treeIdentifier("int-to-bool"),
- operandToTree(intToBool.target()),
+ operandToTree(intToBool.destination()),
operandToTree(intToBool.value())
);
case PatioIntToDataPtr intToDataPtr ->
treeList(
treeIdentifier("int-to-data-ptr"),
- operandToTree(intToDataPtr.target()),
+ operandToTree(intToDataPtr.destination()),
operandToTree(intToDataPtr.value())
);
case PatioLocalStore localStore ->
treeList(
treeIdentifier("local-store"),
- operandToTree(localStore.target()),
+ operandToTree(localStore.destination()),
operandToTree(localStore.value())
);
@@ -269,7 +269,7 @@ public class PatioSerializer {
case PatioMemoryLoad memoryLoad ->
treeListIndented(
treeIdentifier("memory-load"),
- operandToTree(memoryLoad.target()),
+ operandToTree(memoryLoad.destination()),
treeNamed("pointer", operandToTree(memoryLoad.pointer())),
treeNamed("layout", dataLayoutToTree(memoryLoad.layout())),
treeNamed("offset", treeList(
@@ -312,7 +312,7 @@ public class PatioSerializer {
case PatioSwitch switch_ ->
treeListIndented(
treeIdentifier("switch"),
- operandsToTree(switch_.targets()),
+ operandsToTree(switch_.destinations()),
operandToTree(switch_.value()),
treeListIndented(
switch_.cases().stream()
@@ -329,13 +329,13 @@ public class PatioSerializer {
case PatioTry try_ ->
treeListIndented(
treeIdentifier("try"),
- operandsToTree(try_.targets()),
+ operandsToTree(try_.destinations()),
treeListIndented(
try_.catchClauses().stream()
.map(catchClause -> treeListIndented(
treeIdentifier("catch"),
treeString(catchClause.exceptionTypeName()),
- operandToTree(catchClause.target()),
+ operandToTree(catchClause.destination()),
blockToTree(catchClause.body())
))
.toList()
@@ -356,7 +356,7 @@ public class PatioSerializer {
case PatioVarLoad varLoad ->
treeList(
treeIdentifier("var-load"),
- operandToTree(varLoad.target()),
+ operandToTree(varLoad.destination()),
operandToTree(varLoad.var())
);
@@ -403,18 +403,18 @@ public class PatioSerializer {
);
}
- private static Tree optionalOperandToTree(Optional<PatioLocalRef> target) {
- if (target.isEmpty()) {
+ private static Tree optionalOperandToTree(Optional<PatioLocalRef> destination) {
+ if (destination.isEmpty()) {
return treeIdentifier("_");
} else {
- return operandToTree(target.get());
+ return operandToTree(destination.get());
}
}
private static Tree operandsToTree(List<? extends PatioOperand> operands) {
return treeList(
operands.stream()
- .map(target -> operandToTree(target))
+ .map(destination -> operandToTree(destination))
.toList()
);
}
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocHeap.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocHeap.java
index 2737a52d..96be900b 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocHeap.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocHeap.java
@@ -8,10 +8,10 @@ import java.util.List;
/**
* Allocate space on the heap for the given data layout, and store the pointer
- * to the allocated memory in the target local.
+ * to the allocated memory in the destination local.
*/
public record PatioAllocHeap(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioDataLayout layout,
List<Integer> gcChildrenOffset,
int gcChildrenCount,
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocStack.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocStack.java
index a028ed1d..5f545606 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocStack.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioAllocStack.java
@@ -6,11 +6,11 @@ import org.shedlang.compiler.sources.Source;
/**
* Allocate space for the given data layout on the memory stack for the current
- * call frame, and store the pointer to the allocated memory in the target
+ * call frame, and store the pointer to the allocated memory in the destination
* local.
*/
public record PatioAllocStack(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioDataLayout layout,
Source source
) implements PatioInstruction {
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioBoolToInt.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioBoolToInt.java
index db01b703..8a218db4 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioBoolToInt.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioBoolToInt.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
public record PatioBoolToInt(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand value,
Source source
) implements PatioInstruction {
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioCall.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioCall.java
index 3a97bc34..70b7a0f9 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioCall.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioCall.java
@@ -9,10 +9,10 @@ import java.util.Optional;
/**
* Call the function with the given name, and store the returned value in the
- * target local.
+ * destination local.
*/
public record PatioCall(
- Optional<PatioLocalRef> target,
+ Optional<PatioLocalRef> destination,
String functionName,
List<PatioOperand> args,
Source source
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioCallPointer.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioCallPointer.java
index 64059ef4..cbc54148 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioCallPointer.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioCallPointer.java
@@ -8,10 +8,10 @@ import java.util.List;
/**
* Call the function pointed to by the function pointer with the given
- * arguments, and store the returned value in the target local.
+ * arguments, and store the returned value in the destination local.
*/
public record PatioCallPointer(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand functionPointer,
List<PatioOperand> args,
Source source
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioCatchClause.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioCatchClause.java
index aa92bd60..edbeb3bb 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioCatchClause.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioCatchClause.java
@@ -5,12 +5,12 @@ import org.shedlang.compiler.sources.Source;
/**
* A catch clause can accept an exception of a given type. If executed, it will
- * stored the value of the exception in the given target, and then execute the
+ * stored the value of the exception in the given destination, and then execute the
* body.
*/
public record PatioCatchClause(
String exceptionTypeName,
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioBlock body,
Source source
) {
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioDataPtrToInt.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioDataPtrToInt.java
index 55bfc374..5544d297 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioDataPtrToInt.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioDataPtrToInt.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
public record PatioDataPtrToInt(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand value,
Source source
) implements PatioInstruction {
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIf.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIf.java
index f404291f..af6bdac9 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIf.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIf.java
@@ -10,11 +10,11 @@ import java.util.List;
* If the condition is true, execute the instructions in the "true" body,
* otherwise execute the instructions in the "false" body.
* <p>
- * Each block must have the same number of results as targets. Each result is
- * assigned to the target with the same index.
+ * Each block must have the same number of results as destinations. Each result is
+ * assigned to the destination with the same index.
*/
public record PatioIf(
- List<PatioLocalRef> targets,
+ List<PatioLocalRef> destinations,
PatioOperand condition,
PatioBlock trueBody,
PatioBlock falseBody,
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioInstructionBinaryOperation.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioInstructionBinaryOperation.java
index 2098e4be..2c1e888b 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioInstructionBinaryOperation.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioInstructionBinaryOperation.java
@@ -4,7 +4,7 @@ import org.shedlang.compiler.patio.operands.PatioLocalRef;
import org.shedlang.compiler.patio.operands.PatioOperand;
public interface PatioInstructionBinaryOperation {
- PatioLocalRef target();
+ PatioLocalRef destination();
PatioOperand left();
PatioOperand right();
}
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntAdd.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntAdd.java
index 91e90425..2c2e3bf6 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntAdd.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntAdd.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
public record PatioIntAdd(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntEquals.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntEquals.java
index a996fddf..b07d8033 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntEquals.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntEquals.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
public record PatioIntEquals(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntNotEqual.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntNotEqual.java
index c8c1fc81..b00e0f6d 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntNotEqual.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntNotEqual.java
@@ -6,10 +6,10 @@ import org.shedlang.compiler.sources.Source;
/**
* Compare the left and right operands. If they are equal, store false in the
- * target, otherwise store true in the target.
+ * destination, otherwise store true in the destination.
*/
public record PatioIntNotEqual(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntSub.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntSub.java
index 605705e7..24f41107 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntSub.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntSub.java
@@ -6,10 +6,10 @@ import org.shedlang.compiler.sources.Source;
/**
* Calculate the left operand minus the right operand, and store the result in
- * the target.
+ * the destination.
*/
public record PatioIntSub(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToBool.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToBool.java
index b8b969a2..725fa367 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToBool.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToBool.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
public record PatioIntToBool(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand value,
Source source
) implements PatioInstruction {
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToDataPtr.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToDataPtr.java
index 81b6bebc..3d22c0ab 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToDataPtr.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioIntToDataPtr.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
public record PatioIntToDataPtr(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand value,
Source source
) implements PatioInstruction {
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioLocalStore.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioLocalStore.java
index 2b971642..c72d0252 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioLocalStore.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioLocalStore.java
@@ -5,10 +5,10 @@ import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
/**
- * Store the given value in the target local.
+ * Store the given value in the destination local.
*/
public record PatioLocalStore(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand value,
Source source
) implements PatioInstruction {
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioMemoryLoad.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioMemoryLoad.java
index 9237ca81..2251ae91 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioMemoryLoad.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioMemoryLoad.java
@@ -9,10 +9,10 @@ import java.util.List;
/**
* Load the value at the given offset from the given pointer and store it in the
- * target local.
+ * destination local.
*/
public record PatioMemoryLoad(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand pointer,
PatioDataLayout layout,
List<Integer> offset,
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioSwitch.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioSwitch.java
index 58e67ac8..0b11e9d0 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioSwitch.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioSwitch.java
@@ -11,11 +11,11 @@ import java.util.List;
* case is found, execute the body of that case, otherwise execute the default
* body.
* <p>
- * Each block must have the same number of results as targets. Each result
- * is assigned to the target with the same index.
+ * Each block must have the same number of results as destinations. Each result
+ * is assigned to the destination with the same index.
*/
public record PatioSwitch(
- List<PatioLocalRef> targets,
+ List<PatioLocalRef> destinations,
PatioOperand value,
List<Case> cases,
PatioBlock defaultBody,
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioTry.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioTry.java
index 98798c60..893750a6 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioTry.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioTry.java
@@ -13,11 +13,11 @@ import java.util.List;
* is executed instead.
* <p>
* Each block (that is, the body of the try and the body of each catch clause)
- * must have the same number of results as targets. Each result is assigned to
- * the target with the same index.
+ * must have the same number of results as destinations. Each result is assigned to
+ * the destination with the same index.
*/
public record PatioTry(
- List<PatioLocalRef> targets,
+ List<PatioLocalRef> destinations,
List<PatioCatchClause> catchClauses,
PatioBlock body,
Source source
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioVarLoad.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioVarLoad.java
index a03b6766..02117bc6 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioVarLoad.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioVarLoad.java
@@ -4,10 +4,10 @@ import org.shedlang.compiler.patio.operands.PatioLocalRef;
import org.shedlang.compiler.sources.Source;
/**
- * Load the value from the given var and store it in the target local.
+ * Load the value from the given var and store it in the destination local.
*/
public record PatioVarLoad(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioLocalRef var,
Source source
) implements PatioInstruction {
diff --git a/src/main/java/org/shedlang/compiler/patio/instructions/PatioVarStore.java b/src/main/java/org/shedlang/compiler/patio/instructions/PatioVarStore.java
index f6aad952..dd345af2 100644
--- a/src/main/java/org/shedlang/compiler/patio/instructions/PatioVarStore.java
+++ b/src/main/java/org/shedlang/compiler/patio/instructions/PatioVarStore.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;
/**
- * Store the given value in the target var.
+ * Store the given value in the destination var.
*/
public record PatioVarStore(
PatioLocalRef var,
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java
index 6efa93e9..66d9c3be 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java
@@ -198,52 +198,52 @@ public class ShidToPatio {
shidInstruction.source()
);
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.TEMPORARY,
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
yield ShidToPatioClosures.call(
- target,
+ destination,
receiver,
positionalArgs,
namedArgsByName,
shidInstruction.source(),
context
- ).temporaryPush(target);
+ ).temporaryPush(destination);
}
case ShidDefineEffect defineEffect -> {
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.USER_DEFINED_EFFECT,
defineEffect.effect().name(),
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
context = ShidToPatioEffects.createUserDefinedEffect(
- target,
+ destination,
defineEffect.effect(),
defineEffect.source(),
context
);
- context = context.temporaryPush(target);
+ context = context.temporaryPush(destination);
yield context;
}
case ShidDefineFunction defineFunction -> {
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.CLOSURE,
defineFunction.name(),
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
Function<ShidToPatioContext, ShidToPatioContext> generateBody = functionContext -> {
return generateBlockNoResults(defineFunction.body(), functionContext);
@@ -251,7 +251,7 @@ public class ShidToPatio {
context = switch (defineFunction.variant()) {
case EFFECT_HANDLER_METHOD -> ShidToPatioEffects.createEffectHandlerMethod(
- target,
+ destination,
defineFunction.name(),
defineFunction.positionalParams(),
defineFunction.namedParams(),
@@ -261,7 +261,7 @@ public class ShidToPatio {
context
);
case FUNCTION -> ShidToPatioFunctions.create(
- target,
+ destination,
defineFunction.name(),
defineFunction.positionalParams(),
defineFunction.namedParams(),
@@ -272,29 +272,29 @@ public class ShidToPatio {
);
};
- context = context.temporaryPush(target);
+ context = context.temporaryPush(destination);
yield context;
}
case ShidDefineStruct defineStruct -> {
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.STRUCT_TYPE,
defineStruct.type().name(),
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
context = ShidToPatioStructs.createType(
- target,
+ destination,
defineStruct.type(),
defineStruct.fields(),
defineStruct.source(),
context
);
- context = context.temporaryPush(target);
+ context = context.temporaryPush(destination);
yield context;
}
@@ -330,18 +330,18 @@ public class ShidToPatio {
var receiver = receiverResult.value();
context = receiverResult.context();
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.TEMPORARY,
fieldLoad.fieldName(),
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
switch (fieldLoad.receiver()) {
case ShidFieldLoad.Receiver.Effect receiverEffect -> {
context = ShidToPatioEffects.fieldLoad(
- target,
+ destination,
receiver,
receiverEffect.effect(),
fieldLoad.fieldName(),
@@ -352,7 +352,7 @@ public class ShidToPatio {
case ShidFieldLoad.Receiver.Namespace receiverNamespace -> {
context = ShidToPatioNamespaces.fieldLoad(
- target,
+ destination,
receiver,
receiverNamespace.name(),
fieldLoad.fieldName(),
@@ -363,7 +363,7 @@ public class ShidToPatio {
case ShidFieldLoad.Receiver.Struct receiverStruct -> {
context = ShidToPatioStructs.fieldLoad(
- target,
+ destination,
receiver,
receiverStruct.type(),
fieldLoad.fieldName(),
@@ -373,7 +373,7 @@ public class ShidToPatio {
}
}
- context = context.temporaryPush(target);
+ context = context.temporaryPush(destination);
yield context;
}
@@ -383,17 +383,17 @@ public class ShidToPatio {
var conditionBool = conditionBoolResult.value();
context = conditionBoolResult.context();
- var targets = new ArrayList<PatioLocalRef>();
+ var destinations = new ArrayList<PatioLocalRef>();
for (var i = 0; i < if_.resultCount(); i++) {
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.TEMPORARY,
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
- targets.add(target);
+ destinations.add(destination);
}
var trueBodyResult = generateBlock(if_.trueBody(), context);
@@ -405,15 +405,15 @@ public class ShidToPatio {
context = falseBodyResult.context();
context = context.addInstruction(new PatioIf(
- targets,
+ destinations,
conditionBool,
trueBody,
falseBody,
if_.source()
));
- for (var target : targets) {
- context = context.temporaryPush(target);
+ for (var destination : destinations) {
+ context = context.temporaryPush(destination);
}
yield context;
@@ -421,9 +421,9 @@ public class ShidToPatio {
case ShidIntAdd intAdd ->
generateBinaryOperation(
- (target, left, right, operationContext) ->
+ (destination, left, right, operationContext) ->
ShidToPatioInts.add(
- target,
+ destination,
left,
right,
intAdd.source(),
@@ -434,9 +434,9 @@ public class ShidToPatio {
case ShidIntEquals intEquals ->
generateComparison(
- (target, left, right, operationContext) ->
+ (destination, left, right, operationContext) ->
ShidToPatioInts.equals(
- target,
+ destination,
left,
right,
intEquals.source(),
@@ -448,9 +448,9 @@ public class ShidToPatio {
case ShidIntNotEqual intNotEqual ->
generateComparison(
- (target, left, right, operationContext) ->
+ (destination, left, right, operationContext) ->
ShidToPatioInts.notEqual(
- target,
+ destination,
left,
right,
intNotEqual.source(),
@@ -462,9 +462,9 @@ public class ShidToPatio {
case ShidIntSub intSub ->
generateBinaryOperation(
- (target, left, right, operationContext) ->
+ (destination, left, right, operationContext) ->
ShidToPatioInts.sub(
- target,
+ destination,
left,
right,
intSub.source(),
@@ -553,21 +553,21 @@ public class ShidToPatio {
pushValue(pushBool.value() ? 1 : 0, pushBool.source(), context);
case ShidPushInt pushInt -> {
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.INT,
ShidToPatioInts.INT_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
context = ShidToPatioInts.storeConst(
- target,
+ destination,
pushInt.value(),
pushInt.source(),
context
);
- context = context.temporaryPush(target);
+ context = context.temporaryPush(destination);
yield context;
}
@@ -638,9 +638,9 @@ public class ShidToPatio {
case ShidStringAdd stringAdd ->
generateBinaryOperation(
- (target, left, right, operationContext) ->
+ (destination, left, right, operationContext) ->
ShidToPatioStrings.add(
- target,
+ destination,
left,
right,
stringAdd.source(),
@@ -650,12 +650,12 @@ public class ShidToPatio {
);
case ShidSwitch switch_ -> {
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.TEMPORARY,
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
var valueResult = context.temporaryPop();
var value = valueResult.value();
@@ -693,7 +693,7 @@ public class ShidToPatio {
}
context = context.addInstruction(new PatioSwitch(
- List.of(target),
+ List.of(destination),
tag,
cases,
new PatioBlock(
@@ -706,7 +706,7 @@ public class ShidToPatio {
switch_.source()
));
- context = context.temporaryPush(target);
+ context = context.temporaryPush(destination);
yield context;
}
@@ -722,15 +722,15 @@ public class ShidToPatio {
handlerMethodsByName.put(handlerMethodName, handlerMethod);
}
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.TEMPORARY,
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
context = ShidToPatioEffects.try_(
- target,
+ destination,
try_.handledEffect(),
handlerMethodsByName,
bodyContext ->
@@ -739,7 +739,7 @@ public class ShidToPatio {
context
);
- context = context.temporaryPush(target);
+ context = context.temporaryPush(destination);
yield context;
}
@@ -775,17 +775,17 @@ public class ShidToPatio {
var tuple = tupleResult.value();
context = tupleResult.context();
- var targetResult = ShidToPatioTuples.get(
+ var destinationResult = ShidToPatioTuples.get(
tuple,
tupleGet.elementIndex(),
tupleGet.elementCount(),
tupleGet.source(),
context
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
- yield context.temporaryPush(target);
+ yield context.temporaryPush(destination);
}
case ShidVarLoad varLoad -> {
@@ -828,7 +828,7 @@ public class ShidToPatio {
interface BinaryOperationCodeGen {
ShidToPatioContext generate(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
ShidToPatioContext context
@@ -841,24 +841,24 @@ public class ShidToPatio {
ShidToPatioContext context
) {
return generateBinaryOperation(
- (target, left, right, operationContext) -> {
- var targetBoolResult = operationContext.allocateVal(
+ (destination, left, right, operationContext) -> {
+ var destinationBoolResult = operationContext.allocateVal(
ShidToPatioLocalSpace.TEMPORARY,
PatioTypes.BOOL
);
- var targetBool = targetBoolResult.value();
- operationContext = targetBoolResult.context();
+ var destinationBool = destinationBoolResult.value();
+ operationContext = destinationBoolResult.context();
operationContext = binaryOperationCodeGen.generate(
- targetBool,
+ destinationBool,
left,
right,
operationContext
);
operationContext = operationContext.addInstruction(new PatioBoolToInt(
- target,
- targetBool,
+ destination,
+ destinationBool,
source
));
@@ -880,26 +880,26 @@ public class ShidToPatio {
var left = leftResult.value();
context = leftResult.context();
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.BINARY_OP_RESULT,
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
return binaryOperationCodeGen.generate(
- target,
+ destination,
left,
right,
context
- ).temporaryPush(target);
+ ).temporaryPush(destination);
}
private static ShidToPatioContext generateBlockNoResults(
ShidBlock shidBlock,
ShidToPatioContext context
) {
- // TODO: just use a block in Patio instructions even where there are no targets?
+ // TODO: just use a block in Patio instructions even where there are no destinations?
var blockResult = generateBlock(shidBlock, context);
var block = blockResult.value();
context = blockResult.context();
@@ -928,9 +928,9 @@ public class ShidToPatio {
context = generateInstruction(shidInstruction, context);
}
- var targetsResult = context.temporaryPopAll();
- var targets = targetsResult.value().reversed();
- context = targetsResult.context();
+ var destinationsResult = context.temporaryPopAll();
+ var destinations = destinationsResult.value().reversed();
+ context = destinationsResult.context();
var instructionsResult = context.exitBlock();
var instructions = instructionsResult.value();
@@ -938,7 +938,7 @@ public class ShidToPatio {
return context.toResult(new PatioBlock(
instructions,
- targets,
+ destinations,
shidBlock.source()
));
}
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java
index f1e00e50..43b19744 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java
@@ -85,7 +85,7 @@ class ShidToPatioClosures {
}
static ShidToPatioContext create(
- PatioLocalRef target,
+ PatioLocalRef destination,
ShidToPatioCompilationUnitElementSpace functionElementSpace,
String name,
List<ShidDefineFunction.Param> positionalParams,
@@ -132,7 +132,7 @@ class ShidToPatioClosures {
});
context = ShidToPatioClosures.alloc(
- target,
+ destination,
name,
fullName,
layout,
@@ -146,7 +146,7 @@ class ShidToPatioClosures {
}
static ShidToPatioContext alloc(
- PatioLocalRef target,
+ PatioLocalRef destination,
String name,
String functionName,
PatioDataLayout layout,
@@ -191,7 +191,7 @@ class ShidToPatioClosures {
);
context = context.addInstruction(new PatioDataPtrToInt(
- target,
+ destination,
closurePointer,
source
));
@@ -259,7 +259,7 @@ class ShidToPatioClosures {
}
static ShidToPatioContext call(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioLocalRef closure,
List<PatioLocalRef> positionalArgs,
List<Map.Entry<String, PatioLocalRef>> namedArgsByName,
@@ -306,7 +306,7 @@ class ShidToPatioClosures {
return context
.addInstruction(new PatioCallPointer(
- target,
+ destination,
functionPointer,
args,
source
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioContext.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioContext.java
index 8ca486ae..c93dad28 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioContext.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioContext.java
@@ -563,11 +563,11 @@ public record ShidToPatioContext(
}
@CheckReturnValue
- public ShidToPatioContext temporaryPopIntoLocal(PatioLocalRef target, Source source) {
+ public ShidToPatioContext temporaryPopIntoLocal(PatioLocalRef destination, Source source) {
var result = this.functionContext.temporaryPop();
return new ShidToPatioContext(this.globalContext, this.compilationUnitContext, this.blockStack, result.context)
- .addInstruction(new PatioLocalStore(target, result.value, source));
+ .addInstruction(new PatioLocalStore(destination, result.value, source));
}
@CheckReturnValue
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java
index 0b78429a..fb113850 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java
@@ -119,7 +119,7 @@ public class ShidToPatioEffects {
}
public static ShidToPatioContext createUserDefinedEffect(
- PatioLocalRef target,
+ PatioLocalRef destination,
UserDefinedEffect effect,
Source source,
ShidToPatioContext context
@@ -236,7 +236,7 @@ public class ShidToPatioEffects {
}
context = context.addInstruction(new PatioDataPtrToInt(
- target,
+ destination,
effectPointer,
source
));
@@ -245,7 +245,7 @@ public class ShidToPatioEffects {
}
public static ShidToPatioContext fieldLoad(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand receiver,
UserDefinedEffect effect,
String fieldName,
@@ -271,7 +271,7 @@ public class ShidToPatioEffects {
var methodIndex = effectInfo.methodIndex(fieldName);
context = context.addInstruction(new PatioMemoryLoad(
- target,
+ destination,
effectPointer,
effectDataLayout,
userDefinedEffectMethodOffset(methodIndex),
@@ -282,7 +282,7 @@ public class ShidToPatioEffects {
}
public static ShidToPatioContext try_(
- PatioLocalRef target,
+ PatioLocalRef destination,
UserDefinedEffect effect,
Map<String, PatioOperand> handlerMethodsByName,
Function<ShidToPatioContext, ShidToPatioResult<PatioBlock>> generateBody,
@@ -349,7 +349,7 @@ public class ShidToPatioEffects {
context = exceptionValueResult.context();
context = context.addInstruction(new PatioTry(
- List.of(target),
+ List.of(destination),
List.of(
new PatioCatchClause(
context.exceptionTypeName(effect),
@@ -370,7 +370,7 @@ public class ShidToPatioEffects {
}
public static ShidToPatioContext createEffectHandlerMethod(
- PatioLocalRef target,
+ PatioLocalRef destination,
String name,
List<ShidDefineFunction.Param> positionalParams,
List<ShidDefineFunction.Param> namedParams,
@@ -386,7 +386,7 @@ public class ShidToPatioEffects {
var layout = effectHandlerMethodDataLayout(freeVariables, context);
return ShidToPatioClosures.create(
- target,
+ destination,
ShidToPatioCompilationUnitElementSpace.EFFECT_HANDLER_METHOD,
name,
positionalParams,
@@ -491,12 +491,12 @@ public class ShidToPatioEffects {
}
private static ShidToPatioContext getCurrentEffectHandler(
- PatioLocalRef target,
+ PatioLocalRef destination,
Source source,
ShidToPatioContext context
) {
return context.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
GET_HANDLER_DECLARATION.name(),
List.of(),
source
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioFunctions.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioFunctions.java
index c0a6ad74..633cb7b1 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioFunctions.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioFunctions.java
@@ -26,7 +26,7 @@ public class ShidToPatioFunctions {
}
public static ShidToPatioContext create(
- PatioLocalRef target,
+ PatioLocalRef destination,
String name,
List<ShidDefineFunction.Param> positionalParams,
List<ShidDefineFunction.Param> namedParams,
@@ -38,7 +38,7 @@ public class ShidToPatioFunctions {
var layout = functionDataLayout(freeVariables, context);
return ShidToPatioClosures.create(
- target,
+ destination,
ShidToPatioCompilationUnitElementSpace.FUNCTION,
name,
positionalParams,
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java
index 90466728..689cf68d 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java
@@ -65,14 +65,14 @@ public class ShidToPatioGc {
);
public static ShidToPatioContext getGcRootStackIndex(
- PatioLocalRef target,
+ PatioLocalRef destination,
Source source,
ShidToPatioContext context
) {
return context
.ensureCompilationUnitElement(GET_GC_ROOT_STACK_INDEX)
.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
GET_GC_ROOT_STACK_INDEX.name(),
List.of(),
source
@@ -126,7 +126,7 @@ public class ShidToPatioGc {
// == Allocation ==
public static ShidToPatioContext alloc(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioDataLayout layout,
List<Integer> childrenOffset,
int childrenCount,
@@ -134,7 +134,7 @@ public class ShidToPatioGc {
ShidToPatioContext context
) {
return context.addInstruction(new PatioAllocHeap(
- target,
+ destination,
layout,
childrenOffset,
childrenCount,
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java
index e26a6f27..77dada45 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java
@@ -71,7 +71,7 @@ public class ShidToPatioInts {
}
public static ShidToPatioContext storeConst(
- PatioLocalRef target,
+ PatioLocalRef destination,
BigInteger value,
Source source,
ShidToPatioContext context
@@ -79,7 +79,7 @@ public class ShidToPatioInts {
return context
.ensureCompilationUnitElement(INT_CREATE_DECLARATION)
.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
INT_CREATE_DECLARATION.name(),
List.of(new PatioInt(value.intValueExact())),
source
@@ -87,7 +87,7 @@ public class ShidToPatioInts {
}
public static ShidToPatioContext add(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source,
@@ -96,7 +96,7 @@ public class ShidToPatioInts {
return context
.ensureCompilationUnitElement(INT_ADD_DECLARATION)
.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
INT_ADD_DECLARATION.name(),
List.of(left, right),
source
@@ -104,7 +104,7 @@ public class ShidToPatioInts {
}
public static ShidToPatioContext sub(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source,
@@ -113,7 +113,7 @@ public class ShidToPatioInts {
return context
.ensureCompilationUnitElement(INT_SUB_DECLARATION)
.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
INT_SUB_DECLARATION.name(),
List.of(left, right),
source
@@ -121,7 +121,7 @@ public class ShidToPatioInts {
}
public static ShidToPatioContext equals(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source,
@@ -130,7 +130,7 @@ public class ShidToPatioInts {
return context
.ensureCompilationUnitElement(INT_EQUALS_DECLARATION)
.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
INT_EQUALS_DECLARATION.name(),
List.of(left, right),
source
@@ -138,7 +138,7 @@ public class ShidToPatioInts {
}
public static ShidToPatioContext notEqual(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source,
@@ -147,7 +147,7 @@ public class ShidToPatioInts {
return context
.ensureCompilationUnitElement(INT_NOT_EQUAL_DECLARATION)
.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
INT_NOT_EQUAL_DECLARATION.name(),
List.of(left, right),
source
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java
index 289c34f2..c12a25bb 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java
@@ -174,7 +174,7 @@ public class ShidToPatioNamespaces {
}
public static ShidToPatioContext importValue(
- PatioLocalRef target,
+ PatioLocalRef destination,
NamespaceName namespaceName,
Source source,
ShidToPatioContext context
@@ -187,7 +187,7 @@ public class ShidToPatioNamespaces {
));
context = context.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
globalNameNamespaceImport(namespaceName),
List.of(),
source
@@ -197,7 +197,7 @@ public class ShidToPatioNamespaces {
}
public static ShidToPatioContext fieldLoad(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand receiver,
NamespaceName namespaceName,
String fieldName,
@@ -222,7 +222,7 @@ public class ShidToPatioNamespaces {
));
context = context.addInstruction(new PatioMemoryLoad(
- target,
+ destination,
namespacePointer,
layout,
fieldOffset(namespaceTypeInfo.fieldIndex(fieldName)),
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java
index fee60d76..af037ae6 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java
@@ -64,7 +64,7 @@ public class ShidToPatioStrings {
}
public static ShidToPatioContext add(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand left,
PatioOperand right,
Source source,
@@ -73,7 +73,7 @@ public class ShidToPatioStrings {
context = context.ensureCompilationUnitElement(STRING_ADD_DECLARATION);
context = context.addInstruction(new PatioCall(
- Optional.of(target),
+ Optional.of(destination),
STRING_ADD_DECLARATION.name(),
List.of(left, right),
source
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java
index f7e8bdfe..7146320d 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java
@@ -21,14 +21,14 @@ public class ShidToPatioStructs {
}
public static ShidToPatioContext createType(
- PatioLocalRef target,
+ PatioLocalRef destination,
SimpleStructType type,
List<ShidDefineStruct.Field> fields,
Source source,
ShidToPatioContext context
) {
return ShidToPatioFunctions.create(
- target,
+ destination,
type.name(),
List.of(),
fields.stream()
@@ -99,7 +99,7 @@ public class ShidToPatioStructs {
}
public static ShidToPatioContext fieldLoad(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand receiver,
SimpleStructType type,
String fieldName,
@@ -125,7 +125,7 @@ public class ShidToPatioStructs {
var fieldIndex = structTypeInfo.fieldIndex(fieldName);
context = context.addInstruction(new PatioMemoryLoad(
- target,
+ destination,
valuePointer,
structDataLayout,
fieldOffset(fieldIndex),
@@ -136,7 +136,7 @@ public class ShidToPatioStructs {
}
public static ShidToPatioContext tagLoad(
- PatioLocalRef target,
+ PatioLocalRef destination,
PatioOperand receiver,
Source source,
ShidToPatioContext context
@@ -157,7 +157,7 @@ public class ShidToPatioStructs {
var structDataLayout = unknownStructDataLayout();
context = context.addInstruction(new PatioMemoryLoad(
- target,
+ destination,
valuePointer,
structDataLayout,
TAG_OFFSET,
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java
index 501badc5..acf24c08 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java
@@ -97,23 +97,23 @@ public class ShidToPatioTuples {
source
));
- var targetResult = context.allocateVal(
+ var destinationResult = context.allocateVal(
ShidToPatioLocalSpace.TUPLE_ELEMENT,
Integer.toString(elementIndex),
ShidToPatioTypes.VALUE_TYPE
);
- var target = targetResult.value();
- context = targetResult.context();
+ var destination = destinationResult.value();
+ context = destinationResult.context();
context = context.addInstruction(new PatioMemoryLoad(
- target,
+ destination,
tuplePointer,
tupleDataLayout(elementCount),
elementOffset(elementIndex),
source
));
- return context.toResult(target);
+ return context.toResult(destination);
}
private static PatioDataLayout tupleDataLayout(int elementCount) {
diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioVars.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioVars.java
index b38012f0..71fbb6aa 100644
--- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioVars.java
+++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioVars.java
@@ -64,13 +64,13 @@ public class ShidToPatioVars {
}
public static ShidToPatioContext load(
- PatioLocalRef target,
+ PatioLocalRef destination,
String shidName,
Source source,
ShidToPatioContext context
) {
return context.addInstruction(new PatioMemoryLoad(
- target,
+ destination,
context.shidLocalNameToLocal(shidName),
VAR_DATA_LAYOUT,
VALUE_OFFSET,