1 package org.simantics.scl.compiler.internal.codegen.utils;
3 import org.simantics.scl.compiler.internal.codegen.references.Val;
4 import org.simantics.scl.compiler.internal.codegen.references.ValRef;
5 import org.simantics.scl.compiler.types.Type;
6 import org.simantics.scl.compiler.types.Types;
8 public class SSAUtils {
10 public static boolean representSameValue(Val a, ValRef b) {
11 if(b.getTypeParameters().length > 0)
13 return representSameValue(a, b.getBinding());
16 public static boolean representSameValue(Val a, Val b) {
19 Type aT = a.getType();
20 Type bT = b.getType();
21 if(!Types.equals(aT, bT))
23 return isSingletonType(aT);
26 public static boolean isSingletonType(Type type) {
27 type = Types.canonical(type);
28 return type == Types.UNIT || type == Types.PUNIT;