Skip to content

Commit 8fa0d59

Browse files
author
Mikhail Gudim
committed
[ReachingDefAnalysis][NFC] Rename PhysReg to Reg.
This is in order to prepare for future MR where we will extend `ReachingDefAnalysis` to stack slots.
1 parent bfa711a commit 8fa0d59

File tree

2 files changed

+96
-103
lines changed

2 files changed

+96
-103
lines changed

llvm/include/llvm/CodeGen/ReachingDefAnalysis.h

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -176,26 +176,25 @@ class ReachingDefAnalysis : public MachineFunctionPass {
176176
void traverse();
177177

178178
/// Provides the instruction id of the closest reaching def instruction of
179-
/// PhysReg that reaches MI, relative to the begining of MI's basic block.
180-
int getReachingDef(MachineInstr *MI, MCRegister PhysReg) const;
179+
/// Reg that reaches MI, relative to the begining of MI's basic block.
180+
int getReachingDef(MachineInstr *MI, MCRegister Reg) const;
181181

182-
/// Return whether A and B use the same def of PhysReg.
182+
/// Return whether A and B use the same def of Reg.
183183
bool hasSameReachingDef(MachineInstr *A, MachineInstr *B,
184-
MCRegister PhysReg) const;
184+
MCRegister Reg) const;
185185

186186
/// Return whether the reaching def for MI also is live out of its parent
187187
/// block.
188-
bool isReachingDefLiveOut(MachineInstr *MI, MCRegister PhysReg) const;
188+
bool isReachingDefLiveOut(MachineInstr *MI, MCRegister Reg) const;
189189

190-
/// Return the local MI that produces the live out value for PhysReg, or
190+
/// Return the local MI that produces the live out value for Reg, or
191191
/// nullptr for a non-live out or non-local def.
192192
MachineInstr *getLocalLiveOutMIDef(MachineBasicBlock *MBB,
193-
MCRegister PhysReg) const;
193+
MCRegister Reg) const;
194194

195195
/// If a single MachineInstr creates the reaching definition, then return it.
196196
/// Otherwise return null.
197-
MachineInstr *getUniqueReachingMIDef(MachineInstr *MI,
198-
MCRegister PhysReg) const;
197+
MachineInstr *getUniqueReachingMIDef(MachineInstr *MI, MCRegister Reg) const;
199198

200199
/// If a single MachineInstr creates the reaching definition, for MIs operand
201200
/// at Idx, then return it. Otherwise return null.
@@ -207,44 +206,43 @@ class ReachingDefAnalysis : public MachineFunctionPass {
207206

208207
/// Provide whether the register has been defined in the same basic block as,
209208
/// and before, MI.
210-
bool hasLocalDefBefore(MachineInstr *MI, MCRegister PhysReg) const;
209+
bool hasLocalDefBefore(MachineInstr *MI, MCRegister Reg) const;
211210

212211
/// Return whether the given register is used after MI, whether it's a local
213212
/// use or a live out.
214-
bool isRegUsedAfter(MachineInstr *MI, MCRegister PhysReg) const;
213+
bool isRegUsedAfter(MachineInstr *MI, MCRegister Reg) const;
215214

216215
/// Return whether the given register is defined after MI.
217-
bool isRegDefinedAfter(MachineInstr *MI, MCRegister PhysReg) const;
216+
bool isRegDefinedAfter(MachineInstr *MI, MCRegister Reg) const;
218217

219218
/// Provides the clearance - the number of instructions since the closest
220-
/// reaching def instuction of PhysReg that reaches MI.
221-
int getClearance(MachineInstr *MI, MCRegister PhysReg) const;
219+
/// reaching def instuction of Reg that reaches MI.
220+
int getClearance(MachineInstr *MI, MCRegister Reg) const;
222221

223222
/// Provides the uses, in the same block as MI, of register that MI defines.
224223
/// This does not consider live-outs.
225-
void getReachingLocalUses(MachineInstr *MI, MCRegister PhysReg,
224+
void getReachingLocalUses(MachineInstr *MI, MCRegister Reg,
226225
InstSet &Uses) const;
227226

228-
/// Search MBB for a definition of PhysReg and insert it into Defs. If no
227+
/// Search MBB for a definition of Reg and insert it into Defs. If no
229228
/// definition is found, recursively search the predecessor blocks for them.
230-
void getLiveOuts(MachineBasicBlock *MBB, MCRegister PhysReg, InstSet &Defs,
229+
void getLiveOuts(MachineBasicBlock *MBB, MCRegister Reg, InstSet &Defs,
231230
BlockSet &VisitedBBs) const;
232-
void getLiveOuts(MachineBasicBlock *MBB, MCRegister PhysReg,
233-
InstSet &Defs) const;
231+
void getLiveOuts(MachineBasicBlock *MBB, MCRegister Reg, InstSet &Defs) const;
234232

235233
/// For the given block, collect the instructions that use the live-in
236234
/// value of the provided register. Return whether the value is still
237235
/// live on exit.
238-
bool getLiveInUses(MachineBasicBlock *MBB, MCRegister PhysReg,
236+
bool getLiveInUses(MachineBasicBlock *MBB, MCRegister Reg,
239237
InstSet &Uses) const;
240238

241-
/// Collect the users of the value stored in PhysReg, which is defined
239+
/// Collect the users of the value stored in Reg, which is defined
242240
/// by MI.
243-
void getGlobalUses(MachineInstr *MI, MCRegister PhysReg, InstSet &Uses) const;
241+
void getGlobalUses(MachineInstr *MI, MCRegister Reg, InstSet &Uses) const;
244242

245-
/// Collect all possible definitions of the value stored in PhysReg, which is
243+
/// Collect all possible definitions of the value stored in Reg, which is
246244
/// used by MI.
247-
void getGlobalReachingDefs(MachineInstr *MI, MCRegister PhysReg,
245+
void getGlobalReachingDefs(MachineInstr *MI, MCRegister Reg,
248246
InstSet &Defs) const;
249247

250248
/// Return whether From can be moved forwards to just before To.
@@ -269,12 +267,12 @@ class ReachingDefAnalysis : public MachineFunctionPass {
269267

270268
/// Return whether a MachineInstr could be inserted at MI and safely define
271269
/// the given register without affecting the program.
272-
bool isSafeToDefRegAt(MachineInstr *MI, MCRegister PhysReg) const;
270+
bool isSafeToDefRegAt(MachineInstr *MI, MCRegister Reg) const;
273271

274272
/// Return whether a MachineInstr could be inserted at MI and safely define
275273
/// the given register without affecting the program, ignoring any effects
276274
/// on the provided instructions.
277-
bool isSafeToDefRegAt(MachineInstr *MI, MCRegister PhysReg,
275+
bool isSafeToDefRegAt(MachineInstr *MI, MCRegister Reg,
278276
InstSet &Ignore) const;
279277

280278
private:
@@ -309,9 +307,8 @@ class ReachingDefAnalysis : public MachineFunctionPass {
309307
MachineInstr *getInstFromId(MachineBasicBlock *MBB, int InstId) const;
310308

311309
/// Provides the instruction of the closest reaching def instruction of
312-
/// PhysReg that reaches MI, relative to the begining of MI's basic block.
313-
MachineInstr *getReachingLocalMIDef(MachineInstr *MI,
314-
MCRegister PhysReg) const;
310+
/// Reg that reaches MI, relative to the begining of MI's basic block.
311+
MachineInstr *getReachingLocalMIDef(MachineInstr *MI, MCRegister Reg) const;
315312
};
316313

317314
} // namespace llvm

0 commit comments

Comments
 (0)