-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmemory_model.go
58 lines (52 loc) · 1.11 KB
/
memory_model.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
// Copyright (C) 2023 Huawei Technologies Co., Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
package checker
import "vsync/logger"
// MemoryModel is a set of constans identifying different memory models supported by some of the checkers.
//
//go:generate go run golang.org/x/tools/cmd/stringer -type=MemoryModel
type MemoryModel int
const (
// InvalidMemoryModel represents any unknown memory model
InvalidMemoryModel MemoryModel = iota
// TSO memory model
TSO
// ARM8 memory model
ARM8
// Power memory model
Power
// RiscV memory model
RiscV
// IMM memory model
IMM
// GIMM memory model
GIMM
// RC11 memory model
RC11
// VMM memory model
VMM
)
// ParseMemoryModel parses a string and returns an equivalent memory model identifier.
func ParseMemoryModel(mm string) MemoryModel {
logger.Debugf("parsing memory model '%s'", mm)
switch mm {
case "tso":
return TSO
case "arm8":
return ARM8
case "power":
return Power
case "riscv":
return RiscV
case "imm":
return IMM
case "gimm":
return GIMM
case "rc11":
return RC11
case "vmm":
return VMM
default:
return InvalidMemoryModel
}
}