Skip to content

Commit 8bde43b

Browse files
committed
Refactor implementation of isIgnoredCVReg.
1 parent 909e307 commit 8bde43b

File tree

5 files changed

+11
-21
lines changed

5 files changed

+11
-21
lines changed

llvm/include/llvm/CodeGen/TargetRegisterInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,10 @@ class LLVM_ABI TargetRegisterInfo : public MCRegisterInfo {
12431243
getVRegFlagsOfReg(Register Reg, const MachineFunction &MF) const {
12441244
return {};
12451245
}
1246+
1247+
// Whether this register should be ignored when generating CodeView debug
1248+
// info, because it's a known there is no mapping available.
1249+
virtual bool isIgnoredCVReg(MCRegister LLVMReg) const { return false; }
12461250
};
12471251

12481252
//===----------------------------------------------------------------------===//

llvm/include/llvm/MC/MCRegisterInfo.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ class LLVM_ABI MCRegisterInfo {
191191
const DwarfLLVMRegPair *EHDwarf2LRegs; // Dwarf to LLVM regs mapping EH
192192
DenseMap<MCRegister, int> L2SEHRegs; // LLVM to SEH regs mapping
193193
DenseMap<MCRegister, int> L2CVRegs; // LLVM to CV regs mapping
194-
DenseSet<MCRegister> IgnoredCVRegs;
195194

196195
mutable std::vector<std::vector<MCPhysReg>> RegAliasesCache;
197196
ArrayRef<MCPhysReg> getCachedAliasesOf(MCRegister R) const;
@@ -355,12 +354,6 @@ class LLVM_ABI MCRegisterInfo {
355354
L2CVRegs[LLVMReg] = CVReg;
356355
}
357356

358-
void ignoreCVReg(MCRegister LLVMReg) { IgnoredCVRegs.insert(LLVMReg); }
359-
360-
bool isIgnoredCVReg(MCRegister LLVMReg) const {
361-
return IgnoredCVRegs.contains(LLVMReg);
362-
}
363-
364357
/// This method should return the register where the return
365358
/// address can be found.
366359
MCRegister getRARegister() const {

llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,3 +1370,8 @@ bool AArch64RegisterInfo::shouldAnalyzePhysregInMachineLoopInfo(
13701370
MCRegister R) const {
13711371
return R == AArch64::VG;
13721372
}
1373+
1374+
bool AArch64RegisterInfo::isIgnoredCVReg(MCRegister LLVMReg) const {
1375+
return (LLVMReg >= AArch64::Z0 && LLVMReg <= AArch64::Z31) ||
1376+
(LLVMReg >= AArch64::P0 && LLVMReg <= AArch64::P15);
1377+
}

llvm/lib/Target/AArch64/AArch64RegisterInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ class AArch64RegisterInfo final : public AArch64GenRegisterInfo {
154154
SmallVectorImpl<uint64_t> &Ops) const override;
155155

156156
bool shouldAnalyzePhysregInMachineLoopInfo(MCRegister R) const override;
157+
158+
virtual bool isIgnoredCVReg(MCRegister LLVMReg) const override;
157159
};
158160

159161
} // end namespace llvm

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -302,20 +302,6 @@ void AArch64_MC::initLLVMToCVRegMapping(MCRegisterInfo *MRI) {
302302
};
303303
for (const auto &I : RegMap)
304304
MRI->mapLLVMRegToCVReg(I.Reg, static_cast<int>(I.CVReg));
305-
static constexpr MCRegister IgnoredRegs[] = {
306-
AArch64::Z0, AArch64::Z1, AArch64::Z2, AArch64::Z3, AArch64::Z4,
307-
AArch64::Z5, AArch64::Z6, AArch64::Z7, AArch64::Z8, AArch64::Z9,
308-
AArch64::Z10, AArch64::Z11, AArch64::Z12, AArch64::Z13, AArch64::Z14,
309-
AArch64::Z15, AArch64::Z16, AArch64::Z17, AArch64::Z18, AArch64::Z19,
310-
AArch64::Z20, AArch64::Z21, AArch64::Z22, AArch64::Z23, AArch64::Z24,
311-
AArch64::Z25, AArch64::Z26, AArch64::Z27, AArch64::Z28, AArch64::Z29,
312-
AArch64::Z30, AArch64::Z31, AArch64::P0, AArch64::P1, AArch64::P2,
313-
AArch64::P3, AArch64::P4, AArch64::P5, AArch64::P6, AArch64::P7,
314-
AArch64::P8, AArch64::P9, AArch64::P10, AArch64::P11, AArch64::P12,
315-
AArch64::P13, AArch64::P14, AArch64::P15,
316-
};
317-
for (const auto &R : IgnoredRegs)
318-
MRI->ignoreCVReg(R);
319305
}
320306

321307
bool AArch64_MC::isHForm(const MCInst &MI, const MCInstrInfo *MCII) {

0 commit comments

Comments
 (0)