diff --git a/doc/syntax/SYNTAX-4-FUNCTIONS.markdown b/doc/syntax/SYNTAX-4-FUNCTIONS.markdown index 39994d703..43bb09945 100644 --- a/doc/syntax/SYNTAX-4-FUNCTIONS.markdown +++ b/doc/syntax/SYNTAX-4-FUNCTIONS.markdown @@ -109,9 +109,9 @@ Again, the `vault1` or `storage` in the examples can be a variable or a linked b A `sync` instruction (available in Mindustry Logic since version 7.0 build 146) is mapped to a `sync()` function. The function has one parameter - a variable to be synchronized across the network (namely, from the server to all clients). A [global variable](SYNTAX-1-VARIABLES.markdown#global-variables) must be passed as an argument to this -function, otherwise a compile error occurs. The reason is that global variables are more restrained in optimizations -and therefore their dataflow is less altered. If local variables were used, they might not contain the expected -value, as some (or all) assignments to them can be eliminated by the Data Flow Optimization. +function, otherwise a compilation error occurs. The reason is that global variables are more restrained in +optimizations and therefore their dataflow is less altered. If local variables were used, they might not contain the +expected value, as some (or all) assignments to them can be eliminated by the Data Flow Optimization. This constraint makes sense semantically as well: a scope of a global variable is the entire program. When a variable is synced, its scope becomes even broader and is shared between multiple processors; using a local variable diff --git a/mindcode/src/main/java/info/teksol/mindcode/compiler/generator/LogicInstructionGenerator.java b/mindcode/src/main/java/info/teksol/mindcode/compiler/generator/LogicInstructionGenerator.java index 146fbb0d1..81739a98b 100644 --- a/mindcode/src/main/java/info/teksol/mindcode/compiler/generator/LogicInstructionGenerator.java +++ b/mindcode/src/main/java/info/teksol/mindcode/compiler/generator/LogicInstructionGenerator.java @@ -174,8 +174,8 @@ public LogicVariable visitVariable(AstNode node) { } - public CallRecInstruction createCallRecursive(LogicVariable stack, LogicLabel callAddr, LogicLabel retAddr) { - return instructionProcessor.createCallRecursive(astContext, stack, callAddr, retAddr); + public CallRecInstruction createCallRecursive(LogicVariable stack, LogicLabel callAddr, LogicLabel retAddr, LogicVariable returnValue) { + return instructionProcessor.createCallRecursive(astContext, stack, callAddr, retAddr, returnValue); } public EndInstruction createEnd() { @@ -251,8 +251,8 @@ public SetAddressInstruction createSetAddress(LogicVariable variable, LogicLabel return instructionProcessor.createSetAddress(astContext, variable, address); } - public CallInstruction createCallStackless(LogicAddress value) { - return instructionProcessor.createCallStackless(astContext, value); + public CallInstruction createCallStackless(LogicAddress value, LogicVariable returnValue) { + return instructionProcessor.createCallStackless(astContext, value, returnValue); } public StopInstruction createStop() { @@ -466,7 +466,7 @@ private LogicValue handleStacklessFunctionCall(Function function, List * Note: getlink is not deemed a deterministic instruction, as it can be influenced by linking updating * blocks linked to the processor in the Mindustry World. Block variables are considered volatile * for the same reason. diff --git a/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/AbstractOptimizer.java b/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/AbstractOptimizer.java index 33d9d0aa0..cb30076bf 100644 --- a/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/AbstractOptimizer.java +++ b/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/AbstractOptimizer.java @@ -90,12 +90,12 @@ protected boolean isVolatile(LogicInstruction instruction) { // // - protected CallInstruction createCallStackless(AstContext astContext, LogicAddress address) { - return instructionProcessor.createCallStackless(astContext, address); + protected CallInstruction createCallStackless(AstContext astContext, LogicAddress address, LogicVariable returnValue) { + return instructionProcessor.createCallStackless(astContext, address, returnValue); } - protected CallRecInstruction createCallRecursive(AstContext astContext, LogicVariable stack, LogicLabel callAddr, LogicLabel retAddr) { - return instructionProcessor.createCallRecursive(astContext, stack, callAddr, retAddr); + protected CallRecInstruction createCallRecursive(AstContext astContext, LogicVariable stack, LogicLabel callAddr, LogicLabel retAddr, LogicVariable returnValue) { + return instructionProcessor.createCallRecursive(astContext, stack, callAddr, retAddr, returnValue); } protected EndInstruction createEnd(AstContext astContext) { diff --git a/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/DeadCodeEliminator.java b/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/DeadCodeEliminator.java index beb70d7f3..87946a08f 100644 --- a/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/DeadCodeEliminator.java +++ b/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/DeadCodeEliminator.java @@ -5,6 +5,7 @@ import info.teksol.mindcode.compiler.instructions.PushOrPopInstruction; import info.teksol.mindcode.logic.ArgumentType; import info.teksol.mindcode.logic.LogicVariable; +import info.teksol.mindcode.logic.Opcode; import java.util.*; import java.util.function.Predicate; @@ -116,10 +117,12 @@ private void examineInstruction(LogicInstruction instruction) { .map(LogicVariable.class::cast) .forEach(reads::add); - instruction.outputArgumentsStream() - .filter(LogicVariable.class::isInstance) - .map(LogicVariable.class::cast) - .filter(Predicate.not(LogicVariable::isCompilerVariable)) - .forEach(v -> addWrite(instruction, v)); + if (instruction.getOpcode() != Opcode.CALL && instruction.getOpcode() != Opcode.CALLREC) { + instruction.outputArgumentsStream() + .filter(LogicVariable.class::isInstance) + .map(LogicVariable.class::cast) + .filter(Predicate.not(LogicVariable::isCompilerVariable)) + .forEach(v -> addWrite(instruction, v)); + } } } diff --git a/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/FunctionInliner.java b/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/FunctionInliner.java index d405496ce..5705f9491 100644 --- a/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/FunctionInliner.java +++ b/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/FunctionInliner.java @@ -7,9 +7,7 @@ import info.teksol.mindcode.compiler.instructions.EndInstruction; import info.teksol.mindcode.compiler.instructions.GotoInstruction; import info.teksol.mindcode.compiler.instructions.LogicInstruction; -import info.teksol.mindcode.compiler.instructions.SetInstruction; import info.teksol.mindcode.compiler.optimization.OptimizationContext.LogicList; -import info.teksol.mindcode.logic.LogicVariable; import java.util.ArrayList; import java.util.List; @@ -115,7 +113,7 @@ private OptimizationResult inlineFunction(AstContext context, int costLimit) { AstContext newContext = call.parent().createSubcontext(INLINE_CALL, 1.0); int insertionPoint = firstInstructionIndex(call); LogicList newBody = body.duplicateToContext(newContext); - insertInstructions(insertionPoint, swapReturnVariable(call, newBody)); + insertInstructions(insertionPoint, newBody); // Remove original call instructions removeMatchingInstructions(ix -> ix.belongsTo(call)); } @@ -129,25 +127,6 @@ private OptimizationResult inlineFunction(AstContext context, int costLimit) { return OptimizationResult.REALIZED; } - private LogicList swapReturnVariable(AstContext call, LogicList newBody) { - LogicInstruction followup = instructionAfter(call); - if (followup instanceof SetInstruction set - && set.getValue() instanceof LogicVariable variable - && variable.getFunctionPrefix().equals(call.functionPrefix())) { - LogicVariable result = set.getResult(); - removeInstruction(set); - - // TODO When modification support is added to LogicList, rewrite this to modify instructions there - List newInstructions = newBody.stream() - .map(ix -> replaceAllArgs(ix, variable, result)) - .toList(); - - return buildLogicList(newBody.getAstContext(), newInstructions); - } else { - return newBody; - } - } - private class InlineFunctionAction extends AbstractOptimizationAction { public InlineFunctionAction(AstContext astContext, int cost, double benefit) { super(astContext, cost, benefit); @@ -217,7 +196,7 @@ private OptimizationResult inlineFunctionCall(AstContext call, int costLimit) { AstContext newContext = call.parent().createSubcontext(INLINE_CALL, 1.0); int insertionPoint = firstInstructionIndex(call); LogicList newBody = body.duplicateToContext(newContext); - insertInstructions(insertionPoint, swapReturnVariable(call, newBody)); + insertInstructions(insertionPoint, newBody); // Remove original call instructions removeMatchingInstructions(ix -> ix.belongsTo(call)); diff --git a/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/LoopHoisting.java b/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/LoopHoisting.java index 32abe73d5..363a28ddb 100644 --- a/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/LoopHoisting.java +++ b/mindcode/src/main/java/info/teksol/mindcode/compiler/optimization/LoopHoisting.java @@ -8,7 +8,6 @@ import info.teksol.mindcode.compiler.instructions.LogicInstruction; import info.teksol.mindcode.compiler.instructions.NoOpInstruction; import info.teksol.mindcode.compiler.optimization.OptimizationContext.LogicList; -import info.teksol.mindcode.logic.ArgumentType; import info.teksol.mindcode.logic.LogicArgument; import info.teksol.mindcode.logic.LogicVariable; @@ -176,13 +175,6 @@ private void addDependencies(AstContext loop, AstContext inspectedContext, .filter(LogicVariable.class::isInstance) .map(LogicVariable.class::cast) .forEach(arg -> dependencies.computeIfAbsent(arg, a -> new HashSet<>()).addAll(inputs)); - - // Function return variables outside their functions are not loop invariant - instruction.inputArgumentsStream() - .filter(LogicVariable.class::isInstance) - .map(LogicVariable.class::cast) - .filter(l -> l.getType() == ArgumentType.FUNCTION_RETVAL && !Objects.equals(l.getFunctionPrefix(), prefix)) - .forEachOrdered(arg -> dependencies.computeIfAbsent(arg, a -> new HashSet<>()).add(arg)); } else { // This instruction isn't loop independent: it's unsafe, nondeterministic or nonlinear. // Add output variables as depending on themselves, removing their invariant status diff --git a/mindcode/src/main/java/info/teksol/mindcode/logic/MindustryOpcodeVariants.java b/mindcode/src/main/java/info/teksol/mindcode/logic/MindustryOpcodeVariants.java index bd7b47710..15695ea1a 100644 --- a/mindcode/src/main/java/info/teksol/mindcode/logic/MindustryOpcodeVariants.java +++ b/mindcode/src/main/java/info/teksol/mindcode/logic/MindustryOpcodeVariants.java @@ -263,8 +263,8 @@ private List initialize() { add(list, V6, V7A, S, NONE, Opcode.GOTOLABEL, label("address"), label("marker")); add(list, V6, V7A, S, NONE, Opcode.PUSH, block("memory"), in("value")); add(list, V6, V7A, S, NONE, Opcode.POP, block("memory"), out("value")); - add(list, V6, V7A, S, NONE, Opcode.CALL, label("callAddr")); - add(list, V6, V7A, S, NONE, Opcode.CALLREC, block("memory"), label("callAddr"), label("retAddr")); + add(list, V6, V7A, S, NONE, Opcode.CALL, label("callAddr"), out("retval")); + add(list, V6, V7A, S, NONE, Opcode.CALLREC, block("memory"), label("callAddr"), label("retAddr"), out("retval")); add(list, V6, V7A, S, NONE, Opcode.RETURN, block("memory")); add(list, V6, V7A, S, NONE, Opcode.GOTO, in("address"), label("marker")); add(list, V6, V7A, S, NONE, Opcode.GOTOOFFSET, label("address"), in("value"), in("offset"), label("marker")); diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/LogicInstructionLabelResolverTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/LogicInstructionLabelResolverTest.java index 5258625ac..72e3f788c 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/LogicInstructionLabelResolverTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/LogicInstructionLabelResolverTest.java @@ -50,7 +50,7 @@ void resolvesVirtualInstructions() { createInstruction(JUMP, label0, Condition.ALWAYS), createInstruction(PUSH, cell1, a), createInstruction(POP, cell1, a), - createInstruction(CALLREC, cell1, label1, label2), + createInstruction(CALLREC, cell1, label1, label2, fn0retval), createInstruction(LABEL, label1), createInstruction(RETURN, cell1), createInstruction(LABEL, label2), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/generator/LogicInstructionGeneratorFunctionsTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/generator/LogicInstructionGeneratorFunctionsTest.java index d3ee21fa1..4109d4b90 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/generator/LogicInstructionGeneratorFunctionsTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/generator/LogicInstructionGeneratorFunctionsTest.java @@ -45,13 +45,13 @@ def foo(n) """, createInstruction(SET, "__fn0_n", "3"), createInstruction(SETADDR, "__fn0retaddr", var(1001)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1001), "__fn0"), createInstruction(SET, var(0), "__fn0retval"), createInstruction(PRINT, var(0)), createInstruction(SET, "__fn0_n", "4"), createInstruction(SETADDR, "__fn0retaddr", var(1002)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1002), "__fn0"), createInstruction(SET, var(1), "__fn0retval"), createInstruction(PRINT, var(1)), @@ -98,7 +98,7 @@ def foo(n) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_n", "3"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(SET, var(0), "__fn0retval"), createInstruction(PRINT, var(0)), @@ -106,7 +106,7 @@ def foo(n) createInstruction(LABEL, var(1000)), createInstruction(PUSH, "bank1", "__fn0_n"), createInstruction(SET, "__fn0_n", "__fn0_n"), - createInstruction(CALLREC, "bank1", var(1000), var(1003)), + createInstruction(CALLREC, "bank1", var(1000), var(1003), "__fn0retval"), createInstruction(LABEL, var(1003)), createInstruction(POP, "bank1", "__fn0_n"), createInstruction(SET, var(1), "__fn0retval"), @@ -128,7 +128,7 @@ def bar(n) 1 - foo(n) end createInstruction(SET, "__sp", "0"), // call foo createInstruction(SET, "__fn1_n", "4"), - createInstruction(CALLREC, "bank1", var(1001), var(1002)), + createInstruction(CALLREC, "bank1", var(1001), var(1002), "__fn1retval"), createInstruction(LABEL, var(1002)), createInstruction(SET, var(0), "__fn1retval"), createInstruction(PRINT, var(0)), @@ -138,7 +138,7 @@ def bar(n) 1 - foo(n) end // call bar createInstruction(PUSH, "bank1", "__fn0_n"), createInstruction(SET, "__fn1_n", "__fn0_n"), - createInstruction(CALLREC, "bank1", var(1001), var(1004)), + createInstruction(CALLREC, "bank1", var(1001), var(1004), "__fn1retval"), createInstruction(LABEL, var(1004)), createInstruction(POP, "bank1", "__fn0_n"), createInstruction(SET, var(1), "__fn1retval"), @@ -152,7 +152,7 @@ def bar(n) 1 - foo(n) end // call foo createInstruction(PUSH, "bank1", "__fn1_n"), createInstruction(SET, "__fn0_n", "__fn1_n"), - createInstruction(CALLREC, "bank1", var(1000), var(1006)), + createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "bank1", "__fn1_n"), createInstruction(SET, var(3), "__fn0retval"), @@ -233,25 +233,25 @@ def baz(n) 3 ** n end // call foo createInstruction(SET, "__fn1_n", "0"), createInstruction(SETADDR, "__fn1retaddr", var(1003)), - createInstruction(CALL, var(1001)), + createInstruction(CALL, var(1001), "__fn1retval"), createInstruction(GOTOLABEL, var(1003), "__fn1"), createInstruction(SET, var(0), "__fn1retval"), // call bar createInstruction(SET, "__fn0_n", "0"), createInstruction(SETADDR, "__fn0retaddr", var(1004)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1004), "__fn0"), createInstruction(SET, var(1), "__fn0retval"), // call baz createInstruction(SET, "__fn2_n", "0"), createInstruction(SETADDR, "__fn2retaddr", var(1005)), - createInstruction(CALL, var(1002)), + createInstruction(CALL, var(1002), "__fn2retval"), createInstruction(GOTOLABEL, var(1005), "__fn2"), createInstruction(SET, var(2), "__fn2retval"), // call foo (again) createInstruction(SET, "__fn1_n", "4"), createInstruction(SETADDR, "__fn1retaddr", var(1006)), - createInstruction(CALL, var(1001)), + createInstruction(CALL, var(1001), "__fn1retval"), createInstruction(GOTOLABEL, var(1006), "__fn1"), createInstruction(SET, var(3), "__fn1retval"), createInstruction(PRINT, var(3)), @@ -261,7 +261,7 @@ def baz(n) 3 ** n end // call baz createInstruction(SET, "__fn2_n", "__fn0_n"), createInstruction(SETADDR, "__fn2retaddr", var(1008)), - createInstruction(CALL, var(1002)), + createInstruction(CALL, var(1002), "__fn2retval"), createInstruction(GOTOLABEL, var(1008), "__fn2"), createInstruction(OP, "mul", var(4), "2", "__fn2retval"), createInstruction(SET, "__fn0retval", var(4)), @@ -273,7 +273,7 @@ def baz(n) 3 ** n end // call bar createInstruction(SET, "__fn0_n", "__fn1_n"), createInstruction(SETADDR, "__fn0retaddr", var(1010)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1010), "__fn0"), createInstruction(OP, "add", var(5), "1", "__fn0retval"), createInstruction(SET, "__fn1retval", var(5)), @@ -307,14 +307,14 @@ void canIndirectlyReferenceStack() { createInstruction(SET, "HEAPPTR", "cell2"), createInstruction(SET, "__sp", "0"), // Function call - createInstruction(CALLREC, "STACKPTR", var(1000), var(1002)), + createInstruction(CALLREC, "STACKPTR", var(1000), var(1002), "__fn0retval"), createInstruction(LABEL, var(1002)), createInstruction(SET, var(1), "__fn0retval"), createInstruction(WRITE, var(1), "HEAPPTR", "0"), createInstruction(END), // Function definition createInstruction(LABEL, var(1000)), - createInstruction(CALLREC, "STACKPTR", var(1000), var(1004)), + createInstruction(CALLREC, "STACKPTR", var(1000), var(1004), "__fn0retval"), createInstruction(LABEL, var(1004)), createInstruction(SET, var(2), "__fn0retval"), createInstruction(SET, "__fn0retval", var(2)), @@ -360,17 +360,17 @@ def a(n) """, createInstruction(SET, "__fn0_n", "4"), createInstruction(SETADDR, "__fn0retaddr", var(1001)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1001), "__fn0"), createInstruction(SET, var(0), "__fn0retval"), createInstruction(SET, "__fn0_n", var(0)), createInstruction(SETADDR, "__fn0retaddr", var(1002)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1002), "__fn0"), createInstruction(SET, var(1), "__fn0retval"), createInstruction(SET, "__fn0_n", var(1)), createInstruction(SETADDR, "__fn0retaddr", var(1003)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1003), "__fn0"), createInstruction(SET, var(2), "__fn0retval"), createInstruction(PRINT, var(2)), @@ -394,15 +394,15 @@ def a(n) a(n + 1) end """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_n", "4"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(SET, var(0), "__fn0retval"), createInstruction(SET, "__fn0_n", var(0)), - createInstruction(CALLREC, "bank1", var(1000), var(1002)), + createInstruction(CALLREC, "bank1", var(1000), var(1002), "__fn0retval"), createInstruction(LABEL, var(1002)), createInstruction(SET, var(1), "__fn0retval"), createInstruction(SET, "__fn0_n", var(1)), - createInstruction(CALLREC, "bank1", var(1000), var(1003)), + createInstruction(CALLREC, "bank1", var(1000), var(1003), "__fn0retval"), createInstruction(LABEL, var(1003)), createInstruction(SET, var(2), "__fn0retval"), createInstruction(PRINT, var(2)), @@ -413,7 +413,7 @@ def a(n) a(n + 1) end // call a createInstruction(PUSH, "bank1", "__fn0_n"), createInstruction(SET, "__fn0_n", var(3)), - createInstruction(CALLREC, "bank1", var(1000), var(1005)), + createInstruction(CALLREC, "bank1", var(1000), var(1005), "__fn0retval"), createInstruction(LABEL, var(1005)), createInstruction(POP, "bank1", "__fn0_n"), createInstruction(SET, var(4), "__fn0retval"), @@ -435,7 +435,7 @@ def fib(n) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_n", "10"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(SET, var(0), "__fn0retval"), createInstruction(PRINT, var(0)), @@ -450,7 +450,7 @@ def fib(n) createInstruction(OP, "sub", var(3), "__fn0_n", "1"), createInstruction(PUSH, "bank1", "__fn0_n"), createInstruction(SET, "__fn0_n", var(3)), - createInstruction(CALLREC, "bank1", var(1000), var(1005)), + createInstruction(CALLREC, "bank1", var(1000), var(1005), "__fn0retval"), createInstruction(LABEL, var(1005)), createInstruction(POP, "bank1", "__fn0_n"), createInstruction(SET, var(4), "__fn0retval"), @@ -458,7 +458,7 @@ def fib(n) createInstruction(PUSH, "bank1", "__fn0_n"), createInstruction(PUSH, "bank1", var(4)), createInstruction(SET, "__fn0_n", var(5)), - createInstruction(CALLREC, "bank1", var(1000), var(1006)), + createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "bank1", var(4)), createInstruction(POP, "bank1", "__fn0_n"), @@ -566,13 +566,13 @@ def a(n) """, createInstruction(SET, "__fn0_n", "0"), createInstruction(SETADDR, "__fn0retaddr", var(1001)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1001), "__fn0"), createInstruction(SET, var(0), "__fn0retval"), createInstruction(PRINT, var(0)), createInstruction(SET, "__fn0_n", "1"), createInstruction(SETADDR, "__fn0retaddr", var(1002)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1002), "__fn0"), createInstruction(SET, var(1), "__fn0retval"), createInstruction(PRINT, var(1)), @@ -648,7 +648,7 @@ def gdc(a,b) // call gdc createInstruction(SET, "__fn0_a", "115"), createInstruction(SET, "__fn0_b", "78"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(SET, var(0), "__fn0retval"), createInstruction(PRINT, var(0)), @@ -669,7 +669,7 @@ def gdc(a,b) createInstruction(PUSH, "bank1", "__fn0_b"), createInstruction(SET, "__fn0_a", "__fn0_b"), createInstruction(SET, "__fn0_b", var(3)), - createInstruction(CALLREC, "bank1", var(1000), var(1005)), + createInstruction(CALLREC, "bank1", var(1000), var(1005), "__fn0retval"), createInstruction(LABEL, var(1005)), createInstruction(POP, "bank1", "__fn0_b"), createInstruction(POP, "bank1", "__fn0_a"), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/DataFlowOptimizerTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/DataFlowOptimizerTest.java index b0bb935c8..c61ef0917 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/DataFlowOptimizerTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/DataFlowOptimizerTest.java @@ -898,14 +898,14 @@ def getBit(bitIndex) createInstruction(LABEL, var(1007)), createInstruction(OP, "idiv", "__fn0_bitIndex", "n", "2"), createInstruction(SETADDR, "__fn0retaddr", var(1004)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1004), "__fn0"), createInstruction(PRINT, "__fn0retval"), createInstruction(OP, "add", "n", "n", "1"), createInstruction(JUMP, var(1007), "lessThanEq", "n", "1000"), createInstruction(SET, "__fn0_bitIndex", "0"), createInstruction(SETADDR, "__fn0retaddr", var(1005)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1005), "__fn0"), createInstruction(END), createInstruction(LABEL, var(1000)), @@ -925,10 +925,10 @@ def foo(n) """, createInstruction(SET, "__fn0_n", "2"), createInstruction(SETADDR, "__fn0retaddr", var(1001)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1001), "__fn0"), createInstruction(SETADDR, "__fn0retaddr", var(1002)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1002), "__fn0"), createInstruction(END), createInstruction(LABEL, var(1000)), @@ -949,7 +949,7 @@ def fib(n) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_n", "10"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(PRINT, "__fn0retval"), createInstruction(END), @@ -958,13 +958,13 @@ def fib(n) createInstruction(JUMP, var(1004), "lessThan", "__fn0_n", "2"), createInstruction(PUSH, "bank1", "__fn0_n"), createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "1"), - createInstruction(CALLREC, "bank1", var(1000), var(1005)), + createInstruction(CALLREC, "bank1", var(1000), var(1005), "__fn0retval"), createInstruction(LABEL, var(1005)), createInstruction(POP, "bank1", "__fn0_n"), createInstruction(SET, var(4), "__fn0retval"), createInstruction(PUSH, "bank1", var(4)), createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "2"), - createInstruction(CALLREC, "bank1", var(1000), var(1006)), + createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "bank1", var(4)), createInstruction(OP, "add", "__fn0retval", var(4), "__fn0retval"), @@ -992,11 +992,11 @@ def foo(n) createInstruction(SET, "Y", "6"), createInstruction(SET, "__fn0_n", "X"), createInstruction(SETADDR, "__fn0retaddr", var(1001)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1001), "__fn0"), createInstruction(SET, "__fn0_n", "Y"), createInstruction(SETADDR, "__fn0retaddr", var(1004)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1004), "__fn0"), createInstruction(PRINT, "Y"), createInstruction(END), @@ -1018,12 +1018,12 @@ def foo(n) """, createInstruction(SET, "__fn0_n", "2"), createInstruction(SETADDR, "__fn0retaddr", var(1001)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1001), "__fn0"), createInstruction(PRINT, "__fn0retval"), createInstruction(SET, "__fn0_n", "3"), createInstruction(SETADDR, "__fn0retaddr", var(1002)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1002), "__fn0"), createInstruction(PRINT, "__fn0retval"), createInstruction(END), @@ -1051,7 +1051,7 @@ def foo(n) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_n", "10"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(PRINT, "__fn0retval"), createInstruction(END), @@ -1059,7 +1059,7 @@ def foo(n) createInstruction(SET, "__fn0retval", "null"), createInstruction(JUMP, var(1004), "lessThanEq", "__fn0_n", "0"), createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "1"), - createInstruction(CALLREC, "bank1", var(1000), var(1005)), + createInstruction(CALLREC, "bank1", var(1000), var(1005), "__fn0retval"), createInstruction(LABEL, var(1005)), createInstruction(LABEL, var(1004)), createInstruction(RETURN, "bank1") @@ -1084,7 +1084,7 @@ def foo(n) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_n", "10"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(END), createInstruction(LABEL, var(1000)), @@ -1095,7 +1095,7 @@ def foo(n) createInstruction(PUSH, "bank1", "__fn0_n"), createInstruction(PUSH, "bank1", "__fn0_i"), createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "1"), - createInstruction(CALLREC, "bank1", var(1000), var(1006)), + createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "bank1", "__fn0_i"), createInstruction(POP, "bank1", "__fn0_n"), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/DeadCodeEliminatorTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/DeadCodeEliminatorTest.java index b05bd43ea..6c885c60e 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/DeadCodeEliminatorTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/DeadCodeEliminatorTest.java @@ -221,11 +221,11 @@ def foo(n) """, createInstruction(SET, "__fn0_n", "2"), createInstruction(SETADDR, "__fn0retaddr", var(1001)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1001), "__fn0"), createInstruction(SET, "__fn0_n", "4"), createInstruction(SETADDR, "__fn0retaddr", var(1002)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1002), "__fn0"), createInstruction(END), createInstruction(LABEL, var(1000)), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/FunctionInlinerTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/FunctionInlinerTest.java index d916c2f28..8de05fae6 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/FunctionInlinerTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/FunctionInlinerTest.java @@ -82,6 +82,34 @@ def foo(n) ); } + @Test + void inlinesTwoFunctionCallsInsideLoop() { + CompilerProfile compilerProfile = createCompilerProfile().setAllOptimizationLevels(OptimizationLevel.BASIC); + TestCompiler compiler = createTestCompiler(compilerProfile); + assertCompilesTo(compiler, + """ + while true + a = foo() + b = foo() + print(a, b) + end + + def foo() + rand(10) + end + """, + createInstruction(LABEL, var(1001)), + createInstruction(OP, "rand", "__fn0retval", "10"), + createInstruction(SET, "a", "__fn0retval"), + createInstruction(OP, "rand", "__fn0retval", "10"), + createInstruction(SET, "b", "__fn0retval"), + createInstruction(PRINT, "a"), + createInstruction(PRINT, "__fn0retval"), + createInstruction(JUMP, var(1001), "always"), + createInstruction(END) + ); + } + @Test void inlinesNestedFunctionCalls() { assertCompilesTo(""" @@ -104,7 +132,8 @@ def foo() end print(foo() + foo()) """, - createInstruction(OP, "rand", var(0), "10"), + createInstruction(OP, "rand", "__fn0retval", "10"), + createInstruction(SET, var(0), "__fn0retval"), createInstruction(OP, "rand", "__fn0retval", "10"), createInstruction(OP, "add", var(2), var(0), "__fn0retval"), createInstruction(PRINT, var(2)), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/GeneralOptimizationTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/GeneralOptimizationTest.java index a7b28fc66..02ec2189e 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/GeneralOptimizationTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/GeneralOptimizationTest.java @@ -74,11 +74,11 @@ def fn(n) """, createInstruction(SET, "__sp", "33"), createInstruction(SET, "__fn0_n", "4"), - createInstruction(CALLREC, "cell1", var(1000), var(1001)), + createInstruction(CALLREC, "cell1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(SET, var(0), "__fn0retval"), createInstruction(SET, "__fn0_n", "5"), - createInstruction(CALLREC, "cell1", var(1000), var(1002)), + createInstruction(CALLREC, "cell1", var(1000), var(1002), "__fn0retval"), createInstruction(LABEL, var(1002)), createInstruction(OP, "add", var(2), var(0), "__fn0retval"), createInstruction(WRITE, var(2), "cell2", "3"), @@ -89,7 +89,7 @@ def fn(n) createInstruction(LABEL, var(1000)), createInstruction(PUSH, "cell1", "__fn0_n"), createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "1"), - createInstruction(CALLREC, "cell1", var(1000), var(1004)), + createInstruction(CALLREC, "cell1", var(1000), var(1004), "__fn0retval"), createInstruction(LABEL, var(1004)), createInstruction(POP, "cell1", "__fn0_n"), createInstruction(OP, "mul", "__fn0retval", "2", "__fn0_n"), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/LoopHoistingTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/LoopHoistingTest.java index 936dbd2d1..f5a036746 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/LoopHoistingTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/LoopHoistingTest.java @@ -156,7 +156,7 @@ def foo(n) createInstruction(LABEL, var(1009)), createInstruction(OP, "mul", "x", "2", "A"), createInstruction(SET, "__fn0_n", "10"), - createInstruction(CALLREC, "cell1", var(1000), var(1004)), + createInstruction(CALLREC, "cell1", var(1000), var(1004), "__fn0retval"), createInstruction(LABEL, var(1004)), createInstruction(PRINT, "x"), createInstruction(OP, "add", "i", "i", "1"), @@ -167,7 +167,7 @@ def foo(n) createInstruction(SET, "A", "20"), createInstruction(JUMP, var(1007), "lessThanEq", "__fn0_n", "0"), createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "1"), - createInstruction(CALLREC, "cell1", var(1000), var(1008)), + createInstruction(CALLREC, "cell1", var(1000), var(1008), "__fn0retval"), createInstruction(LABEL, var(1008)), createInstruction(LABEL, var(1007)), createInstruction(RETURN, "cell1") @@ -213,7 +213,8 @@ def foo() end """, createInstruction(LABEL, var(1001)), - createInstruction(OP, "rand", "a", "10"), + createInstruction(OP, "rand", "__fn0retval", "10"), + createInstruction(SET, "a", "__fn0retval"), createInstruction(OP, "rand", "__fn0retval", "10"), createInstruction(PRINT, "a"), createInstruction(PRINT, "__fn0retval"), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/PropagateJumpTargetsTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/PropagateJumpTargetsTest.java index 9974d0ea3..b59af947d 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/PropagateJumpTargetsTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/PropagateJumpTargetsTest.java @@ -109,13 +109,13 @@ def foo(n) """, createInstruction(SET, "__fn0_n", "2"), createInstruction(SETADDR, "__fn0retaddr", var(1001)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1001), "__fn0"), createInstruction(SET, var(0), "__fn0retval"), createInstruction(PRINT, var(0)), createInstruction(SET, "__fn0_n", "3"), createInstruction(SETADDR, "__fn0retaddr", var(1002)), - createInstruction(CALL, var(1000)), + createInstruction(CALL, var(1000), "__fn0retval"), createInstruction(GOTOLABEL, var(1002), "__fn0"), createInstruction(SET, var(1), "__fn0retval"), createInstruction(PRINT, var(1)), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/ReturnOptimizerTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/ReturnOptimizerTest.java index e01bced66..be8e64007 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/ReturnOptimizerTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/ReturnOptimizerTest.java @@ -40,7 +40,7 @@ def fib(n) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_n", "10"), - createInstruction(CALLREC, "cell1", var(1000), var(1001)), + createInstruction(CALLREC, "cell1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(PRINT, "__fn0retval"), createInstruction(END), @@ -51,13 +51,13 @@ def fib(n) createInstruction(LABEL, var(1003)), createInstruction(PUSH, "cell1", "__fn0_n"), createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "1"), - createInstruction(CALLREC, "cell1", var(1000), var(1005)), + createInstruction(CALLREC, "cell1", var(1000), var(1005), "__fn0retval"), createInstruction(LABEL, var(1005)), createInstruction(POP, "cell1", "__fn0_n"), createInstruction(SET, var(4), "__fn0retval"), createInstruction(PUSH, "cell1", var(4)), createInstruction(OP, "sub", "__fn0_n", "__fn0_n", "2"), - createInstruction(CALLREC, "cell1", var(1000), var(1006)), + createInstruction(CALLREC, "cell1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "cell1", var(4)), createInstruction(OP, "add", "__fn0retval", var(4), "__fn0retval"), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/StackUsageOptimizerTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/StackUsageOptimizerTest.java index 0ff15bee1..8483c37ea 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/StackUsageOptimizerTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/StackUsageOptimizerTest.java @@ -33,7 +33,7 @@ def foo(x) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_x", "5"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(SET, var(0), "__fn0retval"), createInstruction(PRINT, var(0)), @@ -41,7 +41,7 @@ def foo(x) createInstruction(LABEL, var(1000)), createInstruction(OP, "sub", var(1), "__fn0_x", "1"), createInstruction(SET, "__fn0_x", var(1)), - createInstruction(CALLREC, "bank1", var(1000), var(1003)), + createInstruction(CALLREC, "bank1", var(1000), var(1003), "__fn0retval"), createInstruction(LABEL, var(1003)), createInstruction(SET, var(2), "__fn0retval"), createInstruction(SET, "__fn0retval", var(2)), @@ -62,7 +62,7 @@ def foo(x) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_x", "5"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(SET, var(0), "__fn0retval"), createInstruction(PRINT, var(0)), @@ -71,7 +71,7 @@ def foo(x) createInstruction(OP, "sub", var(1), "__fn0_x", "1"), createInstruction(PUSH, "bank1", "__fn0_x"), createInstruction(SET, "__fn0_x", var(1)), - createInstruction(CALLREC, "bank1", var(1000), var(1003)), + createInstruction(CALLREC, "bank1", var(1000), var(1003), "__fn0retval"), createInstruction(LABEL, var(1003)), createInstruction(POP, "bank1", "__fn0_x"), createInstruction(SET, "__fn0retval", "__fn0_x"), @@ -99,7 +99,7 @@ def foo(x) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_x", "5"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(END), createInstruction(LABEL, var(1000)), @@ -110,7 +110,7 @@ def foo(x) createInstruction(SET, "__fn0_y", "__fn0_x"), createInstruction(PRINT, "__fn0_y"), createInstruction(PUSH, "bank1", "__fn0_y"), - createInstruction(CALLREC, "bank1", var(1000), var(1006)), + createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "bank1", "__fn0_y"), createInstruction(JUMP, var(1003), "always"), @@ -137,7 +137,7 @@ def foo(x) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_x", "5"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(END), createInstruction(LABEL, var(1000)), @@ -148,7 +148,7 @@ def foo(x) createInstruction(PUSH, "bank1", "__fn0_x"), createInstruction(PUSH, "bank1", "__fn0_y"), createInstruction(SET, "__fn0_x", "2"), - createInstruction(CALLREC, "bank1", var(1000), var(1006)), + createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "bank1", "__fn0_y"), createInstruction(POP, "bank1", "__fn0_x"), @@ -156,7 +156,7 @@ def foo(x) createInstruction(LABEL, var(1005)), createInstruction(PRINT, "__fn0_y"), createInstruction(SET, "__fn0_x", "1"), - createInstruction(CALLREC, "bank1", var(1000), var(1007)), + createInstruction(CALLREC, "bank1", var(1000), var(1007), "__fn0retval"), createInstruction(LABEL, var(1007)), createInstruction(SET, var(3), "__fn0retval"), createInstruction(SET, "__fn0retval", var(3)), @@ -182,7 +182,7 @@ def foo(x) """, createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_x", "5"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(END), createInstruction(LABEL, var(1000)), @@ -194,7 +194,7 @@ def foo(x) createInstruction(SET, "__fn0_y", var(1)), createInstruction(PUSH, "bank1", "__fn0_x"), createInstruction(SET, "__fn0_x", "2"), - createInstruction(CALLREC, "bank1", var(1000), var(1006)), + createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "bank1", "__fn0_x"), createInstruction(JUMP, var(1003), "always"), @@ -221,7 +221,7 @@ def foo(m, n) createInstruction(SET, "__sp", "0"), createInstruction(SET, "__fn0_m", "message1"), createInstruction(SET, "__fn0_n", "10"), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(END), createInstruction(LABEL, var(1000)), @@ -236,7 +236,7 @@ def foo(m, n) createInstruction(PUSH, "bank1", "__fn0_i"), createInstruction(PUSH, "bank1", var(1)), createInstruction(SET, "__fn0_n", var(2)), - createInstruction(CALLREC, "bank1", var(1000), var(1006)), + createInstruction(CALLREC, "bank1", var(1000), var(1006), "__fn0retval"), createInstruction(LABEL, var(1006)), createInstruction(POP, "bank1", var(1)), createInstruction(POP, "bank1", "__fn0_i"), @@ -279,7 +279,7 @@ inline def partition(left, right, pivot_index) createInstruction(OP, "sub", var(0), "SIZE", "1"), createInstruction(SET, "__fn0_left", "0"), createInstruction(SET, "__fn0_right", var(0)), - createInstruction(CALLREC, "bank1", var(1000), var(1001)), + createInstruction(CALLREC, "bank1", var(1000), var(1001), "__fn0retval"), createInstruction(LABEL, var(1001)), createInstruction(END), createInstruction(LABEL, var(1000)), @@ -298,13 +298,13 @@ inline def partition(left, right, pivot_index) createInstruction(PUSH, "bank1", "__fn0_right"), createInstruction(PUSH, "bank1", "__fn0_new_pivot_index"), createInstruction(SET, "__fn0_right", var(10)), - createInstruction(CALLREC, "bank1", var(1000), var(1007)), + createInstruction(CALLREC, "bank1", var(1000), var(1007), "__fn0retval"), createInstruction(LABEL, var(1007)), createInstruction(POP, "bank1", "__fn0_new_pivot_index"), createInstruction(POP, "bank1", "__fn0_right"), createInstruction(OP, "add", var(12), "__fn0_new_pivot_index", "1"), createInstruction(SET, "__fn0_left", var(12)), - createInstruction(CALLREC, "bank1", var(1000), var(1008)), + createInstruction(CALLREC, "bank1", var(1000), var(1008), "__fn0retval"), createInstruction(LABEL, var(1008)), createInstruction(SET, var(13), "__fn0retval"), createInstruction(SET, var(3), var(13)), diff --git a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/UnreachableCodeEliminatorTest.java b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/UnreachableCodeEliminatorTest.java index 9be7b67e1..9d2aa7145 100644 --- a/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/UnreachableCodeEliminatorTest.java +++ b/mindcode/src/test/java/info/teksol/mindcode/compiler/optimization/UnreachableCodeEliminatorTest.java @@ -102,18 +102,18 @@ def testc(n) """, // call testa (2x) createInstruction(SETADDR, "__fn2retaddr", var(1003)), - createInstruction(CALL, var(1002)), + createInstruction(CALL, var(1002), "__fn2retval"), createInstruction(GOTOLABEL, var(1003), "__fn2"), createInstruction(SETADDR, "__fn2retaddr", var(1004)), - createInstruction(CALL, var(1002)), + createInstruction(CALL, var(1002), "__fn2retval"), createInstruction(GOTOLABEL, var(1004), "__fn2"), // if false + call testb -- removed // call testc (2) createInstruction(SETADDR, "__fn1retaddr", var(1010)), - createInstruction(CALL, var(1001)), + createInstruction(CALL, var(1001), "__fn1retval"), createInstruction(GOTOLABEL, var(1010), "__fn1"), createInstruction(SETADDR, "__fn1retaddr", var(1011)), - createInstruction(CALL, var(1001)), + createInstruction(CALL, var(1001), "__fn1retval"), createInstruction(GOTOLABEL, var(1011), "__fn1"), createInstruction(PRINTFLUSH, "message1"), createInstruction(END), diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/compute-recursive-fibonacci.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/compute-recursive-fibonacci.log index 1dd49ac7e..a80139e51 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/compute-recursive-fibonacci.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/compute-recursive-fibonacci.log @@ -58,7 +58,7 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - 2 callrec bank1 __label0 __label1 + 2 callrec bank1 __label0 __label1 __fn0retval 3 label __label1 4 set __tmp0 __fn0retval - * print __tmp0 @@ -72,7 +72,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 12 push bank1 __fn0_n - * set __fn0_n __tmp3 + 13 op sub __fn0_n __fn0_n 1 - 14 callrec bank1 __label0 __label5 + 14 callrec bank1 __label0 __label5 __fn0retval 15 label __label5 16 pop bank1 __fn0_n @@ -81,7 +81,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 20 push bank1 __tmp4 - * set __fn0_n __tmp5 + 21 op sub __fn0_n __fn0_n 2 - 22 callrec bank1 __label0 __label6 + 22 callrec bank1 __label0 __label6 __fn0retval 23 label __label6 24 pop bank1 __tmp4 25 pop bank1 __fn0_n @@ -95,7 +95,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 instructions): 1 set __fn0_n 10 - 2 callrec bank1 __label0 __label1 + 2 callrec bank1 __label0 __label1 __fn0retval 3 label __label1 - * set __tmp0 __fn0retval 4 print __fn0retval @@ -107,7 +107,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 - * op sub __tmp3 __fn0_n 1 10 push bank1 __fn0_n 11 op sub __fn0_n __fn0_n 1 - 12 callrec bank1 __label0 __label5 + 12 callrec bank1 __label0 __label5 __fn0retval 13 label __label5 14 pop bank1 __fn0_n 15 set __tmp4 __fn0retval @@ -139,7 +139,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-4 instructions): - * push bank1 __fn0_n 16 push bank1 __tmp4 17 op sub __fn0_n __fn0_n 2 - 18 callrec bank1 __label0 __label6 + 18 callrec bank1 __label0 __label6 __fn0retval 19 label __label6 20 pop bank1 __tmp4 - * pop bank1 __fn0_n @@ -151,7 +151,7 @@ Final code before resolving virtual instructions: set __sp 0 set __fn0_n 10 -callrec bank1 __label0 __label1 +callrec bank1 __label0 __label1 __fn0retval label __label1 print __fn0retval end @@ -160,13 +160,13 @@ set __fn0retval __fn0_n jump __label4 lessThan __fn0_n 2 push bank1 __fn0_n op sub __fn0_n __fn0_n 1 -callrec bank1 __label0 __label5 +callrec bank1 __label0 __label5 __fn0retval label __label5 pop bank1 __fn0_n set __tmp4 __fn0retval push bank1 __tmp4 op sub __fn0_n __fn0_n 2 -callrec bank1 __label0 __label6 +callrec bank1 __label0 __label6 __fn0retval label __label6 pop bank1 __tmp4 op add __fn0retval __tmp4 __fn0retval diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/compute-sum-of-primes.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/compute-sum-of-primes.log index 578bfb103..f5748c92b 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/compute-sum-of-primes.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/compute-sum-of-primes.log @@ -120,7 +120,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-17 ins - * set __fn1_bitIndex __tmp13 + 45 op idiv __fn1_bitIndex __fn2_i 2 46 setaddr __fn1retaddr __label16 - 47 call __label1 + 47 call __label1 __fn1retval 48 gotolabel __label16 __fn1 49 set __tmp14 __fn1retval 50 op equal __tmp15 __tmp14 false @@ -140,7 +140,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-17 ins + 58 op add __fn2_i __fn2_i 2 + 59 op idiv __fn1_bitIndex __fn2_i 2 60 setaddr __fn1retaddr __label19 - 61 call __label1 + 61 call __label1 __fn1retval 62 gotolabel __label19 __fn1 65 jump __label20 equal __tmp21 false @@ -170,7 +170,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-17 ins - * set __fn1_bitIndex __tmp27 + 88 op idiv __fn1_bitIndex __fn0_n 2 89 setaddr __fn1retaddr __label25 - 90 call __label1 + 90 call __label1 __fn1retval 91 gotolabel __label25 __fn1 - * op equal __tmp28 __fn1retval false - * set __fn0_result __tmp28 @@ -303,7 +303,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-6 inst + 38 jump __label15 greaterThan __fn2_i __fn2_maximum 39 op idiv __fn1_bitIndex __fn2_i 2 40 setaddr __fn1retaddr __label16 - 41 call __label1 + 41 call __label1 __fn1retval 42 gotolabel __label16 __fn1 43 set __tmp14 __fn1retval - * op equal __tmp15 __tmp14 false @@ -313,7 +313,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-6 inst 46 jump __label18 always 47 label __label17 - 52 call __label1 + 52 call __label1 __fn1retval 53 gotolabel __label19 __fn1 54 set __tmp20 __fn1retval - * op equal __tmp21 __tmp20 false @@ -397,7 +397,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * set __fn0_maximum __fn2_maximum + 11 set __fn0_maximum 500 12 setaddr __fn0retaddr __label7 - 13 call __label0 + 13 call __label0 __fn0retval 14 gotolabel __label7 __fn0 15 set __tmp4 __fn0retval - * jump __label8 equal __tmp4 false @@ -410,7 +410,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * set __fn0_maximum __fn2_maximum + 22 set __fn0_maximum 500 23 setaddr __fn0retaddr __label10 - 24 call __label0 + 24 call __label0 __fn0retval 25 gotolabel __label10 __fn0 26 set __tmp8 __fn0retval - * jump __label11 equal __tmp8 false @@ -426,7 +426,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: + 36 jump __label15 greaterThan __fn2_i 500 37 op idiv __fn1_bitIndex __fn2_i 2 38 setaddr __fn1retaddr __label16 - 39 call __label1 + 39 call __label1 __fn1retval 40 gotolabel __label16 __fn1 41 set __tmp14 __fn1retval - * jump __label17 notEqual __tmp14 false @@ -435,7 +435,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 44 label __label17 45 label __label18 - 49 call __label1 + 49 call __label1 __fn1retval 50 gotolabel __label19 __fn1 51 set __tmp20 __fn1retval - * jump __label20 notEqual __tmp20 false @@ -487,7 +487,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 7 set __fn0_n __fn2_i 9 setaddr __fn0retaddr __label7 - 10 call __label0 + 10 call __label0 __fn0retval 11 gotolabel __label7 __fn0 - * set __tmp4 __fn0retval 12 jump __label8 equal __fn0retval false @@ -498,7 +498,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 17 set __fn0_n __fn2_i - * set __fn0_maximum 500 18 setaddr __fn0retaddr __label10 - 19 call __label0 + 19 call __label0 __fn0retval 20 gotolabel __label10 __fn0 - * set __tmp8 __fn0retval 21 jump __label11 equal __fn0retval false @@ -506,7 +506,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 23 label __label11 32 setaddr __fn1retaddr __label16 - 33 call __label1 + 33 call __label1 __fn1retval 34 gotolabel __label16 __fn1 - * set __tmp14 __fn1retval 35 jump __label17 notEqual __fn1retval false @@ -514,7 +514,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 37 label __label17 41 setaddr __fn1retaddr __label19 - 42 call __label1 + 42 call __label1 __fn1retval 43 gotolabel __label19 __fn1 - * set __tmp20 __fn1retval 44 jump __label20 notEqual __fn1retval false @@ -565,7 +565,7 @@ Modifications by Iterated phase, Loop Optimization, pass 1, iteration 1 (-1 inst + 31 label __label35 32 op idiv __fn1_bitIndex __fn2_i 2 33 setaddr __fn1retaddr __label16 - 34 call __label1 + 34 call __label1 __fn1retval 51 label __label21 52 op add __fn2_i __fn2_i 4 @@ -599,7 +599,7 @@ Modifications by Function Inlining: inline function getBit (+2 instructions): 31 label __label35 32 op idiv __fn1_bitIndex __fn2_i 2 - * setaddr __fn1retaddr __label16 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label16 __fn1 + 33 label __label37 + 34 op idiv __tmp43 __fn1_bitIndex MOD @@ -615,7 +615,7 @@ Modifications by Function Inlining: inline function getBit (+2 instructions): 44 op add __fn2_i __fn2_i 2 45 op idiv __fn1_bitIndex __fn2_i 2 - * setaddr __fn1retaddr __label19 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label19 __fn1 + 46 label __label39 + 47 op idiv __tmp43 __fn1_bitIndex MOD @@ -632,7 +632,7 @@ Modifications by Function Inlining: inline function getBit (+2 instructions): 67 label __label0 68 op idiv __fn1_bitIndex __fn0_n 2 - * setaddr __fn1retaddr __label25 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label25 __fn1 + 69 label __label41 + 70 op idiv __tmp43 __fn1_bitIndex MOD @@ -664,7 +664,7 @@ Modifications by Function Inlining: inline function testAndSetMultiples (+15 ins 7 set __fn0_n __fn2_i 8 set __fn0_maximum 500 - * setaddr __fn0retaddr __label7 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label7 __fn0 + 9 label __label43 + 10 op idiv __fn1_bitIndex __fn0_n 2 @@ -706,7 +706,7 @@ Modifications by Function Inlining: inline function testAndSetMultiples (+15 ins 46 op add __fn2_i __fn2_i 2 47 set __fn0_n __fn2_i - * setaddr __fn0retaddr __label10 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label10 __fn0 + 48 label __label55 + 49 op idiv __fn1_bitIndex __fn0_n 2 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/quick-sort.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/quick-sort.log index 3bc0a0932..629d9f2e0 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/quick-sort.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/quick-sort.log @@ -64,7 +64,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-5 inst Modifications by Initial phase, Dead Code Elimination, iteration 1 (-10 instructions): 5 set __fn0_right __tmp0 - 6 callrec bank1 __label0 __label1 + 6 callrec bank1 __label0 __label1 __fn0retval 7 label __label1 - * set __tmp1 __fn0retval 8 set __tmp2 SIZE @@ -200,14 +200,14 @@ Modifications by Iterated phase, Expression Optimization, pass 1, iteration 1 (- 70 push bank1 __fn0_new_pivot_index - * set __fn0_left __fn0_left 71 set __fn0_right __tmp25 - 72 callrec bank1 __label0 __label21 + 72 callrec bank1 __label0 __label21 __fn0retval 73 label __label21 81 push bank1 __fn0_pivot_index 82 push bank1 __fn0_new_pivot_index 83 set __fn0_left __tmp27 - * set __fn0_right __fn0_right - 84 callrec bank1 __label0 __label22 + 84 callrec bank1 __label0 __label22 __fn0retval 85 label __label22 86 pop bank1 __fn0_new_pivot_index @@ -302,7 +302,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 instructions): 5 set __fn0_right __tmp0 - 6 callrec bank1 __label0 __label1 + 6 callrec bank1 __label0 __label1 __fn0retval 7 label __label1 - * set __tmp2 SIZE 8 set i 0 @@ -466,7 +466,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-24 instructions) - * push bank1 __fn0_pivot_index 62 push bank1 __fn0_new_pivot_index 63 set __fn0_right __tmp25 - 64 callrec bank1 __label0 __label21 + 64 callrec bank1 __label0 __label21 __fn0retval 65 label __label21 66 pop bank1 __fn0_new_pivot_index - * pop bank1 __fn0_pivot_index @@ -478,7 +478,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-24 instructions) - * push bank1 __fn0_pivot_index - * push bank1 __fn0_new_pivot_index 69 set __fn0_left __tmp27 - 70 callrec bank1 __label0 __label22 + 70 callrec bank1 __label0 __label22 __fn0retval 71 label __label22 - * pop bank1 __fn0_new_pivot_index - * pop bank1 __fn0_pivot_index @@ -496,7 +496,7 @@ set ARRAY bank2 op sub __tmp0 SIZE 1 set __fn0_left 0 set __fn0_right __tmp0 -callrec bank1 __label0 __label1 +callrec bank1 __label0 __label1 __fn0retval label __label1 set i 0 jump __label4 greaterThanEq 0 SIZE @@ -544,13 +544,13 @@ op sub __tmp25 __fn1_index 1 push bank1 __fn0_right push bank1 __fn0_new_pivot_index set __fn0_right __tmp25 -callrec bank1 __label0 __label21 +callrec bank1 __label0 __label21 __fn0retval label __label21 pop bank1 __fn0_new_pivot_index pop bank1 __fn0_right op add __tmp27 __fn0_new_pivot_index 1 set __fn0_left __tmp27 -callrec bank1 __label0 __label22 +callrec bank1 __label0 __label22 __fn0retval label __label22 label __label7 return bank1 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/storage-display.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/storage-display.log index cd56fbece..9b5740610 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/storage-display.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/algorithms/storage-display.log @@ -100,7 +100,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-10 ins 88 set y 152 176 setaddr __fn2retaddr __label48 - 177 call __label2 + 177 call __label2 __fn2retval 178 gotolabel __label48 __fn2 - * set __tmp15 __fn2retval - * set __tmp14 __tmp15 @@ -110,7 +110,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-10 ins 182 set __fn2_x 157 184 setaddr __fn2retaddr __label49 - 185 call __label2 + 185 call __label2 __fn2retval 186 gotolabel __label49 __fn2 - * set __tmp16 __fn2retval - * set __tmp14 __tmp16 @@ -127,7 +127,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-10 ins 193 drawflush display1 196 setaddr __fn0retaddr __label52 - 197 call __label0 + 197 call __label0 __fn0retval 198 gotolabel __label52 __fn0 - * set __tmp21 __fn0retval - * set __tmp20 __tmp21 @@ -255,12 +255,12 @@ Modifications by Initial phase, Case Expression Optimization, iteration 1 (-1 in Modifications by Initial phase, Dead Code Elimination, iteration 1 (-12 instructions): 5 setaddr __fn1retaddr __label3 - 6 call __label1 + 6 call __label1 __fn1retval 7 gotolabel __label3 __fn1 - * set __tmp0 __fn1retval 8 set __fn1_first_column false 9 setaddr __fn1retaddr __label4 - 10 call __label1 + 10 call __label1 __fn1retval 11 gotolabel __label4 __fn1 - * set __tmp1 __fn1retval 12 draw color 255 255 255 255 @@ -279,7 +279,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-12 instruct 93 goto __tmp2 marker0 99 setaddr __fn0retaddr __label26 - 100 call __label0 + 100 call __label0 __fn0retval 101 gotolabel __label26 __fn0 - * set __tmp11 __fn0retval 102 set index 0 @@ -287,7 +287,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-12 instruct 104 set item @sand 171 setaddr __fn2retaddr __label48 - 172 call __label2 + 172 call __label2 __fn2retval 173 gotolabel __label48 __fn2 - * set __tmp14 __fn2retval 174 jump __label47 always @@ -295,7 +295,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-12 instruct 176 set __fn2_x 157 178 setaddr __fn2retaddr __label49 - 179 call __label2 + 179 call __label2 __fn2retval 180 gotolabel __label49 __fn2 - * set __tmp14 __fn2retval 181 label __label47 @@ -303,7 +303,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-12 instruct 183 op sub y y 20 189 setaddr __fn0retaddr __label52 - 190 call __label0 + 190 call __label0 __fn0retval 191 gotolabel __label52 __fn0 - * set __tmp20 __fn0retval 192 jump __label51 always @@ -665,7 +665,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 90 label __label5 185 setaddr __fn0retaddr __label52 - 186 call __label0 + 186 call __label0 __fn0retval 187 gotolabel __label52 __fn0 - * jump __label51 always 188 label __label50 @@ -2222,7 +2222,7 @@ Modifications by Function Inlining: inline function eraseNumbers (-1 instruction 93 set y 152 94 set __fn0_first_column true - * setaddr __fn0retaddr __label26 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label26 __fn0 + 95 label __label272 + 96 draw color 0 0 80 255 @@ -2241,7 +2241,7 @@ Modifications by Function Inlining: inline function eraseNumbers (-1 instruction 187 set y 152 188 set __fn0_first_column false - * setaddr __fn0retaddr __label52 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label52 __fn0 + 189 label __label276 + 190 draw color 0 0 80 255 @@ -2318,7 +2318,7 @@ Modifications by Function Inlining: inline function eraseImages (-1 instructions 3 set y 152 4 set __fn1_first_column true - * setaddr __fn1retaddr __label3 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label3 __fn1 + 5 label __label280 + 6 draw color 0 0 80 255 @@ -2331,7 +2331,7 @@ Modifications by Function Inlining: inline function eraseImages (-1 instructions + 13 label __label283 14 set __fn1_first_column false - * setaddr __fn1retaddr __label4 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label4 __fn1 + 15 label __label284 + 16 draw color 0 0 80 255 @@ -3260,7 +3260,7 @@ Modifications by Function Inlining: inline function displayItem (+369 instructio 241 set __fn2_x 71 242 set __fn2_y y - * setaddr __fn2retaddr __label48 -- * call __label2 +- * call __label2 __fn2retval - * gotolabel __label48 __fn2 + 243 label __label352 + 244 op max __fn2_amount AMOUNT 0 @@ -3810,7 +3810,7 @@ Modifications by Function Inlining: inline function displayItem (+369 instructio 788 set __fn2_x 157 789 set __fn2_y y - * setaddr __fn2retaddr __label49 -- * call __label2 +- * call __label2 __fn2retval - * gotolabel __label49 __fn2 + 790 label __label524 + 791 op max __fn2_amount AMOUNT 0 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/euler/project-euler-31.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/euler/project-euler-31.log index b0861f593..438f6f2cb 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/euler/project-euler-31.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/euler/project-euler-31.log @@ -160,7 +160,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * set __fn0_amount __tmp10 + 71 op sub __fn0_amount __fn0_amount __fn0_p 72 set __fn0_index __fn0_i - 73 callrec bank1 __label0 __label25 + 73 callrec bank1 __label0 __label25 __fn0retval 74 label __label25 78 pop bank1 __fn0_index @@ -211,7 +211,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-1 instructions): 43 set __fn0_index 1 - 44 callrec bank1 __label0 __label14 + 44 callrec bank1 __label0 __label14 __fn0retval 45 label __label14 - * set __tmp3 __fn0retval 46 label __label15 @@ -471,7 +471,7 @@ write 1 bank1 7 print 41 set __fn0_amount 20 set __fn0_index 1 -callrec bank1 __label0 __label14 +callrec bank1 __label0 __label14 __fn0retval label __label14 print __fn0retval end @@ -493,7 +493,7 @@ push bank1 __fn0_i push bank1 __fn0_p op sub __fn0_amount __fn0_amount __fn0_p set __fn0_index __fn0_i -callrec bank1 __label0 __label25 +callrec bank1 __label0 __label25 __fn0retval label __label25 pop bank1 __fn0_p pop bank1 __fn0_i diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/optimizer/OptimizerTest.txt b/mindcode/src/test/resources/info/teksol/mindcode/processor/optimizer/OptimizerTest.txt index 573560343..4bc6cb524 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/optimizer/OptimizerTest.txt +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/optimizer/OptimizerTest.txt @@ -3,7 +3,7 @@ detector-00.mnd: 173 instructions, source CRC FE8119939 factory-monitor-00.mnd: 357 instructions, source CRC 735D793DE9291346, compiled CRC BD9B6E1EB255B21C factory-monitor-silicon-00.mnd: 291 instructions, source CRC A359A3FF5FB80033, compiled CRC E7389555BDC3125C factory-monitor-surge-alloy-00.mnd: 194 instructions, source CRC FB39BBCB30FDEA11, compiled CRC E93022DEEB3840D3 -instant-overdrive-dome-00.mnd: 625 instructions, source CRC A1AE234B22C7A682, compiled CRC 9631B4ED82831C5F +instant-overdrive-dome-00.mnd: 633 instructions, source CRC A1AE234B22C7A682, compiled CRC 26AAE5623D20AF94 item-counter-00.mnd: 99 instructions, source CRC 4D90F2B3A3A52A57, compiled CRC 102983144F395C25 item-counter-micro-00.mnd: 143 instructions, source CRC 38F77F7CF7606263, compiled CRC 390700627A884E47 item-rate-display-00.mnd: 668 instructions, source CRC 0F6F859416342C9C, compiled CRC C4363A7CA6C5C080 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/optimizer/instant-overdrive-dome-00.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/optimizer/instant-overdrive-dome-00.log index 4f63a066f..1c909814d 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/optimizer/instant-overdrive-dome-00.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/optimizer/instant-overdrive-dome-00.log @@ -1,20 +1,20 @@ 454 instructions before optimizations. 33 instructions eliminated by Temp Variables Elimination. 63 instructions eliminated by Dead Code Elimination (6 iterations). - 2 instructions eliminated by Jump Normalization (3 iterations). - 22 instructions eliminated by Jump Optimization (3 iterations). - 23 instructions eliminated by Single Step Elimination (2 passes, 5 iterations). - 2 instructions eliminated by If Expression Optimization (2 iterations). - 24 instructions eliminated by Data Flow Optimization (4 passes, 15 iterations). - 2 instructions added by Loop Optimization (2 iterations). + 2 instructions eliminated by Jump Normalization (4 iterations). + 22 instructions eliminated by Jump Optimization (4 iterations). + 23 instructions eliminated by Single Step Elimination (2 passes, 6 iterations). + 2 instructions eliminated by If Expression Optimization (3 iterations). + 28 instructions eliminated by Data Flow Optimization (4 passes, 16 iterations). + 2 instructions added by Loop Optimization (3 iterations). 3 loops improved by Loop Optimization. - 349 instructions added by Function Inlining (8 iterations). + 357 instructions added by Function Inlining (9 iterations). 11 function calls inlined by Function Inlining. - 2 instructions eliminated by Jump Straightening (3 iterations). + 2 instructions eliminated by Jump Straightening (4 iterations). 8 instructions updated by PropagateJumpTargets. - 8 instructions eliminated by Unreachable Code Elimination. + 4 instructions eliminated by Unreachable Code Elimination. 1 instructions eliminated by Print Merging. - 625 instructions after optimizations. + 633 instructions after optimizations. Pass 1: speed optimization selection (cost limit 689): * Loop Optimization: replicate condition at line 38 cost 1, benefit 25,0, efficiency 25,0 (+1 instructions) @@ -93,7 +93,7 @@ Pass 1: speed optimization selection (cost limit 673): Function Inlining: inline function call at line 130 cost 100, benefit 62,5, efficiency 0,6 Pass 1: speed optimization selection (cost limit 400): - * Function Inlining: inline function findUnit cost 50, benefit 4,5, efficiency 0,1 (+40 instructions) + * Function Inlining: inline function findUnit cost 50, benefit 4,5, efficiency 0,1 (+44 instructions) Function Inlining: inline function call at line 50 cost 17, benefit 1,5, efficiency 0,1 Function Inlining: inline function call at line 51 cost 17, benefit 1,5, efficiency 0,1 Function Inlining: inline function call at line 84 cost 17, benefit 0,8, efficiency 0,0 @@ -136,7 +136,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-33 ins 61 jump __label18 always 86 setaddr __fn1retaddr __label25 - 87 call __label1 + 87 call __label1 __fn1retval 88 gotolabel __label25 __fn1 - * set __tmp21 __fn1retval - * set UNIT_S1 __tmp21 @@ -146,7 +146,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-33 ins 92 label __label23 97 setaddr __fn1retaddr __label28 - 98 call __label1 + 98 call __label1 __fn1retval 99 gotolabel __label28 __fn1 - * set __tmp24 __fn1retval - * set UNIT_P1 __tmp24 @@ -203,7 +203,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-33 ins 142 op equal __tmp50 UNIT_S2 null 143 jump __label36 equal __tmp50 false 144 setaddr __fn1retaddr __label38 - 145 call __label1 + 145 call __label1 __fn1retval 146 gotolabel __label38 __fn1 - * set __tmp52 __fn1retval - * set UNIT_S2 __tmp52 @@ -213,7 +213,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-33 ins 150 label __label36 155 setaddr __fn1retaddr __label41 - 156 call __label1 + 156 call __label1 __fn1retval 157 gotolabel __label41 __fn1 - * set __tmp55 __fn1retval - * set UNIT_P2 __tmp55 @@ -246,7 +246,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-33 ins 222 set __fn2_item @silicon 232 setaddr __fn0retaddr __label50 - 233 call __label0 + 233 call __label0 __fn0retval 234 gotolabel __label50 __fn0 - * set __tmp81 __fn0retval - * set UNIT_S1 __tmp81 @@ -256,7 +256,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-33 ins 238 set __fn0_unit UNIT_S2 242 setaddr __fn0retaddr __label53 - 243 call __label0 + 243 call __label0 __fn0retval 244 gotolabel __label53 __fn0 - * set __tmp84 __fn0retval - * set UNIT_S2 __tmp84 @@ -277,7 +277,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-33 ins 255 set __tmp82 SUPPLY_S_FIRST 270 setaddr __fn0retaddr __label57 - 271 call __label0 + 271 call __label0 __fn0retval 272 gotolabel __label57 __fn0 - * set __tmp91 __fn0retval - * set UNIT_P1 __tmp91 @@ -287,7 +287,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-33 ins 276 set __fn0_unit UNIT_P2 280 setaddr __fn0retaddr __label60 - 281 call __label0 + 281 call __label0 __fn0retval 282 gotolabel __label60 __fn0 - * set __tmp94 __fn0retval - * set UNIT_P2 __tmp94 @@ -381,7 +381,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-42 instruct 78 op equal __tmp19 UNIT_S1 null 79 jump __label23 equal __tmp19 false - 81 call __label1 + 81 call __label1 __fn1retval 82 gotolabel __label25 __fn1 83 set UNIT_S1 __fn1retval - * set __tmp20 UNIT_S1 @@ -392,7 +392,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-42 instruct 87 op equal __tmp22 UNIT_P1 null 88 jump __label26 equal __tmp22 false - 90 call __label1 + 90 call __label1 __fn1retval 91 gotolabel __label28 __fn1 92 set UNIT_P1 __fn1retval - * set __tmp23 UNIT_P1 @@ -414,7 +414,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-42 instruct 108 sensor UNIT_CAPACITY UNIT_S1 @itemCapacity 109 sensor SPEED UNIT_S1 @speed - 133 call __label1 + 133 call __label1 __fn1retval 134 gotolabel __label38 __fn1 135 set UNIT_S2 __fn1retval - * set __tmp51 UNIT_S2 @@ -425,7 +425,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-42 instruct 139 op equal __tmp53 UNIT_P2 null 140 jump __label39 equal __tmp53 false - 142 call __label1 + 142 call __label1 __fn1retval 143 gotolabel __label41 __fn1 144 set UNIT_P2 __fn1retval - * set __tmp54 UNIT_P2 @@ -471,7 +471,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-42 instruct 185 sensor __tmp69 UNIT_S1 @totalItems 202 setaddr __fn2retaddr __label49 - 203 call __label2 + 203 call __label2 __fn2retval 204 gotolabel __label49 __fn2 - * set __tmp80 __fn2retval 205 set __fn0_unit UNIT_S1 @@ -489,7 +489,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-42 instruct 235 set __fn2_item @phase-fabric 236 set __fn2_text "\n[green]Phase fabric[] status:\n" 237 setaddr __fn2retaddr __label56 - 238 call __label2 + 238 call __label2 __fn2retval 239 gotolabel __label56 __fn2 - * set __tmp90 __fn2retval 240 set __fn0_unit UNIT_P1 @@ -508,7 +508,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-42 instruct 271 op floor __tmp101 __tmp100 288 setaddr __fn1retaddr __label66 - 289 call __label1 + 289 call __label1 __fn1retval 290 gotolabel __label66 __fn1 - * set __tmp107 __fn1retval 291 jump __label65 always @@ -818,7 +818,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-22 ins - * jump __label23 equal __tmp19 false + 70 jump __label23 notEqual UNIT_S1 null 71 setaddr __fn1retaddr __label25 - 72 call __label1 + 72 call __label1 __fn1retval 73 gotolabel __label25 __fn1 75 jump __label24 always @@ -828,7 +828,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-22 ins - * jump __label26 equal __tmp22 false + 78 jump __label26 notEqual UNIT_P1 null 79 setaddr __fn1retaddr __label28 - 80 call __label1 + 80 call __label1 __fn1retval 81 gotolabel __label28 __fn1 103 label __label31 @@ -848,7 +848,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-22 ins - * jump __label36 equal __tmp50 false + 119 jump __label36 notEqual UNIT_S2 null 120 setaddr __fn1retaddr __label38 - 121 call __label1 + 121 call __label1 __fn1retval 122 gotolabel __label38 __fn1 124 jump __label37 always @@ -858,7 +858,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-22 ins - * jump __label39 equal __tmp53 false + 127 jump __label39 notEqual UNIT_P2 null 128 setaddr __fn1retaddr __label41 - 129 call __label1 + 129 call __label1 __fn1retval 130 gotolabel __label41 __fn1 270 op strictEqual __tmp103 __tmp102 0 @@ -868,7 +868,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-22 ins - * jump __label64 equal __tmp106 false + 273 jump __label64 greaterThan __tmp103 __tmp105 274 setaddr __fn1retaddr __label66 - 275 call __label1 + 275 call __label1 __fn1retval 276 gotolabel __label66 __fn1 280 sensor __fn0_state @unit @flag @@ -996,7 +996,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 65 label __label10 66 jump __label23 notEqual UNIT_S1 null 67 setaddr __fn1retaddr __label25 - 68 call __label1 + 68 call __label1 __fn1retval 69 gotolabel __label25 __fn1 70 set UNIT_S1 __fn1retval - * jump __label24 always @@ -1004,7 +1004,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 72 label __label24 73 jump __label26 notEqual UNIT_P1 null - 75 call __label1 + 75 call __label1 __fn1retval 76 gotolabel __label28 __fn1 77 set UNIT_P1 __fn1retval - * jump __label27 always @@ -1020,7 +1020,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 90 label __label30 91 sensor UNIT_CAPACITY UNIT_S1 @itemCapacity - 114 call __label1 + 114 call __label1 __fn1retval 115 gotolabel __label38 __fn1 116 set UNIT_S2 __fn1retval - * jump __label37 always @@ -1028,7 +1028,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 118 label __label37 119 jump __label39 notEqual UNIT_P2 null - 121 call __label1 + 121 call __label1 __fn1retval 122 gotolabel __label41 __fn1 123 set UNIT_P2 __fn1retval - * jump __label40 always @@ -1069,7 +1069,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 1, iteration 1 (- 244 op sub __tmp100 @time start 261 setaddr __fn1retaddr __label66 - 262 call __label1 + 262 call __label1 __fn1retval 263 gotolabel __label66 __fn1 - * jump __label65 always 264 label __label64 @@ -1235,7 +1235,7 @@ Modifications by Function Inlining: inline function printDomeStatus (+4 instruct 178 set __fn2_item @silicon 179 set __fn2_text "\n[green]Silicon[] status:\n" - * setaddr __fn2retaddr __label49 -- * call __label2 +- * call __label2 __fn2retval - * gotolabel __label49 __fn2 + 180 label __label105 + 181 print __fn2_text @@ -1259,7 +1259,7 @@ Modifications by Function Inlining: inline function printDomeStatus (+4 instruct 222 set __fn2_item @phase-fabric 223 set __fn2_text "\n[green]Phase fabric[] status:\n" - * setaddr __fn2retaddr __label56 -- * call __label2 +- * call __label2 __fn2retval - * gotolabel __label56 __fn2 + 224 label __label109 + 225 print __fn2_text @@ -1349,7 +1349,7 @@ Modifications by Function Inlining: inline function call at line 191 (+16 instru 278 op notEqual __tmp105 __tmp104 @this 279 jump __label64 greaterThan __tmp103 __tmp105 - * setaddr __fn1retaddr __label66 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label66 __fn1 + 280 label __label113 + 281 label __label114 @@ -1400,15 +1400,14 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 305 label __label64 306 label __label65 -Modifications by Function Inlining: inline function processUnit (+289 instructions): +Modifications by Function Inlining: inline function processUnit (+293 instructions): 193 set __fn0_item @silicon 194 set __fn0_group GROUP1 195 set __fn0_supply SUPPLY_S_FIRST - * setaddr __fn0retaddr __label50 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label50 __fn0 -- * set UNIT_S1 __fn0retval + 196 label __label122 + 197 ubind __fn0_unit + 198 sensor __tmp102 @unit @dead @@ -1543,462 +1542,461 @@ Modifications by Function Inlining: inline function processUnit (+289 instructio + 327 label __label156 + 328 print MSG + 329 label __label157 -+ 330 set UNIT_S1 @unit ++ 330 set __fn0retval @unit + 331 jump __label158 always -+ 332 set UNIT_S1 null ++ 332 set __fn0retval null + 333 label __label158 - 334 jump __label51 equal FOUR_UNITS false - 335 op equal __tmp83 SUPPLY_S_FIRST false - 336 set __fn0_unit UNIT_S2 - 337 set __fn0_item @silicon - 338 set __fn0_group GROUP2 - 339 set __fn0_supply __tmp83 + 334 set UNIT_S1 __fn0retval + 335 jump __label51 equal FOUR_UNITS false + 336 op equal __tmp83 SUPPLY_S_FIRST false + + 338 set __fn0_item @silicon + 339 set __fn0_group GROUP2 + 340 set __fn0_supply __tmp83 - * setaddr __fn0retaddr __label53 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label53 __fn0 -- * set UNIT_S2 __fn0retval -+ 340 label __label159 -+ 341 ubind __fn0_unit -+ 342 sensor __tmp102 @unit @dead -+ 343 op strictEqual __tmp103 __tmp102 0 -+ 344 sensor __tmp104 @unit @controller -+ 345 op notEqual __tmp105 __tmp104 @this -+ 346 jump __label169 greaterThan __tmp103 __tmp105 -+ 347 label __label160 -+ 348 label __label161 -+ 349 ubind UNIT -+ 350 jump __label162 notEqual @unit null -+ 351 print "[salmon]No unit of type " -+ 352 print UNIT -+ 353 print " found..." -+ 354 jump __label165 always -+ 355 label __label162 -+ 356 sensor __tmp153 @unit @controlled -+ 357 jump __label163 equal __tmp153 0 -+ 358 print "[salmon]Looking for a free " -+ 359 print UNIT -+ 360 print "..." -+ 361 jump __label164 always -+ 362 label __label163 -+ 363 ucontrol flag 1 -+ 364 jump __label168 always -+ 365 label __label164 -+ 366 label __label165 -+ 367 printflush message1 -+ 368 label __label166 -+ 369 jump __label161 always -+ 370 label __label167 -+ 371 label __label168 -+ 372 label __label169 -+ 373 label __label170 -+ 374 sensor __fn0_state @unit @flag -+ 375 set __fn0_distance -1 -+ 376 set __fn0_color "gold" -+ 377 jump __label177 notEqual __fn0_state 1 -+ 378 sensor __tmp111 @unit @firstItem -+ 379 jump __label171 notEqual __tmp111 __fn0_item -+ 380 set __fn0_state 3 -+ 381 jump __label176 always -+ 382 label __label171 -+ 383 sensor __tmp114 @unit @totalItems -+ 384 jump __label172 notEqual __tmp114 0 -+ 385 set __fn0_state 2 -+ 386 jump __label175 always -+ 387 label __label172 -+ 388 set MSG ", initializing\n" -+ 389 ucontrol approach CORE_X CORE_Y 6 -+ 390 ucontrol within CORE_X CORE_Y 8 __tmp117 -+ 391 jump __label173 equal __tmp117 false -+ 392 ucontrol itemDrop CORE UNIT_CAPACITY -+ 393 label __label173 -+ 394 label __label174 -+ 395 label __label175 -+ 396 label __label176 -+ 397 label __label177 -+ 398 label __label178 -+ 399 jump __label183 notEqual __fn0_state 2 -+ 400 ucontrol within CORE_X CORE_Y 8 __tmp121 -+ 401 jump __label181 equal __tmp121 false -+ 402 ucontrol itemTake CORE __fn0_item UNIT_CAPACITY -+ 403 sensor __tmp123 @unit @totalItems -+ 404 jump __label179 lessThan __tmp123 UNIT_CAPACITY -+ 405 ucontrol approach DOME_X DOME_Y 6 -+ 406 set __fn0_state 3 -+ 407 jump __label180 always -+ 408 label __label179 -+ 409 set MSG ", loading\n" -+ 410 label __label180 -+ 411 jump __label182 always -+ 412 label __label181 -+ 413 ucontrol approach CORE_X CORE_Y 6 -+ 414 set MSG ", fetching in [gold]" -+ 415 sensor __tmp126 @unit @x -+ 416 op sub __tmp127 CORE_X __tmp126 -+ 417 sensor __tmp128 @unit @y -+ 418 op sub __tmp129 CORE_Y __tmp128 -+ 419 op len __tmp130 __tmp127 __tmp129 -+ 420 op idiv __tmp131 __tmp130 SPEED_TENTHS -+ 421 op div __fn0_distance __tmp131 10 -+ 422 label __label182 -+ 423 label __label183 -+ 424 label __label184 -+ 425 jump __label191 notEqual __fn0_state 3 -+ 426 ucontrol within DOME_X DOME_Y 8 __tmp135 -+ 427 jump __label189 equal __tmp135 false -+ 428 jump __label185 equal __fn0_supply false -+ 429 ucontrol itemDrop DOME UNIT_CAPACITY -+ 430 set MSG ", supplying\n" -+ 431 set __fn0_color "green" -+ 432 jump __label186 always -+ 433 label __label185 -+ 434 ucontrol approach DOME_X DOME_Y 6 -+ 435 set MSG ", waiting\n" -+ 436 label __label186 -+ 437 sensor __tmp138 @unit @totalItems -+ 438 jump __label187 greaterThan __tmp138 0 -+ 439 ucontrol approach CORE_X CORE_Y 6 -+ 440 set __fn0_state 2 -+ 441 label __label187 -+ 442 label __label188 -+ 443 jump __label190 always -+ 444 label __label189 -+ 445 ucontrol approach DOME_X DOME_Y 6 -+ 446 set MSG ", returning in [gold]" -+ 447 sensor __tmp141 @unit @x -+ 448 op sub __tmp142 DOME_X __tmp141 -+ 449 sensor __tmp143 @unit @y -+ 450 op sub __tmp144 DOME_Y __tmp143 -+ 451 op len __tmp145 __tmp142 __tmp144 -+ 452 op idiv __tmp146 __tmp145 SPEED_TENTHS -+ 453 op div __fn0_distance __tmp146 10 -+ 454 label __label190 -+ 455 label __label191 -+ 456 label __label192 -+ 457 ucontrol flag __fn0_state -+ 458 sensor __tmp148 @unit @totalItems -+ 459 print " " -+ 460 print __fn0_group -+ 461 print ": [" -+ 462 print __fn0_color -+ 463 print "]" -+ 464 print __tmp148 -+ 465 print "[]" -+ 466 jump __label193 lessThan __fn0_distance 0 -+ 467 print MSG -+ 468 print __fn0_distance -+ 469 print "[] sec\n" -+ 470 jump __label194 always -+ 471 label __label193 -+ 472 print MSG -+ 473 label __label194 -+ 474 set UNIT_S2 @unit -+ 475 jump __label195 always -+ 476 set UNIT_S2 null -+ 477 label __label195 - 478 jump __label54 equal SUPPLY_S_FIRST false - 479 sensor __tmp86 UNIT_S1 @totalItems - 480 op greaterThan SUPPLY_S_FIRST __tmp86 0 - - 503 set __fn0_item @phase-fabric - 504 set __fn0_group GROUP1 - 505 set __fn0_supply SUPPLY_P_FIRST ++ 341 label __label159 ++ 342 ubind __fn0_unit ++ 343 sensor __tmp102 @unit @dead ++ 344 op strictEqual __tmp103 __tmp102 0 ++ 345 sensor __tmp104 @unit @controller ++ 346 op notEqual __tmp105 __tmp104 @this ++ 347 jump __label169 greaterThan __tmp103 __tmp105 ++ 348 label __label160 ++ 349 label __label161 ++ 350 ubind UNIT ++ 351 jump __label162 notEqual @unit null ++ 352 print "[salmon]No unit of type " ++ 353 print UNIT ++ 354 print " found..." ++ 355 jump __label165 always ++ 356 label __label162 ++ 357 sensor __tmp153 @unit @controlled ++ 358 jump __label163 equal __tmp153 0 ++ 359 print "[salmon]Looking for a free " ++ 360 print UNIT ++ 361 print "..." ++ 362 jump __label164 always ++ 363 label __label163 ++ 364 ucontrol flag 1 ++ 365 jump __label168 always ++ 366 label __label164 ++ 367 label __label165 ++ 368 printflush message1 ++ 369 label __label166 ++ 370 jump __label161 always ++ 371 label __label167 ++ 372 label __label168 ++ 373 label __label169 ++ 374 label __label170 ++ 375 sensor __fn0_state @unit @flag ++ 376 set __fn0_distance -1 ++ 377 set __fn0_color "gold" ++ 378 jump __label177 notEqual __fn0_state 1 ++ 379 sensor __tmp111 @unit @firstItem ++ 380 jump __label171 notEqual __tmp111 __fn0_item ++ 381 set __fn0_state 3 ++ 382 jump __label176 always ++ 383 label __label171 ++ 384 sensor __tmp114 @unit @totalItems ++ 385 jump __label172 notEqual __tmp114 0 ++ 386 set __fn0_state 2 ++ 387 jump __label175 always ++ 388 label __label172 ++ 389 set MSG ", initializing\n" ++ 390 ucontrol approach CORE_X CORE_Y 6 ++ 391 ucontrol within CORE_X CORE_Y 8 __tmp117 ++ 392 jump __label173 equal __tmp117 false ++ 393 ucontrol itemDrop CORE UNIT_CAPACITY ++ 394 label __label173 ++ 395 label __label174 ++ 396 label __label175 ++ 397 label __label176 ++ 398 label __label177 ++ 399 label __label178 ++ 400 jump __label183 notEqual __fn0_state 2 ++ 401 ucontrol within CORE_X CORE_Y 8 __tmp121 ++ 402 jump __label181 equal __tmp121 false ++ 403 ucontrol itemTake CORE __fn0_item UNIT_CAPACITY ++ 404 sensor __tmp123 @unit @totalItems ++ 405 jump __label179 lessThan __tmp123 UNIT_CAPACITY ++ 406 ucontrol approach DOME_X DOME_Y 6 ++ 407 set __fn0_state 3 ++ 408 jump __label180 always ++ 409 label __label179 ++ 410 set MSG ", loading\n" ++ 411 label __label180 ++ 412 jump __label182 always ++ 413 label __label181 ++ 414 ucontrol approach CORE_X CORE_Y 6 ++ 415 set MSG ", fetching in [gold]" ++ 416 sensor __tmp126 @unit @x ++ 417 op sub __tmp127 CORE_X __tmp126 ++ 418 sensor __tmp128 @unit @y ++ 419 op sub __tmp129 CORE_Y __tmp128 ++ 420 op len __tmp130 __tmp127 __tmp129 ++ 421 op idiv __tmp131 __tmp130 SPEED_TENTHS ++ 422 op div __fn0_distance __tmp131 10 ++ 423 label __label182 ++ 424 label __label183 ++ 425 label __label184 ++ 426 jump __label191 notEqual __fn0_state 3 ++ 427 ucontrol within DOME_X DOME_Y 8 __tmp135 ++ 428 jump __label189 equal __tmp135 false ++ 429 jump __label185 equal __fn0_supply false ++ 430 ucontrol itemDrop DOME UNIT_CAPACITY ++ 431 set MSG ", supplying\n" ++ 432 set __fn0_color "green" ++ 433 jump __label186 always ++ 434 label __label185 ++ 435 ucontrol approach DOME_X DOME_Y 6 ++ 436 set MSG ", waiting\n" ++ 437 label __label186 ++ 438 sensor __tmp138 @unit @totalItems ++ 439 jump __label187 greaterThan __tmp138 0 ++ 440 ucontrol approach CORE_X CORE_Y 6 ++ 441 set __fn0_state 2 ++ 442 label __label187 ++ 443 label __label188 ++ 444 jump __label190 always ++ 445 label __label189 ++ 446 ucontrol approach DOME_X DOME_Y 6 ++ 447 set MSG ", returning in [gold]" ++ 448 sensor __tmp141 @unit @x ++ 449 op sub __tmp142 DOME_X __tmp141 ++ 450 sensor __tmp143 @unit @y ++ 451 op sub __tmp144 DOME_Y __tmp143 ++ 452 op len __tmp145 __tmp142 __tmp144 ++ 453 op idiv __tmp146 __tmp145 SPEED_TENTHS ++ 454 op div __fn0_distance __tmp146 10 ++ 455 label __label190 ++ 456 label __label191 ++ 457 label __label192 ++ 458 ucontrol flag __fn0_state ++ 459 sensor __tmp148 @unit @totalItems ++ 460 print " " ++ 461 print __fn0_group ++ 462 print ": [" ++ 463 print __fn0_color ++ 464 print "]" ++ 465 print __tmp148 ++ 466 print "[]" ++ 467 jump __label193 lessThan __fn0_distance 0 ++ 468 print MSG ++ 469 print __fn0_distance ++ 470 print "[] sec\n" ++ 471 jump __label194 always ++ 472 label __label193 ++ 473 print MSG ++ 474 label __label194 ++ 475 set __fn0retval @unit ++ 476 jump __label195 always ++ 477 set __fn0retval null ++ 478 label __label195 + 479 set UNIT_S2 __fn0retval + 480 jump __label54 equal SUPPLY_S_FIRST false + 481 sensor __tmp86 UNIT_S1 @totalItems + + 505 set __fn0_item @phase-fabric + 506 set __fn0_group GROUP1 + 507 set __fn0_supply SUPPLY_P_FIRST - * setaddr __fn0retaddr __label57 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label57 __fn0 -- * set UNIT_P1 __fn0retval -+ 506 label __label196 -+ 507 ubind __fn0_unit -+ 508 sensor __tmp102 @unit @dead -+ 509 op strictEqual __tmp103 __tmp102 0 -+ 510 sensor __tmp104 @unit @controller -+ 511 op notEqual __tmp105 __tmp104 @this -+ 512 jump __label206 greaterThan __tmp103 __tmp105 -+ 513 label __label197 -+ 514 label __label198 -+ 515 ubind UNIT -+ 516 jump __label199 notEqual @unit null -+ 517 print "[salmon]No unit of type " -+ 518 print UNIT -+ 519 print " found..." -+ 520 jump __label202 always -+ 521 label __label199 -+ 522 sensor __tmp153 @unit @controlled -+ 523 jump __label200 equal __tmp153 0 -+ 524 print "[salmon]Looking for a free " -+ 525 print UNIT -+ 526 print "..." -+ 527 jump __label201 always -+ 528 label __label200 -+ 529 ucontrol flag 1 -+ 530 jump __label205 always -+ 531 label __label201 -+ 532 label __label202 -+ 533 printflush message1 -+ 534 label __label203 -+ 535 jump __label198 always -+ 536 label __label204 -+ 537 label __label205 -+ 538 label __label206 -+ 539 label __label207 -+ 540 sensor __fn0_state @unit @flag -+ 541 set __fn0_distance -1 -+ 542 set __fn0_color "gold" -+ 543 jump __label214 notEqual __fn0_state 1 -+ 544 sensor __tmp111 @unit @firstItem -+ 545 jump __label208 notEqual __tmp111 __fn0_item -+ 546 set __fn0_state 3 -+ 547 jump __label213 always -+ 548 label __label208 -+ 549 sensor __tmp114 @unit @totalItems -+ 550 jump __label209 notEqual __tmp114 0 -+ 551 set __fn0_state 2 -+ 552 jump __label212 always -+ 553 label __label209 -+ 554 set MSG ", initializing\n" -+ 555 ucontrol approach CORE_X CORE_Y 6 -+ 556 ucontrol within CORE_X CORE_Y 8 __tmp117 -+ 557 jump __label210 equal __tmp117 false -+ 558 ucontrol itemDrop CORE UNIT_CAPACITY -+ 559 label __label210 -+ 560 label __label211 -+ 561 label __label212 -+ 562 label __label213 -+ 563 label __label214 -+ 564 label __label215 -+ 565 jump __label220 notEqual __fn0_state 2 -+ 566 ucontrol within CORE_X CORE_Y 8 __tmp121 -+ 567 jump __label218 equal __tmp121 false -+ 568 ucontrol itemTake CORE __fn0_item UNIT_CAPACITY -+ 569 sensor __tmp123 @unit @totalItems -+ 570 jump __label216 lessThan __tmp123 UNIT_CAPACITY -+ 571 ucontrol approach DOME_X DOME_Y 6 -+ 572 set __fn0_state 3 -+ 573 jump __label217 always -+ 574 label __label216 -+ 575 set MSG ", loading\n" -+ 576 label __label217 -+ 577 jump __label219 always -+ 578 label __label218 -+ 579 ucontrol approach CORE_X CORE_Y 6 -+ 580 set MSG ", fetching in [gold]" -+ 581 sensor __tmp126 @unit @x -+ 582 op sub __tmp127 CORE_X __tmp126 -+ 583 sensor __tmp128 @unit @y -+ 584 op sub __tmp129 CORE_Y __tmp128 -+ 585 op len __tmp130 __tmp127 __tmp129 -+ 586 op idiv __tmp131 __tmp130 SPEED_TENTHS -+ 587 op div __fn0_distance __tmp131 10 -+ 588 label __label219 -+ 589 label __label220 -+ 590 label __label221 -+ 591 jump __label228 notEqual __fn0_state 3 -+ 592 ucontrol within DOME_X DOME_Y 8 __tmp135 -+ 593 jump __label226 equal __tmp135 false -+ 594 jump __label222 equal __fn0_supply false -+ 595 ucontrol itemDrop DOME UNIT_CAPACITY -+ 596 set MSG ", supplying\n" -+ 597 set __fn0_color "green" -+ 598 jump __label223 always -+ 599 label __label222 -+ 600 ucontrol approach DOME_X DOME_Y 6 -+ 601 set MSG ", waiting\n" -+ 602 label __label223 -+ 603 sensor __tmp138 @unit @totalItems -+ 604 jump __label224 greaterThan __tmp138 0 -+ 605 ucontrol approach CORE_X CORE_Y 6 -+ 606 set __fn0_state 2 -+ 607 label __label224 -+ 608 label __label225 -+ 609 jump __label227 always -+ 610 label __label226 -+ 611 ucontrol approach DOME_X DOME_Y 6 -+ 612 set MSG ", returning in [gold]" -+ 613 sensor __tmp141 @unit @x -+ 614 op sub __tmp142 DOME_X __tmp141 -+ 615 sensor __tmp143 @unit @y -+ 616 op sub __tmp144 DOME_Y __tmp143 -+ 617 op len __tmp145 __tmp142 __tmp144 -+ 618 op idiv __tmp146 __tmp145 SPEED_TENTHS -+ 619 op div __fn0_distance __tmp146 10 -+ 620 label __label227 -+ 621 label __label228 -+ 622 label __label229 -+ 623 ucontrol flag __fn0_state -+ 624 sensor __tmp148 @unit @totalItems -+ 625 print " " -+ 626 print __fn0_group -+ 627 print ": [" -+ 628 print __fn0_color -+ 629 print "]" -+ 630 print __tmp148 -+ 631 print "[]" -+ 632 jump __label230 lessThan __fn0_distance 0 -+ 633 print MSG -+ 634 print __fn0_distance -+ 635 print "[] sec\n" -+ 636 jump __label231 always -+ 637 label __label230 -+ 638 print MSG -+ 639 label __label231 -+ 640 set UNIT_P1 @unit -+ 641 jump __label232 always -+ 642 set UNIT_P1 null -+ 643 label __label232 - 644 jump __label58 equal FOUR_UNITS false - 645 op equal __tmp93 SUPPLY_P_FIRST false - 646 set __fn0_unit UNIT_P2 - 647 set __fn0_item @phase-fabric - 648 set __fn0_group GROUP2 - 649 set __fn0_supply __tmp93 ++ 508 label __label196 ++ 509 ubind __fn0_unit ++ 510 sensor __tmp102 @unit @dead ++ 511 op strictEqual __tmp103 __tmp102 0 ++ 512 sensor __tmp104 @unit @controller ++ 513 op notEqual __tmp105 __tmp104 @this ++ 514 jump __label206 greaterThan __tmp103 __tmp105 ++ 515 label __label197 ++ 516 label __label198 ++ 517 ubind UNIT ++ 518 jump __label199 notEqual @unit null ++ 519 print "[salmon]No unit of type " ++ 520 print UNIT ++ 521 print " found..." ++ 522 jump __label202 always ++ 523 label __label199 ++ 524 sensor __tmp153 @unit @controlled ++ 525 jump __label200 equal __tmp153 0 ++ 526 print "[salmon]Looking for a free " ++ 527 print UNIT ++ 528 print "..." ++ 529 jump __label201 always ++ 530 label __label200 ++ 531 ucontrol flag 1 ++ 532 jump __label205 always ++ 533 label __label201 ++ 534 label __label202 ++ 535 printflush message1 ++ 536 label __label203 ++ 537 jump __label198 always ++ 538 label __label204 ++ 539 label __label205 ++ 540 label __label206 ++ 541 label __label207 ++ 542 sensor __fn0_state @unit @flag ++ 543 set __fn0_distance -1 ++ 544 set __fn0_color "gold" ++ 545 jump __label214 notEqual __fn0_state 1 ++ 546 sensor __tmp111 @unit @firstItem ++ 547 jump __label208 notEqual __tmp111 __fn0_item ++ 548 set __fn0_state 3 ++ 549 jump __label213 always ++ 550 label __label208 ++ 551 sensor __tmp114 @unit @totalItems ++ 552 jump __label209 notEqual __tmp114 0 ++ 553 set __fn0_state 2 ++ 554 jump __label212 always ++ 555 label __label209 ++ 556 set MSG ", initializing\n" ++ 557 ucontrol approach CORE_X CORE_Y 6 ++ 558 ucontrol within CORE_X CORE_Y 8 __tmp117 ++ 559 jump __label210 equal __tmp117 false ++ 560 ucontrol itemDrop CORE UNIT_CAPACITY ++ 561 label __label210 ++ 562 label __label211 ++ 563 label __label212 ++ 564 label __label213 ++ 565 label __label214 ++ 566 label __label215 ++ 567 jump __label220 notEqual __fn0_state 2 ++ 568 ucontrol within CORE_X CORE_Y 8 __tmp121 ++ 569 jump __label218 equal __tmp121 false ++ 570 ucontrol itemTake CORE __fn0_item UNIT_CAPACITY ++ 571 sensor __tmp123 @unit @totalItems ++ 572 jump __label216 lessThan __tmp123 UNIT_CAPACITY ++ 573 ucontrol approach DOME_X DOME_Y 6 ++ 574 set __fn0_state 3 ++ 575 jump __label217 always ++ 576 label __label216 ++ 577 set MSG ", loading\n" ++ 578 label __label217 ++ 579 jump __label219 always ++ 580 label __label218 ++ 581 ucontrol approach CORE_X CORE_Y 6 ++ 582 set MSG ", fetching in [gold]" ++ 583 sensor __tmp126 @unit @x ++ 584 op sub __tmp127 CORE_X __tmp126 ++ 585 sensor __tmp128 @unit @y ++ 586 op sub __tmp129 CORE_Y __tmp128 ++ 587 op len __tmp130 __tmp127 __tmp129 ++ 588 op idiv __tmp131 __tmp130 SPEED_TENTHS ++ 589 op div __fn0_distance __tmp131 10 ++ 590 label __label219 ++ 591 label __label220 ++ 592 label __label221 ++ 593 jump __label228 notEqual __fn0_state 3 ++ 594 ucontrol within DOME_X DOME_Y 8 __tmp135 ++ 595 jump __label226 equal __tmp135 false ++ 596 jump __label222 equal __fn0_supply false ++ 597 ucontrol itemDrop DOME UNIT_CAPACITY ++ 598 set MSG ", supplying\n" ++ 599 set __fn0_color "green" ++ 600 jump __label223 always ++ 601 label __label222 ++ 602 ucontrol approach DOME_X DOME_Y 6 ++ 603 set MSG ", waiting\n" ++ 604 label __label223 ++ 605 sensor __tmp138 @unit @totalItems ++ 606 jump __label224 greaterThan __tmp138 0 ++ 607 ucontrol approach CORE_X CORE_Y 6 ++ 608 set __fn0_state 2 ++ 609 label __label224 ++ 610 label __label225 ++ 611 jump __label227 always ++ 612 label __label226 ++ 613 ucontrol approach DOME_X DOME_Y 6 ++ 614 set MSG ", returning in [gold]" ++ 615 sensor __tmp141 @unit @x ++ 616 op sub __tmp142 DOME_X __tmp141 ++ 617 sensor __tmp143 @unit @y ++ 618 op sub __tmp144 DOME_Y __tmp143 ++ 619 op len __tmp145 __tmp142 __tmp144 ++ 620 op idiv __tmp146 __tmp145 SPEED_TENTHS ++ 621 op div __fn0_distance __tmp146 10 ++ 622 label __label227 ++ 623 label __label228 ++ 624 label __label229 ++ 625 ucontrol flag __fn0_state ++ 626 sensor __tmp148 @unit @totalItems ++ 627 print " " ++ 628 print __fn0_group ++ 629 print ": [" ++ 630 print __fn0_color ++ 631 print "]" ++ 632 print __tmp148 ++ 633 print "[]" ++ 634 jump __label230 lessThan __fn0_distance 0 ++ 635 print MSG ++ 636 print __fn0_distance ++ 637 print "[] sec\n" ++ 638 jump __label231 always ++ 639 label __label230 ++ 640 print MSG ++ 641 label __label231 ++ 642 set __fn0retval @unit ++ 643 jump __label232 always ++ 644 set __fn0retval null ++ 645 label __label232 + 646 set UNIT_P1 __fn0retval + 647 jump __label58 equal FOUR_UNITS false + 648 op equal __tmp93 SUPPLY_P_FIRST false + + 650 set __fn0_item @phase-fabric + 651 set __fn0_group GROUP2 + 652 set __fn0_supply __tmp93 - * setaddr __fn0retaddr __label60 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label60 __fn0 -- * set UNIT_P2 __fn0retval -+ 650 label __label233 -+ 651 ubind __fn0_unit -+ 652 sensor __tmp102 @unit @dead -+ 653 op strictEqual __tmp103 __tmp102 0 -+ 654 sensor __tmp104 @unit @controller -+ 655 op notEqual __tmp105 __tmp104 @this -+ 656 jump __label243 greaterThan __tmp103 __tmp105 -+ 657 label __label234 -+ 658 label __label235 -+ 659 ubind UNIT -+ 660 jump __label236 notEqual @unit null -+ 661 print "[salmon]No unit of type " -+ 662 print UNIT -+ 663 print " found..." -+ 664 jump __label239 always -+ 665 label __label236 -+ 666 sensor __tmp153 @unit @controlled -+ 667 jump __label237 equal __tmp153 0 -+ 668 print "[salmon]Looking for a free " -+ 669 print UNIT -+ 670 print "..." -+ 671 jump __label238 always -+ 672 label __label237 -+ 673 ucontrol flag 1 -+ 674 jump __label242 always -+ 675 label __label238 -+ 676 label __label239 -+ 677 printflush message1 -+ 678 label __label240 -+ 679 jump __label235 always -+ 680 label __label241 -+ 681 label __label242 -+ 682 label __label243 -+ 683 label __label244 -+ 684 sensor __fn0_state @unit @flag -+ 685 set __fn0_distance -1 -+ 686 set __fn0_color "gold" -+ 687 jump __label251 notEqual __fn0_state 1 -+ 688 sensor __tmp111 @unit @firstItem -+ 689 jump __label245 notEqual __tmp111 __fn0_item -+ 690 set __fn0_state 3 -+ 691 jump __label250 always -+ 692 label __label245 -+ 693 sensor __tmp114 @unit @totalItems -+ 694 jump __label246 notEqual __tmp114 0 -+ 695 set __fn0_state 2 -+ 696 jump __label249 always -+ 697 label __label246 -+ 698 set MSG ", initializing\n" -+ 699 ucontrol approach CORE_X CORE_Y 6 -+ 700 ucontrol within CORE_X CORE_Y 8 __tmp117 -+ 701 jump __label247 equal __tmp117 false -+ 702 ucontrol itemDrop CORE UNIT_CAPACITY -+ 703 label __label247 -+ 704 label __label248 -+ 705 label __label249 -+ 706 label __label250 -+ 707 label __label251 -+ 708 label __label252 -+ 709 jump __label257 notEqual __fn0_state 2 -+ 710 ucontrol within CORE_X CORE_Y 8 __tmp121 -+ 711 jump __label255 equal __tmp121 false -+ 712 ucontrol itemTake CORE __fn0_item UNIT_CAPACITY -+ 713 sensor __tmp123 @unit @totalItems -+ 714 jump __label253 lessThan __tmp123 UNIT_CAPACITY -+ 715 ucontrol approach DOME_X DOME_Y 6 -+ 716 set __fn0_state 3 -+ 717 jump __label254 always -+ 718 label __label253 -+ 719 set MSG ", loading\n" -+ 720 label __label254 -+ 721 jump __label256 always -+ 722 label __label255 -+ 723 ucontrol approach CORE_X CORE_Y 6 -+ 724 set MSG ", fetching in [gold]" -+ 725 sensor __tmp126 @unit @x -+ 726 op sub __tmp127 CORE_X __tmp126 -+ 727 sensor __tmp128 @unit @y -+ 728 op sub __tmp129 CORE_Y __tmp128 -+ 729 op len __tmp130 __tmp127 __tmp129 -+ 730 op idiv __tmp131 __tmp130 SPEED_TENTHS -+ 731 op div __fn0_distance __tmp131 10 -+ 732 label __label256 -+ 733 label __label257 -+ 734 label __label258 -+ 735 jump __label265 notEqual __fn0_state 3 -+ 736 ucontrol within DOME_X DOME_Y 8 __tmp135 -+ 737 jump __label263 equal __tmp135 false -+ 738 jump __label259 equal __fn0_supply false -+ 739 ucontrol itemDrop DOME UNIT_CAPACITY -+ 740 set MSG ", supplying\n" -+ 741 set __fn0_color "green" -+ 742 jump __label260 always -+ 743 label __label259 -+ 744 ucontrol approach DOME_X DOME_Y 6 -+ 745 set MSG ", waiting\n" -+ 746 label __label260 -+ 747 sensor __tmp138 @unit @totalItems -+ 748 jump __label261 greaterThan __tmp138 0 -+ 749 ucontrol approach CORE_X CORE_Y 6 -+ 750 set __fn0_state 2 -+ 751 label __label261 -+ 752 label __label262 -+ 753 jump __label264 always -+ 754 label __label263 -+ 755 ucontrol approach DOME_X DOME_Y 6 -+ 756 set MSG ", returning in [gold]" -+ 757 sensor __tmp141 @unit @x -+ 758 op sub __tmp142 DOME_X __tmp141 -+ 759 sensor __tmp143 @unit @y -+ 760 op sub __tmp144 DOME_Y __tmp143 -+ 761 op len __tmp145 __tmp142 __tmp144 -+ 762 op idiv __tmp146 __tmp145 SPEED_TENTHS -+ 763 op div __fn0_distance __tmp146 10 -+ 764 label __label264 -+ 765 label __label265 -+ 766 label __label266 -+ 767 ucontrol flag __fn0_state -+ 768 sensor __tmp148 @unit @totalItems -+ 769 print " " -+ 770 print __fn0_group -+ 771 print ": [" -+ 772 print __fn0_color -+ 773 print "]" -+ 774 print __tmp148 -+ 775 print "[]" -+ 776 jump __label267 lessThan __fn0_distance 0 -+ 777 print MSG -+ 778 print __fn0_distance -+ 779 print "[] sec\n" -+ 780 jump __label268 always -+ 781 label __label267 -+ 782 print MSG -+ 783 label __label268 -+ 784 set UNIT_P2 @unit -+ 785 jump __label269 always -+ 786 set UNIT_P2 null -+ 787 label __label269 - 788 jump __label61 equal SUPPLY_P_FIRST false - 789 sensor __tmp96 UNIT_P1 @totalItems - 790 op greaterThan SUPPLY_P_FIRST __tmp96 0 - - 806 jump __label104 notEqual __tmp78 false - 807 label __label48 - 808 end ++ 653 label __label233 ++ 654 ubind __fn0_unit ++ 655 sensor __tmp102 @unit @dead ++ 656 op strictEqual __tmp103 __tmp102 0 ++ 657 sensor __tmp104 @unit @controller ++ 658 op notEqual __tmp105 __tmp104 @this ++ 659 jump __label243 greaterThan __tmp103 __tmp105 ++ 660 label __label234 ++ 661 label __label235 ++ 662 ubind UNIT ++ 663 jump __label236 notEqual @unit null ++ 664 print "[salmon]No unit of type " ++ 665 print UNIT ++ 666 print " found..." ++ 667 jump __label239 always ++ 668 label __label236 ++ 669 sensor __tmp153 @unit @controlled ++ 670 jump __label237 equal __tmp153 0 ++ 671 print "[salmon]Looking for a free " ++ 672 print UNIT ++ 673 print "..." ++ 674 jump __label238 always ++ 675 label __label237 ++ 676 ucontrol flag 1 ++ 677 jump __label242 always ++ 678 label __label238 ++ 679 label __label239 ++ 680 printflush message1 ++ 681 label __label240 ++ 682 jump __label235 always ++ 683 label __label241 ++ 684 label __label242 ++ 685 label __label243 ++ 686 label __label244 ++ 687 sensor __fn0_state @unit @flag ++ 688 set __fn0_distance -1 ++ 689 set __fn0_color "gold" ++ 690 jump __label251 notEqual __fn0_state 1 ++ 691 sensor __tmp111 @unit @firstItem ++ 692 jump __label245 notEqual __tmp111 __fn0_item ++ 693 set __fn0_state 3 ++ 694 jump __label250 always ++ 695 label __label245 ++ 696 sensor __tmp114 @unit @totalItems ++ 697 jump __label246 notEqual __tmp114 0 ++ 698 set __fn0_state 2 ++ 699 jump __label249 always ++ 700 label __label246 ++ 701 set MSG ", initializing\n" ++ 702 ucontrol approach CORE_X CORE_Y 6 ++ 703 ucontrol within CORE_X CORE_Y 8 __tmp117 ++ 704 jump __label247 equal __tmp117 false ++ 705 ucontrol itemDrop CORE UNIT_CAPACITY ++ 706 label __label247 ++ 707 label __label248 ++ 708 label __label249 ++ 709 label __label250 ++ 710 label __label251 ++ 711 label __label252 ++ 712 jump __label257 notEqual __fn0_state 2 ++ 713 ucontrol within CORE_X CORE_Y 8 __tmp121 ++ 714 jump __label255 equal __tmp121 false ++ 715 ucontrol itemTake CORE __fn0_item UNIT_CAPACITY ++ 716 sensor __tmp123 @unit @totalItems ++ 717 jump __label253 lessThan __tmp123 UNIT_CAPACITY ++ 718 ucontrol approach DOME_X DOME_Y 6 ++ 719 set __fn0_state 3 ++ 720 jump __label254 always ++ 721 label __label253 ++ 722 set MSG ", loading\n" ++ 723 label __label254 ++ 724 jump __label256 always ++ 725 label __label255 ++ 726 ucontrol approach CORE_X CORE_Y 6 ++ 727 set MSG ", fetching in [gold]" ++ 728 sensor __tmp126 @unit @x ++ 729 op sub __tmp127 CORE_X __tmp126 ++ 730 sensor __tmp128 @unit @y ++ 731 op sub __tmp129 CORE_Y __tmp128 ++ 732 op len __tmp130 __tmp127 __tmp129 ++ 733 op idiv __tmp131 __tmp130 SPEED_TENTHS ++ 734 op div __fn0_distance __tmp131 10 ++ 735 label __label256 ++ 736 label __label257 ++ 737 label __label258 ++ 738 jump __label265 notEqual __fn0_state 3 ++ 739 ucontrol within DOME_X DOME_Y 8 __tmp135 ++ 740 jump __label263 equal __tmp135 false ++ 741 jump __label259 equal __fn0_supply false ++ 742 ucontrol itemDrop DOME UNIT_CAPACITY ++ 743 set MSG ", supplying\n" ++ 744 set __fn0_color "green" ++ 745 jump __label260 always ++ 746 label __label259 ++ 747 ucontrol approach DOME_X DOME_Y 6 ++ 748 set MSG ", waiting\n" ++ 749 label __label260 ++ 750 sensor __tmp138 @unit @totalItems ++ 751 jump __label261 greaterThan __tmp138 0 ++ 752 ucontrol approach CORE_X CORE_Y 6 ++ 753 set __fn0_state 2 ++ 754 label __label261 ++ 755 label __label262 ++ 756 jump __label264 always ++ 757 label __label263 ++ 758 ucontrol approach DOME_X DOME_Y 6 ++ 759 set MSG ", returning in [gold]" ++ 760 sensor __tmp141 @unit @x ++ 761 op sub __tmp142 DOME_X __tmp141 ++ 762 sensor __tmp143 @unit @y ++ 763 op sub __tmp144 DOME_Y __tmp143 ++ 764 op len __tmp145 __tmp142 __tmp144 ++ 765 op idiv __tmp146 __tmp145 SPEED_TENTHS ++ 766 op div __fn0_distance __tmp146 10 ++ 767 label __label264 ++ 768 label __label265 ++ 769 label __label266 ++ 770 ucontrol flag __fn0_state ++ 771 sensor __tmp148 @unit @totalItems ++ 772 print " " ++ 773 print __fn0_group ++ 774 print ": [" ++ 775 print __fn0_color ++ 776 print "]" ++ 777 print __tmp148 ++ 778 print "[]" ++ 779 jump __label267 lessThan __fn0_distance 0 ++ 780 print MSG ++ 781 print __fn0_distance ++ 782 print "[] sec\n" ++ 783 jump __label268 always ++ 784 label __label267 ++ 785 print MSG ++ 786 label __label268 ++ 787 set __fn0retval @unit ++ 788 jump __label269 always ++ 789 set __fn0retval null ++ 790 label __label269 + 791 set UNIT_P2 __fn0retval + 792 jump __label61 equal SUPPLY_P_FIRST false + 793 sensor __tmp96 UNIT_P1 @totalItems + + 810 jump __label104 notEqual __tmp78 false + 811 label __label48 + 812 end - * label __label0 - * ubind __fn0_unit - * sensor __tmp102 @unit @dead @@ -2139,11 +2137,11 @@ Modifications by Function Inlining: inline function processUnit (+289 instructio - * label __label63 - * goto __fn0retaddr __fn0 - * end - 809 label __label1 - 810 label __label92 - 811 ubind UNIT + 813 label __label1 + 814 label __label92 + 815 ubind UNIT -Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: +Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-4 instructions): 194 set __fn0_group GROUP1 195 set __fn0_supply SUPPLY_S_FIRST @@ -2190,6 +2188,14 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 318 print __fn0_color 319 print "]" + 329 label __label157 + 330 set __fn0retval @unit + 331 jump __label158 always +- * set __fn0retval null + 332 label __label158 + 333 set UNIT_S1 __fn0retval + 334 jump __label51 equal FOUR_UNITS false + 338 set __fn0_group GROUP2 339 set __fn0_supply __tmp83 340 label __label159 @@ -2235,6 +2241,14 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 462 print __fn0_color 463 print "]" + 473 label __label194 + 474 set __fn0retval @unit + 475 jump __label195 always +- * set __fn0retval null + 476 label __label195 + 477 set UNIT_S2 __fn0retval + 478 jump __label54 equal SUPPLY_S_FIRST false + 504 set __fn0_group GROUP1 505 set __fn0_supply SUPPLY_P_FIRST 506 label __label196 @@ -2280,6 +2294,14 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 628 print __fn0_color 629 print "]" + 639 label __label231 + 640 set __fn0retval @unit + 641 jump __label232 always +- * set __fn0retval null + 642 label __label232 + 643 set UNIT_P1 __fn0retval + 644 jump __label58 equal FOUR_UNITS false + 648 set __fn0_group GROUP2 649 set __fn0_supply __tmp93 650 label __label233 @@ -2324,6 +2346,14 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 771 print ": [" 772 print __fn0_color 773 print "]" + + 783 label __label268 + 784 set __fn0retval @unit + 785 jump __label269 always +- * set __fn0retval null + 786 label __label269 + 787 set UNIT_P2 __fn0retval + 788 jump __label61 equal SUPPLY_P_FIRST false Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-16 instructions): @@ -2338,7 +2368,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 193 ubind UNIT_S1 194 sensor __tmp102 @unit @dead - 329 label __label158 + 329 set UNIT_S1 __fn0retval 330 jump __label51 equal FOUR_UNITS false 331 op equal __tmp83 SUPPLY_S_FIRST false - * set __fn0_unit UNIT_S2 @@ -2360,7 +2390,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 495 ubind UNIT_P1 496 sensor __tmp102 @unit @dead - 631 label __label232 + 631 set UNIT_P1 __fn0retval 632 jump __label58 equal FOUR_UNITS false 633 op equal __tmp93 SUPPLY_P_FIRST false - * set __fn0_unit UNIT_P2 @@ -2371,15 +2401,14 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-1 635 ubind UNIT_P2 636 sensor __tmp102 @unit @dead -Modifications by Function Inlining: inline function findUnit (+40 instructions): +Modifications by Function Inlining: inline function findUnit (+44 instructions): 66 label __label18 67 label __label10 68 jump __label23 notEqual UNIT_S1 null - * setaddr __fn1retaddr __label25 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label25 __fn1 -- * set UNIT_S1 __fn1retval + 69 label __label270 + 70 label __label271 + 71 ubind UNIT @@ -2397,7 +2426,7 @@ Modifications by Function Inlining: inline function findUnit (+40 instructions): + 83 jump __label274 always + 84 label __label273 + 85 ucontrol flag 1 -+ 86 set UNIT_S1 @unit ++ 86 set __fn1retval @unit + 87 jump __label278 always + 88 label __label274 + 89 label __label275 @@ -2405,121 +2434,120 @@ Modifications by Function Inlining: inline function findUnit (+40 instructions): + 91 label __label276 + 92 jump __label271 always + 93 label __label277 -+ 94 set UNIT_S1 null ++ 94 set __fn1retval null + 95 label __label278 - 96 label __label23 - 97 label __label24 - 98 jump __label26 notEqual UNIT_P1 null + 96 set UNIT_S1 __fn1retval + 97 label __label23 + 98 label __label24 + 99 jump __label26 notEqual UNIT_P1 null - * setaddr __fn1retaddr __label28 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label28 __fn1 -- * set UNIT_P1 __fn1retval -+ 99 label __label279 -+ 100 label __label280 -+ 101 ubind UNIT -+ 102 jump __label281 notEqual @unit null -+ 103 print "[salmon]No unit of type " -+ 104 print UNIT -+ 105 print " found..." -+ 106 jump __label284 always -+ 107 label __label281 -+ 108 sensor __tmp153 @unit @controlled -+ 109 jump __label282 equal __tmp153 0 -+ 110 print "[salmon]Looking for a free " -+ 111 print UNIT -+ 112 print "..." -+ 113 jump __label283 always -+ 114 label __label282 -+ 115 ucontrol flag 1 -+ 116 set UNIT_P1 @unit -+ 117 jump __label287 always -+ 118 label __label283 -+ 119 label __label284 -+ 120 printflush message1 -+ 121 label __label285 -+ 122 jump __label280 always -+ 123 label __label286 -+ 124 set UNIT_P1 null -+ 125 label __label287 - 126 label __label26 - 127 label __label27 - 128 sensor __tmp25 UNIT_S1 @firstItem - - 158 op greaterThanEq FOUR_UNITS travel_time 47 - 159 jump __label34 equal FOUR_UNITS false - 160 jump __label36 notEqual UNIT_S2 null ++ 100 label __label279 ++ 101 label __label280 ++ 102 ubind UNIT ++ 103 jump __label281 notEqual @unit null ++ 104 print "[salmon]No unit of type " ++ 105 print UNIT ++ 106 print " found..." ++ 107 jump __label284 always ++ 108 label __label281 ++ 109 sensor __tmp153 @unit @controlled ++ 110 jump __label282 equal __tmp153 0 ++ 111 print "[salmon]Looking for a free " ++ 112 print UNIT ++ 113 print "..." ++ 114 jump __label283 always ++ 115 label __label282 ++ 116 ucontrol flag 1 ++ 117 set __fn1retval @unit ++ 118 jump __label287 always ++ 119 label __label283 ++ 120 label __label284 ++ 121 printflush message1 ++ 122 label __label285 ++ 123 jump __label280 always ++ 124 label __label286 ++ 125 set __fn1retval null ++ 126 label __label287 + 127 set UNIT_P1 __fn1retval + 128 label __label26 + 129 label __label27 + + 160 op greaterThanEq FOUR_UNITS travel_time 47 + 161 jump __label34 equal FOUR_UNITS false + 162 jump __label36 notEqual UNIT_S2 null - * setaddr __fn1retaddr __label38 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label38 __fn1 -- * set UNIT_S2 __fn1retval -+ 161 label __label288 -+ 162 label __label289 -+ 163 ubind UNIT -+ 164 jump __label290 notEqual @unit null -+ 165 print "[salmon]No unit of type " -+ 166 print UNIT -+ 167 print " found..." -+ 168 jump __label293 always -+ 169 label __label290 -+ 170 sensor __tmp153 @unit @controlled -+ 171 jump __label291 equal __tmp153 0 -+ 172 print "[salmon]Looking for a free " -+ 173 print UNIT -+ 174 print "..." -+ 175 jump __label292 always -+ 176 label __label291 -+ 177 ucontrol flag 1 -+ 178 set UNIT_S2 @unit -+ 179 jump __label296 always -+ 180 label __label292 -+ 181 label __label293 -+ 182 printflush message1 -+ 183 label __label294 -+ 184 jump __label289 always -+ 185 label __label295 -+ 186 set UNIT_S2 null -+ 187 label __label296 - 188 label __label36 - 189 label __label37 - 190 jump __label39 notEqual UNIT_P2 null ++ 163 label __label288 ++ 164 label __label289 ++ 165 ubind UNIT ++ 166 jump __label290 notEqual @unit null ++ 167 print "[salmon]No unit of type " ++ 168 print UNIT ++ 169 print " found..." ++ 170 jump __label293 always ++ 171 label __label290 ++ 172 sensor __tmp153 @unit @controlled ++ 173 jump __label291 equal __tmp153 0 ++ 174 print "[salmon]Looking for a free " ++ 175 print UNIT ++ 176 print "..." ++ 177 jump __label292 always ++ 178 label __label291 ++ 179 ucontrol flag 1 ++ 180 set __fn1retval @unit ++ 181 jump __label296 always ++ 182 label __label292 ++ 183 label __label293 ++ 184 printflush message1 ++ 185 label __label294 ++ 186 jump __label289 always ++ 187 label __label295 ++ 188 set __fn1retval null ++ 189 label __label296 + 190 set UNIT_S2 __fn1retval + 191 label __label36 + 192 label __label37 + 193 jump __label39 notEqual UNIT_P2 null - * setaddr __fn1retaddr __label41 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label41 __fn1 -- * set UNIT_P2 __fn1retval -+ 191 label __label297 -+ 192 label __label298 -+ 193 ubind UNIT -+ 194 jump __label299 notEqual @unit null -+ 195 print "[salmon]No unit of type " -+ 196 print UNIT -+ 197 print " found..." -+ 198 jump __label302 always -+ 199 label __label299 -+ 200 sensor __tmp153 @unit @controlled -+ 201 jump __label300 equal __tmp153 0 -+ 202 print "[salmon]Looking for a free " -+ 203 print UNIT -+ 204 print "..." -+ 205 jump __label301 always -+ 206 label __label300 -+ 207 ucontrol flag 1 -+ 208 set UNIT_P2 @unit -+ 209 jump __label305 always -+ 210 label __label301 -+ 211 label __label302 -+ 212 printflush message1 -+ 213 label __label303 -+ 214 jump __label298 always -+ 215 label __label304 -+ 216 set UNIT_P2 null -+ 217 label __label305 - 218 label __label39 - 219 label __label40 - 220 sensor __tmp56 UNIT_S1 @firstItem - - 882 jump __label104 notEqual __tmp78 false - 883 label __label48 - 884 end ++ 194 label __label297 ++ 195 label __label298 ++ 196 ubind UNIT ++ 197 jump __label299 notEqual @unit null ++ 198 print "[salmon]No unit of type " ++ 199 print UNIT ++ 200 print " found..." ++ 201 jump __label302 always ++ 202 label __label299 ++ 203 sensor __tmp153 @unit @controlled ++ 204 jump __label300 equal __tmp153 0 ++ 205 print "[salmon]Looking for a free " ++ 206 print UNIT ++ 207 print "..." ++ 208 jump __label301 always ++ 209 label __label300 ++ 210 ucontrol flag 1 ++ 211 set __fn1retval @unit ++ 212 jump __label305 always ++ 213 label __label301 ++ 214 label __label302 ++ 215 printflush message1 ++ 216 label __label303 ++ 217 jump __label298 always ++ 218 label __label304 ++ 219 set __fn1retval null ++ 220 label __label305 + 221 set UNIT_P2 __fn1retval + 222 label __label39 + 223 label __label40 + + 886 jump __label104 notEqual __tmp78 false + 887 label __label48 + 888 end - * label __label1 - * label __label92 - * ubind UNIT @@ -2550,6 +2578,40 @@ Modifications by Function Inlining: inline function findUnit (+40 instructions): - * goto __fn1retaddr __fn1 - * end +Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (-4 instructions): + + 420 print MSG + 421 label __label157 + 422 set __fn0retval @unit +- * jump __label158 always + 423 label __label158 + 424 set UNIT_S1 __fn0retval + 425 jump __label51 equal FOUR_UNITS false + + 559 print MSG + 560 label __label194 + 561 set __fn0retval @unit +- * jump __label195 always + 562 label __label195 + 563 set UNIT_S2 __fn0retval + 564 jump __label54 equal SUPPLY_S_FIRST false + + 720 print MSG + 721 label __label231 + 722 set __fn0retval @unit +- * jump __label232 always + 723 label __label232 + 724 set UNIT_P1 __fn0retval + 725 jump __label58 equal FOUR_UNITS false + + 859 print MSG + 860 label __label268 + 861 set __fn0retval @unit +- * jump __label269 always + 862 label __label269 + 863 set UNIT_P2 __fn0retval + 864 jump __label61 equal SUPPLY_P_FIRST false + Modifications by Final phase, Jump Straightening, iteration 1 (-2 instructions): 29 set __fn3_count 0 @@ -2574,226 +2636,160 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-2 instructions): Modifications by Final phase, Jump Threading, iteration 1: - 346 jump __label142 lessThan __tmp123 UNIT_CAPACITY - 347 ucontrol approach DOME_X DOME_Y 6 - 348 set __fn0_state 3 + 350 jump __label142 lessThan __tmp123 UNIT_CAPACITY + 351 ucontrol approach DOME_X DOME_Y 6 + 352 set __fn0_state 3 - * jump __label143 always -+ 349 jump __label145 always - 350 label __label142 - 351 set MSG ", loading\n" - 352 label __label143 - - 377 set MSG ", waiting\n" - 378 label __label149 - 379 sensor __tmp138 @unit @totalItems ++ 353 jump __label145 always + 354 label __label142 + 355 set MSG ", loading\n" + 356 label __label143 + + 381 set MSG ", waiting\n" + 382 label __label149 + 383 sensor __tmp138 @unit @totalItems - * jump __label150 greaterThan __tmp138 0 -+ 380 jump __label153 greaterThan __tmp138 0 - 381 ucontrol approach CORE_X CORE_Y 6 - 382 set __fn0_state 2 - 383 label __label150 - - 486 jump __label179 lessThan __tmp123 UNIT_CAPACITY - 487 ucontrol approach DOME_X DOME_Y 6 - 488 set __fn0_state 3 ++ 384 jump __label153 greaterThan __tmp138 0 + 385 ucontrol approach CORE_X CORE_Y 6 + 386 set __fn0_state 2 + 387 label __label150 + + 489 jump __label179 lessThan __tmp123 UNIT_CAPACITY + 490 ucontrol approach DOME_X DOME_Y 6 + 491 set __fn0_state 3 - * jump __label180 always -+ 489 jump __label182 always - 490 label __label179 - 491 set MSG ", loading\n" - 492 label __label180 - - 517 set MSG ", waiting\n" - 518 label __label186 - 519 sensor __tmp138 @unit @totalItems ++ 492 jump __label182 always + 493 label __label179 + 494 set MSG ", loading\n" + 495 label __label180 + + 520 set MSG ", waiting\n" + 521 label __label186 + 522 sensor __tmp138 @unit @totalItems - * jump __label187 greaterThan __tmp138 0 -+ 520 jump __label190 greaterThan __tmp138 0 - 521 ucontrol approach CORE_X CORE_Y 6 - 522 set __fn0_state 2 - 523 label __label187 - - 648 jump __label216 lessThan __tmp123 UNIT_CAPACITY - 649 ucontrol approach DOME_X DOME_Y 6 - 650 set __fn0_state 3 ++ 523 jump __label190 greaterThan __tmp138 0 + 524 ucontrol approach CORE_X CORE_Y 6 + 525 set __fn0_state 2 + 526 label __label187 + + 650 jump __label216 lessThan __tmp123 UNIT_CAPACITY + 651 ucontrol approach DOME_X DOME_Y 6 + 652 set __fn0_state 3 - * jump __label217 always -+ 651 jump __label219 always - 652 label __label216 - 653 set MSG ", loading\n" - 654 label __label217 - - 679 set MSG ", waiting\n" - 680 label __label223 - 681 sensor __tmp138 @unit @totalItems ++ 653 jump __label219 always + 654 label __label216 + 655 set MSG ", loading\n" + 656 label __label217 + + 681 set MSG ", waiting\n" + 682 label __label223 + 683 sensor __tmp138 @unit @totalItems - * jump __label224 greaterThan __tmp138 0 -+ 682 jump __label227 greaterThan __tmp138 0 - 683 ucontrol approach CORE_X CORE_Y 6 - 684 set __fn0_state 2 - 685 label __label224 - - 788 jump __label253 lessThan __tmp123 UNIT_CAPACITY - 789 ucontrol approach DOME_X DOME_Y 6 - 790 set __fn0_state 3 ++ 684 jump __label227 greaterThan __tmp138 0 + 685 ucontrol approach CORE_X CORE_Y 6 + 686 set __fn0_state 2 + 687 label __label224 + + 789 jump __label253 lessThan __tmp123 UNIT_CAPACITY + 790 ucontrol approach DOME_X DOME_Y 6 + 791 set __fn0_state 3 - * jump __label254 always -+ 791 jump __label256 always - 792 label __label253 - 793 set MSG ", loading\n" - 794 label __label254 - - 819 set MSG ", waiting\n" - 820 label __label260 - 821 sensor __tmp138 @unit @totalItems ++ 792 jump __label256 always + 793 label __label253 + 794 set MSG ", loading\n" + 795 label __label254 + + 820 set MSG ", waiting\n" + 821 label __label260 + 822 sensor __tmp138 @unit @totalItems - * jump __label261 greaterThan __tmp138 0 -+ 822 jump __label264 greaterThan __tmp138 0 - 823 ucontrol approach CORE_X CORE_Y 6 - 824 set __fn0_state 2 - 825 label __label261 ++ 823 jump __label264 greaterThan __tmp138 0 + 824 ucontrol approach CORE_X CORE_Y 6 + 825 set __fn0_state 2 + 826 label __label261 -Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-8 instructions): +Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-4 instructions): 88 printflush message1 89 label __label276 90 jump __label271 always - * label __label277 -- * set UNIT_S1 null +- * set __fn1retval null 91 label __label278 - 92 label __label23 - 93 label __label24 + 92 set UNIT_S1 __fn1retval + 93 label __label23 - 116 printflush message1 - 117 label __label285 - 118 jump __label280 always + 117 printflush message1 + 118 label __label285 + 119 jump __label280 always - * label __label286 -- * set UNIT_P1 null - 119 label __label287 - 120 label __label26 - 121 label __label27 - - 176 printflush message1 - 177 label __label294 - 178 jump __label289 always +- * set __fn1retval null + 120 label __label287 + 121 set UNIT_P1 __fn1retval + 122 label __label26 + + 178 printflush message1 + 179 label __label294 + 180 jump __label289 always - * label __label295 -- * set UNIT_S2 null - 179 label __label296 - 180 label __label36 - 181 label __label37 - - 204 printflush message1 - 205 label __label303 - 206 jump __label298 always +- * set __fn1retval null + 181 label __label296 + 182 set UNIT_S2 __fn1retval + 183 label __label36 + + 207 printflush message1 + 208 label __label303 + 209 jump __label298 always - * label __label304 -- * set UNIT_P2 null - 207 label __label305 - 208 label __label39 - 209 label __label40 - - 301 printflush message1 - 302 label __label129 - 303 jump __label124 always -- * label __label130 - 304 label __label131 - 305 label __label132 - 306 label __label133 - - 406 label __label157 - 407 set UNIT_S1 @unit - 408 jump __label158 always -- * set UNIT_S1 null - 409 label __label158 - 410 jump __label51 equal FOUR_UNITS false - 411 op equal __tmp83 SUPPLY_S_FIRST false - - 439 printflush message1 - 440 label __label166 - 441 jump __label161 always -- * label __label167 - 442 label __label168 - 443 label __label169 - 444 label __label170 - - 544 label __label194 - 545 set UNIT_S2 @unit - 546 jump __label195 always -- * set UNIT_S2 null - 547 label __label195 - 548 jump __label54 equal SUPPLY_S_FIRST false - 549 sensor __tmp86 UNIT_S1 @totalItems - - 599 printflush message1 - 600 label __label203 - 601 jump __label198 always -- * label __label204 - 602 label __label205 - 603 label __label206 - 604 label __label207 - - 704 label __label231 - 705 set UNIT_P1 @unit - 706 jump __label232 always -- * set UNIT_P1 null - 707 label __label232 - 708 jump __label58 equal FOUR_UNITS false - 709 op equal __tmp93 SUPPLY_P_FIRST false - - 737 printflush message1 - 738 label __label240 - 739 jump __label235 always -- * label __label241 - 740 label __label242 - 741 label __label243 - 742 label __label244 - - 842 label __label268 - 843 set UNIT_P2 @unit - 844 jump __label269 always -- * set UNIT_P2 null - 845 label __label269 - 846 jump __label61 equal SUPPLY_P_FIRST false - 847 sensor __tmp96 UNIT_P1 @totalItems - -Modifications by Final phase, Single Step Elimination, iteration 1 (-4 instructions): +- * set __fn1retval null + 210 label __label305 + 211 set UNIT_P2 __fn1retval + 212 label __label39 - 405 print MSG - 406 label __label157 - 407 set UNIT_S1 @unit -- * jump __label158 always - 408 label __label158 - 409 jump __label51 equal FOUR_UNITS false - 410 op equal __tmp83 SUPPLY_S_FIRST false + 305 printflush message1 + 306 label __label129 + 307 jump __label124 always +- * label __label130 + 308 label __label131 + 309 label __label132 + 310 label __label133 - 542 print MSG - 543 label __label194 - 544 set UNIT_S2 @unit -- * jump __label195 always - 545 label __label195 - 546 jump __label54 equal SUPPLY_S_FIRST false - 547 sensor __tmp86 UNIT_S1 @totalItems + 443 printflush message1 + 444 label __label166 + 445 jump __label161 always +- * label __label167 + 446 label __label168 + 447 label __label169 + 448 label __label170 - 701 print MSG - 702 label __label231 - 703 set UNIT_P1 @unit -- * jump __label232 always - 704 label __label232 - 705 jump __label58 equal FOUR_UNITS false - 706 op equal __tmp93 SUPPLY_P_FIRST false + 603 printflush message1 + 604 label __label203 + 605 jump __label198 always +- * label __label204 + 606 label __label205 + 607 label __label206 + 608 label __label207 - 838 print MSG - 839 label __label268 - 840 set UNIT_P2 @unit -- * jump __label269 always - 841 label __label269 - 842 jump __label61 equal SUPPLY_P_FIRST false - 843 sensor __tmp96 UNIT_P1 @totalItems + 741 printflush message1 + 742 label __label240 + 743 jump __label235 always +- * label __label241 + 744 label __label242 + 745 label __label243 + 746 label __label244 Modifications by Final phase, Print Merging, iteration 1 (-1 instructions): - 256 label __label104 - 257 set start @time - 258 print " === [gold]Supplying Overdrive Dome[] === " + 260 label __label104 + 261 set start @time + 262 print " === [gold]Supplying Overdrive Dome[] === " - * print "\n" - 259 label __label105 + 263 label __label105 - * print "\n[green]Silicon[] status:\n" -+ 260 print "\n\n[green]Silicon[] status:\n" - 261 sensor __fn2_level DOME @silicon - 262 jump __label106 lessThanEq __fn2_level 3 - 263 print " dome: [green]" ++ 264 print "\n\n[green]Silicon[] status:\n" + 265 sensor __fn2_level DOME @silicon + 266 jump __label106 lessThanEq __fn2_level 3 + 267 print " dome: [green]" Final code before resolving virtual instructions: @@ -2867,13 +2863,14 @@ print "..." jump __label274 always 0 0 label __label273 ucontrol flag 1 0 0 0 0 -set UNIT_S1 @unit +set __fn1retval @unit jump __label278 always 0 0 label __label274 label __label275 printflush message1 jump __label271 always 0 0 label __label278 +set UNIT_S1 __fn1retval label __label23 jump __label26 notEqual UNIT_P1 null label __label280 @@ -2892,13 +2889,14 @@ print "..." jump __label283 always 0 0 label __label282 ucontrol flag 1 0 0 0 0 -set UNIT_P1 @unit +set __fn1retval @unit jump __label287 always 0 0 label __label283 label __label284 printflush message1 jump __label280 always 0 0 label __label287 +set UNIT_P1 __fn1retval label __label26 sensor __tmp25 UNIT_S1 @firstItem op equal __tmp26 __tmp25 @phase-fabric @@ -2946,13 +2944,14 @@ print "..." jump __label292 always 0 0 label __label291 ucontrol flag 1 0 0 0 0 -set UNIT_S2 @unit +set __fn1retval @unit jump __label296 always 0 0 label __label292 label __label293 printflush message1 jump __label289 always 0 0 label __label296 +set UNIT_S2 __fn1retval label __label36 jump __label39 notEqual UNIT_P2 null label __label298 @@ -2971,13 +2970,14 @@ print "..." jump __label301 always 0 0 label __label300 ucontrol flag 1 0 0 0 0 -set UNIT_P2 @unit +set __fn1retval @unit jump __label305 always 0 0 label __label301 label __label302 printflush message1 jump __label298 always 0 0 label __label305 +set UNIT_P2 __fn1retval label __label39 sensor __tmp56 UNIT_S1 @firstItem op equal __tmp57 __tmp56 @phase-fabric @@ -3159,7 +3159,8 @@ jump __label157 always 0 0 label __label156 print MSG label __label157 -set UNIT_S1 @unit +set __fn0retval @unit +set UNIT_S1 __fn0retval jump __label51 equal FOUR_UNITS false op equal __tmp83 SUPPLY_S_FIRST false ubind UNIT_S2 @@ -3284,7 +3285,8 @@ jump __label194 always 0 0 label __label193 print MSG label __label194 -set UNIT_S2 @unit +set __fn0retval @unit +set UNIT_S2 __fn0retval jump __label54 equal SUPPLY_S_FIRST false sensor __tmp86 UNIT_S1 @totalItems op greaterThan SUPPLY_S_FIRST __tmp86 0 @@ -3428,7 +3430,8 @@ jump __label231 always 0 0 label __label230 print MSG label __label231 -set UNIT_P1 @unit +set __fn0retval @unit +set UNIT_P1 __fn0retval jump __label58 equal FOUR_UNITS false op equal __tmp93 SUPPLY_P_FIRST false ubind UNIT_P2 @@ -3553,7 +3556,8 @@ jump __label268 always 0 0 label __label267 print MSG label __label268 -set UNIT_P2 @unit +set __fn0retval @unit +set UNIT_P2 __fn0retval jump __label61 equal SUPPLY_P_FIRST false sensor __tmp96 UNIT_P1 @totalItems op greaterThan SUPPLY_P_FIRST __tmp96 0 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/complex-case-expression.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/complex-case-expression.log index c68b655a0..a519f5b56 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/complex-case-expression.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/complex-case-expression.log @@ -16,7 +16,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-2 instructions): 5 set __fn0_n 10 - 6 callrec bank1 __label0 __label2 + 6 callrec bank1 __label0 __label2 __fn0retval 7 label __label2 - * set __tmp1 __fn0retval - * set __tmp2 __tmp1 @@ -42,7 +42,7 @@ Modifications by Initial phase, Case Expression Optimization, iteration 1 (-1 in 11 jump __label5 greaterThan i __tmp2 - * set __ast0 i 12 set __fn0_n 1 - 13 callrec bank1 __label0 __label9 + 13 callrec bank1 __label0 __label9 __fn0retval 14 label __label9 15 set __tmp4 __fn0retval - * jump __label8 equal __ast0 __tmp4 @@ -51,13 +51,13 @@ Modifications by Initial phase, Case Expression Optimization, iteration 1 (-1 in 18 label __label8 19 set __tmp3 "A" - 23 callrec bank1 __label0 __label12 + 23 callrec bank1 __label0 __label12 __fn0retval 24 label __label12 25 set __tmp5 __fn0retval - * jump __label11 equal __ast0 __tmp5 + 26 jump __label11 equal i __tmp5 27 set __fn0_n 3 - 28 callrec bank1 __label0 __label13 + 28 callrec bank1 __label0 __label13 __fn0retval 29 label __label13 30 set __tmp6 __fn0retval - * jump __label11 equal __ast0 __tmp6 @@ -75,13 +75,13 @@ Modifications by Initial phase, Case Expression Optimization, iteration 1 (-1 in 40 label __label15 41 jump __label4 always - 46 callrec bank1 __label0 __label19 + 46 callrec bank1 __label0 __label19 __fn0retval 47 label __label19 48 set __tmp7 __fn0retval - * jump __label18 lessThan __ast0 __tmp7 + 49 jump __label18 lessThan i __tmp7 50 set __fn0_n 8 - 51 callrec bank1 __label0 __label20 + 51 callrec bank1 __label0 __label20 __fn0retval 52 label __label20 53 set __tmp8 __fn0retval - * jump __label17 lessThanEq __ast0 __tmp8 @@ -100,7 +100,7 @@ Modifications by Initial phase, Case Expression Optimization, iteration 1 (-1 in Modifications by Iterated phase, Jump Straightening, pass 1, iteration 1 (-4 instructions): - 13 callrec bank1 __label0 __label9 + 13 callrec bank1 __label0 __label9 __fn0retval 14 label __label9 15 set __tmp4 __fn0retval - * jump __label8 equal i __tmp4 @@ -177,7 +177,7 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 instructions): - 13 callrec bank1 __label0 __label9 + 13 callrec bank1 __label0 __label9 __fn0retval 14 label __label9 15 set __tmp4 __fn0retval - * jump __label7 notEqual i __tmp4 @@ -186,13 +186,13 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 18 set __tmp3 "A" 19 jump __label6 always - 22 callrec bank1 __label0 __label12 + 22 callrec bank1 __label0 __label12 __fn0retval 23 label __label12 24 set __tmp5 __fn0retval - * jump __label11 equal i __tmp5 + 25 jump __label11 equal i __fn0retval 26 set __fn0_n 3 - 27 callrec bank1 __label0 __label13 + 27 callrec bank1 __label0 __label13 __fn0retval 28 label __label13 29 set __tmp6 __fn0retval - * jump __label11 equal i __tmp6 @@ -208,13 +208,13 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 39 jump __label6 always 40 label __label14 41 set __fn0_n 6 - 42 callrec bank1 __label0 __label19 + 42 callrec bank1 __label0 __label19 __fn0retval 43 label __label19 44 set __tmp7 __fn0retval - * jump __label18 lessThan i __tmp7 + 45 jump __label18 lessThan i __fn0retval 46 set __fn0_n 8 - 47 callrec bank1 __label0 __label20 + 47 callrec bank1 __label0 __label20 __fn0retval 48 label __label20 49 set __tmp8 __fn0retval - * jump __label17 lessThanEq i __tmp8 @@ -243,7 +243,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 75 push bank1 __fn0_n - * set __fn0_n __tmp11 + 76 op mul __fn0_n -1 __fn0_n - 77 callrec bank1 __label0 __label26 + 77 callrec bank1 __label0 __label26 __fn0retval 78 label __label26 79 pop bank1 __fn0_n 80 set __tmp12 __fn0retval @@ -256,7 +256,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-2 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-8 instructions): 12 set __fn0_n 1 - 13 callrec bank1 __label0 __label9 + 13 callrec bank1 __label0 __label9 __fn0retval 14 label __label9 - * set __tmp4 __fn0retval 15 jump __label7 notEqual i __fn0retval @@ -264,12 +264,12 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-8 17 set __tmp3 "A" 20 set __fn0_n 2 - 21 callrec bank1 __label0 __label12 + 21 callrec bank1 __label0 __label12 __fn0retval 22 label __label12 - * set __tmp5 __fn0retval 23 jump __label11 equal i __fn0retval 24 set __fn0_n 3 - 25 callrec bank1 __label0 __label13 + 25 callrec bank1 __label0 __label13 __fn0retval 26 label __label13 - * set __tmp6 __fn0retval 27 jump __label11 equal i __fn0retval @@ -277,12 +277,12 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-8 29 label __label11 38 set __fn0_n 6 - 39 callrec bank1 __label0 __label19 + 39 callrec bank1 __label0 __label19 __fn0retval 40 label __label19 - * set __tmp7 __fn0retval 41 jump __label18 lessThan i __fn0retval 42 set __fn0_n 8 - 43 callrec bank1 __label0 __label20 + 43 callrec bank1 __label0 __label20 __fn0retval 44 label __label20 - * set __tmp8 __fn0retval 45 jump __label17 lessThanEq i __fn0retval @@ -303,7 +303,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-8 - * op mul __tmp11 -1 __fn0_n 68 push bank1 __fn0_n 69 op mul __fn0_n -1 __fn0_n - 70 callrec bank1 __label0 __label26 + 70 callrec bank1 __label0 __label26 __fn0retval 71 label __label26 72 pop bank1 __fn0_n - * set __tmp12 __fn0retval @@ -318,7 +318,7 @@ Modifications by Iterated phase, Loop Optimization, pass 1, iteration 1: 11 jump __label5 greaterThan i __tmp2 + 12 label __label27 13 set __fn0_n 1 - 14 callrec bank1 __label0 __label9 + 14 callrec bank1 __label0 __label9 __fn0retval 15 label __label9 60 print __tmp3 @@ -349,17 +349,17 @@ Modifications by Iterated phase, Data Flow Optimization, pass 2, iteration 1: + 11 jump __label5 greaterThan __tmp0 __fn0retval 12 label __label27 13 set __fn0_n 1 - 14 callrec bank1 __label0 __label9 + 14 callrec bank1 __label0 __label9 __fn0retval Modifications by Final phase, Jump Threading, iteration 1: 39 set __fn0_n 6 - 40 callrec bank1 __label0 __label19 + 40 callrec bank1 __label0 __label19 __fn0retval 41 label __label19 - * jump __label18 lessThan i __fn0retval + 42 jump __label16 lessThan i __fn0retval 43 set __fn0_n 8 - 44 callrec bank1 __label0 __label20 + 44 callrec bank1 __label0 __label20 __fn0retval 45 label __label20 Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-3 instructions): @@ -370,7 +370,7 @@ Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-3 inst - * jump __label6 always 37 label __label14 38 set __fn0_n 6 - 39 callrec bank1 __label0 __label19 + 39 callrec bank1 __label0 __label19 __fn0retval 52 jump __label21 notEqual i 10 53 label __label22 @@ -392,7 +392,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-4 instructions): 66 jump __label25 lessThanEq __fn0_n 0 - * push bank1 __fn0_n 67 op mul __fn0_n -1 __fn0_n - 68 callrec bank1 __label0 __label26 + 68 callrec bank1 __label0 __label26 __fn0retval 69 label __label26 - * pop bank1 __fn0_n 70 op mul __fn0retval -1 __fn0retval @@ -403,29 +403,29 @@ Final code before resolving virtual instructions: set __sp 0 set __fn0_n 1 -callrec bank1 __label0 __label1 +callrec bank1 __label0 __label1 __fn0retval label __label1 set __tmp0 __fn0retval set __fn0_n 10 -callrec bank1 __label0 __label2 +callrec bank1 __label0 __label2 __fn0retval label __label2 set __tmp2 __fn0retval set i __tmp0 jump __label5 greaterThan __tmp0 __fn0retval label __label27 set __fn0_n 1 -callrec bank1 __label0 __label9 +callrec bank1 __label0 __label9 __fn0retval label __label9 jump __label7 notEqual i __fn0retval set __tmp3 "A" jump __label6 always 0 0 label __label7 set __fn0_n 2 -callrec bank1 __label0 __label12 +callrec bank1 __label0 __label12 __fn0retval label __label12 jump __label11 equal i __fn0retval set __fn0_n 3 -callrec bank1 __label0 __label13 +callrec bank1 __label0 __label13 __fn0retval label __label13 jump __label11 equal i __fn0retval jump __label10 notEqual i 4 @@ -437,11 +437,11 @@ jump __label14 notEqual i 5 jump __label4 always 0 0 label __label14 set __fn0_n 6 -callrec bank1 __label0 __label19 +callrec bank1 __label0 __label19 __fn0retval label __label19 jump __label16 lessThan i __fn0retval set __fn0_n 8 -callrec bank1 __label0 __label20 +callrec bank1 __label0 __label20 __fn0retval label __label20 jump __label17 lessThanEq i __fn0retval jump __label16 always 0 0 @@ -464,7 +464,7 @@ label __label0 set __fn0retval __fn0_n jump __label25 lessThanEq __fn0_n 0 op mul __fn0_n -1 __fn0_n -callrec bank1 __label0 __label26 +callrec bank1 __label0 __label26 __fn0retval label __label26 op mul __fn0retval -1 __fn0retval label __label25 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/expression-evaluation-runtime.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/expression-evaluation-runtime.log index 0d646e4f5..5c18a353c 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/expression-evaluation-runtime.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/expression-evaluation-runtime.log @@ -8,7 +8,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 instructions): - 1302 call __label0 + 1302 call __label0 __fn0retval 1303 gotolabel __label241 __fn0 1304 set __tmp242 __fn0retval - * op pow __tmp243 a __tmp242 @@ -18,7 +18,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1307 set __fn49_actual a 1308 set __fn49_expected 16 - 1330 call __label0 + 1330 call __label0 __fn0retval 1331 gotolabel __label246 __fn0 1332 set __tmp247 __fn0retval - * op mul __tmp248 a __tmp247 @@ -28,7 +28,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1335 set __fn50_actual a 1336 set __fn50_expected 8 - 1358 call __label0 + 1358 call __label0 __fn0retval 1359 gotolabel __label251 __fn0 1360 set __tmp252 __fn0retval - * op div __tmp253 a __tmp252 @@ -38,7 +38,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1363 set __fn51_actual a 1364 set __fn51_expected 1.5 - 1386 call __label0 + 1386 call __label0 __fn0retval 1387 gotolabel __label256 __fn0 1388 set __tmp257 __fn0retval - * op idiv __tmp258 a __tmp257 @@ -48,7 +48,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1391 set __fn52_actual a 1392 set __fn52_expected 1 - 1414 call __label0 + 1414 call __label0 __fn0retval 1415 gotolabel __label261 __fn0 1416 set __tmp262 __fn0retval - * op mod __tmp263 a __tmp262 @@ -58,7 +58,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1419 set __fn53_actual a 1420 set __fn53_expected 2 - 1442 call __label0 + 1442 call __label0 __fn0retval 1443 gotolabel __label266 __fn0 1444 set __tmp267 __fn0retval - * op add __tmp268 a __tmp267 @@ -68,7 +68,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1447 set __fn54_actual a 1448 set __fn54_expected 6 - 1470 call __label0 + 1470 call __label0 __fn0retval 1471 gotolabel __label271 __fn0 1472 set __tmp272 __fn0retval - * op sub __tmp273 a __tmp272 @@ -78,7 +78,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1475 set __fn55_actual a 1476 set __fn55_expected 2 - 1498 call __label0 + 1498 call __label0 __fn0retval 1499 gotolabel __label276 __fn0 1500 set __tmp277 __fn0retval - * op shl __tmp278 a __tmp277 @@ -88,7 +88,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1503 set __fn56_actual a 1504 set __fn56_expected 4 - 1526 call __label0 + 1526 call __label0 __fn0retval 1527 gotolabel __label281 __fn0 1528 set __tmp282 __fn0retval - * op shr __tmp283 a __tmp282 @@ -98,7 +98,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1531 set __fn57_actual a 1532 set __fn57_expected 2 - 1554 call __label0 + 1554 call __label0 __fn0retval 1555 gotolabel __label286 __fn0 1556 set __tmp287 __fn0retval - * op or __tmp288 a __tmp287 @@ -108,7 +108,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1559 set __fn58_actual a 1560 set __fn58_expected 3 - 1582 call __label0 + 1582 call __label0 __fn0retval 1583 gotolabel __label291 __fn0 1584 set __tmp292 __fn0retval - * op and __tmp293 a __tmp292 @@ -118,7 +118,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1587 set __fn59_actual a 1588 set __fn59_expected 2 - 1610 call __label0 + 1610 call __label0 __fn0retval 1611 gotolabel __label296 __fn0 1612 set __tmp297 __fn0retval - * op xor __tmp298 a __tmp297 @@ -128,7 +128,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1615 set __fn60_actual a 1616 set __fn60_expected 1 - 1638 call __label0 + 1638 call __label0 __fn0retval 1639 gotolabel __label301 __fn0 1640 set __tmp302 __fn0retval - * op land __tmp303 a __tmp302 @@ -138,7 +138,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1643 set __fn61_actual a 1644 set __fn61_expected false - 1666 call __label0 + 1666 call __label0 __fn0retval 1667 gotolabel __label306 __fn0 1668 set __tmp307 __fn0retval - * op land __tmp308 a __tmp307 @@ -148,7 +148,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-15 ins 1671 set __fn62_actual a 1672 set __fn62_expected true - 1694 call __label0 + 1694 call __label0 __fn0retval 1695 gotolabel __label311 __fn0 1696 set __tmp312 __fn0retval - * op or __tmp313 a __tmp312 @@ -2308,7 +2308,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-63 ins Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 instructions): - 2 call __label0 + 2 call __label0 __fn0retval 3 gotolabel __label1 __fn0 4 set __tmp0 __fn0retval - * op add __tmp1 2 __tmp0 @@ -2335,7 +2335,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 21 label __label5 22 label __label3 - 25 call __label0 + 25 call __label0 __fn0retval 26 gotolabel __label6 __fn0 27 set __tmp5 __fn0retval - * op sub __tmp6 7 __tmp5 @@ -2362,7 +2362,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 44 label __label10 45 label __label8 - 48 call __label0 + 48 call __label0 __fn0retval 49 gotolabel __label11 __fn0 50 set __tmp10 __fn0retval - * op mul __tmp11 3 __tmp10 @@ -2389,7 +2389,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 67 label __label15 68 label __label13 - 71 call __label0 + 71 call __label0 __fn0retval 72 gotolabel __label16 __fn0 73 set __tmp15 __fn0retval - * op div __tmp16 6 __tmp15 @@ -2416,7 +2416,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 90 label __label20 91 label __label18 - 94 call __label0 + 94 call __label0 __fn0retval 95 gotolabel __label21 __fn0 96 set __tmp20 __fn0retval - * op div __tmp21 1 __tmp20 @@ -2443,7 +2443,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 113 label __label25 114 label __label23 - 117 call __label0 + 117 call __label0 __fn0retval 118 gotolabel __label26 __fn0 119 set __tmp25 __fn0retval - * op idiv __tmp26 6 __tmp25 @@ -2470,7 +2470,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 136 label __label30 137 label __label28 - 140 call __label0 + 140 call __label0 __fn0retval 141 gotolabel __label31 __fn0 142 set __tmp30 __fn0retval - * op mod __tmp31 6 __tmp30 @@ -2497,7 +2497,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 159 label __label35 160 label __label33 - 163 call __label0 + 163 call __label0 __fn0retval 164 gotolabel __label36 __fn0 165 set __tmp35 __fn0retval - * op pow __tmp36 2 __tmp35 @@ -2524,7 +2524,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 182 label __label40 183 label __label38 - 186 call __label0 + 186 call __label0 __fn0retval 187 gotolabel __label41 __fn0 188 set __tmp40 __fn0retval - * op equal __tmp41 5 __tmp40 @@ -2551,7 +2551,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 205 label __label45 206 label __label43 - 209 call __label0 + 209 call __label0 __fn0retval 210 gotolabel __label46 __fn0 211 set __tmp45 __fn0retval - * op equal __tmp46 5 __tmp45 @@ -2578,7 +2578,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 228 label __label50 229 label __label48 - 232 call __label0 + 232 call __label0 __fn0retval 233 gotolabel __label51 __fn0 234 set __tmp50 __fn0retval - * op equal __tmp51 0 __tmp50 @@ -2605,7 +2605,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 251 label __label55 252 label __label53 - 255 call __label0 + 255 call __label0 __fn0retval 256 gotolabel __label56 __fn0 257 set __tmp55 __fn0retval - * op notEqual __tmp56 5 __tmp55 @@ -2632,7 +2632,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 274 label __label60 275 label __label58 - 278 call __label0 + 278 call __label0 __fn0retval 279 gotolabel __label61 __fn0 280 set __tmp60 __fn0retval - * op notEqual __tmp61 5 __tmp60 @@ -2659,7 +2659,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 297 label __label65 298 label __label63 - 301 call __label0 + 301 call __label0 __fn0retval 302 gotolabel __label66 __fn0 303 set __tmp65 __fn0retval - * op notEqual __tmp66 0 __tmp65 @@ -2686,7 +2686,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 320 label __label70 321 label __label68 - 324 call __label0 + 324 call __label0 __fn0retval 325 gotolabel __label71 __fn0 326 set __tmp70 __fn0retval - * op land __tmp71 1 __tmp70 @@ -2713,7 +2713,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 343 label __label75 344 label __label73 - 347 call __label0 + 347 call __label0 __fn0retval 348 gotolabel __label76 __fn0 349 set __tmp75 __fn0retval - * op land __tmp76 1 __tmp75 @@ -2740,7 +2740,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 366 label __label80 367 label __label78 - 370 call __label0 + 370 call __label0 __fn0retval 371 gotolabel __label81 __fn0 372 set __tmp80 __fn0retval - * op lessThan __tmp81 0 __tmp80 @@ -2767,7 +2767,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 389 label __label85 390 label __label83 - 393 call __label0 + 393 call __label0 __fn0retval 394 gotolabel __label86 __fn0 395 set __tmp85 __fn0retval - * op lessThan __tmp86 1 __tmp85 @@ -2794,7 +2794,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 412 label __label90 413 label __label88 - 416 call __label0 + 416 call __label0 __fn0retval 417 gotolabel __label91 __fn0 418 set __tmp90 __fn0retval - * op lessThanEq __tmp91 1 __tmp90 @@ -2821,7 +2821,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 435 label __label95 436 label __label93 - 439 call __label0 + 439 call __label0 __fn0retval 440 gotolabel __label96 __fn0 441 set __tmp95 __fn0retval - * op lessThanEq __tmp96 1 __tmp95 @@ -2848,7 +2848,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 458 label __label100 459 label __label98 - 462 call __label0 + 462 call __label0 __fn0retval 463 gotolabel __label101 __fn0 464 set __tmp100 __fn0retval - * op greaterThan __tmp101 2 __tmp100 @@ -2875,7 +2875,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 481 label __label105 482 label __label103 - 485 call __label0 + 485 call __label0 __fn0retval 486 gotolabel __label106 __fn0 487 set __tmp105 __fn0retval - * op greaterThan __tmp106 1 __tmp105 @@ -2902,7 +2902,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 504 label __label110 505 label __label108 - 508 call __label0 + 508 call __label0 __fn0retval 509 gotolabel __label111 __fn0 510 set __tmp110 __fn0retval - * op greaterThanEq __tmp111 1 __tmp110 @@ -2929,7 +2929,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 527 label __label115 528 label __label113 - 531 call __label0 + 531 call __label0 __fn0retval 532 gotolabel __label116 __fn0 533 set __tmp115 __fn0retval - * op greaterThanEq __tmp116 1 __tmp115 @@ -2956,7 +2956,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 550 label __label120 551 label __label118 - 554 call __label0 + 554 call __label0 __fn0retval 555 gotolabel __label121 __fn0 556 set __tmp120 __fn0retval - * op strictEqual __tmp121 0 __tmp120 @@ -2983,7 +2983,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 573 label __label125 574 label __label123 - 577 call __label0 + 577 call __label0 __fn0retval 578 gotolabel __label126 __fn0 579 set __tmp125 __fn0retval - * op strictEqual __tmp126 null __tmp125 @@ -3010,7 +3010,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 596 label __label130 597 label __label128 - 600 call __label0 + 600 call __label0 __fn0retval 601 gotolabel __label131 __fn0 602 set __tmp130 __fn0retval - * op shl __tmp131 1 __tmp130 @@ -3037,7 +3037,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 619 label __label135 620 label __label133 - 623 call __label0 + 623 call __label0 __fn0retval 624 gotolabel __label136 __fn0 625 set __tmp135 __fn0retval - * op shr __tmp136 9 __tmp135 @@ -3064,7 +3064,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 642 label __label140 643 label __label138 - 646 call __label0 + 646 call __label0 __fn0retval 647 gotolabel __label141 __fn0 648 set __tmp140 __fn0retval - * op or __tmp141 1 __tmp140 @@ -3091,7 +3091,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 665 label __label145 666 label __label143 - 669 call __label0 + 669 call __label0 __fn0retval 670 gotolabel __label146 __fn0 671 set __tmp145 __fn0retval - * op and __tmp146 3 __tmp145 @@ -3118,7 +3118,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 688 label __label150 689 label __label148 - 692 call __label0 + 692 call __label0 __fn0retval 693 gotolabel __label151 __fn0 694 set __tmp150 __fn0retval - * op xor __tmp151 3 __tmp150 @@ -3145,7 +3145,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 711 label __label155 712 label __label153 - 715 call __label0 + 715 call __label0 __fn0retval 716 gotolabel __label156 __fn0 717 set __tmp155 __fn0retval - * op not __tmp156 __tmp155 @@ -3172,7 +3172,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 734 label __label160 735 label __label158 - 738 call __label0 + 738 call __label0 __fn0retval 739 gotolabel __label161 __fn0 740 set __tmp160 __fn0retval - * op not __tmp161 __tmp160 @@ -3202,7 +3202,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 - * set __fn0_n a + 760 set __fn0_n 0xabcdefabcdefabc 761 setaddr __fn0retaddr __label166 - 762 call __label0 + 762 call __label0 __fn0retval 763 gotolabel __label166 __fn0 764 set __tmp165 __fn0retval - * op not __tmp166 __tmp165 @@ -3234,7 +3234,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 783 label __label170 784 label __label168 - 787 call __label0 + 787 call __label0 __fn0retval 788 gotolabel __label171 __fn0 789 set __tmp172 __fn0retval - * op max __tmp173 2 __tmp172 @@ -3261,7 +3261,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 806 label __label175 807 label __label173 - 810 call __label0 + 810 call __label0 __fn0retval 811 gotolabel __label176 __fn0 812 set __tmp177 __fn0retval - * op min __tmp178 2 __tmp177 @@ -3288,7 +3288,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 829 label __label180 830 label __label178 - 833 call __label0 + 833 call __label0 __fn0retval 834 gotolabel __label181 __fn0 835 set __tmp182 __fn0retval - * op abs __tmp183 __tmp182 @@ -3315,7 +3315,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 852 label __label185 853 label __label183 - 856 call __label0 + 856 call __label0 __fn0retval 857 gotolabel __label186 __fn0 858 set __tmp187 __fn0retval - * op log __tmp188 __tmp187 @@ -3342,7 +3342,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 875 label __label190 876 label __label188 - 879 call __label0 + 879 call __label0 __fn0retval 880 gotolabel __label191 __fn0 881 set __tmp192 __fn0retval - * op log10 __tmp193 __tmp192 @@ -3369,7 +3369,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 898 label __label195 899 label __label193 - 902 call __label0 + 902 call __label0 __fn0retval 903 gotolabel __label196 __fn0 904 set __tmp197 __fn0retval - * op floor __tmp198 __tmp197 @@ -3396,7 +3396,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 921 label __label200 922 label __label198 - 925 call __label0 + 925 call __label0 __fn0retval 926 gotolabel __label201 __fn0 927 set __tmp202 __fn0retval - * op ceil __tmp203 __tmp202 @@ -3423,7 +3423,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 944 label __label205 945 label __label203 - 948 call __label0 + 948 call __label0 __fn0retval 949 gotolabel __label206 __fn0 950 set __tmp207 __fn0retval - * op sqrt __tmp208 __tmp207 @@ -3450,7 +3450,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 967 label __label210 968 label __label208 - 971 call __label0 + 971 call __label0 __fn0retval 972 gotolabel __label211 __fn0 973 set __tmp212 __fn0retval - * op angle __tmp213 1 __tmp212 @@ -3477,7 +3477,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 990 label __label215 991 label __label213 - 994 call __label0 + 994 call __label0 __fn0retval 995 gotolabel __label216 __fn0 996 set __tmp217 __fn0retval - * op angleDiff __tmp218 45 __tmp217 @@ -3504,7 +3504,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1013 label __label220 1014 label __label218 - 1017 call __label0 + 1017 call __label0 __fn0retval 1018 gotolabel __label221 __fn0 1019 set __tmp222 __fn0retval - * op mul __tmp223 -1 __tmp222 @@ -3531,7 +3531,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1036 label __label225 1037 label __label223 - 1040 call __label0 + 1040 call __label0 __fn0retval 1041 gotolabel __label226 __fn0 1042 set __tmp227 __fn0retval - * op equal __tmp228 __tmp227 false @@ -3558,7 +3558,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1059 label __label230 1060 label __label228 - 1063 call __label0 + 1063 call __label0 __fn0retval 1064 gotolabel __label231 __fn0 1065 set __tmp232 __fn0retval - * op equal __tmp233 __tmp232 false @@ -3585,7 +3585,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1082 label __label235 1083 label __label233 - 1086 call __label0 + 1086 call __label0 __fn0retval 1087 gotolabel __label236 __fn0 1088 set __tmp237 __fn0retval - * op equal __tmp238 __tmp237 false @@ -3612,7 +3612,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1105 label __label240 1106 label __label238 - 1110 call __label0 + 1110 call __label0 __fn0retval 1111 gotolabel __label241 __fn0 1112 set __tmp242 __fn0retval - * op pow a a __tmp242 @@ -3639,7 +3639,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1129 label __label245 1130 label __label243 - 1134 call __label0 + 1134 call __label0 __fn0retval 1135 gotolabel __label246 __fn0 1136 set __tmp247 __fn0retval - * op mul a a __tmp247 @@ -3666,7 +3666,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1153 label __label250 1154 label __label248 - 1158 call __label0 + 1158 call __label0 __fn0retval 1159 gotolabel __label251 __fn0 1160 set __tmp252 __fn0retval - * op div a a __tmp252 @@ -3693,7 +3693,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1177 label __label255 1178 label __label253 - 1182 call __label0 + 1182 call __label0 __fn0retval 1183 gotolabel __label256 __fn0 1184 set __tmp257 __fn0retval - * op idiv a a __tmp257 @@ -3720,7 +3720,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1201 label __label260 1202 label __label258 - 1206 call __label0 + 1206 call __label0 __fn0retval 1207 gotolabel __label261 __fn0 1208 set __tmp262 __fn0retval - * op mod a a __tmp262 @@ -3747,7 +3747,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1225 label __label265 1226 label __label263 - 1230 call __label0 + 1230 call __label0 __fn0retval 1231 gotolabel __label266 __fn0 1232 set __tmp267 __fn0retval - * op add a a __tmp267 @@ -3774,7 +3774,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1249 label __label270 1250 label __label268 - 1254 call __label0 + 1254 call __label0 __fn0retval 1255 gotolabel __label271 __fn0 1256 set __tmp272 __fn0retval - * op sub a a __tmp272 @@ -3801,7 +3801,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1273 label __label275 1274 label __label273 - 1278 call __label0 + 1278 call __label0 __fn0retval 1279 gotolabel __label276 __fn0 1280 set __tmp277 __fn0retval - * op shl a a __tmp277 @@ -3828,7 +3828,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1297 label __label280 1298 label __label278 - 1302 call __label0 + 1302 call __label0 __fn0retval 1303 gotolabel __label281 __fn0 1304 set __tmp282 __fn0retval - * op shr a a __tmp282 @@ -3855,7 +3855,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1321 label __label285 1322 label __label283 - 1326 call __label0 + 1326 call __label0 __fn0retval 1327 gotolabel __label286 __fn0 1328 set __tmp287 __fn0retval - * op or a a __tmp287 @@ -3882,7 +3882,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1345 label __label290 1346 label __label288 - 1350 call __label0 + 1350 call __label0 __fn0retval 1351 gotolabel __label291 __fn0 1352 set __tmp292 __fn0retval - * op and a a __tmp292 @@ -3909,7 +3909,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1369 label __label295 1370 label __label293 - 1374 call __label0 + 1374 call __label0 __fn0retval 1375 gotolabel __label296 __fn0 1376 set __tmp297 __fn0retval - * op xor a a __tmp297 @@ -3936,7 +3936,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1393 label __label300 1394 label __label298 - 1398 call __label0 + 1398 call __label0 __fn0retval 1399 gotolabel __label301 __fn0 1400 set __tmp302 __fn0retval - * op land a a __tmp302 @@ -3963,7 +3963,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1417 label __label305 1418 label __label303 - 1422 call __label0 + 1422 call __label0 __fn0retval 1423 gotolabel __label306 __fn0 1424 set __tmp307 __fn0retval - * op land a a __tmp307 @@ -3992,7 +3992,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 1443 set a 0 - * set __fn0_n 2 1444 setaddr __fn0retaddr __label311 - 1445 call __label0 + 1445 call __label0 __fn0retval 1446 gotolabel __label311 __fn0 1447 set __tmp312 __fn0retval - * op or a a __tmp312 @@ -4022,7 +4022,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1 (-1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-270 instructions): 1 setaddr __fn0retaddr __label1 - 2 call __label0 + 2 call __label0 __fn0retval 3 gotolabel __label1 __fn0 - * set __tmp0 __fn0retval 4 op add __tmp1 2 __fn0retval @@ -4035,7 +4035,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 8 jump __label5 always 20 setaddr __fn0retaddr __label6 - 21 call __label0 + 21 call __label0 __fn0retval 22 gotolabel __label6 __fn0 - * set __tmp5 __fn0retval 23 op sub __tmp6 7 __fn0retval @@ -4048,7 +4048,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 27 jump __label10 always 39 setaddr __fn0retaddr __label11 - 40 call __label0 + 40 call __label0 __fn0retval 41 gotolabel __label11 __fn0 - * set __tmp10 __fn0retval 42 op mul __tmp11 3 __fn0retval @@ -4061,7 +4061,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 46 jump __label15 always 58 setaddr __fn0retaddr __label16 - 59 call __label0 + 59 call __label0 __fn0retval 60 gotolabel __label16 __fn0 - * set __tmp15 __fn0retval 61 op div __tmp16 6 __fn0retval @@ -4074,7 +4074,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 65 jump __label20 always 77 setaddr __fn0retaddr __label21 - 78 call __label0 + 78 call __label0 __fn0retval 79 gotolabel __label21 __fn0 - * set __tmp20 __fn0retval 80 op div __tmp21 1 __fn0retval @@ -4087,7 +4087,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 84 jump __label25 always 96 setaddr __fn0retaddr __label26 - 97 call __label0 + 97 call __label0 __fn0retval 98 gotolabel __label26 __fn0 - * set __tmp25 __fn0retval 99 op idiv __tmp26 6 __fn0retval @@ -4100,7 +4100,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 103 jump __label30 always 115 setaddr __fn0retaddr __label31 - 116 call __label0 + 116 call __label0 __fn0retval 117 gotolabel __label31 __fn0 - * set __tmp30 __fn0retval 118 op mod __tmp31 6 __fn0retval @@ -4113,7 +4113,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 122 jump __label35 always 134 setaddr __fn0retaddr __label36 - 135 call __label0 + 135 call __label0 __fn0retval 136 gotolabel __label36 __fn0 - * set __tmp35 __fn0retval 137 op pow __tmp36 2 __fn0retval @@ -4126,7 +4126,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 141 jump __label40 always 153 setaddr __fn0retaddr __label41 - 154 call __label0 + 154 call __label0 __fn0retval 155 gotolabel __label41 __fn0 - * set __tmp40 __fn0retval 156 op equal __tmp41 5 __fn0retval @@ -4139,7 +4139,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 160 jump __label45 always 172 setaddr __fn0retaddr __label46 - 173 call __label0 + 173 call __label0 __fn0retval 174 gotolabel __label46 __fn0 - * set __tmp45 __fn0retval 175 op equal __tmp46 5 __fn0retval @@ -4152,7 +4152,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 179 jump __label50 always 191 setaddr __fn0retaddr __label51 - 192 call __label0 + 192 call __label0 __fn0retval 193 gotolabel __label51 __fn0 - * set __tmp50 __fn0retval 194 op equal __tmp51 0 __fn0retval @@ -4165,7 +4165,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 198 jump __label55 always 210 setaddr __fn0retaddr __label56 - 211 call __label0 + 211 call __label0 __fn0retval 212 gotolabel __label56 __fn0 - * set __tmp55 __fn0retval 213 op notEqual __tmp56 5 __fn0retval @@ -4178,7 +4178,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 217 jump __label60 always 229 setaddr __fn0retaddr __label61 - 230 call __label0 + 230 call __label0 __fn0retval 231 gotolabel __label61 __fn0 - * set __tmp60 __fn0retval 232 op notEqual __tmp61 5 __fn0retval @@ -4191,7 +4191,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 236 jump __label65 always 248 setaddr __fn0retaddr __label66 - 249 call __label0 + 249 call __label0 __fn0retval 250 gotolabel __label66 __fn0 - * set __tmp65 __fn0retval 251 op notEqual __tmp66 0 __fn0retval @@ -4204,7 +4204,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 255 jump __label70 always 267 setaddr __fn0retaddr __label71 - 268 call __label0 + 268 call __label0 __fn0retval 269 gotolabel __label71 __fn0 - * set __tmp70 __fn0retval 270 op land __tmp71 1 __fn0retval @@ -4217,7 +4217,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 274 jump __label75 always 286 setaddr __fn0retaddr __label76 - 287 call __label0 + 287 call __label0 __fn0retval 288 gotolabel __label76 __fn0 - * set __tmp75 __fn0retval 289 op land __tmp76 1 __fn0retval @@ -4230,7 +4230,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 293 jump __label80 always 305 setaddr __fn0retaddr __label81 - 306 call __label0 + 306 call __label0 __fn0retval 307 gotolabel __label81 __fn0 - * set __tmp80 __fn0retval 308 op lessThan __tmp81 0 __fn0retval @@ -4243,7 +4243,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 312 jump __label85 always 324 setaddr __fn0retaddr __label86 - 325 call __label0 + 325 call __label0 __fn0retval 326 gotolabel __label86 __fn0 - * set __tmp85 __fn0retval 327 op lessThan __tmp86 1 __fn0retval @@ -4256,7 +4256,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 331 jump __label90 always 343 setaddr __fn0retaddr __label91 - 344 call __label0 + 344 call __label0 __fn0retval 345 gotolabel __label91 __fn0 - * set __tmp90 __fn0retval 346 op lessThanEq __tmp91 1 __fn0retval @@ -4269,7 +4269,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 350 jump __label95 always 362 setaddr __fn0retaddr __label96 - 363 call __label0 + 363 call __label0 __fn0retval 364 gotolabel __label96 __fn0 - * set __tmp95 __fn0retval 365 op lessThanEq __tmp96 1 __fn0retval @@ -4282,7 +4282,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 369 jump __label100 always 381 setaddr __fn0retaddr __label101 - 382 call __label0 + 382 call __label0 __fn0retval 383 gotolabel __label101 __fn0 - * set __tmp100 __fn0retval 384 op greaterThan __tmp101 2 __fn0retval @@ -4295,7 +4295,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 388 jump __label105 always 400 setaddr __fn0retaddr __label106 - 401 call __label0 + 401 call __label0 __fn0retval 402 gotolabel __label106 __fn0 - * set __tmp105 __fn0retval 403 op greaterThan __tmp106 1 __fn0retval @@ -4308,7 +4308,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 407 jump __label110 always 419 setaddr __fn0retaddr __label111 - 420 call __label0 + 420 call __label0 __fn0retval 421 gotolabel __label111 __fn0 - * set __tmp110 __fn0retval 422 op greaterThanEq __tmp111 1 __fn0retval @@ -4321,7 +4321,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 426 jump __label115 always 438 setaddr __fn0retaddr __label116 - 439 call __label0 + 439 call __label0 __fn0retval 440 gotolabel __label116 __fn0 - * set __tmp115 __fn0retval 441 op greaterThanEq __tmp116 1 __fn0retval @@ -4334,7 +4334,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 445 jump __label120 always 457 setaddr __fn0retaddr __label121 - 458 call __label0 + 458 call __label0 __fn0retval 459 gotolabel __label121 __fn0 - * set __tmp120 __fn0retval 460 op strictEqual __tmp121 0 __fn0retval @@ -4347,7 +4347,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 464 jump __label125 always 476 setaddr __fn0retaddr __label126 - 477 call __label0 + 477 call __label0 __fn0retval 478 gotolabel __label126 __fn0 - * set __tmp125 __fn0retval 479 op strictEqual __tmp126 null __fn0retval @@ -4360,7 +4360,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 483 jump __label130 always 495 setaddr __fn0retaddr __label131 - 496 call __label0 + 496 call __label0 __fn0retval 497 gotolabel __label131 __fn0 - * set __tmp130 __fn0retval 498 op shl __tmp131 1 __fn0retval @@ -4373,7 +4373,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 502 jump __label135 always 514 setaddr __fn0retaddr __label136 - 515 call __label0 + 515 call __label0 __fn0retval 516 gotolabel __label136 __fn0 - * set __tmp135 __fn0retval 517 op shr __tmp136 9 __fn0retval @@ -4386,7 +4386,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 521 jump __label140 always 533 setaddr __fn0retaddr __label141 - 534 call __label0 + 534 call __label0 __fn0retval 535 gotolabel __label141 __fn0 - * set __tmp140 __fn0retval 536 op or __tmp141 1 __fn0retval @@ -4399,7 +4399,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 540 jump __label145 always 552 setaddr __fn0retaddr __label146 - 553 call __label0 + 553 call __label0 __fn0retval 554 gotolabel __label146 __fn0 - * set __tmp145 __fn0retval 555 op and __tmp146 3 __fn0retval @@ -4412,7 +4412,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 559 jump __label150 always 571 setaddr __fn0retaddr __label151 - 572 call __label0 + 572 call __label0 __fn0retval 573 gotolabel __label151 __fn0 - * set __tmp150 __fn0retval 574 op xor __tmp151 3 __fn0retval @@ -4425,7 +4425,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 578 jump __label155 always 590 setaddr __fn0retaddr __label156 - 591 call __label0 + 591 call __label0 __fn0retval 592 gotolabel __label156 __fn0 - * set __tmp155 __fn0retval 593 op not __tmp156 __fn0retval @@ -4438,7 +4438,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 597 jump __label160 always 609 setaddr __fn0retaddr __label161 - 610 call __label0 + 610 call __label0 __fn0retval 611 gotolabel __label161 __fn0 - * set __tmp160 __fn0retval 612 op not __tmp161 __fn0retval @@ -4456,7 +4456,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 0xabcdefabcdefabc 627 set __fn0_n 0xabcdefabcdefabc 628 setaddr __fn0retaddr __label166 - 629 call __label0 + 629 call __label0 __fn0retval 630 gotolabel __label166 __fn0 - * set __tmp165 __fn0retval 631 op not __tmp166 __fn0retval @@ -4481,7 +4481,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 644 print "\n" 648 setaddr __fn0retaddr __label171 - 649 call __label0 + 649 call __label0 __fn0retval 650 gotolabel __label171 __fn0 - * set __tmp172 __fn0retval 651 op max __tmp173 2 __fn0retval @@ -4494,7 +4494,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 655 jump __label175 always 667 setaddr __fn0retaddr __label176 - 668 call __label0 + 668 call __label0 __fn0retval 669 gotolabel __label176 __fn0 - * set __tmp177 __fn0retval 670 op min __tmp178 2 __fn0retval @@ -4507,7 +4507,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 674 jump __label180 always 686 setaddr __fn0retaddr __label181 - 687 call __label0 + 687 call __label0 __fn0retval 688 gotolabel __label181 __fn0 - * set __tmp182 __fn0retval 689 op abs __tmp183 __fn0retval @@ -4520,7 +4520,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 693 jump __label185 always 705 setaddr __fn0retaddr __label186 - 706 call __label0 + 706 call __label0 __fn0retval 707 gotolabel __label186 __fn0 - * set __tmp187 __fn0retval 708 op log __tmp188 __fn0retval @@ -4533,7 +4533,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 712 jump __label190 always 724 setaddr __fn0retaddr __label191 - 725 call __label0 + 725 call __label0 __fn0retval 726 gotolabel __label191 __fn0 - * set __tmp192 __fn0retval 727 op log10 __tmp193 __fn0retval @@ -4546,7 +4546,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 731 jump __label195 always 743 setaddr __fn0retaddr __label196 - 744 call __label0 + 744 call __label0 __fn0retval 745 gotolabel __label196 __fn0 - * set __tmp197 __fn0retval 746 op floor __tmp198 __fn0retval @@ -4559,7 +4559,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 750 jump __label200 always 762 setaddr __fn0retaddr __label201 - 763 call __label0 + 763 call __label0 __fn0retval 764 gotolabel __label201 __fn0 - * set __tmp202 __fn0retval 765 op ceil __tmp203 __fn0retval @@ -4572,7 +4572,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 769 jump __label205 always 781 setaddr __fn0retaddr __label206 - 782 call __label0 + 782 call __label0 __fn0retval 783 gotolabel __label206 __fn0 - * set __tmp207 __fn0retval 784 op sqrt __tmp208 __fn0retval @@ -4585,7 +4585,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 788 jump __label210 always 800 setaddr __fn0retaddr __label211 - 801 call __label0 + 801 call __label0 __fn0retval 802 gotolabel __label211 __fn0 - * set __tmp212 __fn0retval 803 op angle __tmp213 1 __fn0retval @@ -4598,7 +4598,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 807 jump __label215 always 819 setaddr __fn0retaddr __label216 - 820 call __label0 + 820 call __label0 __fn0retval 821 gotolabel __label216 __fn0 - * set __tmp217 __fn0retval 822 op angleDiff __tmp218 45 __fn0retval @@ -4611,7 +4611,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 826 jump __label220 always 838 setaddr __fn0retaddr __label221 - 839 call __label0 + 839 call __label0 __fn0retval 840 gotolabel __label221 __fn0 - * set __tmp222 __fn0retval 841 op mul __tmp223 -1 __fn0retval @@ -4624,7 +4624,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 845 jump __label225 always 857 setaddr __fn0retaddr __label226 - 858 call __label0 + 858 call __label0 __fn0retval 859 gotolabel __label226 __fn0 - * set __tmp227 __fn0retval 860 op equal __tmp228 __fn0retval false @@ -4637,7 +4637,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 864 jump __label230 always 876 setaddr __fn0retaddr __label231 - 877 call __label0 + 877 call __label0 __fn0retval 878 gotolabel __label231 __fn0 - * set __tmp232 __fn0retval 879 op equal __tmp233 __fn0retval false @@ -4650,7 +4650,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 883 jump __label235 always 895 setaddr __fn0retaddr __label236 - 896 call __label0 + 896 call __label0 __fn0retval 897 gotolabel __label236 __fn0 - * set __tmp237 __fn0retval 898 op equal __tmp238 __fn0retval false @@ -4668,7 +4668,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 2 913 set __fn0_n 4 914 setaddr __fn0retaddr __label241 - 915 call __label0 + 915 call __label0 __fn0retval 916 gotolabel __label241 __fn0 - * set __tmp242 __fn0retval 917 op pow a 2 __fn0retval @@ -4686,7 +4686,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 2 932 set __fn0_n 4 933 setaddr __fn0retaddr __label246 - 934 call __label0 + 934 call __label0 __fn0retval 935 gotolabel __label246 __fn0 - * set __tmp247 __fn0retval 936 op mul a 2 __fn0retval @@ -4704,7 +4704,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 6 951 set __fn0_n 4 952 setaddr __fn0retaddr __label251 - 953 call __label0 + 953 call __label0 __fn0retval 954 gotolabel __label251 __fn0 - * set __tmp252 __fn0retval 955 op div a 6 __fn0retval @@ -4722,7 +4722,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 6 970 set __fn0_n 4 971 setaddr __fn0retaddr __label256 - 972 call __label0 + 972 call __label0 __fn0retval 973 gotolabel __label256 __fn0 - * set __tmp257 __fn0retval 974 op idiv a 6 __fn0retval @@ -4740,7 +4740,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 6 989 set __fn0_n 4 990 setaddr __fn0retaddr __label261 - 991 call __label0 + 991 call __label0 __fn0retval 992 gotolabel __label261 __fn0 - * set __tmp262 __fn0retval 993 op mod a 6 __fn0retval @@ -4758,7 +4758,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 4 1008 set __fn0_n 2 1009 setaddr __fn0retaddr __label266 - 1010 call __label0 + 1010 call __label0 __fn0retval 1011 gotolabel __label266 __fn0 - * set __tmp267 __fn0retval 1012 op add a 4 __fn0retval @@ -4776,7 +4776,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 4 1027 set __fn0_n 2 1028 setaddr __fn0retaddr __label271 - 1029 call __label0 + 1029 call __label0 __fn0retval 1030 gotolabel __label271 __fn0 - * set __tmp272 __fn0retval 1031 op sub a 4 __fn0retval @@ -4794,7 +4794,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 1 1046 set __fn0_n 2 1047 setaddr __fn0retaddr __label276 - 1048 call __label0 + 1048 call __label0 __fn0retval 1049 gotolabel __label276 __fn0 - * set __tmp277 __fn0retval 1050 op shl a 1 __fn0retval @@ -4812,7 +4812,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 9 1065 set __fn0_n 2 1066 setaddr __fn0retaddr __label281 - 1067 call __label0 + 1067 call __label0 __fn0retval 1068 gotolabel __label281 __fn0 - * set __tmp282 __fn0retval 1069 op shr a 9 __fn0retval @@ -4830,7 +4830,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 1 1084 set __fn0_n 2 1085 setaddr __fn0retaddr __label286 - 1086 call __label0 + 1086 call __label0 __fn0retval 1087 gotolabel __label286 __fn0 - * set __tmp287 __fn0retval 1088 op or a 1 __fn0retval @@ -4848,7 +4848,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 3 1103 set __fn0_n 2 1104 setaddr __fn0retaddr __label291 - 1105 call __label0 + 1105 call __label0 __fn0retval 1106 gotolabel __label291 __fn0 - * set __tmp292 __fn0retval 1107 op and a 3 __fn0retval @@ -4866,7 +4866,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 3 - * set __fn0_n 2 1122 setaddr __fn0retaddr __label296 - 1123 call __label0 + 1123 call __label0 __fn0retval 1124 gotolabel __label296 __fn0 - * set __tmp297 __fn0retval 1125 op xor a 3 __fn0retval @@ -4884,7 +4884,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 1 1140 set __fn0_n 0 1141 setaddr __fn0retaddr __label301 - 1142 call __label0 + 1142 call __label0 __fn0retval 1143 gotolabel __label301 __fn0 - * set __tmp302 __fn0retval 1144 op land a 1 __fn0retval @@ -4902,7 +4902,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * set a 1 1159 set __fn0_n 2 1160 setaddr __fn0retaddr __label306 - 1161 call __label0 + 1161 call __label0 __fn0retval 1162 gotolabel __label306 __fn0 - * set __tmp307 __fn0retval 1163 op land a 1 __fn0retval @@ -4919,7 +4919,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 1177 label __label308 - * set a 0 1178 setaddr __fn0retaddr __label311 - 1179 call __label0 + 1179 call __label0 __fn0retval 1180 gotolabel __label311 __fn0 - * set __tmp312 __fn0retval 1181 op or a 0 __fn0retval @@ -4933,7 +4933,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-2 instructions): - 629 call __label0 + 629 call __label0 __fn0retval 630 gotolabel __label166 __fn0 631 op not __tmp166 __fn0retval - * op mul __tmp168 -1 773738404492802690 @@ -4946,7 +4946,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 3 (-2 1101 label __label288 - * set __fn0_n 2 1102 setaddr __fn0retaddr __label291 - 1103 call __label0 + 1103 call __label0 __fn0retval 1104 gotolabel __label291 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-1 instructions): @@ -4956,7 +4956,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 4 (-1 1082 label __label283 - * set __fn0_n 2 1083 setaddr __fn0retaddr __label286 - 1084 call __label0 + 1084 call __label0 __fn0retval 1085 gotolabel __label286 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 5 (-1 instructions): @@ -4966,7 +4966,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 5 (-1 1063 label __label278 - * set __fn0_n 2 1064 setaddr __fn0retaddr __label281 - 1065 call __label0 + 1065 call __label0 __fn0retval 1066 gotolabel __label281 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 6 (-1 instructions): @@ -4976,7 +4976,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 6 (-1 1044 label __label273 - * set __fn0_n 2 1045 setaddr __fn0retaddr __label276 - 1046 call __label0 + 1046 call __label0 __fn0retval 1047 gotolabel __label276 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 7 (-1 instructions): @@ -4986,7 +4986,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 7 (-1 1025 label __label268 - * set __fn0_n 2 1026 setaddr __fn0retaddr __label271 - 1027 call __label0 + 1027 call __label0 __fn0retval 1028 gotolabel __label271 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 8 (-1 instructions): @@ -4996,7 +4996,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 8 (-1 987 label __label258 - * set __fn0_n 4 988 setaddr __fn0retaddr __label261 - 989 call __label0 + 989 call __label0 __fn0retval 990 gotolabel __label261 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 9 (-1 instructions): @@ -5006,7 +5006,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 9 (-1 968 label __label253 - * set __fn0_n 4 969 setaddr __fn0retaddr __label256 - 970 call __label0 + 970 call __label0 __fn0retval 971 gotolabel __label256 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 10 (-1 instructions): @@ -5016,7 +5016,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 10 (- 949 label __label248 - * set __fn0_n 4 950 setaddr __fn0retaddr __label251 - 951 call __label0 + 951 call __label0 __fn0retval 952 gotolabel __label251 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 11 (-1 instructions): @@ -5026,7 +5026,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 11 (- 930 label __label243 - * set __fn0_n 4 931 setaddr __fn0retaddr __label246 - 932 call __label0 + 932 call __label0 __fn0retval 933 gotolabel __label246 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 12 (-1 instructions): @@ -5036,7 +5036,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 12 (- 759 label __label198 - * set __fn0_n 2.5 760 setaddr __fn0retaddr __label201 - 761 call __label0 + 761 call __label0 __fn0retval 762 gotolabel __label201 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 13 (-1 instructions): @@ -5046,7 +5046,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 13 (- 664 label __label173 - * set __fn0_n 4 665 setaddr __fn0retaddr __label176 - 666 call __label0 + 666 call __label0 __fn0retval 667 gotolabel __label176 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 14 (-1 instructions): @@ -5056,7 +5056,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 14 (- 569 label __label148 - * set __fn0_n 2 570 setaddr __fn0retaddr __label151 - 571 call __label0 + 571 call __label0 __fn0retval 572 gotolabel __label151 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 15 (-1 instructions): @@ -5066,7 +5066,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 15 (- 550 label __label143 - * set __fn0_n 2 551 setaddr __fn0retaddr __label146 - 552 call __label0 + 552 call __label0 __fn0retval 553 gotolabel __label146 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 16 (-1 instructions): @@ -5076,7 +5076,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 16 (- 531 label __label138 - * set __fn0_n 2 532 setaddr __fn0retaddr __label141 - 533 call __label0 + 533 call __label0 __fn0retval 534 gotolabel __label141 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 17 (-1 instructions): @@ -5086,7 +5086,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 17 (- 512 label __label133 - * set __fn0_n 2 513 setaddr __fn0retaddr __label136 - 514 call __label0 + 514 call __label0 __fn0retval 515 gotolabel __label136 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 18 (-1 instructions): @@ -5096,7 +5096,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 18 (- 474 label __label123 - * set __fn0_n null 475 setaddr __fn0retaddr __label126 - 476 call __label0 + 476 call __label0 __fn0retval 477 gotolabel __label126 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 19 (-1 instructions): @@ -5106,7 +5106,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 19 (- 132 label __label33 - * set __fn0_n 4 133 setaddr __fn0retaddr __label36 - 134 call __label0 + 134 call __label0 __fn0retval 135 gotolabel __label36 __fn0 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 20 (-1 instructions): @@ -5116,7 +5116,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 20 (- 113 label __label28 - * set __fn0_n 4 114 setaddr __fn0retaddr __label31 - 115 call __label0 + 115 call __label0 __fn0retval 116 gotolabel __label31 __fn0 Modifications by Final phase, Unreachable Code Elimination, iteration 1 (-1 instructions): @@ -5130,7 +5130,7 @@ Final code before resolving virtual instructions: set __fn0_n 3 setaddr __fn0retaddr __label1 -call __label0 +call __label0 __fn0retval gotolabel __label1 __fn0 op add __tmp1 2 __fn0retval jump __label4 notEqual __tmp1 5 @@ -5147,7 +5147,7 @@ print "\n" label __label5 set __fn0_n 6 setaddr __fn0retaddr __label6 -call __label0 +call __label0 __fn0retval gotolabel __label6 __fn0 op sub __tmp6 7 __fn0retval jump __label9 notEqual __tmp6 1 @@ -5164,7 +5164,7 @@ print "\n" label __label10 set __fn0_n 2 setaddr __fn0retaddr __label11 -call __label0 +call __label0 __fn0retval gotolabel __label11 __fn0 op mul __tmp11 3 __fn0retval jump __label14 notEqual __tmp11 6 @@ -5181,7 +5181,7 @@ print "\n" label __label15 set __fn0_n 4 setaddr __fn0retaddr __label16 -call __label0 +call __label0 __fn0retval gotolabel __label16 __fn0 op div __tmp16 6 __fn0retval jump __label19 notEqual __tmp16 1.5 @@ -5198,7 +5198,7 @@ print "\n" label __label20 set __fn0_n 100000 setaddr __fn0retaddr __label21 -call __label0 +call __label0 __fn0retval gotolabel __label21 __fn0 op div __tmp21 1 __fn0retval jump __label24 notEqual __tmp21 0.00001 @@ -5215,7 +5215,7 @@ print "\n" label __label25 set __fn0_n 4 setaddr __fn0retaddr __label26 -call __label0 +call __label0 __fn0retval gotolabel __label26 __fn0 op idiv __tmp26 6 __fn0retval jump __label29 notEqual __tmp26 1 @@ -5231,7 +5231,7 @@ print __tmp26 print "\n" label __label30 setaddr __fn0retaddr __label31 -call __label0 +call __label0 __fn0retval gotolabel __label31 __fn0 op mod __tmp31 6 __fn0retval jump __label34 notEqual __tmp31 2 @@ -5247,7 +5247,7 @@ print __tmp31 print "\n" label __label35 setaddr __fn0retaddr __label36 -call __label0 +call __label0 __fn0retval gotolabel __label36 __fn0 op pow __tmp36 2 __fn0retval jump __label39 notEqual __tmp36 16 @@ -5264,7 +5264,7 @@ print "\n" label __label40 set __fn0_n 5 setaddr __fn0retaddr __label41 -call __label0 +call __label0 __fn0retval gotolabel __label41 __fn0 op equal __tmp41 5 __fn0retval jump __label44 notEqual __tmp41 true @@ -5281,7 +5281,7 @@ print "\n" label __label45 set __fn0_n 6 setaddr __fn0retaddr __label46 -call __label0 +call __label0 __fn0retval gotolabel __label46 __fn0 op equal __tmp46 5 __fn0retval jump __label49 notEqual __tmp46 false @@ -5298,7 +5298,7 @@ print "\n" label __label50 set __fn0_n null setaddr __fn0retaddr __label51 -call __label0 +call __label0 __fn0retval gotolabel __label51 __fn0 op equal __tmp51 0 __fn0retval jump __label54 notEqual __tmp51 true @@ -5315,7 +5315,7 @@ print "\n" label __label55 set __fn0_n 5 setaddr __fn0retaddr __label56 -call __label0 +call __label0 __fn0retval gotolabel __label56 __fn0 op notEqual __tmp56 5 __fn0retval jump __label59 notEqual __tmp56 false @@ -5332,7 +5332,7 @@ print "\n" label __label60 set __fn0_n 6 setaddr __fn0retaddr __label61 -call __label0 +call __label0 __fn0retval gotolabel __label61 __fn0 op notEqual __tmp61 5 __fn0retval jump __label64 notEqual __tmp61 true @@ -5349,7 +5349,7 @@ print "\n" label __label65 set __fn0_n null setaddr __fn0retaddr __label66 -call __label0 +call __label0 __fn0retval gotolabel __label66 __fn0 op notEqual __tmp66 0 __fn0retval jump __label69 notEqual __tmp66 false @@ -5366,7 +5366,7 @@ print "\n" label __label70 set __fn0_n 0 setaddr __fn0retaddr __label71 -call __label0 +call __label0 __fn0retval gotolabel __label71 __fn0 op land __tmp71 1 __fn0retval jump __label74 notEqual __tmp71 false @@ -5383,7 +5383,7 @@ print "\n" label __label75 set __fn0_n 2 setaddr __fn0retaddr __label76 -call __label0 +call __label0 __fn0retval gotolabel __label76 __fn0 op land __tmp76 1 __fn0retval jump __label79 notEqual __tmp76 true @@ -5400,7 +5400,7 @@ print "\n" label __label80 set __fn0_n 1 setaddr __fn0retaddr __label81 -call __label0 +call __label0 __fn0retval gotolabel __label81 __fn0 op lessThan __tmp81 0 __fn0retval jump __label84 notEqual __tmp81 true @@ -5417,7 +5417,7 @@ print "\n" label __label85 set __fn0_n 0 setaddr __fn0retaddr __label86 -call __label0 +call __label0 __fn0retval gotolabel __label86 __fn0 op lessThan __tmp86 1 __fn0retval jump __label89 notEqual __tmp86 false @@ -5434,7 +5434,7 @@ print "\n" label __label90 set __fn0_n 1 setaddr __fn0retaddr __label91 -call __label0 +call __label0 __fn0retval gotolabel __label91 __fn0 op lessThanEq __tmp91 1 __fn0retval jump __label94 notEqual __tmp91 true @@ -5451,7 +5451,7 @@ print "\n" label __label95 set __fn0_n 0 setaddr __fn0retaddr __label96 -call __label0 +call __label0 __fn0retval gotolabel __label96 __fn0 op lessThanEq __tmp96 1 __fn0retval jump __label99 notEqual __tmp96 false @@ -5468,7 +5468,7 @@ print "\n" label __label100 set __fn0_n 1 setaddr __fn0retaddr __label101 -call __label0 +call __label0 __fn0retval gotolabel __label101 __fn0 op greaterThan __tmp101 2 __fn0retval jump __label104 notEqual __tmp101 true @@ -5485,7 +5485,7 @@ print "\n" label __label105 set __fn0_n 2 setaddr __fn0retaddr __label106 -call __label0 +call __label0 __fn0retval gotolabel __label106 __fn0 op greaterThan __tmp106 1 __fn0retval jump __label109 notEqual __tmp106 false @@ -5502,7 +5502,7 @@ print "\n" label __label110 set __fn0_n 1 setaddr __fn0retaddr __label111 -call __label0 +call __label0 __fn0retval gotolabel __label111 __fn0 op greaterThanEq __tmp111 1 __fn0retval jump __label114 notEqual __tmp111 true @@ -5519,7 +5519,7 @@ print "\n" label __label115 set __fn0_n 2 setaddr __fn0retaddr __label116 -call __label0 +call __label0 __fn0retval gotolabel __label116 __fn0 op greaterThanEq __tmp116 1 __fn0retval jump __label119 notEqual __tmp116 false @@ -5536,7 +5536,7 @@ print "\n" label __label120 set __fn0_n null setaddr __fn0retaddr __label121 -call __label0 +call __label0 __fn0retval gotolabel __label121 __fn0 op strictEqual __tmp121 0 __fn0retval jump __label124 notEqual __tmp121 false @@ -5552,7 +5552,7 @@ print __tmp121 print "\n" label __label125 setaddr __fn0retaddr __label126 -call __label0 +call __label0 __fn0retval gotolabel __label126 __fn0 op strictEqual __tmp126 null __fn0retval jump __label129 notEqual __tmp126 true @@ -5569,7 +5569,7 @@ print "\n" label __label130 set __fn0_n 2 setaddr __fn0retaddr __label131 -call __label0 +call __label0 __fn0retval gotolabel __label131 __fn0 op shl __tmp131 1 __fn0retval jump __label134 notEqual __tmp131 4 @@ -5585,7 +5585,7 @@ print __tmp131 print "\n" label __label135 setaddr __fn0retaddr __label136 -call __label0 +call __label0 __fn0retval gotolabel __label136 __fn0 op shr __tmp136 9 __fn0retval jump __label139 notEqual __tmp136 2 @@ -5601,7 +5601,7 @@ print __tmp136 print "\n" label __label140 setaddr __fn0retaddr __label141 -call __label0 +call __label0 __fn0retval gotolabel __label141 __fn0 op or __tmp141 1 __fn0retval jump __label144 notEqual __tmp141 3 @@ -5617,7 +5617,7 @@ print __tmp141 print "\n" label __label145 setaddr __fn0retaddr __label146 -call __label0 +call __label0 __fn0retval gotolabel __label146 __fn0 op and __tmp146 3 __fn0retval jump __label149 notEqual __tmp146 2 @@ -5633,7 +5633,7 @@ print __tmp146 print "\n" label __label150 setaddr __fn0retaddr __label151 -call __label0 +call __label0 __fn0retval gotolabel __label151 __fn0 op xor __tmp151 3 __fn0retval jump __label154 notEqual __tmp151 1 @@ -5650,7 +5650,7 @@ print "\n" label __label155 set __fn0_n 0 setaddr __fn0retaddr __label156 -call __label0 +call __label0 __fn0retval gotolabel __label156 __fn0 op not __tmp156 __fn0retval 0 jump __label159 notEqual __tmp156 -1 @@ -5667,7 +5667,7 @@ print "\n" label __label160 set __fn0_n 65535 setaddr __fn0retaddr __label161 -call __label0 +call __label0 __fn0retval gotolabel __label161 __fn0 op not __tmp161 __fn0retval 0 jump __label164 notEqual __tmp161 -65536 @@ -5684,7 +5684,7 @@ print "\n" label __label165 set __fn0_n 0xabcdefabcdefabc setaddr __fn0retaddr __label166 -call __label0 +call __label0 __fn0retval gotolabel __label166 __fn0 op not __tmp166 __fn0retval 0 jump __label169 notEqual __tmp166 -773738404492802690 @@ -5701,7 +5701,7 @@ print "\n" label __label170 set __fn0_n 4 setaddr __fn0retaddr __label171 -call __label0 +call __label0 __fn0retval gotolabel __label171 __fn0 op max __tmp173 2 __fn0retval jump __label174 notEqual __tmp173 4 @@ -5717,7 +5717,7 @@ print __tmp173 print "\n" label __label175 setaddr __fn0retaddr __label176 -call __label0 +call __label0 __fn0retval gotolabel __label176 __fn0 op min __tmp178 2 __fn0retval jump __label179 notEqual __tmp178 2 @@ -5734,7 +5734,7 @@ print "\n" label __label180 set __fn0_n -2 setaddr __fn0retaddr __label181 -call __label0 +call __label0 __fn0retval gotolabel __label181 __fn0 op abs __tmp183 __fn0retval 0 jump __label184 notEqual __tmp183 2 @@ -5751,7 +5751,7 @@ print "\n" label __label185 set __fn0_n 2.718281828459045 setaddr __fn0retaddr __label186 -call __label0 +call __label0 __fn0retval gotolabel __label186 __fn0 op log __tmp188 __fn0retval 0 jump __label189 notEqual __tmp188 1 @@ -5768,7 +5768,7 @@ print "\n" label __label190 set __fn0_n 10 setaddr __fn0retaddr __label191 -call __label0 +call __label0 __fn0retval gotolabel __label191 __fn0 op log10 __tmp193 __fn0retval 0 jump __label194 notEqual __tmp193 1 @@ -5785,7 +5785,7 @@ print "\n" label __label195 set __fn0_n 2.5 setaddr __fn0retaddr __label196 -call __label0 +call __label0 __fn0retval gotolabel __label196 __fn0 op floor __tmp198 __fn0retval 0 jump __label199 notEqual __tmp198 2 @@ -5801,7 +5801,7 @@ print __tmp198 print "\n" label __label200 setaddr __fn0retaddr __label201 -call __label0 +call __label0 __fn0retval gotolabel __label201 __fn0 op ceil __tmp203 __fn0retval 0 jump __label204 notEqual __tmp203 3 @@ -5818,7 +5818,7 @@ print "\n" label __label205 set __fn0_n 16 setaddr __fn0retaddr __label206 -call __label0 +call __label0 __fn0retval gotolabel __label206 __fn0 op sqrt __tmp208 __fn0retval 0 jump __label209 notEqual __tmp208 4 @@ -5835,7 +5835,7 @@ print "\n" label __label210 set __fn0_n 1 setaddr __fn0retaddr __label211 -call __label0 +call __label0 __fn0retval gotolabel __label211 __fn0 op angle __tmp213 1 __fn0retval jump __label214 notEqual __tmp213 45 @@ -5852,7 +5852,7 @@ print "\n" label __label215 set __fn0_n 135 setaddr __fn0retaddr __label216 -call __label0 +call __label0 __fn0retval gotolabel __label216 __fn0 op angleDiff __tmp218 45 __fn0retval jump __label219 notEqual __tmp218 90 @@ -5869,7 +5869,7 @@ print "\n" label __label220 set __fn0_n 8 setaddr __fn0retaddr __label221 -call __label0 +call __label0 __fn0retval gotolabel __label221 __fn0 op mul __tmp223 -1 __fn0retval jump __label224 notEqual __tmp223 -8 @@ -5886,7 +5886,7 @@ print "\n" label __label225 set __fn0_n 0 setaddr __fn0retaddr __label226 -call __label0 +call __label0 __fn0retval gotolabel __label226 __fn0 op equal __tmp228 __fn0retval false jump __label229 notEqual __tmp228 1 @@ -5903,7 +5903,7 @@ print "\n" label __label230 set __fn0_n 1 setaddr __fn0retaddr __label231 -call __label0 +call __label0 __fn0retval gotolabel __label231 __fn0 op equal __tmp233 __fn0retval false jump __label234 notEqual __tmp233 0 @@ -5920,7 +5920,7 @@ print "\n" label __label235 set __fn0_n 2 setaddr __fn0retaddr __label236 -call __label0 +call __label0 __fn0retval gotolabel __label236 __fn0 op equal __tmp238 __fn0retval false jump __label239 notEqual __tmp238 0 @@ -5937,7 +5937,7 @@ print "\n" label __label240 set __fn0_n 4 setaddr __fn0retaddr __label241 -call __label0 +call __label0 __fn0retval gotolabel __label241 __fn0 op pow a 2 __fn0retval jump __label244 notEqual a 16 @@ -5953,7 +5953,7 @@ print a print "\n" label __label245 setaddr __fn0retaddr __label246 -call __label0 +call __label0 __fn0retval gotolabel __label246 __fn0 op mul a 2 __fn0retval jump __label249 notEqual a 8 @@ -5969,7 +5969,7 @@ print a print "\n" label __label250 setaddr __fn0retaddr __label251 -call __label0 +call __label0 __fn0retval gotolabel __label251 __fn0 op div a 6 __fn0retval jump __label254 notEqual a 1.5 @@ -5985,7 +5985,7 @@ print a print "\n" label __label255 setaddr __fn0retaddr __label256 -call __label0 +call __label0 __fn0retval gotolabel __label256 __fn0 op idiv a 6 __fn0retval jump __label259 notEqual a 1 @@ -6001,7 +6001,7 @@ print a print "\n" label __label260 setaddr __fn0retaddr __label261 -call __label0 +call __label0 __fn0retval gotolabel __label261 __fn0 op mod a 6 __fn0retval jump __label264 notEqual a 2 @@ -6018,7 +6018,7 @@ print "\n" label __label265 set __fn0_n 2 setaddr __fn0retaddr __label266 -call __label0 +call __label0 __fn0retval gotolabel __label266 __fn0 op add a 4 __fn0retval jump __label269 notEqual a 6 @@ -6034,7 +6034,7 @@ print a print "\n" label __label270 setaddr __fn0retaddr __label271 -call __label0 +call __label0 __fn0retval gotolabel __label271 __fn0 op sub a 4 __fn0retval jump __label274 notEqual a 2 @@ -6050,7 +6050,7 @@ print a print "\n" label __label275 setaddr __fn0retaddr __label276 -call __label0 +call __label0 __fn0retval gotolabel __label276 __fn0 op shl a 1 __fn0retval jump __label279 notEqual a 4 @@ -6066,7 +6066,7 @@ print a print "\n" label __label280 setaddr __fn0retaddr __label281 -call __label0 +call __label0 __fn0retval gotolabel __label281 __fn0 op shr a 9 __fn0retval jump __label284 notEqual a 2 @@ -6082,7 +6082,7 @@ print a print "\n" label __label285 setaddr __fn0retaddr __label286 -call __label0 +call __label0 __fn0retval gotolabel __label286 __fn0 op or a 1 __fn0retval jump __label289 notEqual a 3 @@ -6098,7 +6098,7 @@ print a print "\n" label __label290 setaddr __fn0retaddr __label291 -call __label0 +call __label0 __fn0retval gotolabel __label291 __fn0 op and a 3 __fn0retval jump __label294 notEqual a 2 @@ -6114,7 +6114,7 @@ print a print "\n" label __label295 setaddr __fn0retaddr __label296 -call __label0 +call __label0 __fn0retval gotolabel __label296 __fn0 op xor a 3 __fn0retval jump __label299 notEqual a 1 @@ -6131,7 +6131,7 @@ print "\n" label __label300 set __fn0_n 0 setaddr __fn0retaddr __label301 -call __label0 +call __label0 __fn0retval gotolabel __label301 __fn0 op land a 1 __fn0retval jump __label304 notEqual a false @@ -6148,7 +6148,7 @@ print "\n" label __label305 set __fn0_n 2 setaddr __fn0retaddr __label306 -call __label0 +call __label0 __fn0retval gotolabel __label306 __fn0 op land a 1 __fn0retval jump __label309 notEqual a true @@ -6164,7 +6164,7 @@ print a print "\n" label __label310 setaddr __fn0retaddr __label311 -call __label0 +call __label0 __fn0retval gotolabel __label311 __fn0 op or a 0 __fn0retval jump __label314 notEqual a 2 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/for-each-loop-break-continue.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/for-each-loop-break-continue.log index 569de3041..3e4edd770 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/for-each-loop-break-continue.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/for-each-loop-break-continue.log @@ -18,7 +18,7 @@ Pass 1: speed optimization selection (cost limit 936): Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-4 instructions): 6 set __fn0_n 2 - 7 callrec bank1 __label0 __label6 + 7 callrec bank1 __label0 __label6 __fn0retval 8 label __label6 - * set __tmp1 __fn0retval - * set i __tmp1 @@ -28,7 +28,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-4 inst 12 setaddr __tmp0 __label7 17 set __fn0_n 5 - 18 callrec bank1 __label0 __label9 + 18 callrec bank1 __label0 __label9 __fn0retval 19 label __label9 - * set __tmp2 __fn0retval - * set i __tmp2 @@ -38,7 +38,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-4 inst 23 setaddr __tmp0 __label10 28 set __fn0_n 12 - 29 callrec bank1 __label0 __label12 + 29 callrec bank1 __label0 __label12 __fn0retval 30 label __label12 - * set __tmp3 __fn0retval - * set i __tmp3 @@ -83,7 +83,7 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-4 instructi Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-3 instructions): - 38 callrec bank1 __label0 __label14 + 38 callrec bank1 __label0 __label14 __fn0retval 39 label __label14 40 set __tmp4 __fn0retval - * op equal __tmp5 __tmp4 3 @@ -93,7 +93,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-3 inst 43 jump __label16 always 44 label __label15 - 48 callrec bank1 __label0 __label17 + 48 callrec bank1 __label0 __label17 __fn0retval 49 label __label17 50 set __tmp7 __fn0retval - * op equal __tmp8 __tmp7 12 @@ -159,7 +159,7 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - 38 callrec bank1 __label0 __label14 + 38 callrec bank1 __label0 __label14 __fn0retval 39 label __label14 40 set __tmp4 __fn0retval - * jump __label15 notEqual __tmp4 3 @@ -168,7 +168,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 43 label __label15 44 label __label16 - 47 callrec bank1 __label0 __label17 + 47 callrec bank1 __label0 __label17 __fn0retval 48 label __label17 49 set __tmp7 __fn0retval - * jump __label18 notEqual __tmp7 12 @@ -182,7 +182,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 63 push bank1 __fn0_n - * set __fn0_n __tmp12 + 64 op mul __fn0_n -1 __fn0_n - 65 callrec bank1 __label0 __label23 + 65 callrec bank1 __label0 __label23 __fn0retval 66 label __label23 67 pop bank1 __fn0_n 68 set __tmp13 __fn0retval @@ -195,7 +195,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 instructions): 37 set __fn0_n i - 38 callrec bank1 __label0 __label14 + 38 callrec bank1 __label0 __label14 __fn0retval 39 label __label14 - * set __tmp4 __fn0retval 40 jump __label15 notEqual __fn0retval 3 @@ -203,7 +203,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 42 label __label15 45 set __fn0_n i - 46 callrec bank1 __label0 __label17 + 46 callrec bank1 __label0 __label17 __fn0retval 47 label __label17 - * set __tmp7 __fn0retval 48 jump __label18 notEqual __fn0retval 12 @@ -216,7 +216,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 - * op mul __tmp12 -1 __fn0_n 60 push bank1 __fn0_n 61 op mul __fn0_n -1 __fn0_n - 62 callrec bank1 __label0 __label23 + 62 callrec bank1 __label0 __label23 __fn0retval 63 label __label23 64 pop bank1 __fn0_n - * set __tmp13 __fn0retval @@ -232,7 +232,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio - * gotolabel __label4 marker0 - * setaddr __tmp0 __label5 - * set __fn0_n 2 -- * callrec bank1 __label0 __label6 +- * callrec bank1 __label0 __label6 __fn0retval - * label __label6 - * set i __fn0retval - * jump __label2 always @@ -243,7 +243,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio - * gotolabel __label7 marker0 - * setaddr __tmp0 __label8 - * set __fn0_n 5 -- * callrec bank1 __label0 __label9 +- * callrec bank1 __label0 __label9 __fn0retval - * label __label9 - * set i __fn0retval - * jump __label2 always @@ -254,7 +254,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio - * gotolabel __label10 marker0 - * setaddr __tmp0 __label11 - * set __fn0_n 12 -- * callrec bank1 __label0 __label12 +- * callrec bank1 __label0 __label12 __fn0retval - * label __label12 - * set i __fn0retval - * jump __label2 always @@ -263,7 +263,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio - * set i 15 - * label __label2 - * set __fn0_n i -- * callrec bank1 __label0 __label14 +- * callrec bank1 __label0 __label14 __fn0retval - * label __label14 - * jump __label15 notEqual __fn0retval 3 - * jump __label1 always @@ -271,7 +271,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio - * label __label16 - * print i - * set __fn0_n i -- * callrec bank1 __label0 __label17 +- * callrec bank1 __label0 __label17 __fn0retval - * label __label17 - * jump __label18 notEqual __fn0retval 12 - * jump __label3 always @@ -284,7 +284,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 1 set i 1 + 2 label __label24 + 3 set __fn0_n i -+ 4 callrec bank1 __label0 __label25 ++ 4 callrec bank1 __label0 __label25 __fn0retval + 5 label __label25 + 6 jump __label26 notEqual __fn0retval 3 + 7 jump __label31 always @@ -292,7 +292,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 9 label __label27 + 10 print i + 11 set __fn0_n i -+ 12 callrec bank1 __label0 __label28 ++ 12 callrec bank1 __label0 __label28 __fn0retval + 13 label __label28 + 14 jump __label29 notEqual __fn0retval 12 + 15 jump __label3 always @@ -300,12 +300,12 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 17 label __label30 + 18 label __label31 + 19 set __fn0_n 2 -+ 20 callrec bank1 __label0 __label32 ++ 20 callrec bank1 __label0 __label32 __fn0retval + 21 label __label32 + 22 set i __fn0retval + 23 label __label33 + 24 set __fn0_n i -+ 25 callrec bank1 __label0 __label34 ++ 25 callrec bank1 __label0 __label34 __fn0retval + 26 label __label34 + 27 jump __label35 notEqual __fn0retval 3 + 28 jump __label40 always @@ -313,7 +313,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 30 label __label36 + 31 print i + 32 set __fn0_n i -+ 33 callrec bank1 __label0 __label37 ++ 33 callrec bank1 __label0 __label37 __fn0retval + 34 label __label37 + 35 jump __label38 notEqual __fn0retval 12 + 36 jump __label3 always @@ -323,7 +323,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 40 set i 3 + 41 label __label41 + 42 set __fn0_n i -+ 43 callrec bank1 __label0 __label42 ++ 43 callrec bank1 __label0 __label42 __fn0retval + 44 label __label42 + 45 jump __label43 notEqual __fn0retval 3 + 46 jump __label48 always @@ -331,7 +331,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 48 label __label44 + 49 print i + 50 set __fn0_n i -+ 51 callrec bank1 __label0 __label45 ++ 51 callrec bank1 __label0 __label45 __fn0retval + 52 label __label45 + 53 jump __label46 notEqual __fn0retval 12 + 54 jump __label3 always @@ -339,12 +339,12 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 56 label __label47 + 57 label __label48 + 58 set __fn0_n 5 -+ 59 callrec bank1 __label0 __label49 ++ 59 callrec bank1 __label0 __label49 __fn0retval + 60 label __label49 + 61 set i __fn0retval + 62 label __label50 + 63 set __fn0_n i -+ 64 callrec bank1 __label0 __label51 ++ 64 callrec bank1 __label0 __label51 __fn0retval + 65 label __label51 + 66 jump __label52 notEqual __fn0retval 3 + 67 jump __label57 always @@ -352,7 +352,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 69 label __label53 + 70 print i + 71 set __fn0_n i -+ 72 callrec bank1 __label0 __label54 ++ 72 callrec bank1 __label0 __label54 __fn0retval + 73 label __label54 + 74 jump __label55 notEqual __fn0retval 12 + 75 jump __label3 always @@ -362,7 +362,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 79 set i 8 + 80 label __label58 + 81 set __fn0_n i -+ 82 callrec bank1 __label0 __label59 ++ 82 callrec bank1 __label0 __label59 __fn0retval + 83 label __label59 + 84 jump __label60 notEqual __fn0retval 3 + 85 jump __label65 always @@ -370,7 +370,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 87 label __label61 + 88 print i + 89 set __fn0_n i -+ 90 callrec bank1 __label0 __label62 ++ 90 callrec bank1 __label0 __label62 __fn0retval + 91 label __label62 + 92 jump __label63 notEqual __fn0retval 12 + 93 jump __label3 always @@ -378,12 +378,12 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 95 label __label64 + 96 label __label65 + 97 set __fn0_n 12 -+ 98 callrec bank1 __label0 __label66 ++ 98 callrec bank1 __label0 __label66 __fn0retval + 99 label __label66 + 100 set i __fn0retval + 101 label __label67 + 102 set __fn0_n i -+ 103 callrec bank1 __label0 __label68 ++ 103 callrec bank1 __label0 __label68 __fn0retval + 104 label __label68 + 105 jump __label69 notEqual __fn0retval 3 + 106 jump __label74 always @@ -391,7 +391,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 108 label __label70 + 109 print i + 110 set __fn0_n i -+ 111 callrec bank1 __label0 __label71 ++ 111 callrec bank1 __label0 __label71 __fn0retval + 112 label __label71 + 113 jump __label72 notEqual __fn0retval 12 + 114 jump __label3 always @@ -401,7 +401,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 118 set i 15 + 119 label __label75 + 120 set __fn0_n i -+ 121 callrec bank1 __label0 __label76 ++ 121 callrec bank1 __label0 __label76 __fn0retval + 122 label __label76 + 123 jump __label77 notEqual __fn0retval 3 + 124 jump __label82 always @@ -409,7 +409,7 @@ Modifications by Loop Unrolling: unroll iteration loop at line 3 (+64 instructio + 126 label __label78 + 127 print i + 128 set __fn0_n i -+ 129 callrec bank1 __label0 __label79 ++ 129 callrec bank1 __label0 __label79 __fn0retval + 130 label __label79 + 131 jump __label80 notEqual __fn0retval 12 + 132 jump __label3 always @@ -427,7 +427,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 2 label __label24 - * set __fn0_n i + 3 set __fn0_n 1 - 4 callrec bank1 __label0 __label25 + 4 callrec bank1 __label0 __label25 __fn0retval 5 label __label25 6 jump __label26 notEqual __fn0retval 3 7 jump __label31 always @@ -437,7 +437,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * set __fn0_n i + 10 print 1 + 11 set __fn0_n 1 - 12 callrec bank1 __label0 __label28 + 12 callrec bank1 __label0 __label28 __fn0retval 13 label __label28 14 jump __label29 notEqual __fn0retval 12 @@ -446,7 +446,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 23 label __label33 - * set __fn0_n i + 24 set __fn0_n __fn0retval - 25 callrec bank1 __label0 __label34 + 25 callrec bank1 __label0 __label34 __fn0retval 26 label __label34 27 jump __label35 notEqual __fn0retval 3 @@ -455,7 +455,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 41 label __label41 - * set __fn0_n i + 42 set __fn0_n 3 - 43 callrec bank1 __label0 __label42 + 43 callrec bank1 __label0 __label42 __fn0retval 44 label __label42 45 jump __label43 notEqual __fn0retval 3 46 jump __label48 always @@ -465,7 +465,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * set __fn0_n i + 49 print 3 + 50 set __fn0_n 3 - 51 callrec bank1 __label0 __label45 + 51 callrec bank1 __label0 __label45 __fn0retval 52 label __label45 53 jump __label46 notEqual __fn0retval 12 @@ -474,7 +474,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 62 label __label50 - * set __fn0_n i + 63 set __fn0_n __fn0retval - 64 callrec bank1 __label0 __label51 + 64 callrec bank1 __label0 __label51 __fn0retval 65 label __label51 66 jump __label52 notEqual __fn0retval 3 @@ -483,7 +483,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 80 label __label58 - * set __fn0_n i + 81 set __fn0_n 8 - 82 callrec bank1 __label0 __label59 + 82 callrec bank1 __label0 __label59 __fn0retval 83 label __label59 84 jump __label60 notEqual __fn0retval 3 85 jump __label65 always @@ -493,7 +493,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * set __fn0_n i + 88 print 8 + 89 set __fn0_n 8 - 90 callrec bank1 __label0 __label62 + 90 callrec bank1 __label0 __label62 __fn0retval 91 label __label62 92 jump __label63 notEqual __fn0retval 12 @@ -502,7 +502,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 101 label __label67 - * set __fn0_n i + 102 set __fn0_n __fn0retval - 103 callrec bank1 __label0 __label68 + 103 callrec bank1 __label0 __label68 __fn0retval 104 label __label68 105 jump __label69 notEqual __fn0retval 3 @@ -511,7 +511,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 119 label __label75 - * set __fn0_n i + 120 set __fn0_n 15 - 121 callrec bank1 __label0 __label76 + 121 callrec bank1 __label0 __label76 __fn0retval 122 label __label76 123 jump __label77 notEqual __fn0retval 3 124 jump __label82 always @@ -521,7 +521,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * set __fn0_n i + 127 print 15 + 128 set __fn0_n 15 - 129 callrec bank1 __label0 __label79 + 129 callrec bank1 __label0 __label79 __fn0retval 130 label __label79 131 jump __label80 notEqual __fn0retval 12 @@ -530,7 +530,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 - * set i 1 1 label __label24 2 set __fn0_n 1 - 3 callrec bank1 __label0 __label25 + 3 callrec bank1 __label0 __label25 __fn0retval 36 label __label38 37 label __label39 @@ -538,7 +538,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 - * set i 3 39 label __label41 40 set __fn0_n 3 - 41 callrec bank1 __label0 __label42 + 41 callrec bank1 __label0 __label42 __fn0retval 74 label __label55 75 label __label56 @@ -546,7 +546,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 - * set i 8 77 label __label58 78 set __fn0_n 8 - 79 callrec bank1 __label0 __label59 + 79 callrec bank1 __label0 __label59 __fn0retval 112 label __label72 113 label __label73 @@ -554,11 +554,11 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 - * set i 15 115 label __label75 116 set __fn0_n 15 - 117 callrec bank1 __label0 __label76 + 117 callrec bank1 __label0 __label76 __fn0retval Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (-2 instructions): - 125 callrec bank1 __label0 __label79 + 125 callrec bank1 __label0 __label79 __fn0retval 126 label __label79 127 jump __label80 notEqual __fn0retval 12 - * jump __label3 always @@ -577,7 +577,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (- Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 2 (-1 instructions): 124 set __fn0_n 15 - 125 callrec bank1 __label0 __label79 + 125 callrec bank1 __label0 __label79 __fn0retval 126 label __label79 - * jump __label80 notEqual __fn0retval 12 127 label __label80 @@ -587,7 +587,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 2 (- Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions): 2 set __fn0_n 1 - 3 callrec bank1 __label0 __label25 + 3 callrec bank1 __label0 __label25 __fn0retval 4 label __label25 - * jump __label26 notEqual __fn0retval 3 - * jump __label31 always @@ -596,7 +596,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 7 label __label27 8 print 1 9 set __fn0_n 1 - 10 callrec bank1 __label0 __label28 + 10 callrec bank1 __label0 __label28 __fn0retval 11 label __label28 - * jump __label29 notEqual __fn0retval 12 - * jump __label3 always @@ -606,7 +606,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 15 label __label31 21 set __fn0_n __fn0retval - 22 callrec bank1 __label0 __label34 + 22 callrec bank1 __label0 __label34 __fn0retval 23 label __label34 - * jump __label35 notEqual __fn0retval 3 - * jump __label40 always @@ -615,7 +615,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 26 label __label36 27 print i 28 set __fn0_n i - 29 callrec bank1 __label0 __label37 + 29 callrec bank1 __label0 __label37 __fn0retval 30 label __label37 - * jump __label38 notEqual __fn0retval 12 - * jump __label3 always @@ -625,7 +625,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 34 label __label40 36 set __fn0_n 3 - 37 callrec bank1 __label0 __label42 + 37 callrec bank1 __label0 __label42 __fn0retval 38 label __label42 - * jump __label43 notEqual __fn0retval 3 - * jump __label48 always @@ -634,7 +634,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 41 label __label44 42 print 3 43 set __fn0_n 3 - 44 callrec bank1 __label0 __label45 + 44 callrec bank1 __label0 __label45 __fn0retval 45 label __label45 - * jump __label46 notEqual __fn0retval 12 - * jump __label3 always @@ -644,7 +644,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 49 label __label48 55 set __fn0_n __fn0retval - 56 callrec bank1 __label0 __label51 + 56 callrec bank1 __label0 __label51 __fn0retval 57 label __label51 - * jump __label52 notEqual __fn0retval 3 - * jump __label57 always @@ -653,7 +653,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 60 label __label53 61 print i 62 set __fn0_n i - 63 callrec bank1 __label0 __label54 + 63 callrec bank1 __label0 __label54 __fn0retval 64 label __label54 - * jump __label55 notEqual __fn0retval 12 - * jump __label3 always @@ -663,7 +663,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 68 label __label57 70 set __fn0_n 8 - 71 callrec bank1 __label0 __label59 + 71 callrec bank1 __label0 __label59 __fn0retval 72 label __label59 - * jump __label60 notEqual __fn0retval 3 - * jump __label65 always @@ -672,7 +672,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 75 label __label61 76 print 8 77 set __fn0_n 8 - 78 callrec bank1 __label0 __label62 + 78 callrec bank1 __label0 __label62 __fn0retval 79 label __label62 - * jump __label63 notEqual __fn0retval 12 - * jump __label3 always @@ -682,7 +682,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 83 label __label65 89 set __fn0_n __fn0retval - 90 callrec bank1 __label0 __label68 + 90 callrec bank1 __label0 __label68 __fn0retval 91 label __label68 - * jump __label69 notEqual __fn0retval 3 - * jump __label74 always @@ -691,7 +691,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 94 label __label70 95 print i 96 set __fn0_n i - 97 callrec bank1 __label0 __label71 + 97 callrec bank1 __label0 __label71 __fn0retval 98 label __label71 - * jump __label72 notEqual __fn0retval 12 - * jump __label3 always @@ -701,7 +701,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-13 instructions) 102 label __label74 104 set __fn0_n 15 - 105 callrec bank1 __label0 __label76 + 105 callrec bank1 __label0 __label76 __fn0retval 106 label __label76 - * jump __label77 notEqual __fn0retval 3 - * jump __label82 always @@ -724,7 +724,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-4 instructions): 121 jump __label22 lessThanEq __fn0_n 0 - * push bank1 __fn0_n 122 op mul __fn0_n -1 __fn0_n - 123 callrec bank1 __label0 __label23 + 123 callrec bank1 __label0 __label23 __fn0retval 124 label __label23 - * pop bank1 __fn0_n 125 op mul __fn0retval -1 __fn0retval @@ -735,84 +735,84 @@ Final code before resolving virtual instructions: set __sp 0 set __fn0_n 1 -callrec bank1 __label0 __label25 +callrec bank1 __label0 __label25 __fn0retval label __label25 jump __label31 equal __fn0retval 3 print 1 set __fn0_n 1 -callrec bank1 __label0 __label28 +callrec bank1 __label0 __label28 __fn0retval label __label28 jump __label3 equal __fn0retval 12 label __label31 set __fn0_n 2 -callrec bank1 __label0 __label32 +callrec bank1 __label0 __label32 __fn0retval label __label32 set i __fn0retval set __fn0_n __fn0retval -callrec bank1 __label0 __label34 +callrec bank1 __label0 __label34 __fn0retval label __label34 jump __label40 equal __fn0retval 3 print i set __fn0_n i -callrec bank1 __label0 __label37 +callrec bank1 __label0 __label37 __fn0retval label __label37 jump __label3 equal __fn0retval 12 label __label40 set __fn0_n 3 -callrec bank1 __label0 __label42 +callrec bank1 __label0 __label42 __fn0retval label __label42 jump __label48 equal __fn0retval 3 print 3 set __fn0_n 3 -callrec bank1 __label0 __label45 +callrec bank1 __label0 __label45 __fn0retval label __label45 jump __label3 equal __fn0retval 12 label __label48 set __fn0_n 5 -callrec bank1 __label0 __label49 +callrec bank1 __label0 __label49 __fn0retval label __label49 set i __fn0retval set __fn0_n __fn0retval -callrec bank1 __label0 __label51 +callrec bank1 __label0 __label51 __fn0retval label __label51 jump __label57 equal __fn0retval 3 print i set __fn0_n i -callrec bank1 __label0 __label54 +callrec bank1 __label0 __label54 __fn0retval label __label54 jump __label3 equal __fn0retval 12 label __label57 set __fn0_n 8 -callrec bank1 __label0 __label59 +callrec bank1 __label0 __label59 __fn0retval label __label59 jump __label65 equal __fn0retval 3 print 8 set __fn0_n 8 -callrec bank1 __label0 __label62 +callrec bank1 __label0 __label62 __fn0retval label __label62 jump __label3 equal __fn0retval 12 label __label65 set __fn0_n 12 -callrec bank1 __label0 __label66 +callrec bank1 __label0 __label66 __fn0retval label __label66 set i __fn0retval set __fn0_n __fn0retval -callrec bank1 __label0 __label68 +callrec bank1 __label0 __label68 __fn0retval label __label68 jump __label74 equal __fn0retval 3 print i set __fn0_n i -callrec bank1 __label0 __label71 +callrec bank1 __label0 __label71 __fn0retval label __label71 jump __label3 equal __fn0retval 12 label __label74 set __fn0_n 15 -callrec bank1 __label0 __label76 +callrec bank1 __label0 __label76 __fn0retval label __label76 jump __label82 equal __fn0retval 3 print 15 set __fn0_n 15 -callrec bank1 __label0 __label79 +callrec bank1 __label0 __label79 __fn0retval label __label79 label __label82 label __label3 @@ -821,7 +821,7 @@ label __label0 set __fn0retval __fn0_n jump __label22 lessThanEq __fn0_n 0 op mul __fn0_n -1 __fn0_n -callrec bank1 __label0 __label23 +callrec bank1 __label0 __label23 __fn0retval label __label23 op mul __fn0retval -1 __fn0retval label __label22 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/function-inlining.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/function-inlining.log index e7b8d7ccd..1cc9bf80f 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/function-inlining.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/function-inlining.log @@ -65,28 +65,28 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-7 inst - * set __fn1_n __tmp4 + 22 op add __fn1_n 10 __fn0_s 23 setaddr __fn1retaddr __label7 - 24 call __label1 + 24 call __label1 __fn1retval 25 gotolabel __label7 __fn1 26 set __tmp5 __fn1retval - * op add __tmp6 20 __fn0_s - * set __fn1_n __tmp6 + 27 op add __fn1_n 20 __fn0_s 28 setaddr __fn1retaddr __label8 - 29 call __label1 + 29 call __label1 __fn1retval 30 gotolabel __label8 __fn1 31 set __tmp7 __fn1retval - * op add __tmp8 30 __fn0_s - * set __fn1_n __tmp8 + 32 op add __fn1_n 30 __fn0_s 33 setaddr __fn1retaddr __label9 - 34 call __label1 + 34 call __label1 __fn1retval 35 gotolabel __label9 __fn1 36 set __tmp9 __fn1retval - * op add __tmp10 40 __fn0_s - * set __fn1_n __tmp10 + 37 op add __fn1_n 40 __fn0_s 38 setaddr __fn1retaddr __label10 - 39 call __label1 + 39 call __label1 __fn1retval 40 gotolabel __label10 __fn1 - * set __tmp11 __fn1retval - * set __fn0retval __tmp11 @@ -113,49 +113,49 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-7 inst Modifications by Initial phase, Dead Code Elimination, iteration 1 (-7 instructions): 1 setaddr __fn0retaddr __label2 - 2 call __label0 + 2 call __label0 __fn0retval 3 gotolabel __label2 __fn0 - * set __tmp0 __fn0retval 4 set __fn0_s 2 5 setaddr __fn0retaddr __label3 - 6 call __label0 + 6 call __label0 __fn0retval 7 gotolabel __label3 __fn0 - * set __tmp1 __fn0retval 8 set __fn0_s 3 9 setaddr __fn0retaddr __label4 - 10 call __label0 + 10 call __label0 __fn0retval 11 gotolabel __label4 __fn0 - * set __tmp2 __fn0retval 12 set __fn0_s 4 13 setaddr __fn0retaddr __label5 - 14 call __label0 + 14 call __label0 __fn0retval 15 gotolabel __label5 __fn0 - * set __tmp3 __fn0retval 16 end 17 label __label0 18 op add __fn1_n 10 __fn0_s 19 setaddr __fn1retaddr __label7 - 20 call __label1 + 20 call __label1 __fn1retval 21 gotolabel __label7 __fn1 - * set __tmp5 __fn1retval 22 op add __fn1_n 20 __fn0_s 23 setaddr __fn1retaddr __label8 - 24 call __label1 + 24 call __label1 __fn1retval 25 gotolabel __label8 __fn1 - * set __tmp7 __fn1retval 26 op add __fn1_n 30 __fn0_s 27 setaddr __fn1retaddr __label9 - 28 call __label1 + 28 call __label1 __fn1retval 29 gotolabel __label9 __fn1 - * set __tmp9 __fn1retval 30 op add __fn1_n 40 __fn0_s 31 setaddr __fn1retaddr __label10 - 32 call __label1 + 32 call __label1 __fn1retval Modifications by Initial phase, Dead Code Elimination, iteration 2 (-1 instructions): 31 setaddr __fn1retaddr __label10 - 32 call __label1 + 32 call __label1 __fn1retval 33 gotolabel __label10 __fn1 - * set __fn0retval __fn1retval 34 label __label6 @@ -899,109 +899,109 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-5 Modifications by Function Inlining: inline function bar (+26 instructions): 0 set __fn0_s 1 - * setaddr __fn0retaddr __label2 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label2 __fn0 + 1 label __label117 + 2 op add __fn1_n 10 __fn0_s + 3 setaddr __fn1retaddr __label118 -+ 4 call __label1 ++ 4 call __label1 __fn1retval + 5 gotolabel __label118 __fn1 + 6 op add __fn1_n 20 __fn0_s + 7 setaddr __fn1retaddr __label119 -+ 8 call __label1 ++ 8 call __label1 __fn1retval + 9 gotolabel __label119 __fn1 + 10 op add __fn1_n 30 __fn0_s + 11 setaddr __fn1retaddr __label120 -+ 12 call __label1 ++ 12 call __label1 __fn1retval + 13 gotolabel __label120 __fn1 + 14 op add __fn1_n 40 __fn0_s + 15 setaddr __fn1retaddr __label121 -+ 16 call __label1 ++ 16 call __label1 __fn1retval + 17 gotolabel __label121 __fn1 + 18 label __label122 19 set __fn0_s 2 - * setaddr __fn0retaddr __label3 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label3 __fn0 + 20 label __label123 + 21 op add __fn1_n 10 __fn0_s + 22 setaddr __fn1retaddr __label124 -+ 23 call __label1 ++ 23 call __label1 __fn1retval + 24 gotolabel __label124 __fn1 + 25 op add __fn1_n 20 __fn0_s + 26 setaddr __fn1retaddr __label125 -+ 27 call __label1 ++ 27 call __label1 __fn1retval + 28 gotolabel __label125 __fn1 + 29 op add __fn1_n 30 __fn0_s + 30 setaddr __fn1retaddr __label126 -+ 31 call __label1 ++ 31 call __label1 __fn1retval + 32 gotolabel __label126 __fn1 + 33 op add __fn1_n 40 __fn0_s + 34 setaddr __fn1retaddr __label127 -+ 35 call __label1 ++ 35 call __label1 __fn1retval + 36 gotolabel __label127 __fn1 + 37 label __label128 38 set __fn0_s 3 - * setaddr __fn0retaddr __label4 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label4 __fn0 + 39 label __label129 + 40 op add __fn1_n 10 __fn0_s + 41 setaddr __fn1retaddr __label130 -+ 42 call __label1 ++ 42 call __label1 __fn1retval + 43 gotolabel __label130 __fn1 + 44 op add __fn1_n 20 __fn0_s + 45 setaddr __fn1retaddr __label131 -+ 46 call __label1 ++ 46 call __label1 __fn1retval + 47 gotolabel __label131 __fn1 + 48 op add __fn1_n 30 __fn0_s + 49 setaddr __fn1retaddr __label132 -+ 50 call __label1 ++ 50 call __label1 __fn1retval + 51 gotolabel __label132 __fn1 + 52 op add __fn1_n 40 __fn0_s + 53 setaddr __fn1retaddr __label133 -+ 54 call __label1 ++ 54 call __label1 __fn1retval + 55 gotolabel __label133 __fn1 + 56 label __label134 57 set __fn0_s 4 - * setaddr __fn0retaddr __label5 -- * call __label0 +- * call __label0 __fn0retval - * gotolabel __label5 __fn0 + 58 label __label135 + 59 op add __fn1_n 10 __fn0_s + 60 setaddr __fn1retaddr __label136 -+ 61 call __label1 ++ 61 call __label1 __fn1retval + 62 gotolabel __label136 __fn1 + 63 op add __fn1_n 20 __fn0_s + 64 setaddr __fn1retaddr __label137 -+ 65 call __label1 ++ 65 call __label1 __fn1retval + 66 gotolabel __label137 __fn1 + 67 op add __fn1_n 30 __fn0_s + 68 setaddr __fn1retaddr __label138 -+ 69 call __label1 ++ 69 call __label1 __fn1retval + 70 gotolabel __label138 __fn1 + 71 op add __fn1_n 40 __fn0_s + 72 setaddr __fn1retaddr __label139 -+ 73 call __label1 ++ 73 call __label1 __fn1retval + 74 gotolabel __label139 __fn1 + 75 label __label140 76 end - * label __label0 - * op add __fn1_n 10 __fn0_s - * setaddr __fn1retaddr __label7 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label7 __fn1 - * op add __fn1_n 20 __fn0_s - * setaddr __fn1retaddr __label8 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label8 __fn1 - * op add __fn1_n 30 __fn0_s - * setaddr __fn1retaddr __label9 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label9 __fn1 - * op add __fn1_n 40 __fn0_s - * setaddr __fn1retaddr __label10 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label10 __fn1 - * label __label6 - * goto __fn0retaddr __fn0 @@ -1016,22 +1016,22 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * op add __fn1_n 10 __fn0_s + 2 op add __fn1_n 10 1 3 setaddr __fn1retaddr __label118 - 4 call __label1 + 4 call __label1 __fn1retval 5 gotolabel __label118 __fn1 - * op add __fn1_n 20 __fn0_s + 6 op add __fn1_n 20 1 7 setaddr __fn1retaddr __label119 - 8 call __label1 + 8 call __label1 __fn1retval 9 gotolabel __label119 __fn1 - * op add __fn1_n 30 __fn0_s + 10 op add __fn1_n 30 1 11 setaddr __fn1retaddr __label120 - 12 call __label1 + 12 call __label1 __fn1retval 13 gotolabel __label120 __fn1 - * op add __fn1_n 40 __fn0_s + 14 op add __fn1_n 40 1 15 setaddr __fn1retaddr __label121 - 16 call __label1 + 16 call __label1 __fn1retval 17 gotolabel __label121 __fn1 18 label __label122 19 set __fn0_s 2 @@ -1039,22 +1039,22 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * op add __fn1_n 10 __fn0_s + 21 op add __fn1_n 10 2 22 setaddr __fn1retaddr __label124 - 23 call __label1 + 23 call __label1 __fn1retval 24 gotolabel __label124 __fn1 - * op add __fn1_n 20 __fn0_s + 25 op add __fn1_n 20 2 26 setaddr __fn1retaddr __label125 - 27 call __label1 + 27 call __label1 __fn1retval 28 gotolabel __label125 __fn1 - * op add __fn1_n 30 __fn0_s + 29 op add __fn1_n 30 2 30 setaddr __fn1retaddr __label126 - 31 call __label1 + 31 call __label1 __fn1retval 32 gotolabel __label126 __fn1 - * op add __fn1_n 40 __fn0_s + 33 op add __fn1_n 40 2 34 setaddr __fn1retaddr __label127 - 35 call __label1 + 35 call __label1 __fn1retval 36 gotolabel __label127 __fn1 37 label __label128 38 set __fn0_s 3 @@ -1062,22 +1062,22 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * op add __fn1_n 10 __fn0_s + 40 op add __fn1_n 10 3 41 setaddr __fn1retaddr __label130 - 42 call __label1 + 42 call __label1 __fn1retval 43 gotolabel __label130 __fn1 - * op add __fn1_n 20 __fn0_s + 44 op add __fn1_n 20 3 45 setaddr __fn1retaddr __label131 - 46 call __label1 + 46 call __label1 __fn1retval 47 gotolabel __label131 __fn1 - * op add __fn1_n 30 __fn0_s + 48 op add __fn1_n 30 3 49 setaddr __fn1retaddr __label132 - 50 call __label1 + 50 call __label1 __fn1retval 51 gotolabel __label132 __fn1 - * op add __fn1_n 40 __fn0_s + 52 op add __fn1_n 40 3 53 setaddr __fn1retaddr __label133 - 54 call __label1 + 54 call __label1 __fn1retval 55 gotolabel __label133 __fn1 56 label __label134 57 set __fn0_s 4 @@ -1085,22 +1085,22 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - * op add __fn1_n 10 __fn0_s + 59 op add __fn1_n 10 4 60 setaddr __fn1retaddr __label136 - 61 call __label1 + 61 call __label1 __fn1retval 62 gotolabel __label136 __fn1 - * op add __fn1_n 20 __fn0_s + 63 op add __fn1_n 20 4 64 setaddr __fn1retaddr __label137 - 65 call __label1 + 65 call __label1 __fn1retval 66 gotolabel __label137 __fn1 - * op add __fn1_n 30 __fn0_s + 67 op add __fn1_n 30 4 68 setaddr __fn1retaddr __label138 - 69 call __label1 + 69 call __label1 __fn1retval 70 gotolabel __label138 __fn1 - * op add __fn1_n 40 __fn0_s + 71 op add __fn1_n 40 4 72 setaddr __fn1retaddr __label139 - 73 call __label1 + 73 call __label1 __fn1retval 74 gotolabel __label139 __fn1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 instructions): @@ -1109,7 +1109,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 1 op add __fn1_n 10 1 2 setaddr __fn1retaddr __label118 - 15 call __label1 + 15 call __label1 __fn1retval 16 gotolabel __label121 __fn1 17 label __label122 - * set __fn0_s 2 @@ -1117,7 +1117,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 19 op add __fn1_n 10 2 20 setaddr __fn1retaddr __label124 - 33 call __label1 + 33 call __label1 __fn1retval 34 gotolabel __label127 __fn1 35 label __label128 - * set __fn0_s 3 @@ -1125,7 +1125,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-4 37 op add __fn1_n 10 3 38 setaddr __fn1retaddr __label130 - 51 call __label1 + 51 call __label1 __fn1retval 52 gotolabel __label133 __fn1 53 label __label134 - * set __fn0_s 4 @@ -1137,7 +1137,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): 0 label __label117 1 op add __fn1_n 10 1 - * setaddr __fn1retaddr __label118 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label118 __fn1 + 2 label __label141 + 3 op rand __fn1_r 10 @@ -1302,7 +1302,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 162 label __label244 163 op add __fn1_n 20 1 - * setaddr __fn1retaddr __label119 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label119 __fn1 + 164 label __label245 + 165 op rand __fn1_r 10 @@ -1467,7 +1467,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 324 label __label348 325 op add __fn1_n 30 1 - * setaddr __fn1retaddr __label120 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label120 __fn1 + 326 label __label349 + 327 op rand __fn1_r 10 @@ -1632,7 +1632,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 486 label __label452 487 op add __fn1_n 40 1 - * setaddr __fn1retaddr __label121 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label121 __fn1 + 488 label __label453 + 489 op rand __fn1_r 10 @@ -1799,7 +1799,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): 650 label __label123 651 op add __fn1_n 10 2 - * setaddr __fn1retaddr __label124 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label124 __fn1 + 652 label __label557 + 653 op rand __fn1_r 10 @@ -1964,7 +1964,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 812 label __label660 813 op add __fn1_n 20 2 - * setaddr __fn1retaddr __label125 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label125 __fn1 + 814 label __label661 + 815 op rand __fn1_r 10 @@ -2129,7 +2129,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 974 label __label764 975 op add __fn1_n 30 2 - * setaddr __fn1retaddr __label126 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label126 __fn1 + 976 label __label765 + 977 op rand __fn1_r 10 @@ -2294,7 +2294,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 1136 label __label868 1137 op add __fn1_n 40 2 - * setaddr __fn1retaddr __label127 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label127 __fn1 + 1138 label __label869 + 1139 op rand __fn1_r 10 @@ -2461,7 +2461,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): 1300 label __label129 1301 op add __fn1_n 10 3 - * setaddr __fn1retaddr __label130 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label130 __fn1 + 1302 label __label973 + 1303 op rand __fn1_r 10 @@ -2626,7 +2626,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 1462 label __label1076 1463 op add __fn1_n 20 3 - * setaddr __fn1retaddr __label131 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label131 __fn1 + 1464 label __label1077 + 1465 op rand __fn1_r 10 @@ -2791,7 +2791,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 1624 label __label1180 1625 op add __fn1_n 30 3 - * setaddr __fn1retaddr __label132 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label132 __fn1 + 1626 label __label1181 + 1627 op rand __fn1_r 10 @@ -2956,7 +2956,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 1786 label __label1284 1787 op add __fn1_n 40 3 - * setaddr __fn1retaddr __label133 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label133 __fn1 + 1788 label __label1285 + 1789 op rand __fn1_r 10 @@ -3123,7 +3123,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): 1950 label __label135 1951 op add __fn1_n 10 4 - * setaddr __fn1retaddr __label136 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label136 __fn1 + 1952 label __label1389 + 1953 op rand __fn1_r 10 @@ -3288,7 +3288,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 2112 label __label1492 2113 op add __fn1_n 20 4 - * setaddr __fn1retaddr __label137 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label137 __fn1 + 2114 label __label1493 + 2115 op rand __fn1_r 10 @@ -3453,7 +3453,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 2274 label __label1596 2275 op add __fn1_n 30 4 - * setaddr __fn1retaddr __label138 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label138 __fn1 + 2276 label __label1597 + 2277 op rand __fn1_r 10 @@ -3618,7 +3618,7 @@ Modifications by Function Inlining: inline function foo (+821 instructions): + 2436 label __label1700 2437 op add __fn1_n 40 4 - * setaddr __fn1retaddr __label139 -- * call __label1 +- * call __label1 __fn1retval - * gotolabel __label139 __fn1 + 2438 label __label1701 + 2439 op rand __fn1_r 10 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/iterated-for-loop-break-continue.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/iterated-for-loop-break-continue.log index d039eda15..fb75dfcf4 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/iterated-for-loop-break-continue.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/iterated-for-loop-break-continue.log @@ -66,14 +66,14 @@ Modifications by Initial phase, Dead Code Elimination, iteration 1 (-4 instructi Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-4 instructions): - 9 callrec bank1 __label0 __label5 + 9 callrec bank1 __label0 __label5 __fn0retval 10 label __label5 11 set __tmp1 __fn0retval - * op lessThanEq __tmp2 __tmp0 __tmp1 - * jump __label3 equal __tmp2 false + 12 jump __label3 greaterThan __tmp0 __tmp1 13 set __fn0_n i - 14 callrec bank1 __label0 __label6 + 14 callrec bank1 __label0 __label6 __fn0retval 15 label __label6 16 set __tmp3 __fn0retval - * op equal __tmp4 __tmp3 4 @@ -83,7 +83,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-4 inst 19 jump __label8 always 20 label __label7 - 25 callrec bank1 __label0 __label9 + 25 callrec bank1 __label0 __label9 __fn0retval 26 label __label9 27 set __tmp6 __fn0retval - * op equal __tmp7 __tmp6 10 @@ -149,13 +149,13 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - 9 callrec bank1 __label0 __label5 + 9 callrec bank1 __label0 __label5 __fn0retval 10 label __label5 11 set __tmp1 __fn0retval - * jump __label3 greaterThan __tmp0 __tmp1 + 12 jump __label3 greaterThan __tmp0 __fn0retval 13 set __fn0_n i - 14 callrec bank1 __label0 __label6 + 14 callrec bank1 __label0 __label6 __fn0retval 15 label __label6 16 set __tmp3 __fn0retval - * jump __label7 notEqual __tmp3 4 @@ -164,7 +164,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 19 label __label7 20 label __label8 - 24 callrec bank1 __label0 __label9 + 24 callrec bank1 __label0 __label9 __fn0retval 25 label __label9 26 set __tmp6 __fn0retval - * jump __label10 notEqual __tmp6 10 @@ -178,7 +178,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 41 push bank1 __fn0_n - * set __fn0_n __tmp13 + 42 op mul __fn0_n -1 __fn0_n - 43 callrec bank1 __label0 __label15 + 43 callrec bank1 __label0 __label15 __fn0retval 44 label __label15 45 pop bank1 __fn0_n 46 set __tmp14 __fn0retval @@ -191,12 +191,12 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-5 instructions): 8 set __fn0_n j - 9 callrec bank1 __label0 __label5 + 9 callrec bank1 __label0 __label5 __fn0retval 10 label __label5 - * set __tmp1 __fn0retval 11 jump __label3 greaterThan __tmp0 __fn0retval 12 set __fn0_n i - 13 callrec bank1 __label0 __label6 + 13 callrec bank1 __label0 __label6 __fn0retval 14 label __label6 - * set __tmp3 __fn0retval 15 jump __label7 notEqual __fn0retval 4 @@ -204,7 +204,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-5 17 label __label7 21 set __fn0_n i - 22 callrec bank1 __label0 __label9 + 22 callrec bank1 __label0 __label9 __fn0retval 23 label __label9 - * set __tmp6 __fn0retval 24 jump __label10 notEqual __fn0retval 10 @@ -217,7 +217,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-5 - * op mul __tmp13 -1 __fn0_n 37 push bank1 __fn0_n 38 op mul __fn0_n -1 __fn0_n - 39 callrec bank1 __label0 __label15 + 39 callrec bank1 __label0 __label15 __fn0retval 40 label __label15 41 pop bank1 __fn0_n - * set __tmp14 __fn0retval @@ -227,12 +227,12 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-5 Modifications by Loop Optimization: replicate condition at line 3 (+9 instructions): - 9 callrec bank1 __label0 __label5 + 9 callrec bank1 __label0 __label5 __fn0retval 10 label __label5 11 jump __label3 greaterThan __tmp0 __fn0retval + 12 label __label16 13 set __fn0_n i - 14 callrec bank1 __label0 __label6 + 14 callrec bank1 __label0 __label6 __fn0retval 15 label __label6 29 label __label2 @@ -240,11 +240,11 @@ Modifications by Loop Optimization: replicate condition at line 3 (+9 instructio 31 op add j j 1 - * jump __label1 always + 32 set __fn0_n i -+ 33 callrec bank1 __label0 __label17 ++ 33 callrec bank1 __label0 __label17 __fn0retval + 34 label __label17 + 35 set __tmp0 __fn0retval + 36 set __fn0_n j -+ 37 callrec bank1 __label0 __label18 ++ 37 callrec bank1 __label0 __label18 __fn0retval + 38 label __label18 + 39 jump __label16 lessThanEq __tmp0 __fn0retval 40 label __label3 @@ -258,12 +258,12 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 3 label __label1 - * set __fn0_n i + 4 set __fn0_n 0 - 5 callrec bank1 __label0 __label4 + 5 callrec bank1 __label0 __label4 __fn0retval 6 label __label4 7 set __tmp0 __fn0retval - * set __fn0_n j + 8 set __fn0_n 10 - 9 callrec bank1 __label0 __label5 + 9 callrec bank1 __label0 __label5 __fn0retval 10 label __label5 11 jump __label3 greaterThan __tmp0 __fn0retval @@ -280,7 +280,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (- Modifications by Final phase, Jump Straightening, iteration 1 (-2 instructions): 13 set __fn0_n i - 14 callrec bank1 __label0 __label6 + 14 callrec bank1 __label0 __label6 __fn0retval 15 label __label6 - * jump __label7 notEqual __fn0retval 4 - * jump __label2 always @@ -290,7 +290,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-2 instructions): 19 print i 21 set __fn0_n i - 22 callrec bank1 __label0 __label9 + 22 callrec bank1 __label0 __label9 __fn0retval 23 label __label9 - * jump __label10 notEqual __fn0retval 10 - * jump __label3 always @@ -313,7 +313,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-4 instructions): 42 jump __label14 lessThanEq __fn0_n 0 - * push bank1 __fn0_n 43 op mul __fn0_n -1 __fn0_n - 44 callrec bank1 __label0 __label15 + 44 callrec bank1 __label0 __label15 __fn0retval 45 label __label15 - * pop bank1 __fn0_n 46 op mul __fn0retval -1 __fn0retval @@ -326,33 +326,33 @@ set __sp 0 set i 0 set j 10 set __fn0_n 0 -callrec bank1 __label0 __label4 +callrec bank1 __label0 __label4 __fn0retval label __label4 set __tmp0 __fn0retval set __fn0_n 10 -callrec bank1 __label0 __label5 +callrec bank1 __label0 __label5 __fn0retval label __label5 jump __label3 greaterThan __tmp0 __fn0retval label __label16 set __fn0_n i -callrec bank1 __label0 __label6 +callrec bank1 __label0 __label6 __fn0retval label __label6 jump __label2 equal __fn0retval 4 print i print j set __fn0_n i -callrec bank1 __label0 __label9 +callrec bank1 __label0 __label9 __fn0retval label __label9 jump __label3 equal __fn0retval 10 label __label2 op add i i 2 op add j j 1 set __fn0_n i -callrec bank1 __label0 __label17 +callrec bank1 __label0 __label17 __fn0retval label __label17 set __tmp0 __fn0retval set __fn0_n j -callrec bank1 __label0 __label18 +callrec bank1 __label0 __label18 __fn0retval label __label18 jump __label16 lessThanEq __tmp0 __fn0retval label __label3 @@ -361,7 +361,7 @@ label __label0 set __fn0retval __fn0_n jump __label14 lessThanEq __fn0_n 0 op mul __fn0_n -1 __fn0_n -callrec bank1 __label0 __label15 +callrec bank1 __label0 __label15 __fn0retval label __label15 op mul __fn0retval -1 __fn0retval label __label14 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/ranged-for-loop-break-continue.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/ranged-for-loop-break-continue.log index 007d2db9d..b10190aa7 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/ranged-for-loop-break-continue.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/ranged-for-loop-break-continue.log @@ -15,7 +15,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-2 instructions): 5 set __fn0_n 10 - 6 callrec bank1 __label0 __label2 + 6 callrec bank1 __label0 __label2 __fn0retval 7 label __label2 - * set __tmp1 __fn0retval - * set __tmp2 __tmp1 @@ -70,7 +70,7 @@ Modifications by Iterated phase, Jump Optimization, pass 1, iteration 1 (-3 inst 14 jump __label7 always 15 label __label6 - 19 callrec bank1 __label0 __label8 + 19 callrec bank1 __label0 __label8 __fn0retval 20 label __label8 21 set __tmp5 __fn0retval - * op equal __tmp6 i __tmp5 @@ -136,7 +136,7 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - 18 callrec bank1 __label0 __label8 + 18 callrec bank1 __label0 __label8 __fn0retval 19 label __label8 20 set __tmp5 __fn0retval - * jump __label9 notEqual i __tmp5 @@ -150,7 +150,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 34 push bank1 __fn0_n - * set __fn0_n __tmp10 + 35 op mul __fn0_n -1 __fn0_n - 36 callrec bank1 __label0 __label14 + 36 callrec bank1 __label0 __label14 __fn0retval 37 label __label14 38 pop bank1 __fn0_n 39 set __tmp11 __fn0retval @@ -163,7 +163,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-3 instructions): 17 set __fn0_n 5 - 18 callrec bank1 __label0 __label8 + 18 callrec bank1 __label0 __label8 __fn0retval 19 label __label8 - * set __tmp5 __fn0retval 20 jump __label9 notEqual i __fn0retval @@ -176,7 +176,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-3 - * op mul __tmp10 -1 __fn0_n 32 push bank1 __fn0_n 33 op mul __fn0_n -1 __fn0_n - 34 callrec bank1 __label0 __label14 + 34 callrec bank1 __label0 __label14 __fn0retval 35 label __label14 36 pop bank1 __fn0_n - * set __tmp11 __fn0retval @@ -236,7 +236,7 @@ Modifications by Final phase, Jump Straightening, iteration 1 (-2 instructions): 15 label __label7 16 print i 17 set __fn0_n 5 - 18 callrec bank1 __label0 __label8 + 18 callrec bank1 __label0 __label8 __fn0retval 19 label __label8 - * jump __label9 notEqual i __fn0retval - * jump __label5 always @@ -259,7 +259,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-4 instructions): 30 jump __label13 lessThanEq __fn0_n 0 - * push bank1 __fn0_n 31 op mul __fn0_n -1 __fn0_n - 32 callrec bank1 __label0 __label14 + 32 callrec bank1 __label0 __label14 __fn0retval 33 label __label14 - * pop bank1 __fn0_n 34 op mul __fn0retval -1 __fn0retval @@ -270,11 +270,11 @@ Final code before resolving virtual instructions: set __sp 0 set __fn0_n 1 -callrec bank1 __label0 __label1 +callrec bank1 __label0 __label1 __fn0retval label __label1 set __tmp0 __fn0retval set __fn0_n 10 -callrec bank1 __label0 __label2 +callrec bank1 __label0 __label2 __fn0retval label __label2 set __tmp2 __fn0retval set i __tmp0 @@ -283,7 +283,7 @@ label __label15 jump __label4 equal i 3 print i set __fn0_n 5 -callrec bank1 __label0 __label8 +callrec bank1 __label0 __label8 __fn0retval label __label8 jump __label5 equal i __fn0retval label __label4 @@ -295,7 +295,7 @@ label __label0 set __fn0retval __fn0_n jump __label13 lessThanEq __fn0_n 0 op mul __fn0_n -1 __fn0_n -callrec bank1 __label0 __label14 +callrec bank1 __label0 __label14 __fn0retval label __label14 op mul __fn0retval -1 __fn0retval label __label13 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/recursive-function-condition.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/recursive-function-condition.log index 55a42e849..ec6e3738b 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/recursive-function-condition.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/recursive-function-condition.log @@ -11,7 +11,7 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-1 instructions): - 13 callrec bank1 __label0 __label5 + 13 callrec bank1 __label0 __label5 __fn0retval 14 label __label5 15 pop bank1 __fn0_n - * set __tmp4 __fn0retval @@ -44,7 +44,7 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 10 op sub __tmp3 __fn0_n 1 11 push bank1 __fn0_n 12 set __fn0_n __tmp3 - 13 callrec bank1 __label0 __label5 + 13 callrec bank1 __label0 __label5 __fn0retval 14 label __label5 15 pop bank1 __fn0_n - * set __tmp2 __fn0retval @@ -60,7 +60,7 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - 2 callrec bank1 __label0 __label1 + 2 callrec bank1 __label0 __label1 __fn0retval 3 label __label1 4 set __tmp0 __fn0retval - * print __tmp0 @@ -73,14 +73,14 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 11 push bank1 __fn0_n - * set __fn0_n __tmp3 + 12 op sub __fn0_n __fn0_n 1 - 13 callrec bank1 __label0 __label5 + 13 callrec bank1 __label0 __label5 __fn0retval 14 label __label5 15 pop bank1 __fn0_n Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 instructions): 1 set __fn0_n 1 - 2 callrec bank1 __label0 __label1 + 2 callrec bank1 __label0 __label1 __fn0retval 3 label __label1 - * set __tmp0 __fn0retval 4 print __fn0retval @@ -91,7 +91,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * op sub __tmp3 __fn0_n 1 9 push bank1 __fn0_n 10 op sub __fn0_n __fn0_n 1 - 11 callrec bank1 __label0 __label5 + 11 callrec bank1 __label0 __label5 __fn0retval Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (-1 instructions): @@ -105,7 +105,7 @@ Modifications by Iterated phase, Single Step Elimination, pass 2, iteration 1 (- Modifications by Iterated phase, Expression Optimization, pass 2, iteration 1 (-1 instructions): - 11 callrec bank1 __label0 __label5 + 11 callrec bank1 __label0 __label5 __fn0retval 12 label __label5 13 pop bank1 __fn0_n - * set __fn0retval __fn0retval @@ -127,7 +127,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-4 instructions): 8 jump __label4 lessThanEq __fn0_n 0 - * push bank1 __fn0_n 9 op sub __fn0_n __fn0_n 1 - 10 callrec bank1 __label0 __label5 + 10 callrec bank1 __label0 __label5 __fn0retval 11 label __label5 - * pop bank1 __fn0_n 12 label __label4 @@ -138,7 +138,7 @@ Final code before resolving virtual instructions: set __sp 0 set __fn0_n 1 -callrec bank1 __label0 __label1 +callrec bank1 __label0 __label1 __fn0retval label __label1 print __fn0retval end @@ -146,7 +146,7 @@ label __label0 set __fn0retval null jump __label4 lessThanEq __fn0_n 0 op sub __fn0_n __fn0_n 1 -callrec bank1 __label0 __label5 +callrec bank1 __label0 __label5 __fn0retval label __label5 label __label4 return bank1 diff --git a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/while-loop.log b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/while-loop.log index 837f530d9..ac15cb8e0 100644 --- a/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/while-loop.log +++ b/mindcode/src/test/resources/info/teksol/mindcode/processor/processor/while-loop.log @@ -13,13 +13,13 @@ Modifications by Initial phase, Temp Variables Elimination, iteration 1 (-5 instructions): 1 set __fn0_n 0 - 2 callrec bank1 __label0 __label1 + 2 callrec bank1 __label0 __label1 __fn0retval 3 label __label1 - * set __tmp0 __fn0retval - * set j __tmp0 + 4 set j __fn0retval 5 set __fn0_n j - 6 callrec bank1 __label0 __label2 + 6 callrec bank1 __label0 __label2 __fn0retval 7 label __label2 - * set __tmp1 __fn0retval - * set i __tmp1 @@ -98,12 +98,12 @@ Modifications by Iterated phase, If Expression Optimization, pass 1, iteration 1 Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: - 2 callrec bank1 __label0 __label1 + 2 callrec bank1 __label0 __label1 __fn0retval 3 label __label1 4 set j __fn0retval - * set __fn0_n j + 5 set __fn0_n __fn0retval - 6 callrec bank1 __label0 __label2 + 6 callrec bank1 __label0 __label2 __fn0retval 7 label __label2 8 set i __fn0retval @@ -112,7 +112,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 1: 22 push bank1 __fn0_n - * set __fn0_n __tmp7 + 23 op mul __fn0_n -1 __fn0_n - 24 callrec bank1 __label0 __label9 + 24 callrec bank1 __label0 __label9 __fn0retval 25 label __label9 26 pop bank1 __fn0_n 27 set __tmp8 __fn0retval @@ -130,7 +130,7 @@ Modifications by Iterated phase, Data Flow Optimization, pass 1, iteration 2 (-2 - * op mul __tmp7 -1 __fn0_n 21 push bank1 __fn0_n 22 op mul __fn0_n -1 __fn0_n - 23 callrec bank1 __label0 __label9 + 23 callrec bank1 __label0 __label9 __fn0retval 24 label __label9 25 pop bank1 __fn0_n - * set __tmp8 __fn0retval @@ -189,7 +189,7 @@ Modifications by Final phase, Stack Optimization, iteration 1 (-4 instructions): 21 jump __label8 lessThanEq __fn0_n 0 - * push bank1 __fn0_n 22 op mul __fn0_n -1 __fn0_n - 23 callrec bank1 __label0 __label9 + 23 callrec bank1 __label0 __label9 __fn0retval 24 label __label9 - * pop bank1 __fn0_n 25 op mul __fn0retval -1 __fn0retval @@ -200,11 +200,11 @@ Final code before resolving virtual instructions: set __sp 0 set __fn0_n 0 -callrec bank1 __label0 __label1 +callrec bank1 __label0 __label1 __fn0retval label __label1 set j __fn0retval set __fn0_n __fn0retval -callrec bank1 __label0 __label2 +callrec bank1 __label0 __label2 __fn0retval label __label2 set i __fn0retval jump __label5 greaterThanEq __fn0retval 10 @@ -219,7 +219,7 @@ label __label0 set __fn0retval __fn0_n jump __label8 lessThanEq __fn0_n 0 op mul __fn0_n -1 __fn0_n -callrec bank1 __label0 __label9 +callrec bank1 __label0 __label9 __fn0retval label __label9 op mul __fn0retval -1 __fn0retval label __label8