9#ifndef CLANG_CIR_LOWERING_DIRECTTOLLVM_LOWERTOLLVMMETADATA_H
10#define CLANG_CIR_LOWERING_DIRECTTOLLVM_LOWERTOLLVMMETADATA_H
12#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"
13#include "mlir/IR/Attributes.h"
14#include "mlir/IR/BuiltinAttributes.h"
15#include "mlir/IR/BuiltinTypes.h"
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/SmallVector.h"
18#include "llvm/ADT/StringRef.h"
25class MaxWorkGroupSizeAttr;
33 mlir::LLVM::MDConstantAttr
getI32(
unsigned value)
const {
34 mlir::IntegerType intTy = mlir::IntegerType::get(ctx, 32);
35 mlir::IntegerAttr intAttr = mlir::IntegerAttr::get(intTy, value);
36 return mlir::LLVM::MDConstantAttr::get(ctx, intAttr);
39 mlir::LLVM::MDStringAttr
getString(llvm::StringRef value)
const {
40 return mlir::LLVM::MDStringAttr::get(ctx,
41 mlir::StringAttr::get(ctx, value));
44 mlir::LLVM::MDNodeAttr
46 return mlir::LLVM::MDNodeAttr::get(ctx, metadata);
51 for (
unsigned value : values)
52 metadata.push_back(
getI32(value));
58 for (mlir::StringAttr attr : attrs.getAsRange<mlir::StringAttr>())
59 metadata.push_back(
getString(attr.getValue()));
64 mlir::MLIRContext *ctx;
71 bool lower(mlir::NamedAttribute attr,
bool includeFunctionOnlyAttrs);
75 void lower(cir::MaxWorkGroupSizeAttr maxWGSize);
77 mlir::MLIRContext *ctx;