xref: /llvm-project/mlir/utils/spirv/refresh_inst.sh (revision 4bd25d0b81d1687d7f4be4c170e748277856f33c)
1#!/bin/bash
2# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3# See https://llvm.org/LICENSE.txt for license information.
4# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
6# Script for refreshing all defined SPIR-V ops using SPIR-V spec from the
7# Internet.
8#
9# Run as:
10# ./refresh_inst.sh
11
12current_file="$(readlink -f "$0")"
13current_dir="$(dirname "$current_file")"
14
15spirv_ir_include_dir="${current_dir}/../../include/mlir/Dialect/SPIRV/IR/"
16
17for file in "${spirv_ir_include_dir}"/*; do
18  file_name="$(basename $file)"
19  if [[ $file_name == "SPIRVOps.td" ||
20        $file_name == "SPIRVCLOps.td" ||
21        $file_name == "SPIRVGLOps.td" ]]; then
22    continue
23  fi
24  if [[ $file_name =~ SPIRV.*Ops.td ]]; then
25    echo "--- refreshing $file_name ---"
26    "${current_dir}/define_inst.sh" ${file_name} Op
27  fi
28done
29
30