Skip to content

Commit

Permalink
add "global" to reserved keywords in jl-generators
Browse files Browse the repository at this point in the history
  • Loading branch information
jumerckx committed Dec 31, 2023
1 parent 7b2cfa7 commit 0e17855
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion deps/tblgen/jl-generators.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ end
auto opname = op.getOperationName();
auto functionname = opname.substr(op.getDialectName().str().length() + 1); // get rid of "dialect." prefix.
// check if functionname colides with Julia keywords (for, return, if, continue, break, ...):
if (functionname == "for" || functionname == "return" || functionname == "if" || functionname == "continue" || functionname == "break" || functionname == "module")
std::vector<std::string> reservedKeywords = {"for", "return", "if", "continue", "break", "module", "global"};
if (std::find(reservedKeywords.begin(), reservedKeywords.end(), functionname) != reservedKeywords.end())
{
functionname = functionname + "_";
}
Expand Down
4 changes: 2 additions & 2 deletions src/dialects/MemRef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ function get_global(; result::MLIRType, name::Union{Attribute, NamedAttribute},
end

"""
global
global_
The `memref.global` operation declares or defines a named global memref
variable. The backing memory for the variable is allocated statically and is
Expand Down Expand Up @@ -917,7 +917,7 @@ memref.global @z : memref<3xf16> = uninitialized
memref.global constant @c : memref<2xi32> = dense<1, 4>
```
"""
function global(; sym_name::Union{Attribute, NamedAttribute}, sym_visibility=nothing::Union{Nothing, Union{Attribute, NamedAttribute}}, type::Union{Attribute, NamedAttribute}, initial_value=nothing::Union{Nothing, Union{Attribute, NamedAttribute}}, constant=nothing::Union{Nothing, Union{Attribute, NamedAttribute}}, alignment=nothing::Union{Nothing, Union{Attribute, NamedAttribute}}, location=Location())
function global_(; sym_name::Union{Attribute, NamedAttribute}, sym_visibility=nothing::Union{Nothing, Union{Attribute, NamedAttribute}}, type::Union{Attribute, NamedAttribute}, initial_value=nothing::Union{Nothing, Union{Attribute, NamedAttribute}}, constant=nothing::Union{Nothing, Union{Attribute, NamedAttribute}}, alignment=nothing::Union{Nothing, Union{Attribute, NamedAttribute}}, location=Location())
results = MLIRType[]
operands = Value[]
owned_regions = Region[]
Expand Down

0 comments on commit 0e17855

Please sign in to comment.