Package net.emustudio.edigen.passes
Class SplitVisitor
- java.lang.Object
-
- net.emustudio.edigen.Visitor
-
- net.emustudio.edigen.passes.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
intorlongsize.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 voidvisit(Mask mask)Saves the mask bits and removes the node.voidvisit(Pattern pattern)Saves the pattern bits and removes the node.voidvisit(Variant variant)Splits the mask and pattern and adds the split pieces to the variant.
-
-
-
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:
visitin classVisitor- Parameters:
variant- the variant node- Throws:
SemanticException- never
-
visit
public void visit(Mask mask)
Saves the mask bits and removes the node.
-
-