LLVM  14.0.0git
GISelChangeObserver.cpp
Go to the documentation of this file.
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 
15 
16 using namespace llvm;
17 
20  for (auto &ChangingMI : MRI.use_instructions(Reg)) {
21  changingInstr(ChangingMI);
22  ChangingAllUsesOfReg.insert(&ChangingMI);
23  }
24 }
25 
27  for (auto *ChangedMI : ChangingAllUsesOfReg)
28  changedInstr(*ChangedMI);
29  ChangingAllUsesOfReg.clear();
30 }
31 
34  : MF(MF), Delegate(Del) {
35  // Register this as the delegate for handling insertions and deletions of
36  // instructions.
37  MF.setDelegate(Del);
38 }
39 
41 
43  GISelChangeObserver &Observer)
44  : MF(MF) {
45  MF.setObserver(&Observer);
46 }
47 
llvm::MachineFunction::resetDelegate
void resetDelegate(Delegate *delegate)
Reset the currently registered delegate - otherwise assert.
Definition: MachineFunction.h:557
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
llvm::RAIIMFObserverInstaller::~RAIIMFObserverInstaller
~RAIIMFObserverInstaller()
Definition: GISelChangeObserver.cpp:48
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:52
llvm::GISelChangeObserver::finishedChangingAllUsesOfReg
void finishedChangingAllUsesOfReg()
All instructions reported as changing by changingAllUsesOfReg() have finished being changed.
Definition: GISelChangeObserver.cpp:26
llvm::RAIIDelegateInstaller::~RAIIDelegateInstaller
~RAIIDelegateInstaller()
Definition: GISelChangeObserver.cpp:40
llvm::MachineRegisterInfo::use_instructions
iterator_range< use_instr_iterator > use_instructions(Register Reg) const
Definition: MachineRegisterInfo.h:485
llvm::MachineFunction::setDelegate
void setDelegate(Delegate *delegate)
Set the delegate.
Definition: MachineFunction.h:565
llvm::RAIIDelegateInstaller::RAIIDelegateInstaller
RAIIDelegateInstaller(MachineFunction &MF, MachineFunction::Delegate *Del)
Definition: GISelChangeObserver.cpp:32
MachineRegisterInfo.h
llvm::MachineFunction::setObserver
void setObserver(GISelChangeObserver *O)
Definition: MachineFunction.h:573
llvm::GISelChangeObserver::changingAllUsesOfReg
void changingAllUsesOfReg(const MachineRegisterInfo &MRI, Register Reg)
All the instructions using the given register are being changed.
Definition: GISelChangeObserver.cpp:18
llvm::MachineFunction::Delegate
Definition: MachineFunction.h:395
llvm::GISelChangeObserver::changingInstr
virtual void changingInstr(MachineInstr &MI)=0
This instruction is about to be mutated in some way.
llvm::GISelChangeObserver::changedInstr
virtual void changedInstr(MachineInstr &MI)=0
This instruction was mutated in some way.
llvm::MachineFunction
Definition: MachineFunction.h:230
llvm::GISelChangeObserver
Abstract class that contains various methods for clients to notify about changes.
Definition: GISelChangeObserver.h:29
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::RAIIMFObserverInstaller::RAIIMFObserverInstaller
RAIIMFObserverInstaller(MachineFunction &MF, GISelChangeObserver &Observer)
Definition: GISelChangeObserver.cpp:42
GISelChangeObserver.h