gpt4 book ai didi

org.graalvm.compiler.nodes.calc.ZeroExtendNode类的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 00:06:31 30 4
gpt4 key购买 nike

本文整理了Java中org.graalvm.compiler.nodes.calc.ZeroExtendNode类的一些代码示例,展示了ZeroExtendNode类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroExtendNode类的具体详情如下:
包路径:org.graalvm.compiler.nodes.calc.ZeroExtendNode
类名称:ZeroExtendNode

ZeroExtendNode介绍

[英]The ZeroExtendNode converts an integer to a wider integer using zero extension.
[中]ZeroExtendNode使用零扩展将整数转换为更宽的整数。

代码示例

代码示例来源:origin: org.graalvm.compiler/compiler

public static ValueNode create(ValueNode input, int inputBits, int resultBits, NodeView view) {
  return create(input, inputBits, resultBits, view, false);
}

代码示例来源:origin: org.graalvm.compiler/compiler

@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
  NodeView view = NodeView.from(tool);
  ValueNode ret = super.canonical(tool, forValue);
  if (ret != this) {
    return ret;
  }
  return canonical(this, forValue, getInputBits(), getResultBits(), view, inputAlwaysPositive);
}

代码示例来源:origin: org.graalvm.compiler/compiler

public static ValueNode create(ValueNode input, int inputBits, int resultBits, NodeView view, boolean alwaysPositive) {
  IntegerConvertOp<ZeroExtend> signExtend = ArithmeticOpTable.forStamp(input.stamp(view)).getZeroExtend();
  ValueNode synonym = findSynonym(signExtend, input, inputBits, resultBits, signExtend.foldStamp(inputBits, resultBits, input.stamp(view)));
  if (synonym != null) {
    return synonym;
  }
  return canonical(null, input, inputBits, resultBits, view, alwaysPositive);
}

代码示例来源:origin: org.graalvm.compiler/compiler

private static boolean applicableToImplicitZeroExtend(ZeroExtendNode zeroExtendNode) {
  return zeroExtendNode.isInputAlwaysPositive() && zeroExtendNode.getInputBits() == INT_BITS && zeroExtendNode.getResultBits() == ADDRESS_BITS;
}

代码示例来源:origin: org.graalvm.compiler/compiler

@Override
public void generate(NodeLIRBuilderTool nodeValueMap, ArithmeticLIRGeneratorTool gen) {
  nodeValueMap.setResult(this, gen.emitZeroExtend(nodeValueMap.operand(getValue()), getInputBits(), getResultBits()));
}

代码示例来源:origin: org.graalvm.compiler/compiler

return new ZeroExtendNode(other.getValue(), other.getInputBits(), resultBits, other.isInputAlwaysPositive());
      return create(narrow.getValue(), resultBits, view);
    } else if (istamp.getBits() > resultBits) {
self = new ZeroExtendNode(forValue, inputBits, resultBits, alwaysPositive);

代码示例来源:origin: org.graalvm.compiler/compiler

/**
 * @param compressible whether the convert should be compressible
 */
protected ValueNode implicitLoadConvert(JavaKind kind, ValueNode value, boolean compressible) {
  if (useCompressedOops(kind, compressible)) {
    return newCompressionNode(CompressionOp.Uncompress, value);
  }
  switch (kind) {
    case Byte:
    case Short:
      return new SignExtendNode(value, 32);
    case Boolean:
    case Char:
      return new ZeroExtendNode(value, 32);
  }
  return value;
}

代码示例来源:origin: org.graalvm.compiler/compiler

} else if (forValue instanceof ZeroExtendNode) {
  ZeroExtendNode other = (ZeroExtendNode) forValue;
  if (other.getResultBits() > other.getInputBits()) {
    return ZeroExtendNode.create(other.getValue(), other.getInputBits(), resultBits, view, other.isInputAlwaysPositive());
    return ZeroExtendNode.create(forValue, inputBits, resultBits, view, true);

代码示例来源:origin: org.graalvm.compiler/compiler

@Override
  public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
    // return (char) (Integer.reverse(i) >> 16);
    ReverseBytesNode reverse = b.add(new ReverseBytesNode(value));
    RightShiftNode rightShift = b.add(new RightShiftNode(reverse, b.add(ConstantNode.forInt(16))));
    ZeroExtendNode charCast = b.add(new ZeroExtendNode(b.add(new NarrowNode(rightShift, 16)), 32));
    b.push(JavaKind.Char, b.append(charCast.canonical(null)));
    return true;
  }
});

代码示例来源:origin: org.graalvm.compiler/compiler

return new ZeroExtendNode(other.getValue(), other.getInputBits(), getResultBits(), ((ZeroExtendNode) other).isInputAlwaysPositive());

代码示例来源:origin: org.graalvm.compiler/compiler

@MatchRule("(ZeroExtend Read=access)")
@MatchRule("(ZeroExtend FloatingRead=access)")
public ComplexMatchResult zeroExtend(ZeroExtendNode root, Access access) {
  return emitZeroExtendMemory(access, root.getInputBits(), root.getResultBits());
}

代码示例来源:origin: org.graalvm.compiler/compiler

/**
 * Given that Add(a, cst) is always positive, performs the following: ZeroExtend(Add(a, cst)) ->
 * Add(SignExtend(a), SignExtend(cst)).
 */
