[Infra] Fix version-check workflow (#100090)
[llvm-project.git] / mlir / utils / spirv / define_enum.sh
blobca9d8642cd9027958b76ba400e7dec8b9a6abf3c
1 #!/bin/bash
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
7 # Script for defining a new enum attr using SPIR-V spec from the Internet.
9 # Run as:
10 # ./define_enum.sh <enum-class-name>
12 # The 'operand_kinds' dict of spirv.core.grammar.json contains all supported
13 # SPIR-V enum classes.
15 # If <enum-class-name> is missing, this script updates existing ones.
17 set -e
19 new_enum=$1
21 current_file="$(readlink -f "$0")"
22 current_dir="$(dirname "$current_file")"
24 python3 ${current_dir}/gen_spirv_dialect.py \
25 --base-td-path ${current_dir}/../../include/mlir/Dialect/SPIRV/IR/SPIRVBase.td \
26 --new-enum "${new_enum}"