LLVM  12.0.0git
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 
15 #include "WebAssembly.h"
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->getDebugOperand(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->getDebugOperand(0).setReg(NewReg);
44  MBB->insert(Insert, Clone);
45  }
46 }
47 
49  for (auto *DBI : DbgValues) {
50  MachineOperand &Op = DBI->getDebugOperand(0);
52  }
53 }
MachineOperand & getDebugOperand(unsigned Index)
Definition: MachineInstr.h:475
void collectDebugValues(SmallVectorImpl< MachineInstr *> &DbgValues)
Scan instructions immediately following MI and collect any matching DBG_VALUEs.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
unsigned Reg
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end...
MachineBasicBlock & MBB
void setReg(Register Reg)
Change the register this operand corresponds to.
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...
MachineOperand class - Representation of each machine instruction operand.
const MachineBasicBlock * getParent() const
Definition: MachineInstr.h:280
Representation of each machine instruction.
Definition: MachineInstr.h:62
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;...
This file declares WebAssembly-specific per-machine-function information.
void ChangeToTargetIndex(unsigned Idx, int64_t Offset, unsigned TargetFlags=0)
Replace this operand with a target index.
This file contains the declaration of the WebAssembly-specific manager for DebugValues associated wit...
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
Definition: STLExtras.h:341
void clone(MachineInstr *Insert, unsigned NewReg)