48 public:
49
50 // Machine-dependent definitions
51 #include CPU_HEADER(matcher)
52
53 // State and MStack class used in xform() and find_shared() iterative methods.
54 enum Node_State { Pre_Visit, // node has to be pre-visited
55 Visit, // visit node
56 Post_Visit, // post-visit node
57 Alt_Post_Visit // alternative post-visit path
58 };
59
60 class MStack: public Node_Stack {
61 public:
62 MStack(int size) : Node_Stack(size) { }
63
64 void push(Node *n, Node_State ns) {
65 Node_Stack::push(n, (uint)ns);
66 }
67 void push(Node *n, Node_State ns, Node *parent, int indx) {
68 ++_inode_top;
69 if ((_inode_top + 1) >= _inode_max) grow();
70 _inode_top->node = parent;
71 _inode_top->indx = (uint)indx;
72 ++_inode_top;
73 _inode_top->node = n;
74 _inode_top->indx = (uint)ns;
75 }
76 Node *parent() {
77 pop();
78 return node();
79 }
80 Node_State state() const {
81 return (Node_State)index();
82 }
83 void set_state(Node_State ns) {
84 set_index((uint)ns);
85 }
86 };
87
88 private:
89 // Private arena of State objects
90 ResourceArea _states_arena;
91
92 // Map old nodes to new nodes
93 Node_List _new_nodes;
94
|
48 public:
49
50 // Machine-dependent definitions
51 #include CPU_HEADER(matcher)
52
53 // State and MStack class used in xform() and find_shared() iterative methods.
54 enum Node_State { Pre_Visit, // node has to be pre-visited
55 Visit, // visit node
56 Post_Visit, // post-visit node
57 Alt_Post_Visit // alternative post-visit path
58 };
59
60 class MStack: public Node_Stack {
61 public:
62 MStack(int size) : Node_Stack(size) { }
63
64 void push(Node *n, Node_State ns) {
65 Node_Stack::push(n, (uint)ns);
66 }
67 void push(Node *n, Node_State ns, Node *parent, int indx) {
68 Node_Stack::push(parent, (uint)indx);
69 Node_Stack::push(n, (uint)ns);
70 }
71 Node *parent() {
72 pop();
73 return node();
74 }
75 Node_State state() const {
76 return (Node_State)index();
77 }
78 void set_state(Node_State ns) {
79 set_index((uint)ns);
80 }
81 };
82
83 private:
84 // Private arena of State objects
85 ResourceArea _states_arena;
86
87 // Map old nodes to new nodes
88 Node_List _new_nodes;
89
|