403 protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key) {
404 // Making a copy of the switch value is necessary because jump table destroys the input
405 // value
406 Variable tmp = newVariable(key.getValueKind());
407 emitMove(tmp, key);
408 append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(LIRKind.value(target().arch.getWordKind()))));
409 }
410
411 protected SPARC getArchitecture() {
412 return (SPARC) target().arch;
413 }
414
415 @Override
416 public Variable emitByteSwap(Value input) {
417 Variable result = newVariable(LIRKind.combine(input));
418 append(new SPARCByteSwapOp(this, result, asAllocatable(input)));
419 return result;
420 }
421
422 @Override
423 public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length) {
424 Variable result = newVariable(LIRKind.value(SPARCKind.WORD));
425 append(new SPARCArrayEqualsOp(this, kind, result, load(array1), load(array2), asAllocatable(length)));
426 return result;
427 }
428
429 @Override
430 public void emitMembar(int barriers) {
431 int necessaryBarriers = target().arch.requiredBarriers(barriers);
432 if (target().isMP && necessaryBarriers != 0) {
433 append(new MembarOp(necessaryBarriers));
434 }
435 }
436
437 @Override
438 public void emitDeoptimize(Value actionAndReason, Value speculation, LIRFrameState state) {
439 append(new ReturnOp(Value.ILLEGAL));
440 }
441
442 public Value emitSignExtendLoad(LIRKind kind, LIRKind resultKind, Value address, LIRFrameState state) {
443 SPARCAddressValue loadAddress = asAddressValue(address);
444 Variable result = newVariable(resultKind);
445 append(new LoadOp(kind.getPlatformKind(), result, loadAddress, state, true));
459 assert kind == XWORD : address + " - " + kind + " not an object!";
460 append(new NullCheckOp(asAddressValue(address), state));
461 }
462
463 public void emitLoadConstantTableBase() {
464 constantTableBaseProvider.constantTableBase = newVariable(LIRKind.value(XWORD));
465 int nextPosition = getResult().getLIR().getLIRforBlock(getCurrentBlock()).size();
466 NoOp placeHolder = append(new NoOp(getCurrentBlock(), nextPosition));
467 loadConstantTableBaseOp = new SPARCLoadConstantTableBaseOp(constantTableBaseProvider.constantTableBase, placeHolder);
468 }
469
470 @Override
471 public void beforeRegisterAllocation() {
472 LIR lir = getResult().getLIR();
473 loadConstantTableBaseOp.setAlive(lir, constantTableBaseProvider.useConstantTableBase);
474 }
475
476 @Override
477 public void emitPause() {
478 append(new SPARCPauseOp());
479 }
480 }
|
403 protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key) {
404 // Making a copy of the switch value is necessary because jump table destroys the input
405 // value
406 Variable tmp = newVariable(key.getValueKind());
407 emitMove(tmp, key);
408 append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(LIRKind.value(target().arch.getWordKind()))));
409 }
410
411 protected SPARC getArchitecture() {
412 return (SPARC) target().arch;
413 }
414
415 @Override
416 public Variable emitByteSwap(Value input) {
417 Variable result = newVariable(LIRKind.combine(input));
418 append(new SPARCByteSwapOp(this, result, asAllocatable(input)));
419 return result;
420 }
421
422 @Override
423 public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
424 Variable result = newVariable(LIRKind.value(SPARCKind.WORD));
425 append(new SPARCArrayEqualsOp(this, kind, result, load(array1), load(array2), asAllocatable(length), directPointers));
426 return result;
427 }
428
429 @Override
430 public void emitMembar(int barriers) {
431 int necessaryBarriers = target().arch.requiredBarriers(barriers);
432 if (target().isMP && necessaryBarriers != 0) {
433 append(new MembarOp(necessaryBarriers));
434 }
435 }
436
437 @Override
438 public void emitDeoptimize(Value actionAndReason, Value speculation, LIRFrameState state) {
439 append(new ReturnOp(Value.ILLEGAL));
440 }
441
442 public Value emitSignExtendLoad(LIRKind kind, LIRKind resultKind, Value address, LIRFrameState state) {
443 SPARCAddressValue loadAddress = asAddressValue(address);
444 Variable result = newVariable(resultKind);
445 append(new LoadOp(kind.getPlatformKind(), result, loadAddress, state, true));
459 assert kind == XWORD : address + " - " + kind + " not an object!";
460 append(new NullCheckOp(asAddressValue(address), state));
461 }
462
463 public void emitLoadConstantTableBase() {
464 constantTableBaseProvider.constantTableBase = newVariable(LIRKind.value(XWORD));
465 int nextPosition = getResult().getLIR().getLIRforBlock(getCurrentBlock()).size();
466 NoOp placeHolder = append(new NoOp(getCurrentBlock(), nextPosition));
467 loadConstantTableBaseOp = new SPARCLoadConstantTableBaseOp(constantTableBaseProvider.constantTableBase, placeHolder);
468 }
469
470 @Override
471 public void beforeRegisterAllocation() {
472 LIR lir = getResult().getLIR();
473 loadConstantTableBaseOp.setAlive(lir, constantTableBaseProvider.useConstantTableBase);
474 }
475
476 @Override
477 public void emitPause() {
478 append(new SPARCPauseOp());
479 }
480
481 @Override
482 public void emitSpeculationFence() {
483 throw GraalError.unimplemented();
484 }
485 }
|