MLIR  21.0.0git
PrintCallHelper.h
Go to the documentation of this file.
1 //===- PrintCallHelper.h - Helper to emit runtime print calls ---*- 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 #ifndef MLIR_DIALECT_LLVMIR_PRINTCALLHELPER_H_
10 #define MLIR_DIALECT_LLVMIR_PRINTCALLHELPER_H_
11 
13 #include "llvm/ADT/StringRef.h"
14 #include <optional>
15 
16 namespace mlir {
17 
18 class OpBuilder;
19 class LLVMTypeConverter;
20 class SymbolTableCollection;
21 
22 namespace LLVM {
23 
24 /// Generate IR that prints the given string to stdout.
25 /// If a custom runtime function is defined via `runtimeFunctionName`, it must
26 /// have the signature void(char const*). The default function is `printString`.
27 LogicalResult createPrintStrCall(
28  OpBuilder &builder, Location loc, ModuleOp moduleOp, StringRef symbolName,
29  StringRef string, const LLVMTypeConverter &typeConverter,
30  bool addNewline = true, std::optional<StringRef> runtimeFunctionName = {},
31  SymbolTableCollection *symbolTables = nullptr);
32 } // namespace LLVM
33 
34 } // namespace mlir
35 
36 #endif
LogicalResult createPrintStrCall(OpBuilder &builder, Location loc, ModuleOp moduleOp, StringRef symbolName, StringRef string, const LLVMTypeConverter &typeConverter, bool addNewline=true, std::optional< StringRef > runtimeFunctionName={}, SymbolTableCollection *symbolTables=nullptr)
Generate IR that prints the given string to stdout.
Include the generated interface declarations.