Skip to content

Commit

Permalink
fix operand names conflicting with local variables in the generated f…
Browse files Browse the repository at this point in the history
…unctions (#74)

* add local variables used in the generated function to the `reservedKeywords` list

* changed API bindings?

* updated dialect bindings

* ignore structs when generating API wrappers (these are wrapped manually)

* newly generated API wrappers

* Regenerate bindings

* Revert "Regenerate bindings"

This reverts commit 752bdd9.

* LLVM14 dialect wrappers (had to be generated using Julia 1.9)

---------

Co-authored-by: Sergio Sánchez Ramírez <[email protected]>
  • Loading branch information
jumerckx and mofeing authored Jun 6, 2024
1 parent b8ab825 commit 67d3a33
Show file tree
Hide file tree
Showing 142 changed files with 34,373 additions and 71,325 deletions.
37 changes: 37 additions & 0 deletions bindings/wrap.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@ show_c_function_prototype = false
printer_blacklist = [
"MAKE_MLIR_PYTHON_QUALNAME",
]
output_ignorelist = [
"MlirTypeID",
"MlirTypeIDAllocator",
"MlirLlvmThreadPool",
"MlirStringRef",
"MlirLogicalResult",
"MlirContext",
"MlirDialect",
"MlirDialectHandle",
"MlirDialectRegistry",
"MlirOperation",
"MlirOpOperand",
"MlirOpPrintingFlags",
"MlirBlock",
"MlirRegion",
"MlirSymbolTable",
"MlirAttribute",
"MlirIdentifier",
"MlirLocation",
"MlirModule",
"MlirType",
"MlirValue",
"MlirNamedAttribute",
"MlirOperationState",
"MlirAffineExpr",
"MlirAffineMap",
"MlirPass",
"MlirExternalPass",
"MlirPassManager",
"MlirOpPassManager",
"MlirExternalPassCallbacks",
"MlirDiagnostic",
"MlirExecutionEngine",
"MlirIntegerSet",
"MlirAsmState",
"MlirBytecodeWriterConfig",
]

[codegen]
use_julia_bool = true
Expand Down
6 changes: 5 additions & 1 deletion deps/tblgen/jl-generators.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ namespace
}
// check if name colides with Julia keywords, generated module name, or "location":
// https://docs.julialang.org/en/v1/base/base/#Keywords
std::vector<std::string> reservedKeywords = {"include", "location", "baremodule", "begin", "break", "catch", "const", "continue", "do", "else", "elseif", "end", "export", "false", "finally", "for", "function", "global", "if", "import", "let", "local", "macro", "module", "public", "quote", "return", "struct", "true", "try", "using", "while"};
// aditionally check that name doesn't conflict with local variables defined in the function (results, operands, owned_regions, successors, attributes)
std::vector<std::string> reservedKeywords = {
"results", "operands", "owned_regions", "successors", "attributes",
"include", "location", "baremodule", "begin", "break", "catch", "const", "continue", "do", "else", "elseif", "end", "export", "false", "finally", "for", "function", "global", "if", "import", "let", "local", "macro", "module", "public", "quote", "return", "struct", "true", "try", "using", "while"
};
if (modulename.has_value()) {
reservedKeywords.push_back(modulename.value());
}
Expand Down
Loading

0 comments on commit 67d3a33

Please sign in to comment.