Class SplitVisitor


  • public class SplitVisitor
    extends Visitor
    A visitor which splits the patterns and mask into smaller pieces of the same length (max length is equal to decoder unit size).

    This is necessary to support instructions with variable length, especially instructions with length larger than int or long size.

    Expectation of a tree at input, e.g.:

       Rule
         Variant
         Mask (length > UNIT_SIZE_BITS)
         Pattern (length > UNIT_SIZE_BITS)
     

    Expectation of the tree at output:

       Rule
         Variant
           Mask (length = UNIT_SIZE_BITS)
             Pattern (length = UNIT_SIZE_BITS)
               ...
                 Mask (length <= UNIT_SIZE_BITS)
                   Pattern (length <= UNIT_SIZE_BITS)
     
    • Constructor Summary

      Constructors 
      Constructor Description
      SplitVisitor()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void visit​(Mask mask)
      Saves the mask bits and removes the node.
      void visit​(Pattern pattern)
      Saves the pattern bits and removes the node.
      void visit​(Variant variant)
      Splits the mask and pattern and adds the split pieces to the variant.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SplitVisitor

        public SplitVisitor()
    • Method Detail

      • visit

        public void visit​(Variant variant)
                   throws SemanticException
        Splits the mask and pattern and adds the split pieces to the variant.

        The nodes are placed "vertically" - each pattern is a child of the corresponding mask and each mask is a child of the previous pattern (or variant, if there is no previous pattern).

        In addition, starting positions of the masks are set.

        Overrides:
        visit in class Visitor
        Parameters:
        variant - the variant node
        Throws:
        SemanticException - never
      • visit

        public void visit​(Mask mask)
        Saves the mask bits and removes the node.
        Overrides:
        visit in class Visitor
        Parameters:
        mask - the mask node
      • visit

        public void visit​(Pattern pattern)
        Saves the pattern bits and removes the node.
        Overrides:
        visit in class Visitor
        Parameters:
        pattern - the pattern node