CIRCT 23.0.0git
Loading...
Searching...
No Matches
ImportVerilog.cpp
Go to the documentation of this file.
1//===- ImportVerilog.cpp - Slang Verilog frontend integration -------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This implements bridging from the slang Verilog frontend to CIRCT dialects.
10//
11//===----------------------------------------------------------------------===//
12
19#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
20#include "mlir/IR/Diagnostics.h"
21#include "mlir/IR/Verifier.h"
22#include "mlir/Pass/PassManager.h"
23#include "mlir/Support/Timing.h"
24#include "mlir/Tools/mlir-translate/Translation.h"
25#include "mlir/Transforms/Passes.h"
26#include "llvm/ADT/Hashing.h"
27#include "llvm/Support/SourceMgr.h"
28
29#include "slang/analysis/AnalysisManager.h"
30#include "slang/diagnostics/DiagnosticClient.h"
31#include "slang/driver/Driver.h"
32#include "slang/parsing/Preprocessor.h"
33#include "slang/syntax/SyntaxPrinter.h"
34#include "slang/util/VersionInfo.h"
35
36using namespace mlir;
37using namespace circt;
38using namespace ImportVerilog;
39
40using llvm::SourceMgr;
41
43 std::string buffer;
44 llvm::raw_string_ostream os(buffer);
45 os << "slang version ";
46 os << slang::VersionInfo::getMajor() << ".";
47 os << slang::VersionInfo::getMinor() << ".";
48 os << slang::VersionInfo::getPatch() << "+";
49 os << slang::VersionInfo::getHash();
50 return buffer;
51}
52
53//===----------------------------------------------------------------------===//
54// Diagnostics
55//===----------------------------------------------------------------------===//
56
57/// Convert a slang `SourceLocation` to an MLIR `Location`.
58static Location convertLocation(MLIRContext *context,
59 const slang::SourceManager &sourceManager,
60 slang::SourceLocation loc) {
61 if (loc && loc.buffer() != slang::SourceLocation::NoLocation.buffer()) {
62 auto fileName = sourceManager.getFileName(loc);
63 auto line = sourceManager.getLineNumber(loc);
64 auto column = sourceManager.getColumnNumber(loc);
65 return FileLineColLoc::get(context, fileName, line, column);
66 }
67 return UnknownLoc::get(context);
68}
69
70/// Convert a slang `SourceRange` to an MLIR `Location`.
71static Location convertLocation(MLIRContext *context,
72 const slang::SourceManager &sourceManager,
73 slang::SourceRange range) {
74 auto start = range.start();
75 auto end = range.end();
76 if (start && start.buffer() != slang::SourceLocation::NoLocation.buffer()) {
77 auto fileName = sourceManager.getFileName(start);
78 auto startLine = sourceManager.getLineNumber(start);
79 auto startColumn = sourceManager.getColumnNumber(start);
80 if (end && end.buffer() == start.buffer()) {
81 auto endLine = sourceManager.getLineNumber(end);
82 auto endColumn = sourceManager.getColumnNumber(end);
83 return FileLineColRange::get(context, fileName, startLine, startColumn,
84 endLine, endColumn);
85 }
86 return FileLineColLoc::get(context, fileName, startLine, startColumn);
87 }
88 return UnknownLoc::get(context);
89}
90
91Location Context::convertLocation(slang::SourceLocation loc) {
92 return ::convertLocation(getContext(), sourceManager, loc);
93}
94
95Location Context::convertLocation(slang::SourceRange range) {
96 return ::convertLocation(getContext(), sourceManager, range);
97}
98
99namespace {
100/// A converter that can be plugged into a slang `DiagnosticEngine` as a client
101/// that will map slang diagnostics to their MLIR counterpart and emit them.
102class MlirDiagnosticClient : public slang::DiagnosticClient {
103public:
104 MlirDiagnosticClient(MLIRContext *context) : context(context) {}
105
106 void report(const slang::ReportedDiagnostic &diag) override {
107 // Generate the primary MLIR diagnostic.
108 auto &diagEngine = context->getDiagEngine();
109 Location loc = !diag.ranges.empty() ? convertLocation(diag.ranges[0])
110 : convertLocation(diag.location);
111
112 auto mlirDiag = diagEngine.emit(loc, getSeverity(diag.severity));
113 mlirDiag << diag.formattedMessage;
114
115 // Append the name of the option that can be used to control this
116 // diagnostic.
117 auto optionName = engine->getOptionName(diag.originalDiagnostic.code);
118 if (!optionName.empty())
119 mlirDiag << " [-W" << optionName << "]";
120
121 // Write out macro expansions, if we have any, in reverse order.
122 for (auto loc : std::views::reverse(diag.expansionLocs)) {
123 auto &note = mlirDiag.attachNote(
124 convertLocation(sourceManager->getFullyOriginalLoc(loc)));
125 auto macroName = sourceManager->getMacroName(loc);
126 if (macroName.empty())
127 note << "expanded from here";
128 else
129 note << "expanded from macro '" << macroName << "'";
130 }
131
132 // Write out the include stack.
133 slang::SmallVector<slang::SourceLocation> includeStack;
134 getIncludeStack(diag.location.buffer(), includeStack);
135 for (auto &loc : std::views::reverse(includeStack))
136 mlirDiag.attachNote(convertLocation(loc)) << "included from here";
137 }
138
139 /// Convert a slang `SourceLocation` to an MLIR `Location`.
140 Location convertLocation(slang::SourceLocation loc) const {
141 return ::convertLocation(context, *sourceManager, loc);
142 }
143
144 /// Convert a slang `SourceRange` to an MLIR `Location`.
145 Location convertLocation(slang::SourceRange range) const {
146 return ::convertLocation(context, *sourceManager, range);
147 }
148
149 static DiagnosticSeverity getSeverity(slang::DiagnosticSeverity severity) {
150 switch (severity) {
151 case slang::DiagnosticSeverity::Fatal:
152 case slang::DiagnosticSeverity::Error:
153 return DiagnosticSeverity::Error;
154 case slang::DiagnosticSeverity::Warning:
155 return DiagnosticSeverity::Warning;
156 case slang::DiagnosticSeverity::Ignored:
157 case slang::DiagnosticSeverity::Note:
158 return DiagnosticSeverity::Remark;
159 }
160 llvm_unreachable("all slang diagnostic severities should be handled");
161 return DiagnosticSeverity::Error;
162 }
163
164private:
165 MLIRContext *context;
166};
167} // namespace
168
169// Allow for `slang::BufferID` to be used as hash map keys.
170namespace llvm {
171template <>
172struct DenseMapInfo<slang::BufferID> {
173 static unsigned getHashValue(slang::BufferID id) {
174 return llvm::hash_value(id.getId());
175 }
176 static bool isEqual(slang::BufferID a, slang::BufferID b) { return a == b; }
177};
178} // namespace llvm
179
180//===----------------------------------------------------------------------===//
181// Driver
182//===----------------------------------------------------------------------===//
183
184namespace {
185const static ImportVerilogOptions defaultOptions;
186
187struct ImportDriver {
188 ImportDriver(MLIRContext *mlirContext, TimingScope &ts,
189 const ImportVerilogOptions *options)
190 : mlirContext(mlirContext), ts(ts),
191 options(options ? *options : defaultOptions) {}
192
193 LogicalResult prepareDriver(SourceMgr &sourceMgr);
194 LogicalResult importVerilog(ModuleOp module);
195 LogicalResult preprocessVerilog(llvm::raw_ostream &os);
196
197 MLIRContext *mlirContext;
198 TimingScope &ts;
199 const ImportVerilogOptions &options;
200
201 // Use slang's driver which conveniently packages a lot of the things we
202 // need for compilation.
203 slang::driver::Driver driver;
204};
205} // namespace
206
207/// Populate the Slang driver with source files from the given `sourceMgr`, and
208/// configure driver options based on the `ImportVerilogOptions` passed to the
209/// `ImportDriver` constructor.
210LogicalResult ImportDriver::prepareDriver(SourceMgr &sourceMgr) {
211 // Use slang's driver which conveniently packages a lot of the things we
212 // need for compilation.
213 auto diagClient = std::make_shared<MlirDiagnosticClient>(mlirContext);
214 driver.diagEngine.addClient(diagClient);
215
216 for (const auto &value : options.commandFiles)
217 if (!driver.processCommandFiles(value, /*makeRelative=*/true,
218 /*separateUnit=*/true))
219 return failure();
220
221 // Populate the source manager with the source files.
222 // NOTE: This is a bit ugly since we're essentially copying the Verilog
223 // source text in memory. At a later stage we'll want to extend slang's
224 // SourceManager such that it can contain non-owned buffers. This will do
225 // for now.
226 DenseSet<StringRef> seenBuffers;
227 for (unsigned i = 0, e = sourceMgr.getNumBuffers(); i < e; ++i) {
228 const llvm::MemoryBuffer *mlirBuffer = sourceMgr.getMemoryBuffer(i + 1);
229 auto name = mlirBuffer->getBufferIdentifier();
230 if (!name.empty() && !seenBuffers.insert(name).second)
231 continue; // Slang doesn't like listing the same buffer twice
232 auto slangBuffer =
233 driver.sourceManager.assignText(name, mlirBuffer->getBuffer());
234 driver.sourceLoader.addBuffer(slangBuffer);
235 }
236
237 for (const auto &libDir : options.libDirs)
238 driver.sourceLoader.addSearchDirectories(libDir);
239
240 for (const auto &libExt : options.libExts)
241 driver.sourceLoader.addSearchExtension(libExt);
242
243 for (const auto &[i, f] : llvm::enumerate(options.libraryFiles)) {
244 // Include a space to avoid conflicts with explicitly-specified names.
245 auto libName = "library " + std::to_string(i);
246 driver.sourceLoader.addLibraryFiles(libName, f);
247 }
248
249 for (const auto &includeDir : options.includeDirs)
250 if (driver.sourceManager.addUserDirectories(includeDir))
251 return failure();
252
253 for (const auto &includeSystemDir : options.includeSystemDirs)
254 if (driver.sourceManager.addSystemDirectories(includeSystemDir))
255 return failure();
256
257 // Populate the driver options.
258 driver.addStandardArgs();
259
260 driver.options.excludeExts.insert(options.excludeExts.begin(),
261 options.excludeExts.end());
262 driver.options.ignoreDirectives = options.ignoreDirectives;
263
264 driver.options.maxIncludeDepth = options.maxIncludeDepth;
265 driver.options.defines = options.defines;
266 driver.options.undefines = options.undefines;
267 driver.options.librariesInheritMacros = options.librariesInheritMacros;
268
269 driver.options.timeScale = options.timeScale;
270 driver.options
271 .compilationFlags[slang::ast::CompilationFlags::AllowUseBeforeDeclare] =
272 options.allowUseBeforeDeclare;
273 driver.options
274 .compilationFlags[slang::ast::CompilationFlags::IgnoreUnknownModules] =
275 options.ignoreUnknownModules;
276 driver.options.compilationFlags[slang::ast::CompilationFlags::LintMode] =
278 driver.options
279 .compilationFlags[slang::ast::CompilationFlags::DisableInstanceCaching] =
280 false;
281 driver.options.topModules = options.topModules;
282 driver.options.paramOverrides = options.paramOverrides;
283
284 driver.options.errorLimit = options.errorLimit;
285 driver.options.warningOptions = options.warningOptions;
286
287 driver.options.singleUnit = options.singleUnit;
288
289 // Parse pass through options.
290 if (!options.slangArgs.empty()) {
291 SmallVector<const char *> slangArgs;
292 slangArgs.push_back("slang"); // dummy program name
293 for (const auto &arg : options.slangArgs)
294 slangArgs.push_back(arg.c_str());
295 if (!driver.parseCommandLine(slangArgs.size(), slangArgs.data()))
296 return failure();
297 }
298
299 return success(driver.processOptions());
300}
301
302/// Parse and elaborate the prepared source files, and populate the given MLIR
303/// `module` with corresponding operations.
304LogicalResult ImportDriver::importVerilog(ModuleOp module) {
305 // Parse the input.
306 auto parseTimer = ts.nest("Verilog parser");
307 bool parseSuccess = driver.parseAllSources();
308 parseTimer.stop();
309
310 // Elaborate the input.
311 auto compileTimer = ts.nest("Verilog elaboration");
312 auto compilation = driver.createCompilation();
313
314 // Semantic analysis
315 auto analysisTimer = ts.nest("Semantic analysis");
316 driver.runAnalysis(*compilation);
317
318 for (auto &diag : compilation->getAllDiagnostics())
319 driver.diagEngine.issue(diag);
320 if (!parseSuccess || driver.diagEngine.getNumErrors() > 0)
321 return failure();
322 compileTimer.stop();
323
324 // If we were only supposed to lint the input, return here. This leaves the
325 // module empty, but any Slang linting messages got reported as diagnostics.
326 if (options.mode == ImportVerilogOptions::Mode::OnlyLint)
327 return success();
328
329 // Traverse the parsed Verilog AST and map it to the equivalent CIRCT ops.
330 mlirContext
331 ->loadDialect<moore::MooreDialect, hw::HWDialect, cf::ControlFlowDialect,
332 func::FuncDialect, verif::VerifDialect, ltl::LTLDialect,
333 debug::DebugDialect>();
334 auto conversionTimer = ts.nest("Verilog to dialect mapping");
335 Context context(options, *compilation, module, driver.sourceManager);
336 if (failed(context.convertCompilation()))
337 return failure();
338 conversionTimer.stop();
339
340 // Run the verifier on the constructed module to ensure it is clean.
341 auto verifierTimer = ts.nest("Post-parse verification");
342 return verify(module);
343}
344
345/// Preprocess the prepared source files and print them to the given output
346/// stream.
347LogicalResult ImportDriver::preprocessVerilog(llvm::raw_ostream &os) {
348 auto parseTimer = ts.nest("Verilog preprocessing");
349
350 // Run the preprocessor to completion across all sources previously added with
351 // `pushSource`, report diagnostics, and print the output.
352 auto preprocessAndPrint = [&](slang::parsing::Preprocessor &preprocessor) {
353 slang::syntax::SyntaxPrinter output;
354 output.setIncludeComments(false);
355 while (true) {
356 slang::parsing::Token token = preprocessor.next();
357 output.print(token);
358 if (token.kind == slang::parsing::TokenKind::EndOfFile)
359 break;
360 }
361
362 for (auto &diag : preprocessor.getDiagnostics()) {
363 if (diag.isError()) {
364 driver.diagEngine.issue(diag);
365 return failure();
366 }
367 }
368 os << output.str();
369 return success();
370 };
371
372 // Depending on whether the single-unit option is set, either add all source
373 // files to a single preprocessor such that they share define macros and
374 // directives, or create a separate preprocessor for each, such that each
375 // source file is in its own compilation unit.
376 auto optionBag = driver.createOptionBag();
377 if (driver.options.singleUnit == true) {
378 slang::BumpAllocator alloc;
379 slang::Diagnostics diagnostics;
380 slang::parsing::Preprocessor preprocessor(driver.sourceManager, alloc,
381 diagnostics, optionBag);
382 // Sources have to be pushed in reverse, as they form a stack in the
383 // preprocessor. Last pushed source is processed first.
384 auto sources = driver.sourceLoader.loadSources();
385 for (auto &buffer : std::views::reverse(sources))
386 preprocessor.pushSource(buffer);
387 if (failed(preprocessAndPrint(preprocessor)))
388 return failure();
389 } else {
390 for (auto &buffer : driver.sourceLoader.loadSources()) {
391 slang::BumpAllocator alloc;
392 slang::Diagnostics diagnostics;
393 slang::parsing::Preprocessor preprocessor(driver.sourceManager, alloc,
394 diagnostics, optionBag);
395 preprocessor.pushSource(buffer);
396 if (failed(preprocessAndPrint(preprocessor)))
397 return failure();
398 }
399 }
400
401 return success();
402}
403
404//===----------------------------------------------------------------------===//
405// Entry Points
406//===----------------------------------------------------------------------===//
407
408/// Parse the specified Verilog inputs into the specified MLIR context.
409LogicalResult circt::importVerilog(SourceMgr &sourceMgr,
410 MLIRContext *mlirContext, TimingScope &ts,
411 ModuleOp module,
412 const ImportVerilogOptions *options) {
413 ImportDriver importDriver(mlirContext, ts, options);
414 if (failed(importDriver.prepareDriver(sourceMgr)))
415 return failure();
416 return importDriver.importVerilog(module);
417}
418
419/// Run the files in a source manager through Slang's Verilog preprocessor and
420/// emit the result to the given output stream.
421LogicalResult circt::preprocessVerilog(SourceMgr &sourceMgr,
422 MLIRContext *mlirContext,
423 TimingScope &ts, llvm::raw_ostream &os,
424 const ImportVerilogOptions *options) {
425 ImportDriver importDriver(mlirContext, ts, options);
426 if (failed(importDriver.prepareDriver(sourceMgr)))
427 return failure();
428 return importDriver.preprocessVerilog(os);
429}
430
431/// Entry point as an MLIR translation.
433 static TranslateToMLIRRegistration fromVerilog(
434 "import-verilog", "import Verilog or SystemVerilog",
435 [](llvm::SourceMgr &sourceMgr, MLIRContext *context) {
436 TimingScope ts;
438 ModuleOp::create(UnknownLoc::get(context)));
439 ImportVerilogOptions options;
440 options.debugInfo = true;
441 options.warningOptions.push_back("no-missing-top");
442 if (failed(
443 importVerilog(sourceMgr, context, ts, module.get(), &options)))
444 module = {};
445 return module;
446 });
447}
448
449//===----------------------------------------------------------------------===//
450// Pass Pipeline
451//===----------------------------------------------------------------------===//
452
453/// Optimize and simplify the Moore dialect IR.
454void circt::populateVerilogToMoorePipeline(OpPassManager &pm) {
455 {
456 // Perform an initial cleanup and preprocessing across all
457 // modules/functions.
458 auto &anyPM = pm.nestAny();
459 anyPM.addPass(mlir::createCSEPass());
460 anyPM.addPass(mlir::createCanonicalizerPass());
461 }
462
463 pm.addPass(moore::createVTablesPass());
464
465 // Remove unused symbols.
466 pm.addPass(mlir::createSymbolDCEPass());
467
468 {
469 // Perform module-specific transformations.
470 auto &modulePM = pm.nest<moore::SVModuleOp>();
471 modulePM.addPass(moore::createSimplifyRefsPass());
472 // TODO: Enable the following once it not longer interferes with @(...)
473 // event control checks. The introduced dummy variables make the event
474 // control observe a static local variable that never changes, instead of
475 // observing a module-wide signal.
476 // modulePM.addPass(moore::createSimplifyProceduresPass());
477 modulePM.addPass(mlir::createSROA());
478 }
479
480 {
481 // Perform a final cleanup across all modules/functions.
482 auto &anyPM = pm.nestAny();
483 anyPM.addPass(mlir::createMem2Reg());
484 anyPM.addPass(mlir::createCSEPass());
485 anyPM.addPass(mlir::createCanonicalizerPass());
486 }
487}
488
489/// Convert Moore dialect IR into core dialect IR
490void circt::populateMooreToCorePipeline(OpPassManager &pm) {
491 // Perform the conversion.
492 pm.addPass(createConvertMooreToCorePass());
493
494 {
495 // Conversion to the core dialects likely uncovers new canonicalization
496 // opportunities.
497 auto &anyPM = pm.nestAny();
498 anyPM.addPass(mlir::createCSEPass());
499 anyPM.addPass(mlir::createCanonicalizerPass());
500 }
501}
502
503/// Convert LLHD dialect IR into core dialect IR
505 OpPassManager &pm, const LlhdToCorePipelineOptions &options) {
506 // Inline function calls and lower SCF to CF.
507 pm.addNestedPass<hw::HWModuleOp>(llhd::createWrapProceduralOpsPass());
508 pm.addPass(mlir::createSCFToControlFlowPass());
509 pm.addPass(llhd::createInlineCallsPass());
510 pm.addPass(mlir::createSymbolDCEPass());
511
512 // Simplify processes, replace signals with process results, and detect
513 // registers.
514 auto &modulePM = pm.nest<hw::HWModuleOp>();
515 // See https://github.com/llvm/circt/issues/8804.
516 if (options.sroa) {
517 modulePM.addPass(mlir::createSROA());
518 }
519 modulePM.addPass(llhd::createMem2RegPass());
520 modulePM.addPass(llhd::createHoistSignalsPass());
521 modulePM.addPass(llhd::createDeseqPass());
522 modulePM.addPass(llhd::createLowerProcessesPass());
523 modulePM.addPass(mlir::createCSEPass());
524 modulePM.addPass(mlir::createCanonicalizerPass());
525
526 // Unroll loops and remove control flow.
527 modulePM.addPass(llhd::createUnrollLoopsPass());
528 modulePM.addPass(mlir::createCSEPass());
529 modulePM.addPass(mlir::createCanonicalizerPass());
530 modulePM.addPass(llhd::createRemoveControlFlowPass());
531 modulePM.addPass(mlir::createCSEPass());
532 modulePM.addPass(mlir::createCanonicalizerPass());
533
534 // Convert `arith.select` generated by some of the control flow canonicalizers
535 // to `comb.mux`.
536 modulePM.addPass(createMapArithToCombPass(true));
537
538 // Simplify module-level signals.
539 modulePM.addPass(llhd::createCombineDrivesPass());
540 modulePM.addPass(llhd::createSig2Reg());
541 modulePM.addPass(mlir::createCSEPass());
542 modulePM.addPass(mlir::createCanonicalizerPass());
543
544 // Map `seq.firreg` with array type and `hw.array_inject` self-feedback to
545 // `seq.firmem` ops.
546 if (options.detectMemories) {
547 modulePM.addPass(seq::createRegOfVecToMem());
548 modulePM.addPass(mlir::createCSEPass());
549 modulePM.addPass(mlir::createCanonicalizerPass());
550 }
551}
static std::unique_ptr< Context > context
static Location convertLocation(MLIRContext *context, const slang::SourceManager &sourceManager, slang::SourceLocation loc)
Convert a slang SourceLocation to an MLIR Location.
static llvm::lsp::DiagnosticSeverity getSeverity(slang::DiagnosticSeverity severity)
std::unique_ptr< mlir::Pass > createSimplifyRefsPass()
std::unique_ptr< mlir::Pass > createVTablesPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
std::unique_ptr< mlir::Pass > createMapArithToCombPass(bool enableBestEffortLowering=false)
void populateVerilogToMoorePipeline(mlir::OpPassManager &pm)
Optimize and simplify the Moore dialect IR.
void populateMooreToCorePipeline(mlir::OpPassManager &pm)
Convert Moore dialect IR into core dialect IR.
void populateLlhdToCorePipeline(mlir::OpPassManager &pm, const LlhdToCorePipelineOptions &options)
std::string getSlangVersion()
Return a human-readable string describing the slang frontend version linked into CIRCT.
std::unique_ptr< OperationPass< ModuleOp > > createConvertMooreToCorePass()
Create an Moore to Comb/HW/LLHD conversion pass.
mlir::LogicalResult importVerilog(llvm::SourceMgr &sourceMgr, mlir::MLIRContext *context, mlir::TimingScope &ts, mlir::ModuleOp module, const ImportVerilogOptions *options=nullptr)
Parse files in a source manager as Verilog source code and populate the given MLIR module with corres...
mlir::LogicalResult preprocessVerilog(llvm::SourceMgr &sourceMgr, mlir::MLIRContext *context, mlir::TimingScope &ts, llvm::raw_ostream &os, const ImportVerilogOptions *options=nullptr)
Run the files in a source manager through Slang's Verilog preprocessor and emit the result to the giv...
void registerFromVerilogTranslation()
Register the import-verilog MLIR translation.
llvm::hash_code hash_value(const DenseSet< T > &set)
Options that control how Verilog input files are parsed and processed.
std::vector< std::string > warningOptions
A list of warning options that will be passed to the DiagnosticEngine.
@ OnlyLint
Only lint the input, without elaboration and lowering to CIRCT IR.
bool debugInfo
Generate debug information in the form of debug dialect ops in the IR.
A helper class to facilitate the conversion from a Slang AST to MLIR operations.
const slang::SourceManager & sourceManager
MLIRContext * getContext()
Return the MLIR context.
Location convertLocation(slang::SourceLocation loc)
Convert a slang SourceLocation into an MLIR Location.
Convert LLHD dialect IR into core dialect IR.
static bool isEqual(slang::BufferID a, slang::BufferID b)
static unsigned getHashValue(slang::BufferID id)