1 //===- LegalizeForExport.h - Prepare for translation to LLVM IR -*- 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_TRANSFORMS_LEGALIZE_FOR_EXPORT_H 10 #define MLIR_DIALECT_LLVMIR_TRANSFORMS_LEGALIZE_FOR_EXPORT_H 11 12 #include <memory> 13 14 namespace mlir { 15 class Operation; 16 class Pass; 17 18 namespace LLVM { 19 20 /// Make argument-taking successors of each block distinct. PHI nodes in LLVM 21 /// IR use the predecessor ID to identify which value to take. They do not 22 /// support different values coming from the same predecessor. If a block has 23 /// another block as a successor more than once with different values, insert 24 /// a new dummy block for LLVM PHI nodes to tell the sources apart. 25 void ensureDistinctSuccessors(Operation *op); 26 27 /// Creates a pass that legalizes the LLVM dialect operations so that they can 28 /// be translated to LLVM IR. 29 std::unique_ptr<Pass> createLegalizeForExportPass(); 30 31 } // namespace LLVM 32 } // namespace mlir 33 34 #endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_LEGALIZE_FOR_EXPORT_H 35