...
1
2
3
4
5 package pointer
6
7 import "go/types"
8
9 type constraint interface {
10
11
12 ptr() nodeid
13
14
15 renumber(mapping []nodeid)
16
17
18
19
20
21 presolve(h *hvn)
22
23
24
25 solve(a *analysis, delta *nodeset)
26
27 String() string
28 }
29
30
31
32
33 type addrConstraint struct {
34 dst nodeid
35 src nodeid
36 }
37
38 func (c *addrConstraint) ptr() nodeid { return c.dst }
39 func (c *addrConstraint) renumber(mapping []nodeid) {
40 c.dst = mapping[c.dst]
41 c.src = mapping[c.src]
42 }
43
44
45
46 type copyConstraint struct {
47 dst nodeid
48 src nodeid
49 }
50
51 func (c *copyConstraint) ptr() nodeid { return c.dst }
52 func (c *copyConstraint) renumber(mapping []nodeid) {
53 c.dst = mapping[c.dst]
54 c.src = mapping[c.src]
55 }
56
57
58
59 type loadConstraint struct {
60 offset uint32
61 dst nodeid
62 src nodeid
63 }
64
65 func (c *loadConstraint) ptr() nodeid { return c.src }
66 func (c *loadConstraint) renumber(mapping []nodeid) {
67 c.dst = mapping[c.dst]
68 c.src = mapping[c.src]
69 }
70
71
72
73 type storeConstraint struct {
74 offset uint32
75 dst nodeid
76 src nodeid
77 }
78
79 func (c *storeConstraint) ptr() nodeid { return c.dst }
80 func (c *storeConstraint) renumber(mapping []nodeid) {
81 c.dst = mapping[c.dst]
82 c.src = mapping[c.src]
83 }
84
85
86
87 type offsetAddrConstraint struct {
88 offset uint32
89 dst nodeid
90 src nodeid
91 }
92
93 func (c *offsetAddrConstraint) ptr() nodeid { return c.src }
94 func (c *offsetAddrConstraint) renumber(mapping []nodeid) {
95 c.dst = mapping[c.dst]
96 c.src = mapping[c.src]
97 }
98
99
100
101
102 type typeFilterConstraint struct {
103 typ types.Type
104 dst nodeid
105 src nodeid
106 }
107
108 func (c *typeFilterConstraint) ptr() nodeid { return c.src }
109 func (c *typeFilterConstraint) renumber(mapping []nodeid) {
110 c.dst = mapping[c.dst]
111 c.src = mapping[c.src]
112 }
113
114
115
116
117
118
119
120
121
122
123
124 type untagConstraint struct {
125 typ types.Type
126 dst nodeid
127 src nodeid
128 exact bool
129 }
130
131 func (c *untagConstraint) ptr() nodeid { return c.src }
132 func (c *untagConstraint) renumber(mapping []nodeid) {
133 c.dst = mapping[c.dst]
134 c.src = mapping[c.src]
135 }
136
137
138
139 type invokeConstraint struct {
140 method *types.Func
141 iface nodeid
142 params nodeid
143 }
144
145 func (c *invokeConstraint) ptr() nodeid { return c.iface }
146 func (c *invokeConstraint) renumber(mapping []nodeid) {
147 c.iface = mapping[c.iface]
148 c.params = mapping[c.params]
149 }
150
View as plain text