MLIR 22.0.0git
CppEmitter.h
Go to the documentation of this file.
1//===- CppEmitter.h - Helpers to create C++ emitter -------------*- 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// This file defines helpers to emit C++ code using the EmitC dialect.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_TARGET_CPP_CPPEMITTER_H
14#define MLIR_TARGET_CPP_CPPEMITTER_H
15
16#include "mlir/Support/LLVM.h"
17#include "llvm/ADT/StringRef.h"
18
19namespace mlir {
20class Operation;
21namespace emitc {
22
23/// Translates the given operation to C++ code. The operation or operations in
24/// the region of 'op' need almost all be in EmitC dialect. The parameter
25/// 'declareVariablesAtTop' enforces that all variables for op results and block
26/// arguments are declared at the beginning of the function.
27/// If parameter 'fileId' is non-empty, then body of `emitc.file` ops
28/// with matching id are emitted.
29LogicalResult translateToCpp(Operation *op, raw_ostream &os,
30 bool declareVariablesAtTop = false,
31 StringRef fileId = {});
32} // namespace emitc
33} // namespace mlir
34
35#endif // MLIR_TARGET_CPP_CPPEMITTER_H
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
LogicalResult translateToCpp(Operation *op, raw_ostream &os, bool declareVariablesAtTop=false, StringRef fileId={})
Translates the given operation to C++ code.
Include the generated interface declarations.