LLVM 23.0.0git
MachineIDFSSAUpdater.h
Go to the documentation of this file.
1//===- MachineIDFSSAUpdater.h - Unstructured SSA Update Tool ----*- C++ -*-===//
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 declares the MachineIDFSSAUpdater class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CODEGEN_MACHINEIDFSSAUPDATER_H
14#define LLVM_CODEGEN_MACHINEIDFSSAUPDATER_H
15
16#include "llvm/ADT/DenseMap.h"
20
21namespace llvm {
22
26class TargetInstrInfo;
27
29 struct BBValueInfo {
30 Register LiveInValue;
31 Register LiveOutValue;
32 };
33
36 const TargetInstrInfo &TII;
38
42
43 MachineInstrBuilder createInst(unsigned Opc, MachineBasicBlock *BB,
45
46 // IsLiveOut indicates whether we are computing live-out values (true) or
47 // live-in values (false).
48 Register computeValue(MachineBasicBlock *BB, bool IsLiveOut);
49
50public:
52 const MachineRegisterInfo::VRegAttrs &RegAttr)
53 : DT(DT), MRI(MF.getRegInfo()), TII(*MF.getSubtarget().getInstrInfo()),
54 RegAttrs(RegAttr) {}
55
58 : MachineIDFSSAUpdater(DT, MF, MF.getRegInfo().getVRegAttrs(Reg)) {}
59
60 /// Indicate that a rewritten value is available in the specified block
61 /// with the specified value. Must be called before invoking Calculate().
63 Defines.emplace_back(BB, V);
64 }
65
66 /// Record a basic block that uses the value. This method should be called for
67 /// every basic block where the value will be used. Must be called before
68 /// invoking Calculate().
69 void addUseBlock(MachineBasicBlock *BB) { UseBlocks.push_back(BB); }
70
71 /// Calculate and insert necessary PHI nodes for SSA form.
72 /// Must be called after registering all definitions and uses.
73 void calculate();
74
75 /// See SSAUpdater::GetValueInMiddleOfBlock description.
77};
78
79} // end namespace llvm
80
81#endif // LLVM_CODEGEN_MACHINEIDFSSAUPDATER_H
This file defines the DenseMap class.
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
This file defines the SmallVector class.
MachineInstrBundleIterator< MachineInstr > iterator
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
MachineIDFSSAUpdater(MachineDominatorTree &DT, MachineFunction &MF, Register Reg)
Register getValueInMiddleOfBlock(MachineBasicBlock *BB)
See SSAUpdater::GetValueInMiddleOfBlock description.
void addAvailableValue(MachineBasicBlock *BB, Register V)
Indicate that a rewritten value is available in the specified block with the specified value.
void calculate()
Calculate and insert necessary PHI nodes for SSA form.
MachineIDFSSAUpdater(MachineDominatorTree &DT, MachineFunction &MF, const MachineRegisterInfo::VRegAttrs &RegAttr)
void addUseBlock(MachineBasicBlock *BB)
Record a basic block that uses the value.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
Definition Register.h:20
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetInstrInfo - Interface to description of machine instruction set.
This is an optimization pass for GlobalISel generic memory operations.
All attributes(register class or bank and low-level type) a virtual register can have.