@@ -45,6 +45,18 @@ const (
45
45
gt
46
46
)
47
47
48
+ var relationStrings = [... ]string {
49
+ 0 : "none" , lt : "<" , eq : "==" , lt | eq : "<=" ,
50
+ gt : ">" , gt | lt : "!=" , gt | eq : ">=" , gt | eq | lt : "any" ,
51
+ }
52
+
53
+ func (r relation ) String () string {
54
+ if r < relation (len (relationStrings )) {
55
+ return relationStrings [r ]
56
+ }
57
+ return fmt .Sprintf ("relation(%d)" , uint (r ))
58
+ }
59
+
48
60
// domain represents the domain of a variable pair in which a set
49
61
// of relations is known. For example, relations learned for unsigned
50
62
// pairs cannot be transferred to signed pairs because the same bit
@@ -58,6 +70,30 @@ const (
58
70
boolean
59
71
)
60
72
73
+ var domainStrings = [... ]string {
74
+ "signed" , "unsigned" , "pointer" , "boolean" ,
75
+ }
76
+
77
+ func (d domain ) String () string {
78
+ s := ""
79
+ for i , ds := range domainStrings {
80
+ if d & (1 << uint (i )) != 0 {
81
+ if len (s ) != 0 {
82
+ s += "|"
83
+ }
84
+ s += ds
85
+ d &^= 1 << uint (i )
86
+ }
87
+ }
88
+ if d != 0 {
89
+ if len (s ) != 0 {
90
+ s += "|"
91
+ }
92
+ s += fmt .Sprintf ("0x%x" , uint (d ))
93
+ }
94
+ return s
95
+ }
96
+
61
97
type pair struct {
62
98
v , w * Value // a pair of values, ordered by ID.
63
99
// v can be nil, to mean the zero value.
0 commit comments