1 //===- AMDGPUSplitModule.h -------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
11 #ifndef LLVM_TARGET_AMDGPUSPLITMODULE_H
12 #define LLVM_TARGET_AMDGPUSPLITMODULE_H
14 #include "llvm/ADT/STLFunctionalExtras.h"
15 #include "llvm/IR/PassManager.h"
20 /// Splits the module M into N linkable partitions. The function ModuleCallback
21 /// is called N times passing each individual partition as the MPart argument.
22 class AMDGPUSplitModulePass
: public PassInfoMixin
<AMDGPUSplitModulePass
> {
24 using ModuleCreationCallback
=
25 function_ref
<void(std::unique_ptr
<Module
> MPart
)>;
27 AMDGPUSplitModulePass(unsigned N
, ModuleCreationCallback ModuleCallback
)
28 : N(N
), ModuleCallback(ModuleCallback
) {}
30 PreservedAnalyses
run(Module
&M
, ModuleAnalysisManager
&MAM
);
34 ModuleCreationCallback ModuleCallback
;
37 } // end namespace llvm
39 #endif // LLVM_TARGET_AMDGPUSPLITMODULE_H