Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java @ 2867:5c545fef2c81
merge
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Tue, 07 Jun 2011 16:33:04 +0200 |
parents | 7f14e6b48a9c a97605b0489b |
children | fc75fd3fa5e4 |
comparison
equal
deleted
inserted
replaced
2866:7f14e6b48a9c | 2867:5c545fef2c81 |
---|---|
547 } | 547 } |
548 | 548 |
549 private void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, boolean canTrap) { | 549 private void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, boolean canTrap) { |
550 Value yValue = frameState.pop(y); | 550 Value yValue = frameState.pop(y); |
551 Value xValue = frameState.pop(x); | 551 Value xValue = frameState.pop(x); |
552 Value result1 = append(new ArithmeticOp(opcode, result, xValue, yValue, isStrict(method.accessFlags()), canTrap, graph)); | 552 Value result1 = append(new Arithmetic(opcode, result, xValue, yValue, isStrict(method.accessFlags()), canTrap, graph)); |
553 append(new ValueAnchor(result1, graph)); | 553 if (canTrap) { |
554 append(new ValueAnchor(result1, graph)); | |
555 } | |
554 frameState.push(result, result1); | 556 frameState.push(result, result1); |
555 } | 557 } |
556 | 558 |
557 private void genNegateOp(CiKind kind) { | 559 private void genNegateOp(CiKind kind) { |
558 frameState.push(kind, append(new NegateOp(frameState.pop(kind), graph))); | 560 frameState.push(kind, append(new Negate(frameState.pop(kind), graph))); |
559 } | 561 } |
560 | 562 |
561 private void genShiftOp(CiKind kind, int opcode) { | 563 private void genShiftOp(CiKind kind, int opcode) { |
562 Value s = frameState.ipop(); | 564 Value s = frameState.ipop(); |
563 Value x = frameState.pop(kind); | 565 Value x = frameState.pop(kind); |
564 frameState.push(kind, append(new ShiftOp(opcode, x, s, graph))); | 566 frameState.push(kind, append(new Shift(opcode, x, s, graph))); |
565 } | 567 } |
566 | 568 |
567 private void genLogicOp(CiKind kind, int opcode) { | 569 private void genLogicOp(CiKind kind, int opcode) { |
568 Value y = frameState.pop(kind); | 570 Value y = frameState.pop(kind); |
569 Value x = frameState.pop(kind); | 571 Value x = frameState.pop(kind); |
570 frameState.push(kind, append(new LogicOp(opcode, x, y, graph))); | 572 Logic v; |
573 switch(opcode){ | |
574 case IAND: | |
575 case LAND: v = new And(kind, x, y, graph); break; | |
576 case IOR: | |
577 case LOR: v = new Or(kind, x, y, graph); break; | |
578 case IXOR: | |
579 case LXOR: v = new Xor(kind, x, y, graph); break; | |
580 default: | |
581 throw new CiBailout("should not reach"); | |
582 } | |
583 frameState.push(kind, append(v)); | |
571 } | 584 } |
572 | 585 |
573 private void genCompareOp(CiKind kind, int opcode, CiKind resultKind) { | 586 private void genCompareOp(CiKind kind, int opcode, CiKind resultKind) { |
574 Value y = frameState.pop(kind); | 587 Value y = frameState.pop(kind); |
575 Value x = frameState.pop(kind); | 588 Value x = frameState.pop(kind); |
576 Value value = append(new CompareOp(opcode, resultKind, x, y, graph)); | 589 Value value = append(new Materialize(opcode, resultKind, x, y, graph)); |
577 if (!resultKind.isVoid()) { | 590 if (!resultKind.isVoid()) { |
578 frameState.ipush(value); | 591 frameState.ipush(value); |
579 } | 592 } |
580 } | 593 } |
581 | 594 |
587 private void genIncrement() { | 600 private void genIncrement() { |
588 int index = stream().readLocalIndex(); | 601 int index = stream().readLocalIndex(); |
589 int delta = stream().readIncrement(); | 602 int delta = stream().readIncrement(); |
590 Value x = frameState.localAt(index); | 603 Value x = frameState.localAt(index); |
591 Value y = append(Constant.forInt(delta, graph)); | 604 Value y = append(Constant.forInt(delta, graph)); |
592 frameState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method.accessFlags()), false, graph))); | 605 frameState.storeLocal(index, append(new Arithmetic(IADD, CiKind.Int, x, y, isStrict(method.accessFlags()), false, graph))); |
593 } | 606 } |
594 | 607 |
595 private void genGoto(int fromBCI, int toBCI) { | 608 private void genGoto(int fromBCI, int toBCI) { |
596 appendGoto(createTargetAt(toBCI, frameState)); | 609 appendGoto(createTargetAt(toBCI, frameState)); |
597 } | 610 } |