-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathparams.go
68 lines (58 loc) · 1.17 KB
/
params.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// Copyright (c) 2020-2022 Markku Rossi
//
// All rights reserved.
//
package utils
import (
"io"
)
// Params specify compiler parameters.
type Params struct {
Verbose bool
Diagnostics bool
SSAOut io.WriteCloser
SSADotOut io.WriteCloser
// MaxVarBits specifies the maximum variable width in bits.
MaxVarBits int
// MaxLoopUnroll specifies the upper limit for loop unrolling.
MaxLoopUnroll int
NoCircCompile bool
CircOut io.WriteCloser
CircDotOut io.WriteCloser
CircSvgOut io.WriteCloser
CircFormat string
CircMultArrayTreshold int
OptPruneGates bool
}
// NewParams returns new compiler params object, initialized with the
// default values.
func NewParams() *Params {
return &Params{
MaxVarBits: 0x20000,
MaxLoopUnroll: 0x20000,
}
}
// Close closes all open resources.
func (p *Params) Close() {
if p.SSAOut != nil {
p.SSAOut.Close()
p.SSAOut = nil
}
if p.SSADotOut != nil {
p.SSADotOut.Close()
p.SSADotOut = nil
}
if p.CircOut != nil {
p.CircOut.Close()
p.CircOut = nil
}
if p.CircDotOut != nil {
p.CircDotOut.Close()
p.CircDotOut = nil
}
if p.CircSvgOut != nil {
p.CircSvgOut.Close()
p.CircSvgOut = nil
}
}