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

public class DPatternCompiler extends Object
IR expression pattern compiler. (Do not confuse this class with the IR compiler!)

This compiler takes a pattern as a string and compiles it to a pattern. A pattern is essentially is a template tree.

Rules: see DPatternCompiler.DPattern.

  • Field Details

    • FLAG_NO_VARIABLE_LEAF_OVERLAP

      public static final int FLAG_NO_VARIABLE_LEAF_OVERLAP
      This flag is used to indicate that input patterns leaves matching EVar should not map to overlapped IR elements.

      Example:

       Pattern: V0 = V1
       IR:      r5 = r5
       
      If this flag is specified, the pattern will not match on the IR since leaves ids 0 and 1 would map to the same underlying IR EVar r5.
      See Also:
    • FLAG_SAME_BITSIZE_FOR_LEAVES

      public static final int FLAG_SAME_BITSIZE_FOR_LEAVES
      This flag indicates that all leaves in the input pattern must have the same bitsize.

      If some leaves in the pattern have specified (required) bitsizes, then those bitsizes must be the same and other leaves with unspecified bitsizes must have that same bitsize as well, else matching will fail.

      See Also:
    • FLAG_INVALIDATE_DFA

      public static final int FLAG_INVALIDATE_DFA
      This client-side flag indicates that a successfully generated output (replacing a matched input) should be followed by the invalidation of all data-flow analysis.

      This flag is not honored by the matcher. It is up to the client to take action and honor this flag on a successful matching.

      See Also:
    • DEFAULT_COMPILER

      public static final DPatternCompiler DEFAULT_COMPILER
      A static pattern compiler using default settings (no flags).
  • Constructor Details

    • DPatternCompiler

      public DPatternCompiler(int flags)
      Create a pattern compiler.
      Parameters:
      flags - compiler flags
    • DPatternCompiler

      public DPatternCompiler()
      Create a pattern compiler using default settings.
  • Method Details

    • getFlags

      public int getFlags()
      Retrieve the compiler flags.
      Returns:
      the compiler flags
    • compile

      Compile an IR pattern.
      Parameters:
      pattern - a non-compiled pattern; attempting to compile an already-compiled pattern will raise an IllegalStateException
      Returns:
      this pattern, compiled