[Infra] Fix version-check workflow (#100090)
[llvm-project.git] / mlir / utils / spirv / define_opcodes.sh
blob5284ce8e7db225673b704ef6d5eb250183530c06
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 map for opname to opcode using SPIR-V spec from the
8 # Internet
10 # Run as:
11 # ./define_opcode.sh (<op-name>)*
13 # For example:
14 # ./define_opcode.sh OpTypeVoid OpTypeFunction
16 # If no op-name is specified, the existing opcodes are updated
18 # The 'instructions' list of spirv.core.grammar.json contains all instructions
19 # in SPIR-V
21 set -e
23 current_file="$(readlink -f "$0")"
24 current_dir="$(dirname "$current_file")"
26 python3 ${current_dir}/gen_spirv_dialect.py \
27 --base-td-path ${current_dir}/../../include/mlir/Dialect/SPIRV/IR/SPIRVBase.td \
28 --new-opcode $@