Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java @ 2515:4fdef1464592
Removed extended bytecodes and related HIR instructions.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 27 Apr 2011 15:36:29 +0200 |
parents | 16b9a8b5ad39 |
children | f6125fb5bfbc |
comparison
equal
deleted
inserted
replaced
2514:34b5eea9b001 | 2515:4fdef1464592 |
---|---|
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 | 23 |
24 package com.sun.c1x.target.amd64; | 24 package com.sun.c1x.target.amd64; |
25 | 25 |
26 import static com.sun.cri.bytecode.Bytecodes.UnsignedComparisons.*; | |
27 | |
28 import com.sun.c1x.*; | 26 import com.sun.c1x.*; |
29 import com.sun.c1x.alloc.OperandPool.VariableFlag; | 27 import com.sun.c1x.alloc.OperandPool.VariableFlag; |
30 import com.sun.c1x.gen.*; | 28 import com.sun.c1x.gen.*; |
31 import com.sun.c1x.globalstub.*; | 29 import com.sun.c1x.globalstub.*; |
32 import com.sun.c1x.ir.*; | 30 import com.sun.c1x.ir.*; |
141 } else if (x.kind == CiKind.Double) { | 139 } else if (x.kind == CiKind.Double) { |
142 globalStub = stubFor(GlobalStub.Id.dneg); | 140 globalStub = stubFor(GlobalStub.Id.dneg); |
143 } | 141 } |
144 lir.negate(value.result(), reg, globalStub); | 142 lir.negate(value.result(), reg, globalStub); |
145 setResult(x, reg); | 143 setResult(x, reg); |
146 } | |
147 | |
148 @Override | |
149 public void visitSignificantBit(SignificantBitOp x) { | |
150 LIRItem value = new LIRItem(x.value(), this); | |
151 value.setDestroysRegister(); | |
152 value.loadItem(); | |
153 CiValue reg = createResultVariable(x); | |
154 if (x.op == Bytecodes.LSB) { | |
155 lir.lsb(value.result(), reg); | |
156 } else { | |
157 lir.msb(value.result(), reg); | |
158 } | |
159 } | 144 } |
160 | 145 |
161 public boolean livesLonger(Value x, Value y) { | 146 public boolean livesLonger(Value x, Value y) { |
162 BlockBegin bx = x.block(); | 147 BlockBegin bx = x.block(); |
163 BlockBegin by = y.block(); | 148 BlockBegin by = y.block(); |
462 Util.unimplemented(); | 447 Util.unimplemented(); |
463 } | 448 } |
464 } | 449 } |
465 | 450 |
466 @Override | 451 @Override |
467 public void visitUnsignedCompareOp(UnsignedCompareOp x) { | |
468 LIRItem left = new LIRItem(x.x(), this); | |
469 LIRItem right = new LIRItem(x.y(), this); | |
470 left.loadItem(); | |
471 right.loadItem(); | |
472 Condition condition = null; | |
473 switch (x.op) { | |
474 case BELOW_THAN : condition = Condition.BT; break; | |
475 case ABOVE_THAN : condition = Condition.AT; break; | |
476 case BELOW_EQUAL : condition = Condition.BE; break; | |
477 case ABOVE_EQUAL : condition = Condition.AE; break; | |
478 default: | |
479 Util.unimplemented(); | |
480 } | |
481 CiValue result = createResultVariable(x); | |
482 lir.cmp(condition, left.result(), right.result()); | |
483 lir.cmove(condition, CiConstant.INT_1, CiConstant.INT_0, result); | |
484 } | |
485 | |
486 @Override | |
487 public void visitCompareAndSwap(CompareAndSwap x) { | |
488 | |
489 // (tw) TODO: Factor out common code with genCompareAndSwap. | |
490 | |
491 CiKind dataKind = x.dataKind; | |
492 CiValue tempPointer = load(x.pointer()); | |
493 CiAddress addr = getAddressForPointerOp(x, dataKind, tempPointer); | |
494 | |
495 CiValue expectedValue = force(x.expectedValue(), AMD64.rax.asValue(dataKind)); | |
496 CiValue newValue = load(x.newValue()); | |
497 assert Util.archKindsEqual(newValue.kind, dataKind) : "invalid type"; | |
498 | |
499 if (dataKind.isObject()) { // Write-barrier needed for Object fields. | |
500 // Do the pre-write barrier : if any. | |
501 preGCWriteBarrier(addr, false, null); | |
502 } | |
503 | |
504 CiValue pointer = newVariable(CiKind.Word); | |
505 lir.lea(addr, pointer); | |
506 CiValue result = createResultVariable(x); | |
507 CiValue resultReg = AMD64.rax.asValue(dataKind); | |
508 if (dataKind.isObject()) { | |
509 lir.casObj(pointer, expectedValue, newValue); | |
510 } else if (dataKind.isInt()) { | |
511 lir.casInt(pointer, expectedValue, newValue); | |
512 } else { | |
513 assert dataKind.isLong() || dataKind.isWord(); | |
514 lir.casLong(pointer, expectedValue, newValue); | |
515 } | |
516 | |
517 lir.move(resultReg, result); | |
518 | |
519 if (dataKind.isObject()) { // Write-barrier needed for Object fields. | |
520 // Seems to be precise | |
521 postGCWriteBarrier(pointer, newValue); | |
522 } | |
523 } | |
524 | |
525 @Override | |
526 protected void genCompareAndSwap(Intrinsic x, CiKind kind) { | 452 protected void genCompareAndSwap(Intrinsic x, CiKind kind) { |
527 assert x.numberOfArguments() == 5 : "wrong number of arguments: " + x.numberOfArguments(); | 453 assert x.numberOfArguments() == 5 : "wrong number of arguments: " + x.numberOfArguments(); |
528 // Argument 0 is the receiver. | 454 // Argument 0 is the receiver. |
529 LIRItem obj = new LIRItem(x.argumentAt(1), this); // object | 455 LIRItem obj = new LIRItem(x.argumentAt(1), this); // object |
530 LIRItem offset = new LIRItem(x.argumentAt(2), this); // offset of field | 456 LIRItem offset = new LIRItem(x.argumentAt(2), this); // offset of field |