xref: /freebsd/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineModuleSlotTracker.h (revision e09104dfb76a36b65a64bd315bd1520941c4beed)
1 //===-- llvm/CodeGen/MachineModuleInfo.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 #ifndef LLVM_CODEGEN_MACHINEMODULESLOTTRACKER_H
10 #define LLVM_CODEGEN_MACHINEMODULESLOTTRACKER_H
11 
12 #include "llvm/IR/ModuleSlotTracker.h"
13 #include "llvm/Support/Compiler.h"
14 
15 namespace llvm {
16 
17 class AbstractSlotTrackerStorage;
18 class Function;
19 class MachineModuleInfo;
20 class MachineFunction;
21 class Module;
22 
23 class LLVM_ABI MachineModuleSlotTracker : public ModuleSlotTracker {
24   const Function &TheFunction;
25   const MachineModuleInfo &TheMMI;
26   unsigned MDNStartSlot = 0, MDNEndSlot = 0;
27 
28   void processMachineFunctionMetadata(AbstractSlotTrackerStorage *AST,
29                                       const MachineFunction &MF);
30   void processMachineModule(AbstractSlotTrackerStorage *AST, const Module *M,
31                             bool ShouldInitializeAllMetadata);
32   void processMachineFunction(AbstractSlotTrackerStorage *AST,
33                               const Function *F,
34                               bool ShouldInitializeAllMetadata);
35 
36 public:
37   MachineModuleSlotTracker(const MachineModuleInfo &MMI,
38                            const MachineFunction *MF,
39                            bool ShouldInitializeAllMetadata = true);
40   ~MachineModuleSlotTracker();
41 
42   void collectMachineMDNodes(MachineMDNodeListType &L) const;
43 };
44 
45 } // namespace llvm
46 
47 #endif // LLVM_CODEGEN_MACHINEMODULESLOTTRACKER_H
48