llvm-project

Форк
0
/
MemorySizeDistributions.cpp 
204 строки · 6.3 Кб
1
#include "MemorySizeDistributions.h"
2

3
#include "llvm/Support/ErrorHandling.h"
4
#include "llvm/Support/raw_ostream.h"
5

6
namespace llvm {
7
namespace libc_benchmarks {
8

9
static constexpr double MemmoveGoogleA[] = {
10
#include "distributions/MemmoveGoogleA.csv"
11
};
12
static constexpr double MemmoveGoogleB[] = {
13
#include "distributions/MemmoveGoogleB.csv"
14
};
15
static constexpr double MemmoveGoogleD[] = {
16
#include "distributions/MemmoveGoogleD.csv"
17
};
18
static constexpr double MemmoveGoogleQ[] = {
19
#include "distributions/MemmoveGoogleQ.csv"
20
};
21
static constexpr double MemmoveGoogleL[] = {
22
#include "distributions/MemmoveGoogleL.csv"
23
};
24
static constexpr double MemmoveGoogleM[] = {
25
#include "distributions/MemmoveGoogleM.csv"
26
};
27
static constexpr double MemmoveGoogleS[] = {
28
#include "distributions/MemmoveGoogleS.csv"
29
};
30
static constexpr double MemmoveGoogleW[] = {
31
#include "distributions/MemmoveGoogleW.csv"
32
};
33
static constexpr double MemmoveGoogleU[] = {
34
#include "distributions/MemmoveGoogleU.csv"
35
};
36
static constexpr double MemcmpGoogleA[] = {
37
#include "distributions/MemcmpGoogleA.csv"
38
};
39
static constexpr double MemcmpGoogleB[] = {
40
#include "distributions/MemcmpGoogleB.csv"
41
};
42
static constexpr double MemcmpGoogleD[] = {
43
#include "distributions/MemcmpGoogleD.csv"
44
};
45
static constexpr double MemcmpGoogleQ[] = {
46
#include "distributions/MemcmpGoogleQ.csv"
47
};
48
static constexpr double MemcmpGoogleL[] = {
49
#include "distributions/MemcmpGoogleL.csv"
50
};
51
static constexpr double MemcmpGoogleM[] = {
52
#include "distributions/MemcmpGoogleM.csv"
53
};
54
static constexpr double MemcmpGoogleS[] = {
55
#include "distributions/MemcmpGoogleS.csv"
56
};
57
static constexpr double MemcmpGoogleW[] = {
58
#include "distributions/MemcmpGoogleW.csv"
59
};
60
static constexpr double MemcmpGoogleU[] = {
61
#include "distributions/MemcmpGoogleU.csv"
62
};
63
static constexpr double MemcpyGoogleA[] = {
64
#include "distributions/MemcpyGoogleA.csv"
65
};
66
static constexpr double MemcpyGoogleB[] = {
67
#include "distributions/MemcpyGoogleB.csv"
68
};
69
static constexpr double MemcpyGoogleD[] = {
70
#include "distributions/MemcpyGoogleD.csv"
71
};
72
static constexpr double MemcpyGoogleQ[] = {
73
#include "distributions/MemcpyGoogleQ.csv"
74
};
75
static constexpr double MemcpyGoogleL[] = {
76
#include "distributions/MemcpyGoogleL.csv"
77
};
78
static constexpr double MemcpyGoogleM[] = {
79
#include "distributions/MemcpyGoogleM.csv"
80
};
81
static constexpr double MemcpyGoogleS[] = {
82
#include "distributions/MemcpyGoogleS.csv"
83
};
84
static constexpr double MemcpyGoogleW[] = {
85
#include "distributions/MemcpyGoogleW.csv"
86
};
87
static constexpr double MemcpyGoogleU[] = {
88
#include "distributions/MemcpyGoogleU.csv"
89
};
90
static constexpr double MemsetGoogleA[] = {
91
#include "distributions/MemsetGoogleA.csv"
92
};
93
static constexpr double MemsetGoogleB[] = {
94
#include "distributions/MemsetGoogleB.csv"
95
};
96
static constexpr double MemsetGoogleD[] = {
97
#include "distributions/MemsetGoogleD.csv"
98
};
99
static constexpr double MemsetGoogleQ[] = {
100
#include "distributions/MemsetGoogleQ.csv"
101
};
102
static constexpr double MemsetGoogleL[] = {
103
#include "distributions/MemsetGoogleL.csv"
104
};
105
static constexpr double MemsetGoogleM[] = {
106
#include "distributions/MemsetGoogleM.csv"
107
};
108
static constexpr double MemsetGoogleS[] = {
109
#include "distributions/MemsetGoogleS.csv"
110
};
111
static constexpr double MemsetGoogleW[] = {
112
#include "distributions/MemsetGoogleW.csv"
113
};
114
static constexpr double MemsetGoogleU[] = {
115
#include "distributions/MemsetGoogleU.csv"
116
};
117
static constexpr double Uniform384To4096[] = {
118
#include "distributions/Uniform384To4096.csv"
119
};
120

121
ArrayRef<MemorySizeDistribution> getMemmoveSizeDistributions() {
122
  static constexpr MemorySizeDistribution kDistributions[] = {
123
      {"memmove Google A", MemmoveGoogleA},
124
      {"memmove Google B", MemmoveGoogleB},
125
      {"memmove Google D", MemmoveGoogleD},
126
      {"memmove Google L", MemmoveGoogleL},
127
      {"memmove Google M", MemmoveGoogleM},
128
      {"memmove Google Q", MemmoveGoogleQ},
129
      {"memmove Google S", MemmoveGoogleS},
130
      {"memmove Google U", MemmoveGoogleU},
131
      {"memmove Google W", MemmoveGoogleW},
132
      {"uniform 384 to 4096", Uniform384To4096},
133
  };
134
  return kDistributions;
135
}
136

137
ArrayRef<MemorySizeDistribution> getMemcpySizeDistributions() {
138
  static constexpr MemorySizeDistribution kDistributions[] = {
139
      {"memcpy Google A", MemcpyGoogleA},
140
      {"memcpy Google B", MemcpyGoogleB},
141
      {"memcpy Google D", MemcpyGoogleD},
142
      {"memcpy Google L", MemcpyGoogleL},
143
      {"memcpy Google M", MemcpyGoogleM},
144
      {"memcpy Google Q", MemcpyGoogleQ},
145
      {"memcpy Google S", MemcpyGoogleS},
146
      {"memcpy Google U", MemcpyGoogleU},
147
      {"memcpy Google W", MemcpyGoogleW},
148
      {"uniform 384 to 4096", Uniform384To4096},
149
  };
150
  return kDistributions;
151
}
152

153
ArrayRef<MemorySizeDistribution> getMemsetSizeDistributions() {
154
  static constexpr MemorySizeDistribution kDistributions[] = {
155
      {"memset Google A", MemsetGoogleA},
156
      {"memset Google B", MemsetGoogleB},
157
      {"memset Google D", MemsetGoogleD},
158
      {"memset Google L", MemsetGoogleL},
159
      {"memset Google M", MemsetGoogleM},
160
      {"memset Google Q", MemsetGoogleQ},
161
      {"memset Google S", MemsetGoogleS},
162
      {"memset Google U", MemsetGoogleU},
163
      {"memset Google W", MemsetGoogleW},
164
      {"uniform 384 to 4096", Uniform384To4096},
165
  };
166
  return kDistributions;
167
}
168

169
ArrayRef<MemorySizeDistribution> getMemcmpSizeDistributions() {
170
  static constexpr MemorySizeDistribution kDistributions[] = {
171
      {"memcmp Google A", MemcmpGoogleA},
172
      {"memcmp Google B", MemcmpGoogleB},
173
      {"memcmp Google D", MemcmpGoogleD},
174
      {"memcmp Google L", MemcmpGoogleL},
175
      {"memcmp Google M", MemcmpGoogleM},
176
      {"memcmp Google Q", MemcmpGoogleQ},
177
      {"memcmp Google S", MemcmpGoogleS},
178
      {"memcmp Google U", MemcmpGoogleU},
179
      {"memcmp Google W", MemcmpGoogleW},
180
      {"uniform 384 to 4096", Uniform384To4096},
181
  };
182
  return kDistributions;
183
}
184

185
MemorySizeDistribution
186
getDistributionOrDie(ArrayRef<MemorySizeDistribution> Distributions,
187
                     StringRef Name) {
188
  size_t Index = 0;
189
  for (const auto &MSD : Distributions) {
190
    if (MSD.Name == Name)
191
      return MSD;
192
    ++Index;
193
  }
194
  std::string Message;
195
  raw_string_ostream Stream(Message);
196
  Stream << "Unknown MemorySizeDistribution '" << Name
197
         << "', available distributions:\n";
198
  for (const auto &MSD : Distributions)
199
    Stream << "'" << MSD.Name << "'\n";
200
  report_fatal_error(Stream.str());
201
}
202

203
} // namespace libc_benchmarks
204
} // namespace llvm
205

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.