LLVM  8.0.1
WebAssemblyDebugValueManager.cpp
Go to the documentation of this file.
1 //===-- WebAssemblyDebugValueManager.cpp - WebAssembly DebugValue Manager -===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// This file implements the manager for MachineInstr DebugValues.
12 ///
13 //===----------------------------------------------------------------------===//
14 
18 
19 using namespace llvm;
20 
22  MachineInstr *Instr) {
23  Instr->collectDebugValues(DbgValues);
24 }
25 
27  MachineBasicBlock *MBB = Insert->getParent();
28  for (MachineInstr *DBI : reverse(DbgValues))
29  MBB->splice(Insert, DBI->getParent(), DBI);
30 }
31 
33  for (auto *DBI : DbgValues)
34  DBI->getOperand(0).setReg(Reg);
35 }
36 
38  unsigned NewReg) {
39  MachineBasicBlock *MBB = Insert->getParent();
40  MachineFunction *MF = MBB->getParent();
41  for (MachineInstr *DBI : reverse(DbgValues)) {
42  MachineInstr *Clone = MF->CloneMachineInstr(DBI);
43  Clone->getOperand(0).setReg(NewReg);
44  MBB->insert(Insert, Clone);
45  }
46 }
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:24
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:267
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:254
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:414
void clone(MachineInstr *Insert, unsigned NewReg)