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 18 namespace mlir { 19 class Operation; 20 namespace emitc { 21 22 /// Translates the given operation to C++ code. The operation or operations in 23 /// the region of 'op' need almost all be in EmitC dialect. The parameter 24 /// 'declareVariablesAtTop' enforces that all variables for op results and block 25 /// arguments are declared at the beginning of the function. 26 LogicalResult translateToCpp(Operation *op, raw_ostream &os, 27 bool declareVariablesAtTop = false); 28 } // namespace emitc 29 } // namespace mlir 30 31 #endif // MLIR_TARGET_CPP_CPPEMITTER_H 32