< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGeneratorTool.java

Print this page
rev 52509 : [mq]: graal


  43 import jdk.vm.ci.code.CodeCacheProvider;
  44 import jdk.vm.ci.code.Register;
  45 import jdk.vm.ci.code.RegisterAttributes;
  46 import jdk.vm.ci.code.RegisterConfig;
  47 import jdk.vm.ci.code.TargetDescription;
  48 import jdk.vm.ci.code.ValueKindFactory;
  49 import jdk.vm.ci.meta.AllocatableValue;
  50 import jdk.vm.ci.meta.Constant;
  51 import jdk.vm.ci.meta.JavaConstant;
  52 import jdk.vm.ci.meta.JavaKind;
  53 import jdk.vm.ci.meta.MetaAccessProvider;
  54 import jdk.vm.ci.meta.PlatformKind;
  55 import jdk.vm.ci.meta.Value;
  56 import jdk.vm.ci.meta.ValueKind;
  57 
  58 public interface LIRGeneratorTool extends DiagnosticLIRGeneratorTool, ValueKindFactory<LIRKind> {
  59 
  60     /**
  61      * Factory for creating moves.
  62      */
  63     public interface MoveFactory {
  64 
  65         /**
  66          * Checks whether the supplied constant can be used without loading it into a register for
  67          * most operations, i.e., for commonly used arithmetic, logical, and comparison operations.
  68          *
  69          * @param c The constant to check.
  70          * @return True if the constant can be used directly, false if the constant needs to be in a
  71          *         register.
  72          */
  73         boolean canInlineConstant(Constant c);
  74 
  75         /**
  76          * @param constant The constant that might be moved to a stack slot.
  77          * @return {@code true} if constant to stack moves are supported for this constant.
  78          */
  79         boolean allowConstantToStackMove(Constant constant);
  80 
  81         LIRInstruction createMove(AllocatableValue result, Value input);
  82 
  83         LIRInstruction createStackMove(AllocatableValue result, AllocatableValue input);


 244 
 245     void emitOverflowCheckBranch(LabelRef overflow, LabelRef noOverflow, LIRKind cmpKind, double overflowProbability);
 246 
 247     void emitIntegerTestBranch(Value left, Value right, LabelRef trueDestination, LabelRef falseDestination, double trueSuccessorProbability);
 248 
 249     Variable emitConditionalMove(PlatformKind cmpKind, Value leftVal, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue);
 250 
 251     Variable emitIntegerTestMove(Value leftVal, Value right, Value trueValue, Value falseValue);
 252 
 253     void emitStrategySwitch(JavaConstant[] keyConstants, double[] keyProbabilities, LabelRef[] keyTargets, LabelRef defaultTarget, Variable value);
 254 
 255     void emitStrategySwitch(SwitchStrategy strategy, Variable key, LabelRef[] keyTargets, LabelRef defaultTarget);
 256 
 257     Variable emitByteSwap(Value operand);
 258 
 259     @SuppressWarnings("unused")
 260     default Variable emitArrayCompareTo(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length1, Value length2) {
 261         throw GraalError.unimplemented("String.compareTo substitution is not implemented on this architecture");
 262     }
 263 
 264     Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length);
 265 
 266     @SuppressWarnings("unused")
 267     default Variable emitStringIndexOf(Value sourcePointer, Value sourceCount, Value targetPointer, Value targetCount, int constantTargetCount) {
 268         throw GraalError.unimplemented("String.indexOf substitution is not implemented on this architecture");
 269     }
 270 










 271     @SuppressWarnings("unused")
 272     default Variable emitArrayIndexOf(JavaKind kind, Value sourcePointer, Value sourceCount, Value charValue) {
 273         throw GraalError.unimplemented("String.indexOf substitution is not implemented on this architecture");





 274     }
 275 
 276     void emitBlackhole(Value operand);
 277 
 278     LIRKind getLIRKind(Stamp stamp);
 279 
 280     void emitPause();
 281 
 282     void emitPrefetchAllocate(Value address);
 283 
 284     Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 285 
 286     Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 287 
 288     default void emitConvertNullToZero(AllocatableValue result, Value input) {
 289         emitMove(result, input);
 290     }
 291 
 292     default void emitConvertZeroToNull(AllocatableValue result, Value input) {
 293         emitMove(result, input);
 294     }






 295 }


  43 import jdk.vm.ci.code.CodeCacheProvider;
  44 import jdk.vm.ci.code.Register;
  45 import jdk.vm.ci.code.RegisterAttributes;
  46 import jdk.vm.ci.code.RegisterConfig;
  47 import jdk.vm.ci.code.TargetDescription;
  48 import jdk.vm.ci.code.ValueKindFactory;
  49 import jdk.vm.ci.meta.AllocatableValue;
  50 import jdk.vm.ci.meta.Constant;
  51 import jdk.vm.ci.meta.JavaConstant;
  52 import jdk.vm.ci.meta.JavaKind;
  53 import jdk.vm.ci.meta.MetaAccessProvider;
  54 import jdk.vm.ci.meta.PlatformKind;
  55 import jdk.vm.ci.meta.Value;
  56 import jdk.vm.ci.meta.ValueKind;
  57 
  58 public interface LIRGeneratorTool extends DiagnosticLIRGeneratorTool, ValueKindFactory<LIRKind> {
  59 
  60     /**
  61      * Factory for creating moves.
  62      */
  63     interface MoveFactory {
  64 
  65         /**
  66          * Checks whether the supplied constant can be used without loading it into a register for
  67          * most operations, i.e., for commonly used arithmetic, logical, and comparison operations.
  68          *
  69          * @param c The constant to check.
  70          * @return True if the constant can be used directly, false if the constant needs to be in a
  71          *         register.
  72          */
  73         boolean canInlineConstant(Constant c);
  74 
  75         /**
  76          * @param constant The constant that might be moved to a stack slot.
  77          * @return {@code true} if constant to stack moves are supported for this constant.
  78          */
  79         boolean allowConstantToStackMove(Constant constant);
  80 
  81         LIRInstruction createMove(AllocatableValue result, Value input);
  82 
  83         LIRInstruction createStackMove(AllocatableValue result, AllocatableValue input);


 244 
 245     void emitOverflowCheckBranch(LabelRef overflow, LabelRef noOverflow, LIRKind cmpKind, double overflowProbability);
 246 
 247     void emitIntegerTestBranch(Value left, Value right, LabelRef trueDestination, LabelRef falseDestination, double trueSuccessorProbability);
 248 
 249     Variable emitConditionalMove(PlatformKind cmpKind, Value leftVal, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue);
 250 
 251     Variable emitIntegerTestMove(Value leftVal, Value right, Value trueValue, Value falseValue);
 252 
 253     void emitStrategySwitch(JavaConstant[] keyConstants, double[] keyProbabilities, LabelRef[] keyTargets, LabelRef defaultTarget, Variable value);
 254 
 255     void emitStrategySwitch(SwitchStrategy strategy, Variable key, LabelRef[] keyTargets, LabelRef defaultTarget);
 256 
 257     Variable emitByteSwap(Value operand);
 258 
 259     @SuppressWarnings("unused")
 260     default Variable emitArrayCompareTo(JavaKind kind1, JavaKind kind2, Value array1, Value array2, Value length1, Value length2) {
 261         throw GraalError.unimplemented("String.compareTo substitution is not implemented on this architecture");
 262     }
 263 
 264     Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers);
 265 
 266     @SuppressWarnings("unused")
 267     default Variable emitArrayIndexOf(JavaKind kind, boolean findTwoConsecutive, Value sourcePointer, Value sourceCount, Value... searchValues) {
 268         throw GraalError.unimplemented("String.indexOf substitution is not implemented on this architecture");
 269     }
 270 
 271     /*
 272      * The routines emitStringLatin1Inflate/3 and emitStringUTF16Compress/3 models a simplified
 273      * version of
 274      *
 275      * emitStringLatin1Inflate(Value src, Value src_ndx, Value dst, Value dst_ndx, Value len) and
 276      * emitStringUTF16Compress(Value src, Value src_ndx, Value dst, Value dst_ndx, Value len)
 277      *
 278      * respectively, where we have hoisted the offset address computations in a method replacement
 279      * snippet.
 280      */
 281     @SuppressWarnings("unused")
 282     default void emitStringLatin1Inflate(Value src, Value dst, Value len) {
 283         throw GraalError.unimplemented("StringLatin1.inflate substitution is not implemented on this architecture");
 284     }
 285 
 286     @SuppressWarnings("unused")
 287     default Variable emitStringUTF16Compress(Value src, Value dst, Value len) {
 288         throw GraalError.unimplemented("StringUTF16.compress substitution is not implemented on this architecture");
 289     }
 290 
 291     void emitBlackhole(Value operand);
 292 
 293     LIRKind getLIRKind(Stamp stamp);
 294 
 295     void emitPause();
 296 
 297     void emitPrefetchAllocate(Value address);
 298 
 299     Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 300 
 301     Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull);
 302 
 303     default void emitConvertNullToZero(AllocatableValue result, Value input) {
 304         emitMove(result, input);
 305     }
 306 
 307     default void emitConvertZeroToNull(AllocatableValue result, Value input) {
 308         emitMove(result, input);
 309     }
 310 
 311     /**
 312      * Emits an instruction that prevents speculative execution from proceeding: no instruction
 313      * after this fence will execute until all previous instructions have retired.
 314      */
 315     void emitSpeculationFence();
 316 }
< prev index next >