Class IRBuildHelper

java.lang.Object
pascal.taie.ir.IRBuildHelper

public class IRBuildHelper extends Object
Helper for building IR for a method from scratch. Given a JMethod, this helper automatically creates this variable (for instance method), parameters, and return variable (if method return type is not void) for the method.
  • Constructor Details

    • IRBuildHelper

      public IRBuildHelper(JMethod method)
  • Method Details

    • getThisVar

      public Var getThisVar()
      Returns:
      this variable of the IR being built.
      Throws:
      AssertionError - if the method is not an instance method.
    • getParam

      public Var getParam(int i)
    • getReturnVar

      public Var getReturnVar()
      Returns:
      the return variable of the IR being built.
    • newTempVar

      public Var newTempVar(Type type)
      Returns:
      a new temporary variable of given type.
    • newReturn

      public Return newReturn()
      Returns:
      a new return statement of the IR being built.
    • buildEmpty

      public IR buildEmpty()
      Builds an emtpy IR which contains only a Return statement.
    • build

      public IR build(List<Stmt> stmts)
      Builds an IR with given Stmts. This method sets the indexes of given Stmts, so client code does not need to set the indexes.
      Parameters:
      stmts - statements of the IR being built.