most of the missing context-rewriting code
[IRC.git] / Robust / src / Analysis / Disjoint / CanonicalOp.java
1 package Analysis.Disjoint;
2
3 // a CanonicalOperation defines an operation on 
4 // Canonical objects.  The Canonical class maps
5 // an op to its result, so when you ask the
6 // Canonical static methods to do an op that is
7 // non-trivial, it will generate one of these
8 // first and do a result look-up
9 public class CanonicalOp {
10
11   public static final int REACHTUPLE_UNIONARITY_REACHTUPLE     = 0x1a34;
12   public static final int REACHSTATE_UNION_REACHSTATE          = 0x5678;
13   public static final int REACHSTATE_UNION_REACHTUPLE          = 0x32b6;
14   public static final int REACHSTATE_UNIONUPARITY_REACHSTATE   = 0x9152;
15   public static final int REACHSTATE_REMOVE_REACHTUPLE         = 0x8173;
16   public static final int REACHSTATE_AGETUPLESFROM_ALLOCSITE   = 0x4f65;
17   public static final int REACHSET_UNION_REACHSET              = 0x2131;
18   public static final int REACHSET_UNION_REACHSTATE            = 0xe3c8;
19   public static final int REACHSET_INTERSECTION_REACHSET       = 0x3361;
20   public static final int REACHSET_REMOVE_REACHSTATE           = 0x9391;
21   public static final int REACHSET_APPLY_CHANGESET             = 0x1d55;
22   public static final int REACHSET_UNIONTOCHANGESET_REACHSET   = 0x46a9;
23   public static final int REACHSET_AGETUPLESFROM_ALLOCSITE     = 0x22bb;
24   public static final int REACHSET_PRUNEBY_REACHSET            = 0xd774;
25   public static final int CHANGESET_UNION_CHANGESET            = 0x53b3;
26   public static final int CHANGESET_UNION_CHANGETUPLE          = 0x9ee4;
27   public static final int EXISTPREDSET_JOIN_EXISTPREDSET       = 0x8a21;
28   public static final int EXISTPREDSET_ADD_EXISTPRED           = 0xba5f;
29   public static final int PRIM_OP_UNUSED                       = 0xef01;
30   public static final int REACHSET_TOCALLEECONTEXT_ALLOCSITE   = 0x56f6;
31   public static final int REACHSTATE_TOCALLEECONTEXT_ALLOCSITE = 0x7faf;
32   public static final int REACHSET_TOCALLERCONTEXT_ALLOCSITE   = 0x2f6a;
33   public static final int REACHSTATE_TOCALLERCONTEXT_ALLOCSITE = 0xb2b1;
34   public static final int REACHSET_UNSHADOW_ALLOCSITE          = 0x1049;
35   public static final int REACHSTATE_UNSHADOW_ALLOCSITE        = 0x08ef;
36
37   protected int opCode;
38   protected Canonical operand1;
39   protected Canonical operand2;
40   protected int       operand3;
41
42   public CanonicalOp( int       opc,
43                       Canonical op1, 
44                       Canonical op2 ) {
45     this( opc, op1, op2, PRIM_OP_UNUSED );
46   }
47
48   public CanonicalOp( int       opc,
49                       Canonical op1, 
50                       Canonical op2,
51                       int       op3 ) {
52     assert op1.isCanonical();
53     assert op2.isCanonical();
54     opCode   = opc;
55     operand1 = op1;
56     operand2 = op2;
57     operand3 = op3;
58   }
59   
60   public int hashCode() {
61     return opCode ^
62       (operand1.getCanonicalValue() << 2) ^
63       (operand2.getCanonicalValue() << 1) ^
64       (operand3 << 3);
65   }
66
67   public boolean equals( Object o ) {
68     if( o == null ) {
69       return false;
70     }
71
72     CanonicalOp co = (CanonicalOp) o;
73     return opCode == co.opCode &&
74       (operand1.getCanonicalValue() == co.operand1.getCanonicalValue()) &&
75       (operand2.getCanonicalValue() == co.operand2.getCanonicalValue()) &&
76       operand3 == co.operand3;
77   }
78 }