Class AbstractCElementOptimizer

All Implemented Interfaces:
IPlugin, ICOptimizer, IOptimizer<ICMethod>

public abstract class AbstractCElementOptimizer extends AbstractCBlockOptimizer
Specialized base optimizer for C elements. Each element contained in the AST method is provided to optimizeElement(ICElement, ICElement)

  • Constructor Details

    • AbstractCElementOptimizer

      public AbstractCElementOptimizer()
      Same as this(false).
    • AbstractCElementOptimizer

      public AbstractCElementOptimizer(boolean innerReplacement)
      Parameters:
      innerReplacement - if false, parent.replaceSubElement(elt, new_elt) will be called after a successful optimization (optimizeElement(ICElement, ICElement) returned non-null)
  • Method Details

    • optimizeBlock

      protected final int optimizeBlock(ICBlock b)
      Process the block. Sub-classes should not override the default implementation.
      Specified by:
      optimizeBlock in class AbstractCBlockOptimizer
      Parameters:
      b - a block of statements
      Returns:
      the number of optimizations done
    • optimizeElement

      protected abstract ICElement optimizeElement(ICElement e, ICElement parent)
      Optimize an element. Sub-classes must implement this method
      Parameters:
      e - input element to be optimized
      parent - the parent of the input element
      Returns:
      non-null if the element was optimized; null means it was not optimized (if innerReplacement=true was provided to the constructor, this return value, if non-null, must be the input element itself)