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