From: llvm-dev <llvm-dev-bounces@lists.llvm.org> On Behalf Of Great
Indian Bison via llvm-dev
Sent: den 14 februari 2021 05:53
To: llvm-dev@lists.llvm.org
Subject: [llvm-dev] Check for isConstantPhysReg() in bool
LiveRangeCalc::findReachingDefs
Hello LLVMDevs,
Should following code in bool LiveRangeCalc::findReachingDefs() check for
isConstantPhysReg()?
Or there is a code which should prevent error below to hit for constant
physical register?
Not sure, but maybe it is assumed that a constant physical register also
should be defined as being "reserved". And if I recall it correctly
liveness isn't calculated for reserved registers.
15 // The physregs aliasing Unit are the roots and their super-registers.
16 // Create all values as dead defs before extending to uses. Note that roots
17 // may share super-registers. That's OK because createDeadDefs() is
18 // idempotent. It is very rare for a register unit to have multiple roots, so
19 // uniquing super-registers is probably not worthwhile.
20 bool IsReserved = false;
21 for (MCRegUnitRootIterator Root(Unit, TRI); Root.isValid(); ++Root) {
22 bool IsRootReserved = true;
23 for (MCSuperRegIterator Super(*Root, TRI, /*IncludeSelf=*/true);
24 Super.isValid(); ++Super) {
25 MCRegister Reg = *Super;
26 if (!MRI->reg_empty(Reg))
27 LICalc->createDeadDefs(LR, Reg);
28 // A register unit is considered reserved if all its roots and all their
29 // super registers are reserved.
30 if (!MRI->isReserved(Reg))
31 IsRootReserved = false;
32 }
33 IsReserved |= IsRootReserved;
However say I mark super register as reserved but one of sub register fails isReserved() check then is it incorrect way to define a super register?