Пример #1
0
        protected void CreateStoreIncGraph(
            OperationValueGraph g, ValueNode x, ValueNode p,
            ValueNode pi, int inc)
        {
            OperationNode storeOp = new StoreOperationNode();
            OperationNode addOp   = new AddOperationNode();
            OperationNode constOp = new ConstOperationNode();

            g.AddNode(storeOp);
            g.AddNode(addOp);
            g.AddNode(constOp);

            ValueNode m = new MemoryValueNode(x.Datatype, null);
            g.AddNode(m);

            ValueNode t = new IntRegisterNode();
            ValueNode i = new IntConstantNode(inc);

            g.AddNode(t);
            g.AddNode(i);

            g.AddEdge(x, storeOp);
            g.AddEdge(p, storeOp);
            g.AddEdge(storeOp, m);
            g.AddEdge(p, addOp);
            g.AddEdge(i, constOp);
            g.AddEdge(constOp, t);
            g.AddEdge(t, addOp);
            g.AddEdge(addOp, pi);
        }
Пример #2
0
        protected void CreateLoadIncGraph(
            OperationValueGraph g, ValueNode x, ValueNode p,
            ValueNode pi, int inc)
        {
            OperationNode loadOp  = new LoadOperationNode();
            OperationNode addOp   = new AddOperationNode();
            OperationNode constOp = new ConstOperationNode();

            g.AddNode(loadOp);
            g.AddNode(addOp);
            g.AddNode(constOp);

            ValueNode t = new IntRegisterNode();
            ValueNode i = new IntConstantNode(inc);

            g.AddNode(t);
            g.AddNode(i);

            g.AddEdge(p, loadOp);
            g.AddEdge(loadOp, x);
            g.AddEdge(p, addOp);
            g.AddEdge(i, constOp);
            g.AddEdge(constOp, t);
            g.AddEdge(t, addOp);
            g.AddEdge(addOp, pi);
        }