-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.go
44 lines (39 loc) · 1.04 KB
/
example.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
// Copyright (c) 2020-2021 C4 Project
//
// This file is part of c4t.
// Licenced under the MIT licence; see `LICENSE`.
package compiler
import (
"github.com/c4-project/c4t/internal/id"
"github.com/c4-project/c4t/internal/model/service/compiler/optlevel"
)
// MockPower9GCCOpt produces a GCC-compatible instance with Power9 architecture and optimisation configuration.
func MockPower9GCCOpt() Instance {
return Instance{
Compiler: Compiler{
Style: id.CStyleGCC,
Arch: id.ArchPPCPOWER9,
Opt: &optlevel.Selection{
Enabled: []string{"1", "2", "3"},
Disabled: []string{"fast"},
},
},
}
}
// MockX86Gcc produces a GCC-compatible instance with X86 architecture.
func MockX86Gcc() Instance {
return Instance{
Compiler: Compiler{
Style: id.CStyleGCC,
Arch: id.ArchX86,
},
}
}
// MockSet produces a mock compiler set.
func MockSet() map[id.ID]Instance {
// These names line up with those in the example corpus.
return map[id.ID]Instance{
id.FromString("gcc"): MockPower9GCCOpt(),
id.FromString("clang"): MockX86Gcc(),
}
}