LLVM  9.0.0svn
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 
19  const MachineRegisterInfo &MRI, unsigned Reg) {
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 }
30 
33  : MF(MF), Delegate(Del) {
34  // Register this as the delegate for handling insertions and deletions of
35  // instructions.
36  MF.setDelegate(Del);
37 }
38 
This class represents lattice values for constants.
Definition: AllocatorList.h:23
unsigned Reg
void resetDelegate(Delegate *delegate)
Reset the currently registered delegate - otherwise assert.
void finishedChangingAllUsesOfReg()
All instructions reported as changing by changingAllUsesOfReg() have finished being changed...
void setDelegate(Delegate *delegate)
Set the delegate.
unsigned const MachineRegisterInfo * MRI
void changingAllUsesOfReg(const MachineRegisterInfo &MRI, unsigned Reg)
All the instructions using the given register are being changed.
virtual void changingInstr(MachineInstr &MI)=0
This instruction is about to be mutated in some way.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
RAIIDelegateInstaller(MachineFunction &MF, MachineFunction::Delegate *Del)
iterator_range< use_instr_iterator > use_instructions(unsigned Reg) const
virtual void changedInstr(MachineInstr &MI)=0
This instruction was mutated in some way.