Пример #1
0
        public static void CoalesceLoadsAndDeclarations(NodeGraph graph)
        {
            for (int i = 0; i < graph.numBlocks; i++)
            {
                NodeBlock block = graph[i];
                for (NodeList.iterator iter = block.nodes.begin(); iter.more();)
                {
                    DNode node = iter.node;

                    if (node.type == NodeType.DeclareLocal)
                    {
                        // Peephole next = store(this, expr)
                        DDeclareLocal local = (DDeclareLocal)node;
                        if (node.next.type == NodeType.Store)
                        {
                            DStore store = (DStore)node.next;
                            if (store.getOperand(0) == local)
                            {
                                local.replaceOperand(0, store.getOperand(1));
                                store.removeFromUseChains();
                                iter.next();
                                block.nodes.remove(iter);
                                continue;
                            }
                        }
                    }

                    iter.next();
                }
            }
        }
Пример #2
0
        private void writeStore(DStore store)
        {
            string lhs = buildLoadStoreRef(store.getOperand(0));
            string rhs = buildExpression(store.getOperand(1));
            string eq  = store.spop == SPOpcode.nop
                        ? "="
                        : spop(store.spop) + "=";

            outputLine(lhs + " " + eq + " " + rhs + ";");
        }
Пример #3
0
 public override void visit(DStore store)
 {
     store.getOperand(0).setUsedAsReference();
 }
Пример #4
0
 public override void visit(DStore store)
 {
     store.getOperand(0).setUsedAsReference();
 }
Пример #5
0
 private void writeStore(DStore store)
 {
     string lhs = buildLoadStoreRef(store.getOperand(0));
     string rhs = buildExpression(store.getOperand(1));
     string eq = store.spop == SPOpcode.nop
                 ? "="
                 : spop(store.spop) + "=";
     outputLine(lhs + " " + eq + " " + rhs + ";");
 }