java.lang.Object
net.covers1624.coffeegrinder.bytecode.transform.transformers.ConditionDetection
All Implemented Interfaces:
BlockTransformer, Transformer

public class ConditionDetection extends Object implements BlockTransformer
Created by covers1624 on 25/5/21.
  • Constructor Details

    • ConditionDetection

      public ConditionDetection()
  • Method Details

    • transform

      public void transform(Block block, BlockTransformContext ctx)
      Description copied from interface: BlockTransformer
      Runs the transform on the specified block.
      Specified by:
      transform in interface BlockTransformer
      Parameters:
      block - The block to transform.
      ctx - Additional context provided to the transform.
    • inlineExitBranch

      public static boolean inlineExitBranch(Block block, BlockTransformContext ctx)
      Only inlines branches that are strictly dominated by this block (incoming edge count == 1)
          ...; br nextBlock;
       ->
          ...; { nextBlock... }
       
      Parameters:
      block - The block.
      Returns:
      If the exit was inlined.
    • invertIf

      public static void invertIf(IfInstruction ifInsn, MethodTransformContext ctx)
      Invert an IfInstruction. Assumes the IfInstruction does not have an else block.
          if (cond) { then... }
          else...;
          exit;
       ->
          if (!cond) { else...; exit }
          then...;
       
      Parameters:
      ifInsn - The IfInstruction.
      ctx - The transform context.