1 // WebAssemblyDebugValueManager.h - WebAssembly DebugValue Manager -*- C++ -*-//
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
7 //===----------------------------------------------------------------------===//
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
16 //===----------------------------------------------------------------------===//
18 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYDEBUGVALUEMANAGER_H
19 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYDEBUGVALUEMANAGER_H
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/CodeGen/Register.h"
28 class WebAssemblyDebugValueManager
{
30 SmallVector
<MachineInstr
*, 1> DbgValues
;
32 SmallVector
<MachineInstr
*, 1>
33 getSinkableDebugValues(MachineInstr
*Insert
) const;
34 bool isInsertSamePlace(MachineInstr
*Insert
) const;
37 WebAssemblyDebugValueManager(MachineInstr
*Def
);
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
50 void replaceWithLocal(unsigned LocalId
);
51 // Remove Def, and set its DBG_VALUEs to undef.
55 } // end namespace llvm