1 package org.simantics.scl.compiler.constants;
3 import org.objectweb.asm.Label;
4 import org.simantics.scl.compiler.internal.codegen.references.Val;
5 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
6 import org.simantics.scl.compiler.types.TVar;
7 import org.simantics.scl.compiler.types.Type;
8 import org.simantics.scl.compiler.types.Types;
10 public class JavaComparisonToZeroOperation extends FunctionValue {
14 public JavaComparisonToZeroOperation(String op) {
15 super(TVar.EMPTY_ARRAY, Types.NO_EFFECTS, Types.BOOLEAN, Types.INTEGER);
20 public Type applyExact(MethodBuilder mb, Val[] parameters) {
21 Label thenBranch = mb.createLabel();
22 Label joinPoint = mb.createLabel();
24 mb.push(parameters[0], Types.INTEGER);
25 mb.ifZeroComparisonBranch(thenBranch, op);
27 mb.loadConstant(false);
30 mb.setLocation(thenBranch);
31 mb.loadConstant(true);
32 mb.setLocation(joinPoint);
34 return getReturnType();
38 public String toString() {