java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.ir.compiler.Util

public class Util extends Object
Utility routines to build IR templates.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Calculate and cache derived properties for a template tree.
    static Leaf
    L(int id)
    Create a leaf node matching everything (terminals and non-terminals alike, of any bitsize).
    static Leaf
    L(int id, int bitsize)
    Create a leaf node matching terminals and non-terminals of the provided bitsize.
    static Leaf
    L(int id, int bitsize, int flags, INodeHandler customHandler)
    Create a leaf node.
    static Leaf
    LC(long value)
    Create a leaf node matching a given immediate, regardless of its bitsize.
    static Leaf
    LC(long value, int bitsize)
    Create a leaf node matching a given immediate with an explicit bitsize.
    static Leaf
    LC(long value, int bitsize, int id)
    Create a leaf node matching a given immediate with an explicit bitsize.
    static Leaf
    LI(int id)
    Create a leaf node matching immediates only.
    static Leaf
    LIV(int id)
    Create a leaf node matching immediates and variables only.
    static Leaf
    LT(int id)
    Create a leaf node matching all terminals, but terminals only.
    static Leaf
    LV(int id)
    Create a leaf node matching variables only.
    static Node
    N(OGroup opgrp, INode... operands)
    Create an operator-group node.
    static Node
    N(O operator, INode... operands)
    Create an operator node.
    SD(INode pattern, INode replacement)
    Create a substitution definition.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • N

      public static Node N(O operator, INode... operands)
      Create an operator node.
      Parameters:
      operator - operator to match
      operands - child template nodes
      Returns:
      the created node
    • N

      public static Node N(OGroup opgrp, INode... operands)
      Create an operator-group node.
      Parameters:
      opgrp - operator group to match
      operands - child template nodes
      Returns:
      the created node
    • L

      public static Leaf L(int id, int bitsize, int flags, INodeHandler customHandler)
      Create a leaf node.
      Parameters:
      id - leaf id
      bitsize - required bitsize, or 0 for any
      flags - leaf matching flags
      customHandler - optional custom matching handler
      Returns:
      the created leaf
    • L

      public static Leaf L(int id)
      Create a leaf node matching everything (terminals and non-terminals alike, of any bitsize).
      Parameters:
      id - leaf id
      Returns:
      the created leaf
    • L

      public static Leaf L(int id, int bitsize)
      Create a leaf node matching terminals and non-terminals of the provided bitsize.
      Parameters:
      id - leaf id
      bitsize - required bitsize
      Returns:
      the created leaf
    • LT

      public static Leaf LT(int id)
      Create a leaf node matching all terminals, but terminals only.
      Parameters:
      id - leaf id
      Returns:
      the created leaf
    • LI

      public static Leaf LI(int id)
      Create a leaf node matching immediates only.
      Parameters:
      id - leaf id
      Returns:
      the created leaf
    • LV

      public static Leaf LV(int id)
      Create a leaf node matching variables only.
      Parameters:
      id - leaf id
      Returns:
      the created leaf
    • LIV

      public static Leaf LIV(int id)
      Create a leaf node matching immediates and variables only.
      Parameters:
      id - leaf id
      Returns:
      the created leaf
    • LC

      public static Leaf LC(long value, int bitsize, int id)
      Create a leaf node matching a given immediate with an explicit bitsize.
      Parameters:
      value - immediate value
      bitsize - required bitsize
      id - leaf id
      Returns:
      the created leaf
    • LC

      public static Leaf LC(long value, int bitsize)
      Create a leaf node matching a given immediate with an explicit bitsize.
      Parameters:
      value - immediate value
      bitsize - required bitsize
      Returns:
      the created leaf
    • LC

      public static Leaf LC(long value)
      Create a leaf node matching a given immediate, regardless of its bitsize.
      Parameters:
      value - immediate value
      Returns:
      the created leaf
    • SD

      public static SubstitutionDefinition SD(INode pattern, INode replacement)
      Create a substitution definition.
      Parameters:
      pattern - source pattern
      replacement - replacement pattern
      Returns:
      the substitution definition
    • calculateProperties

      public static void calculateProperties(INode root)
      Calculate and cache derived properties for a template tree.
      Parameters:
      root - root node