xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Target/RegisterTargetPassConfigCallback.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===----------------------------------------------------------------------===//
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 contains the registry for PassConfigCallbacks that enable changes
10 /// to the TargetPassConfig during the initialization of TargetMachine.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_TARGET_REGISTERTARGETPASSCONFIGCALLBACK_H
15 #define LLVM_TARGET_REGISTERTARGETPASSCONFIGCALLBACK_H
16 
17 #include "TargetMachine.h"
18 #include "llvm/Support/Compiler.h"
19 
20 namespace llvm {
21 
22 using PassConfigCallback =
23     std::function<void(TargetMachine &, PassManagerBase &, TargetPassConfig *)>;
24 
25 class RegisterTargetPassConfigCallback {
26 public:
27   PassConfigCallback Callback;
28 
29   LLVM_ABI explicit RegisterTargetPassConfigCallback(PassConfigCallback &&C);
30   LLVM_ABI ~RegisterTargetPassConfigCallback();
31 };
32 
33 LLVM_ABI void
34 invokeGlobalTargetPassConfigCallbacks(TargetMachine &TM, PassManagerBase &PM,
35                                       TargetPassConfig *PassConfig);
36 } // namespace llvm
37 
38 #endif // LLVM_TARGET_REGISTERTARGETPASSCONFIGCALLBACK_H
39