From d7a746dc0e3215e8c72b67de8c4a64a695619f8a Mon Sep 17 00:00:00 2001 From: jumerckx Date: Fri, 5 Jan 2024 17:34:14 +0100 Subject: [PATCH 1/2] add *all* julia keywords to `reservedKeywords` instead of just seeing as I go --- deps/build.jl | 26 +++++++++++++------------- deps/tblgen/jl-generators.cc | 5 +++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index 6c0f742c..a9f928d3 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -46,37 +46,37 @@ target_dialects = [ ("AMX.jl", "AMX/AMX.td"), ("Affine.jl", "Affine/IR/AffineOps.td"), ("Arithmetic.jl", "Arithmetic/IR/ArithmeticOps.td"), - # ("ArmNeon.jl", "ArmNeon/ArmNeon.td"), + ("ArmNeon.jl", "ArmNeon/ArmNeon.td"), ("ArmSVE.jl", "ArmSVE/ArmSVE.td"), ("Async.jl", "Async/IR/AsyncOps.td"), ("Bufferization.jl", "Bufferization/IR/BufferizationOps.td"), ("Complex.jl", "Complex/IR/ComplexOps.td"), ("ControlFlow.jl", "ControlFlow/IR/ControlFlowOps.td"), - # ("DLTI.jl", "DLTI/DLTI.td"), + ("DLTI.jl", "DLTI/DLTI.td"), ("EmitC.jl", "EmitC/IR/EmitC.td"), ("Func.jl", "Func/IR/FuncOps.td"), - # ("GPU.jl", "GPU/IR/GPUOps.td"), + ("GPU.jl", "GPU/IR/GPUOps.td"), ("Linalg.jl", "Linalg/IR/LinalgOps.td"), - # ("LinalgStructured.jl", "Linalg/IR/LinalgStructuredOps.td"), + ("LinalgStructured.jl", "Linalg/IR/LinalgStructuredOps.td"), ("LLVMIR.jl", "LLVMIR/LLVMOps.td"), - # ("MLProgram.jl", "MLProgram/IR/MLProgramOps.td"), + ("MLProgram.jl", "MLProgram/IR/MLProgramOps.td"), ("Math.jl", "Math/IR/MathOps.td"), ("MemRef.jl", "MemRef/IR/MemRefOps.td"), ("NVGPU.jl", "NVGPU/IR/NVGPU.td"), - # ("OpenACC.jl", "OpenACC/OpenACCOps.td"), - # ("OpenMP.jl", "OpenMP/OpenMPOps.td"), - # ("PDL.jl", "PDL/IR/PDLOps.td"), - # ("PDLInterp.jl", "PDLInterp/IR/PDLInterpOps.td"), + ("OpenACC.jl", "OpenACC/OpenACCOps.td"), + ("OpenMP.jl", "OpenMP/OpenMPOps.td"), + ("PDL.jl", "PDL/IR/PDLOps.td"), + ("PDLInterp.jl", "PDLInterp/IR/PDLInterpOps.td"), ("Quant.jl", "Quant/QuantOps.td"), - # ("SCF.jl", "SCF/IR/SCFOps.td"), - # ("SPIRV.jl", "SPIRV/IR/SPIRVOps.td"), + ("SCF.jl", "SCF/IR/SCFOps.td"), + ("SPIRV.jl", "SPIRV/IR/SPIRVOps.td"), ("Shape.jl", "Shape/IR/ShapeOps.td"), ("SparseTensor.jl", "SparseTensor/IR/SparseTensorOps.td"), ("Tensor.jl", "Tensor/IR/TensorOps.td"), - # ("Tosa.jl", "Tosa/IR/TosaOps.td"), + ("Tosa.jl", "Tosa/IR/TosaOps.td"), ("Transform.jl", "Transform/IR/TransformOps.td"), ("Vector.jl", "Vector/IR/VectorOps.td"), - # ("X86Vector.jl", "X86Vector/X86Vector.td"), + ("X86Vector.jl", "X86Vector/X86Vector.td"), ] for (file, path) in target_dialects diff --git a/deps/tblgen/jl-generators.cc b/deps/tblgen/jl-generators.cc index 54b3e422..6ae6bacb 100644 --- a/deps/tblgen/jl-generators.cc +++ b/deps/tblgen/jl-generators.cc @@ -189,8 +189,9 @@ 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, ...): - std::vector reservedKeywords = {modulename, "for", "return", "if", "continue", "break", "module", "global"}; + // check if functionname colides with Julia keywords or generated module name: + // https://docs.julialang.org/en/v1/base/base/#Keywords + std::vector reservedKeywords = {modulename, "baremodule", "begin", "break", "catch", "const", "continue", "do", "else", "elseif", "end", "export", "false", "finally", "for", "function", "global", "if", "import", "let", "local", "macro", "module", "quote", "return", "struct", "true", "try", "using", "while"}; if (std::find(reservedKeywords.begin(), reservedKeywords.end(), functionname) != reservedKeywords.end()) { functionname = functionname + "_"; From 49b8e2cf9e218597775b8c4014fd542acf76af4f Mon Sep 17 00:00:00 2001 From: jumerckx <31353884+jumerckx@users.noreply.github.com> Date: Thu, 11 Jan 2024 20:52:27 +0100 Subject: [PATCH 2/2] add "public" to list of reserved keywords Co-authored-by: Paul Berg --- deps/tblgen/jl-generators.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/tblgen/jl-generators.cc b/deps/tblgen/jl-generators.cc index 6ae6bacb..040d8d57 100644 --- a/deps/tblgen/jl-generators.cc +++ b/deps/tblgen/jl-generators.cc @@ -191,7 +191,7 @@ end auto functionname = opname.substr(op.getDialectName().str().length() + 1); // get rid of "dialect." prefix. // check if functionname colides with Julia keywords or generated module name: // https://docs.julialang.org/en/v1/base/base/#Keywords - std::vector reservedKeywords = {modulename, "baremodule", "begin", "break", "catch", "const", "continue", "do", "else", "elseif", "end", "export", "false", "finally", "for", "function", "global", "if", "import", "let", "local", "macro", "module", "quote", "return", "struct", "true", "try", "using", "while"}; + std::vector reservedKeywords = {modulename, "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 (std::find(reservedKeywords.begin(), reservedKeywords.end(), functionname) != reservedKeywords.end()) { functionname = functionname + "_";