[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / mlir / lib / Dialect / SPIRV / IR / SPIRVOpUtils.h
blobe60fd53737d52d2ebf9cc5fa9dd174407168cdc2
1 //===- SPIRVOpUtils.h - MLIR SPIR-V Dialect Op Definition Utilities -------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
11 namespace mlir::spirv {
13 /// Returns the bit width of the `type`.
14 inline unsigned getBitWidth(Type type) {
15 if (isa<spirv::PointerType>(type)) {
16 // Just return 64 bits for pointer types for now.
17 // TODO: Make sure not caller relies on the actual pointer width value.
18 return 64;
21 if (type.isIntOrFloat())
22 return type.getIntOrFloatBitWidth();
24 if (auto vectorType = dyn_cast<VectorType>(type)) {
25 assert(vectorType.getElementType().isIntOrFloat());
26 return vectorType.getNumElements() *
27 vectorType.getElementType().getIntOrFloatBitWidth();
29 llvm_unreachable("unhandled bit width computation for type");
32 void printVariableDecorations(Operation *op, OpAsmPrinter &printer,
33 SmallVectorImpl<StringRef> &elidedAttrs);
35 LogicalResult extractValueFromConstOp(Operation *op, int32_t &value);
37 LogicalResult verifyMemorySemantics(Operation *op,
38 spirv::MemorySemantics memorySemantics);
40 } // namespace mlir::spirv