llvm-project/llvm/lib/Target/SPIRV/SPIRVMetadata.h
Michal Paszkowski 0fbaf03f70
[SPIR-V] Cast ptr kernel args to i8* when used as Store's value operand (#78603)
Handle a special case when StoreInst's value operand is a kernel
argument of a pointer type. Since these arguments could have either a
basic element type (e.g. float*) or OpenCL builtin type (sampler_t),
bitcast the StoreInst's value operand to default pointer element type
(i8).

This pull request addresses the issue
https://github.com/llvm/llvm-project/issues/72864
2024-01-28 19:30:14 -08:00

32 lines
1.1 KiB
C++

//===--- SPIRVMetadata.h ---- IR Metadata Parsing Funcs ---------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains functions needed for parsing LLVM IR metadata relevant
// to the SPIR-V target.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVMETADATA_H
#define LLVM_LIB_TARGET_SPIRV_SPIRVMETADATA_H
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
namespace llvm {
//===----------------------------------------------------------------------===//
// OpenCL Metadata
//
MDString *getOCLKernelArgAccessQual(const Function &F, unsigned ArgIdx);
MDString *getOCLKernelArgTypeQual(const Function &F, unsigned ArgIdx);
MDString *getOCLKernelArgType(const Function &F, unsigned ArgIdx);
} // namespace llvm
#endif // LLVM_LIB_TARGET_SPIRV_METADATA_H