@@ -41,9 +41,26 @@ class VariableNameInferrer {
41
41
using Options = OptionSet<Flag>;
42
42
43
43
private:
44
- template <typename T, unsigned smallSize>
44
+ // / A two phase stack data structure. The first phase only allows for two
45
+ // / operations:
46
+ // /
47
+ // / 1. pushing elements onto the stack.
48
+ // / 2. pushing/popping a "snapshot" of the stack (see description below).
49
+ // /
50
+ // / The second phase only allows for the stack to be drained.
51
+ // /
52
+ // / DISCUSSION: The snapshot operation stashes the current size of the
53
+ // / variable name path array when the snapshot operation occurs. If one pops
54
+ // / the snapshot, the data structure sets its current insertion point to be
55
+ // / the old stack point effectively popping off all of the elements of the
56
+ // / stack until the last snapshot. This is useful when working with things
57
+ // / like phis where one wants to speculatively push items onto this stack
58
+ // / while discovering if one has an actual interesting value from the phi. If
59
+ // / one fails to find something interesting, then one can just pop the
60
+ // / snapshot and go process the next phi incoming value.
61
+ template <typename T, unsigned SmallSize>
45
62
class VariableNamePathArray {
46
- SmallVector<T, smallSize > data;
63
+ SmallVector<T, SmallSize > data;
47
64
48
65
unsigned lastSnapShotIndex = 0 ;
49
66
unsigned insertionPointIndex = 0 ;
0 commit comments