*** empty log message ***
[repair.git] / Repair / RepairCompiler / MCC / IR / UpdateNode.java
index 7c0e5a464ab3129dc016f70f3cb52627b6471fd2..d4583822aeb15a2bbd4872a639599c82db9b61ea 100755 (executable)
@@ -356,6 +356,7 @@ class UpdateNode {
            if (u.getType()==Updates.ACCESSPATH) {
                VarDescriptor newright=VarDescriptor.makeNew("right");
                /* Need to do the modulo computation here...FIXME */
+               generate_accesspath(cr, right,newright,u);
                right=newright;
            }
            VarDescriptor left=VarDescriptor.makeNew("left");
@@ -432,6 +433,38 @@ class UpdateNode {
        }
     }
 
+
+    private void generate_accesspath(CodeWriter cr, VarDescriptor right, VarDescriptor newright, Updates u) {
+       Vector dotvector=new Vector();
+       Expr ptr=u.getRightExpr();
+
+       while(true) {
+           /* Does something other than a dereference? */
+           dotvector.add(ptr);
+           if (ptr instanceof DotExpr)
+               ptr=((DotExpr)ptr).left;
+           else if (ptr instanceof CastExpr)
+               ptr=((CastExpr)ptr).getExpr();
+
+           if (ptr instanceof VarExpr) {
+               /* Finished constructing vector */
+               break;
+           }
+       }
+       ArrayAnalysis.AccessPath ap=u.getAccessPath();
+       VarDescriptor init=VarDescriptor.makeNew("init");
+       if (ap.isSet()) {
+           cr.outputline("int "+init.getSafeSymbol()+"="+ap.getSet().getSafeSymbol()+"_hash->firstkey();")
+       } else {
+           init=ap.getVar();
+       }
+       for(int i=dotvector.size()-1;i>=0;i--) {
+           Expr e=(Expr)dotvector.get(i);
+           
+       }
+       
+    }
+
     private void generate_bindings(CodeWriter cr, String slot0, String slot1) {
        for(int i=0;i<bindings.size();i++) {
            Binding b=(Binding)bindings.get(i);