Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
Line
Count
Source
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
14
#include "WebAssemblyDebugValueManager.h"
15
#include "WebAssemblyMachineFunctionInfo.h"
16
#include "llvm/CodeGen/MachineInstr.h"
17
18
using namespace llvm;
19
20
WebAssemblyDebugValueManager::WebAssemblyDebugValueManager(
21
26.4k
    MachineInstr *Instr) {
22
26.4k
  Instr->collectDebugValues(DbgValues);
23
26.4k
}
24
25
22.7k
void WebAssemblyDebugValueManager::move(MachineInstr *Insert) {
26
22.7k
  MachineBasicBlock *MBB = Insert->getParent();
27
22.7k
  for (MachineInstr *DBI : reverse(DbgValues))
28
8
    MBB->splice(Insert, DBI->getParent(), DBI);
29
22.7k
}
30
31
147
void WebAssemblyDebugValueManager::updateReg(unsigned Reg) {
32
147
  for (auto *DBI : DbgValues)
33
7
    DBI->getOperand(0).setReg(Reg);
34
147
}
35
36
void WebAssemblyDebugValueManager::clone(MachineInstr *Insert,
37
5.03k
                                         unsigned NewReg) {
38
5.03k
  MachineBasicBlock *MBB = Insert->getParent();
39
5.03k
  MachineFunction *MF = MBB->getParent();
40
5.03k
  for (MachineInstr *DBI : reverse(DbgValues)) {
41
4
    MachineInstr *Clone = MF->CloneMachineInstr(DBI);
42
4
    Clone->getOperand(0).setReg(NewReg);
43
4
    MBB->insert(Insert, Clone);
44
4
  }
45
5.03k
}