/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/CodeGen/GlobalISel/GISelChangeObserver.cpp
Line | Count | Source |
1 | | //===-- lib/CodeGen/GlobalISel/GISelChangeObserver.cpp --------------------===// |
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 | | // This file constains common code to combine machine functions at generic |
10 | | // level. |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h" |
14 | | #include "llvm/CodeGen/MachineRegisterInfo.h" |
15 | | |
16 | | using namespace llvm; |
17 | | |
18 | | void GISelChangeObserver::changingAllUsesOfReg( |
19 | 692k | const MachineRegisterInfo &MRI, unsigned Reg) { |
20 | 864k | for (auto &ChangingMI : MRI.use_instructions(Reg)) { |
21 | 864k | changingInstr(ChangingMI); |
22 | 864k | ChangingAllUsesOfReg.insert(&ChangingMI); |
23 | 864k | } |
24 | 692k | } |
25 | | |
26 | 692k | void GISelChangeObserver::finishedChangingAllUsesOfReg() { |
27 | 692k | for (auto *ChangedMI : ChangingAllUsesOfReg) |
28 | 864k | changedInstr(*ChangedMI); |
29 | 692k | ChangingAllUsesOfReg.clear(); |
30 | 692k | } |
31 | | |
32 | | RAIIDelegateInstaller::RAIIDelegateInstaller(MachineFunction &MF, |
33 | | MachineFunction::Delegate *Del) |
34 | 846k | : MF(MF), Delegate(Del) { |
35 | 846k | // Register this as the delegate for handling insertions and deletions of |
36 | 846k | // instructions. |
37 | 846k | MF.setDelegate(Del); |
38 | 846k | } |
39 | | |
40 | 846k | RAIIDelegateInstaller::~RAIIDelegateInstaller() { MF.resetDelegate(Delegate); } |