1 //===------ DumpFunctionPass.cpp --------------------------------*- 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 // Write a function to a file. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef POLLY_SUPPORT_DUMPFUNCTIONPASS_H 14 #define POLLY_SUPPORT_DUMPFUNCTIONPASS_H 15 16 #include "llvm/IR/PassManager.h" 17 #include <string> 18 19 namespace llvm { 20 class FunctionPass; 21 class ModulePass; 22 } // namespace llvm 23 24 namespace polly { 25 llvm::FunctionPass *createDumpFunctionWrapperPass(std::string Suffix); 26 27 /// A pass that isolates a function into a new Module and writes it into a file. 28 struct DumpFunctionPass final : llvm::PassInfoMixin<DumpFunctionPass> { 29 std::string Suffix; 30 DumpFunctionPassfinal31 DumpFunctionPass(std::string Suffix) : Suffix(std::move(Suffix)) {} 32 33 llvm::PreservedAnalyses run(llvm::Function &F, 34 llvm::FunctionAnalysisManager &AM); 35 }; 36 37 } // namespace polly 38 39 namespace llvm { 40 class PassRegistry; 41 void initializeDumpFunctionWrapperPassPass(llvm::PassRegistry &); 42 } // namespace llvm 43 44 #endif /* POLLY_SUPPORT_DUMPFUNCTIONPASS_H */ 45