xref: /llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.h (revision 999643f1513e86d7d438ec953a3d73c4bc21eb25)
1 // WebAssemblyDebugValueManager.h - WebAssembly DebugValue Manager -*- 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 /// \file
10 /// This file contains the declaration of the WebAssembly-specific
11 /// manager for DebugValues associated with the specific MachineInstr.
12 /// This pass currently does not handle DBG_VALUE_LISTs; they are assumed to
13 /// have been set to undef in NullifyDebugValueLists pass.
14 /// TODO Handle DBG_VALUE_LIST
15 ///
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYDEBUGVALUEMANAGER_H
19 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYDEBUGVALUEMANAGER_H
20 
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/CodeGen/Register.h"
23 
24 namespace llvm {
25 
26 class MachineInstr;
27 
28 class WebAssemblyDebugValueManager {
29   SmallVector<MachineInstr *, 1> DbgValues;
30   Register CurrentReg;
31 
32 public:
33   WebAssemblyDebugValueManager(MachineInstr *Def);
34 
35   void move(MachineInstr *Insert);
36   void clone(MachineInstr *Insert, Register NewReg);
37   // Update the register for Def and DBG_VALUEs.
38   void updateReg(Register Reg);
39   // Replace the current register in DBG_VALUEs with the given LocalId target
40   // index.
41   void replaceWithLocal(unsigned LocalId);
42 };
43 
44 } // end namespace llvm
45 
46 #endif
47