MLIR 24.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
12#include "mlir/Support/LLVM.h"
13#include "llvm/ADT/StringRef.h"
14#include <optional>
15
16namespace mlir {
17class Location;
18class ModuleOp;
19class OpBuilder;
22
23namespace LLVM {
24
25/// Generate IR that prints the given string to stdout.
26/// If a custom runtime function is defined via `runtimeFunctionName`, it must
27/// have the signature void(char const*). The default function is `printString`.
28LogicalResult createPrintStrCall(
29 OpBuilder &builder, Location loc, ModuleOp moduleOp, StringRef symbolName,
30 StringRef string, const LLVMTypeConverter &typeConverter,
31 bool addNewline = true, std::optional<StringRef> runtimeFunctionName = {},
32 SymbolTableCollection *symbolTables = nullptr);
33} // namespace LLVM
34
35} // namespace mlir
36
37#endif
Conversion from types to the LLVM IR dialect.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition Location.h:76
This class helps build Operations.
Definition Builders.h:210
This class represents a collection of SymbolTables.
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.