Polly 22.0.0git
DumpModulePass.h
Go to the documentation of this file.
1//===------ DumpModulePass.h ------------------------------------*- 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 module to a file.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef POLLY_SUPPORT_DUMPMODULEPASS_H
14#define POLLY_SUPPORT_DUMPMODULEPASS_H
15
16#include "llvm/IR/PassManager.h"
17#include <string>
18
19namespace polly {
20/// A pass that prints the module into a file.
21///
22/// The meaning of @p Filename depends on @p IsSuffix. If IsSuffix==false, then
23/// the module is written to the @p Filename. If it is true, the filename is
24/// generated from the module's name, @p Filename with an '.ll' extension.
25///
26/// The intent of IsSuffix is to avoid the file being overwritten when
27/// processing multiple modules and/or with multiple dump passes in the
28/// pipeline.
29struct DumpModulePass final : llvm::PassInfoMixin<DumpModulePass> {
30 std::string Filename;
32
33 DumpModulePass(std::string Filename, bool IsSuffix)
34 : Filename(std::move(Filename)), IsSuffix(IsSuffix) {}
35
36 llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
37};
38
39} // namespace polly
40
41#endif /* POLLY_SUPPORT_DUMPMODULEPASS_H */
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM)
DumpModulePass(std::string Filename, bool IsSuffix)