clang 24.0.0git
LowerToLLVMOffloadPrintf.h
Go to the documentation of this file.
1//===- LowerToLLVMOffloadPrintf.h - Lower cir.offload.printf ----*- C++ -*-===//
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//===----------------------------------------------------------------------===//
8//
9// Lowerings of cir.offload.printf to the printf runtime interface of each
10// device target.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CLANG_CIR_LOWERING_DIRECTTOLLVM_LOWERTOLLVMOFFLOADPRINTF_H
15#define CLANG_CIR_LOWERING_DIRECTTOLLVM_LOWERTOLLVMOFFLOADPRINTF_H
16
17#include "mlir/IR/SymbolTable.h"
18#include "mlir/Interfaces/DataLayoutInterfaces.h"
19#include "mlir/Transforms/DialectConversion.h"
21
22namespace cir {
23namespace direct {
24
25/// Lowers \p op, whose lowered format and arguments are \p format and
26/// \p args, to a call to vprintf.
27mlir::LogicalResult lowerNVPTXPrintf(cir::OffloadPrintfOp op,
28 mlir::Value format, mlir::ValueRange args,
29 mlir::ConversionPatternRewriter &rewriter,
30 const mlir::DataLayout &dataLayout,
31 mlir::SymbolTableCollection &symbolTables);
32
33/// Lowers \p op, whose lowered operands are \p operands, to the buffered
34/// printf runtime interface if \p isBuffered and to hostcall printf otherwise.
35/// Strings are passed to the runtime in \p genericAddrSpace.
36mlir::LogicalResult lowerAMDGPUPrintf(cir::OffloadPrintfOp op,
37 mlir::ValueRange operands,
38 mlir::ConversionPatternRewriter &rewriter,
39 const mlir::DataLayout &dataLayout,
40 mlir::SymbolTableCollection &symbolTables,
41 unsigned genericAddrSpace,
42 bool isBuffered);
43
44} // namespace direct
45} // namespace cir
46
47#endif // CLANG_CIR_LOWERING_DIRECTTOLLVM_LOWERTOLLVMOFFLOADPRINTF_H
mlir::LogicalResult lowerAMDGPUPrintf(cir::OffloadPrintfOp op, mlir::ValueRange operands, mlir::ConversionPatternRewriter &rewriter, const mlir::DataLayout &dataLayout, mlir::SymbolTableCollection &symbolTables, unsigned genericAddrSpace, bool isBuffered)
Lowers op, whose lowered operands are operands, to the buffered printf runtime interface if isBuffere...
mlir::LogicalResult lowerNVPTXPrintf(cir::OffloadPrintfOp op, mlir::Value format, mlir::ValueRange args, mlir::ConversionPatternRewriter &rewriter, const mlir::DataLayout &dataLayout, mlir::SymbolTableCollection &symbolTables)
Lowers op, whose lowered format and arguments are format and args, to a call to vprintf.