#include <trees.h>
Inheritance diagram for node:
Public Member Functions | |
node () | |
void * | operator new (unsigned int num_bytes) |
void * | operator new (unsigned int num_bytes, pool *mem_pool) |
void | set_name (node_name n) |
node_name | get_name (void) |
void | set_kid (node *kid) |
node * | get_kid (void) |
void | set_sib (node *s) |
node * | get_sib (void) |
uint | is_leaf (void) |
uint | is_nonleaf (void) |
node * | first_kid (void) |
node * | second_kid (void) |
node * | third_kid (void) |
node * | fourth_kid (void) |
node * | fifth_kid (void) |
virtual uint | get_kind (void) |
virtual void | set_const (pConst c) |
virtual const pConst | get_const (void) |
virtual void | set_type (pType t) |
virtual const pType | get_type (void) |
virtual void | set_sym (pSym s) |
virtual const pSym | get_sym (void) |
Private Attributes | |
node * | kids |
node * | sib |
uint | kid_cnt |
number of nodes down the "kids" chain | |
uint | name: 16 |
uint | td_rmark: 1 |
uint | td_rdonly: 1 |
uint | unused: 14 |
SRC_REF | sref |
This tree node is based on the trees developed by Peter Donovan and used in the Quickturn Verilog compiler. They have proven to be fast and easy to manage, but they take some getting used to.
The "kids" pointer points to the first child of the current node. The "sib" pointer points to the next "sibling" child. For example, in the tree shown below, the kids pointer would point to "A". Since "+" has no siblings in the tree shown, the "sib" node of "+" would be NULL. The sibling node of "A" would point to "B".
+ / \ / \ A B
+ / \ / kids NULL \ A / sib / \ B NULLA call like "foo( a, b + c, d, e)" would have the structure shown below (here the right pointer is the "kids" pointer and the left pointer is the "sib" pointer).
foo / \ NULL a / \ + / \ d b / / e cThis scheme for representing trees has several advantages: children can be easily added by simply inserting them into the sibling list; trees with more than two children can be easily represented and a field that reflects the number of children is not required.
Notes:
kid_cnt
kid_cnt is 32-bits to accomodate large statement lists. For example, one of the children of a process would be a block, containing a statement list. The kid_cnt of the block node will be the number of statements in the list. In an HDL its possible for this to be very large, since automaticly generated VHDL may be encountered.
Definition at line 105 of file trees.h.
|
Definition at line 120 of file trees.h. References FALSE, kids, name, NULL, sib, td_rdonly, and td_rmark.
|
|
Definition at line 158 of file trees.h. References get_sib(), and kids.
|
|
Definition at line 154 of file trees.h. References kids.
00154 { return kids; } |
|
Definition at line 157 of file trees.h. References get_sib(), and kids.
|
|
Reimplemented in node_const. Definition at line 170 of file trees.h. References NULL.
00171 { 00172 return NULL; 00173 } |
|
Definition at line 145 of file trees.h. References kids.
00145 { return kids; } |
|
Reimplemented in node_const, node_type, and node_sym. Definition at line 161 of file trees.h. References nd_bad_node, and uint.
00161 { return nd_bad_node; } |
|
Definition at line 142 of file trees.h. References name.
00142 { return name; } |
|
Definition at line 148 of file trees.h. References sib. Referenced by fifth_kid(), fourth_kid(), second_kid(), and third_kid().
00148 { return sib; } |
|
Reimplemented in node_sym. Definition at line 192 of file trees.h. References NULL.
00193 { 00194 return NULL; 00195 } |
|
Reimplemented in node_type. Definition at line 181 of file trees.h. References NULL.
00182 { 00183 return NULL; 00184 } |
|
Definition at line 151 of file trees.h. References kids, NULL, and uint.
|
|
Definition at line 152 of file trees.h. References kids, NULL, and uint.
|
|
Definition at line 136 of file trees.h. References pool::GetMem().
00137 { 00138 return mem_pool->GetMem( num_bytes ); 00139 } |
|
Definition at line 130 of file trees.h.
00131 { 00132 assert( FALSE ); 00133 return NULL; 00134 } |
|
Definition at line 155 of file trees.h. References get_sib(), and kids.
|
|
Reimplemented in node_const. Definition at line 166 of file trees.h. References FALSE.
00167 { 00168 assert( FALSE ); 00169 } |
|
Definition at line 144 of file trees.h. References kids.
00144 { kids = kid; } |
|
Definition at line 141 of file trees.h. References name.
00141 { name = n; } |
|
Definition at line 147 of file trees.h. References sib.
00147 { sib = s; }; |
|
Reimplemented in node_sym. Definition at line 188 of file trees.h. References FALSE.
00189 { 00190 assert( FALSE ); 00191 } |
|
Reimplemented in node_type. Definition at line 177 of file trees.h. References FALSE.
00178 { 00179 assert( FALSE ); 00180 } |
|
Definition at line 156 of file trees.h. References get_sib(), and kids.
|
|
number of nodes down the "kids" chain
|
|
Definition at line 107 of file trees.h. Referenced by fifth_kid(), first_kid(), fourth_kid(), get_kid(), is_leaf(), is_nonleaf(), node(), second_kid(), set_kid(), and third_kid(). |
|
Definition at line 112 of file trees.h. Referenced by get_name(), node(), and set_name(). |
|
|
|
|
|
Definition at line 112 of file trees.h. Referenced by node(). |
|
Definition at line 112 of file trees.h. Referenced by node(). |
|
|