Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java @ 2586:421da5f53b5e
more Op2 changes
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 05 May 2011 14:37:17 +0200 |
parents | 768d77a1c7af |
children | 51ebe5f0516f |
comparison
equal
deleted
inserted
replaced
2585:3e0e65161345 | 2586:421da5f53b5e |
---|---|
26 import static java.lang.reflect.Modifier.*; | 26 import static java.lang.reflect.Modifier.*; |
27 | 27 |
28 import java.lang.reflect.*; | 28 import java.lang.reflect.*; |
29 import java.util.*; | 29 import java.util.*; |
30 | 30 |
31 import com.oracle.graal.graph.*; | |
31 import com.sun.c1x.*; | 32 import com.sun.c1x.*; |
32 import com.sun.c1x.debug.*; | 33 import com.sun.c1x.debug.*; |
33 import com.sun.c1x.ir.*; | 34 import com.sun.c1x.ir.*; |
34 import com.sun.c1x.opt.*; | 35 import com.sun.c1x.opt.*; |
35 import com.sun.c1x.util.*; | 36 import com.sun.c1x.util.*; |
120 Instruction lastInstr; // the last instruction added | 121 Instruction lastInstr; // the last instruction added |
121 final LogStream log; | 122 final LogStream log; |
122 | 123 |
123 boolean skipBlock; // skip processing of the rest of this block | 124 boolean skipBlock; // skip processing of the rest of this block |
124 private Value rootMethodSynchronizedObject; | 125 private Value rootMethodSynchronizedObject; |
126 | |
127 | |
128 | |
129 private Graph graph = new Graph(); | |
130 | |
131 | |
125 /** | 132 /** |
126 * Creates a new, initialized, {@code GraphBuilder} instance for a given compilation. | 133 * Creates a new, initialized, {@code GraphBuilder} instance for a given compilation. |
127 * | 134 * |
128 * @param compilation the compilation | 135 * @param compilation the compilation |
129 * @param ir the IR to build the graph into | 136 * @param ir the IR to build the graph into |
546 } | 553 } |
547 | 554 |
548 void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, FrameState state) { | 555 void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, FrameState state) { |
549 Value yValue = pop(y); | 556 Value yValue = pop(y); |
550 Value xValue = pop(x); | 557 Value xValue = pop(x); |
551 Value result1 = append(new ArithmeticOp(opcode, result, xValue, yValue, isStrict(method().accessFlags()), state)); | 558 Value result1 = append(new ArithmeticOp(opcode, result, xValue, yValue, isStrict(method().accessFlags()), state, graph)); |
552 push(result, result1); | 559 push(result, result1); |
553 } | 560 } |
554 | 561 |
555 void genNegateOp(CiKind kind) { | 562 void genNegateOp(CiKind kind) { |
556 push(kind, append(new NegateOp(pop(kind)))); | 563 push(kind, append(new NegateOp(pop(kind)))); |
558 | 565 |
559 void genShiftOp(CiKind kind, int opcode) { | 566 void genShiftOp(CiKind kind, int opcode) { |
560 Value s = ipop(); | 567 Value s = ipop(); |
561 Value x = pop(kind); | 568 Value x = pop(kind); |
562 // note that strength reduction of e << K >>> K is correctly handled in canonicalizer now | 569 // note that strength reduction of e << K >>> K is correctly handled in canonicalizer now |
563 push(kind, append(new ShiftOp(opcode, x, s))); | 570 push(kind, append(new ShiftOp(opcode, x, s, graph))); |
564 } | 571 } |
565 | 572 |
566 void genLogicOp(CiKind kind, int opcode) { | 573 void genLogicOp(CiKind kind, int opcode) { |
567 Value y = pop(kind); | 574 Value y = pop(kind); |
568 Value x = pop(kind); | 575 Value x = pop(kind); |
569 push(kind, append(new LogicOp(opcode, x, y))); | 576 push(kind, append(new LogicOp(opcode, x, y, graph))); |
570 } | 577 } |
571 | 578 |
572 void genCompareOp(CiKind kind, int opcode, CiKind resultKind) { | 579 void genCompareOp(CiKind kind, int opcode, CiKind resultKind) { |
573 Value y = pop(kind); | 580 Value y = pop(kind); |
574 Value x = pop(kind); | 581 Value x = pop(kind); |
575 Value value = append(new CompareOp(opcode, resultKind, x, y)); | 582 Value value = append(new CompareOp(opcode, resultKind, x, y, graph)); |
576 if (!resultKind.isVoid()) { | 583 if (!resultKind.isVoid()) { |
577 ipush(value); | 584 ipush(value); |
578 } | 585 } |
579 } | 586 } |
580 | 587 |
586 void genIncrement() { | 593 void genIncrement() { |
587 int index = stream().readLocalIndex(); | 594 int index = stream().readLocalIndex(); |
588 int delta = stream().readIncrement(); | 595 int delta = stream().readIncrement(); |
589 Value x = curState.localAt(index); | 596 Value x = curState.localAt(index); |
590 Value y = append(Constant.forInt(delta)); | 597 Value y = append(Constant.forInt(delta)); |
591 curState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method().accessFlags()), null))); | 598 curState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method().accessFlags()), null, graph))); |
592 } | 599 } |
593 | 600 |
594 void genGoto(int fromBCI, int toBCI) { | 601 void genGoto(int fromBCI, int toBCI) { |
595 boolean isSafepoint = !noSafepoints() && toBCI <= fromBCI; | 602 boolean isSafepoint = !noSafepoints() && toBCI <= fromBCI; |
596 append(new Goto(blockAt(toBCI), null, isSafepoint)); | 603 append(new Goto(blockAt(toBCI), null, isSafepoint)); |