LLVM  9.0.0svn
WebAssemblyDebugValueManager.cpp
Go to the documentation of this file.
1 //===-- WebAssemblyDebugValueManager.cpp - WebAssembly DebugValue Manager -===//
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 implements the manager for MachineInstr DebugValues.
11 ///
12 //===----------------------------------------------------------------------===//
13 
17 
18 using namespace llvm;
19 
21  MachineInstr *Instr) {
22  Instr->collectDebugValues(DbgValues);
23 }
24 
26  MachineBasicBlock *MBB = Insert->getParent();
27  for (MachineInstr *DBI : reverse(DbgValues))
28  MBB->splice(Insert, DBI->getParent(), DBI);
29 }
30 
32  for (auto *DBI : DbgValues)
33  DBI->getOperand(0).setReg(Reg);
34 }
35 
37  unsigned NewReg) {
38  MachineBasicBlock *MBB = Insert->getParent();
39  MachineFunction *MF = MBB->getParent();
40  for (MachineInstr *DBI : reverse(DbgValues)) {
41  MachineInstr *Clone = MF->CloneMachineInstr(DBI);
42  Clone->getOperand(0).setReg(NewReg);
43  MBB->insert(Insert, Clone);
44  }
45 }
void collectDebugValues(SmallVectorImpl< MachineInstr *> &DbgValues)
Scan instructions following MI and collect any matching DBG_VALUEs.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
unsigned Reg
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
Definition: STLExtras.h:273
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
const MachineBasicBlock * getParent() const
Definition: MachineInstr.h:256
Representation of each machine instruction.
Definition: MachineInstr.h:64
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB &#39;Other&#39; at the position From, and insert it into this MBB right before &#39;...
void setReg(unsigned Reg)
Change the register this operand corresponds to.
This file declares WebAssembly-specific per-machine-function information.
This file contains the declaration of the WebAssembly-specific manager for DebugValues associated wit...
const MachineOperand & getOperand(unsigned i) const
Definition: MachineInstr.h:416
void clone(MachineInstr *Insert, unsigned NewReg)