MLIR  20.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 
21 namespace LLVM {
22 
23 /// Generate IR that prints the given string to stdout.
24 /// If a custom runtime function is defined via `runtimeFunctionName`, it must
25 /// have the signature void(char const*). The default function is `printString`.
26 void createPrintStrCall(OpBuilder &builder, Location loc, ModuleOp moduleOp,
27  StringRef symbolName, StringRef string,
28  const LLVMTypeConverter &typeConverter,
29  bool addNewline = true,
30  std::optional<StringRef> runtimeFunctionName = {});
31 } // namespace LLVM
32 
33 } // namespace mlir
34 
35 #endif
void createPrintStrCall(OpBuilder &builder, Location loc, ModuleOp moduleOp, StringRef symbolName, StringRef string, const LLVMTypeConverter &typeConverter, bool addNewline=true, std::optional< StringRef > runtimeFunctionName={})
Generate IR that prints the given string to stdout.
Include the generated interface declarations.