private static void optimizeAdd(ZeroExtendNode zeroExtendNode, ConstantNode constant, ValueNode other, LoopEx loop) {
  StructuredGraph graph = zeroExtendNode.graph();
  AddNode addNode = graph.unique(new AddNode(signExtend(other, loop), ConstantNode.forLong(constant.asJavaConstant().asInt(), graph)));
  zeroExtendNode.replaceAtUsages(addNode);
}

代码示例来源:origin: org.graalvm.compiler/compiler

private static ValueNode tryImplicitZeroExtend(ValueNode input) {
  if (input instanceof ZeroExtendNode) {
    ZeroExtendNode zeroExtendNode = (ZeroExtendNode) input;
    if (applicableToImplicitZeroExtend(zeroExtendNode)) {
      return zeroExtendNode.getValue();
    }
  }
  return input;
}

代码示例来源:origin: org.graalvm.compiler/compiler

@MatchRule("(ZeroExtend Read=access)")
@MatchRule("(ZeroExtend FloatingRead=access)")
public ComplexMatchResult zeroExtend(ZeroExtendNode root, LIRLowerableAccess access) {
  AMD64Kind memoryKind = getMemoryKind(access);
  return builder -> getArithmeticLIRGenerator().emitZeroExtendMemory(memoryKind, root.getResultBits(), (AMD64AddressValue) operand(access.getAddress()), getState(access));
}

代码示例来源:origin: com.oracle.substratevm/svm

@Override
  public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unused, ValueNode objectNode) {
    if (ReferenceAccess.singleton().haveCompressedReferences()) {
      ValueNode compressedObj = SubstrateCompressionNode.compress(objectNode, ImageSingletons.lookup(CompressEncoding.class));
      JavaKind compressedIntKind = JavaKind.fromWordSize(ConfigurationValues.getObjectLayout().getReferenceSize());
      ValueNode compressedValue = b.add(WordCastNode.narrowOopToUntrackedWord(compressedObj, compressedIntKind));
      b.addPush(JavaKind.Object, ZeroExtendNode.convertUnsigned(compressedValue, FrameAccess.getWordStamp(), NodeView.DEFAULT));
    } else {
      b.addPush(JavaKind.Object, WordCastNode.objectToUntrackedPointer(objectNode, FrameAccess.getWordKind()));
    }
    return true;
  }
});

代码示例来源:origin: org.graalvm.compiler/compiler

public ValueNode convert(GraphBuilderContext b, ValueNode value, JavaKind toKind, boolean unsigned) {
  if (value.getStackKind() == toKind) {
    return value;
  }
  if (toKind == JavaKind.Int) {
    assert value.getStackKind() == JavaKind.Long;
    return b.add(new NarrowNode(value, 32));
  } else {
    assert toKind == JavaKind.Long;
    assert value.getStackKind() == JavaKind.Int;
    if (unsigned) {
      return b.add(new ZeroExtendNode(value, 64));
    } else {
      return b.add(new SignExtendNode(value, 64));
    }
  }
}

代码示例来源:origin: org.graalvm.compiler/compiler

private static void tryOptimize(OffsetAddressNode offsetAddress, LoopEx loop) {
  EconomicMap<Node, InductionVariable> ivs = loop.getInductionVariables();
  InductionVariable currentIV = ivs.get(offsetAddress.getOffset());
  while (currentIV != null) {
    if (!(currentIV instanceof DerivedInductionVariable)) {
      break;
    }
    ValueNode currentValue = currentIV.valueNode();
    if (currentValue.isDeleted()) {
      break;
    }
    if (currentValue instanceof ZeroExtendNode) {
      ZeroExtendNode zeroExtendNode = (ZeroExtendNode) currentValue;
      if (applicableToImplicitZeroExtend(zeroExtendNode)) {
        ValueNode input = zeroExtendNode.getValue();
        if (input instanceof AddNode) {
          AddNode add = (AddNode) input;
          if (add.getX().isConstant()) {
            optimizeAdd(zeroExtendNode, (ConstantNode) add.getX(), add.getY(), loop);
          } else if (add.getY().isConstant()) {
            optimizeAdd(zeroExtendNode, (ConstantNode) add.getY(), add.getX(), loop);
          }
        }
      }
    }
    currentIV = ((DerivedInductionVariable) currentIV).getBase();
  }
}

代码示例来源:origin: org.graalvm.compiler/compiler

long shortestTrip = (extremum - init) / stride + 1;
  if (countedLoopInfo.constantMaxTripCount().equals(shortestTrip)) {
    return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, true));
      inductionVariable.direction() == InductionVariable.Direction.Up &&
      (countedLoopInfo.getOverFlowGuard() != null || countedLoopInfo.counterNeverOverflows())) {
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, true));

代码示例来源:origin: org.graalvm.compiler/compiler

protected ValueNode genZeroExtend(ValueNode input, int bitCount) {
  return ZeroExtendNode.create(input, bitCount, NodeView.DEFAULT);
}

代码示例来源:origin: com.oracle.substratevm/svm

return graph.unique(new NarrowNode(value, toBits));
} else if (isUnsigned) {
  return graph.unique(new ZeroExtendNode(value, toBits));
} else {
  return graph.unique(new SignExtendNode(value, toBits));

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com