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 | MachineInstr *Def; |
30 | SmallVector<MachineInstr *, 1> DbgValues; |
31 | Register CurrentReg; |
32 | SmallVector<MachineInstr *, 1> |
33 | getSinkableDebugValues(MachineInstr *Insert) const; |
34 | bool isInsertSamePlace(MachineInstr *Insert) const; |
35 | |
36 | public: |
37 | WebAssemblyDebugValueManager(MachineInstr *Def); |
38 | |
39 | // Sink 'Def', and also sink its eligible DBG_VALUEs to the place before |
40 | // 'Insert'. Convert the original DBG_VALUEs into undefs. |
41 | void sink(MachineInstr *Insert); |
42 | // Clone 'Def' (optionally), and also clone its eligible DBG_VALUEs to the |
43 | // place before 'Insert'. |
44 | void cloneSink(MachineInstr *Insert, Register NewReg = Register(), |
45 | bool CloneDef = true) const; |
46 | // Update the register for Def and DBG_VALUEs. |
47 | void updateReg(Register Reg); |
48 | // Replace the current register in DBG_VALUEs with the given LocalId target |
49 | // index. |
50 | void replaceWithLocal(unsigned LocalId); |
51 | // Remove Def, and set its DBG_VALUEs to undef. |
52 | void removeDef(); |
53 | }; |
54 | |
55 | } // end namespace llvm |
56 | |
57 | #endif |
58 | |