29 lines · bash
1#!/bin/bash2 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-exception6 7# Script for defining map for opname to opcode using SPIR-V spec from the8# Internet9#10# Run as:11# ./define_opcode.sh (<op-name>)*12#13# For example:14# ./define_opcode.sh OpTypeVoid OpTypeFunction15#16# If no op-name is specified, the existing opcodes are updated17#18# The 'instructions' list of spirv.core.grammar.json contains all instructions19# in SPIR-V20 21set -e22 23current_file="$(readlink -f "$0")"24current_dir="$(dirname "$current_file")"25 26python3 ${current_dir}/gen_spirv_dialect.py \27 --base-td-path ${current_dir}/../../include/mlir/Dialect/SPIRV/IR/SPIRVBase.td \28 --new-opcode $@29