File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 3
3
4
4
# Folder util
5
5
6
- \author Martin Brain
6
+ \author Martin Brain, Owen Jones
7
7
8
8
\section data_structures Data Structures
9
9
@@ -82,6 +82,19 @@ recurse on the expression on either side.
82
82
[ ^ 2 ] : Unless ` USE_STD_STRING ` is set, this is actually
83
83
a ` dstring ` and thus an integer which is a reference into a string table
84
84
85
+ \subsection irep_idt Irep_idt and Dstringt
86
+
87
+ Inside ` irept ` s, strings are stored as ` irep_idt ` s, or ` irep_namet ` s for
88
+ keys to ` named_sub ` or ` comments ` . If ` USE_STD_STRING ` is set then both
89
+ ` irep_idt ` and ` irep_namet ` are ` typedef ` ed to ` std::string ` , but by default
90
+ it is not set and they are ` typedef ` ed to ` dstringt ` . ` dstringt ` has one
91
+ field, an unsigned integer which is an index into a static table of strings.
92
+ This makes it expensive to create a new string (because you have to look
93
+ through the whole table to see if it is already there, and add it if it
94
+ isn't) but very cheap to compare strings (just compare the two integers). It
95
+ also means that when you have lots of copies of the same string you only have
96
+ to store the whole string once, which saves space.
97
+
85
98
\dot
86
99
digraph G {
87
100
node [ shape=box] ;
You can’t perform that action at this time.
0 commit comments