CIRCT  19.0.0git
SVDialect.h
Go to the documentation of this file.
1 //===- SVDialect.h - SV dialect declaration ---------------------*- C++ -*-===//
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 file defines an SV MLIR dialect.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_DIALECT_SV_DIALECT_H
14 #define CIRCT_DIALECT_SV_DIALECT_H
15 
17 #include "circt/Support/LLVM.h"
18 #include "mlir/IR/BuiltinOps.h"
19 #include "mlir/IR/Dialect.h"
20 #include "llvm/ADT/StringSet.h"
21 
22 namespace circt {
23 namespace sv {
24 
25 /// Given string \p origName, generate a new name if it conflicts with any
26 /// keyword or any other name in the map \p nextGeneratedNameIDs. Use the value
27 /// of \p nextGeneratedNameIDs as a counter for suffix. Update the \p
28 /// nextGeneratedNameIDs with the generated name and return the StringRef. If
29 /// \p is true, then check against the reserved keywords in a case insensitive
30 /// manner.
31 llvm::StringRef
32 resolveKeywordConflict(llvm::StringRef origName,
33  llvm::StringMap<size_t> &nextGeneratedNameIDs,
34  bool caseInsensitiveKeywords);
35 
36 /// Legalize the specified name for use in SV output. Auto-uniquifies the name
37 /// through \c resolveKeywordConflict if required. If the name is empty, a
38 /// unique temp name is created.
39 StringRef legalizeName(llvm::StringRef name,
40  llvm::StringMap<size_t> &nextGeneratedNameIDs,
41  bool caseInsensitiveKeywords);
42 
43 /// Check if a name is valid for use in SV output by only containing characters
44 /// allowed in SV identifiers.
45 ///
46 /// Call \c legalizeName() to obtain a legal version of the name. If \p
47 /// caseInsensitive is true, then the check will be done case insensitively.
48 bool isNameValid(llvm::StringRef name, bool caseInsensitiveKeywords);
49 
50 } // namespace sv
51 } // namespace circt
52 
53 // Pull in the dialect definition.
54 #include "circt/Dialect/SV/SVDialect.h.inc"
55 
56 #endif // CIRCT_DIALECT_SV_DIALECT_H
llvm::StringRef resolveKeywordConflict(llvm::StringRef origName, llvm::StringMap< size_t > &nextGeneratedNameIDs, bool caseInsensitiveKeywords)
Given string origName, generate a new name if it conflicts with any keyword or any other name in the ...
StringRef legalizeName(llvm::StringRef name, llvm::StringMap< size_t > &nextGeneratedNameIDs, bool caseInsensitiveKeywords)
Legalize the specified name for use in SV output.
bool isNameValid(llvm::StringRef name, bool caseInsensitiveKeywords)
Check if a name is valid for use in SV output by only containing characters allowed in SV identifiers...
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: sv.py:1