forked from OSchip/llvm-project
Require non-NULL register masks.
It doesn't seem worthwhile to give meaning to a NULL register mask pointer. It complicates all the code using register mask operands. llvm-svn: 149646
This commit is contained in:
parent
2e12965942
commit
5e1ac45b93
|
@ -446,12 +446,11 @@ public:
|
|||
assert(isRegMask() && "Wrong MachineOperand accessor");
|
||||
// See TargetRegisterInfo.h.
|
||||
assert(PhysReg < (1u << 30) && "Not a physical register");
|
||||
return !Contents.RegMask ||
|
||||
!(Contents.RegMask[PhysReg / 32] & (1u << PhysReg % 32));
|
||||
return !(Contents.RegMask[PhysReg / 32] & (1u << PhysReg % 32));
|
||||
}
|
||||
|
||||
/// getRegMask - Returns a bit mask of registers preserved by this RegMask
|
||||
/// operand. A NULL pointer means that all registers are clobbered.
|
||||
/// operand.
|
||||
const uint32_t *getRegMask() const {
|
||||
assert(isRegMask() && "Wrong MachineOperand accessor");
|
||||
return Contents.RegMask;
|
||||
|
@ -616,6 +615,7 @@ public:
|
|||
/// Any physreg with a 0 bit in the mask is clobbered by the instruction.
|
||||
///
|
||||
static MachineOperand CreateRegMask(const uint32_t *Mask) {
|
||||
assert(Mask && "Missing register mask");
|
||||
MachineOperand Op(MachineOperand::MO_RegisterMask);
|
||||
Op.Contents.RegMask = Mask;
|
||||
return Op;
|
||||
|
|
|
@ -376,7 +376,10 @@ public:
|
|||
///
|
||||
/// Bits are numbered from the LSB, so the bit for physical register Reg can
|
||||
/// be found as (Mask[Reg / 32] >> Reg % 32) & 1.
|
||||
/// NULL pointer is equivalent to an all-zero mask.
|
||||
///
|
||||
/// A NULL pointer means that no register mask will be used, and call
|
||||
/// instructions should use implicit-def operands to indicate call clobbered
|
||||
/// registers.
|
||||
///
|
||||
virtual const uint32_t *getCallPreservedMask(CallingConv::ID) const {
|
||||
// The default mask clobbers everything. All targets should override.
|
||||
|
|
|
@ -175,10 +175,7 @@ bool DeadMachineInstructionElim::runOnMachineFunction(MachineFunction &MF) {
|
|||
}
|
||||
} else if (MO.isRegMask()) {
|
||||
// Register mask of preserved registers. All clobbers are dead.
|
||||
if (const uint32_t *Mask = MO.getRegMask())
|
||||
LivePhysRegs.clearBitsNotInMask(Mask);
|
||||
else
|
||||
LivePhysRegs.reset();
|
||||
LivePhysRegs.clearBitsNotInMask(MO.getRegMask());
|
||||
LivePhysRegs |= ReservedRegs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
|
|||
OS << '>';
|
||||
break;
|
||||
case MachineOperand::MO_RegisterMask:
|
||||
OS << (getRegMask() ? "<regmask>" : "<regmask:null>");
|
||||
OS << "<regmask>";
|
||||
break;
|
||||
case MachineOperand::MO_Metadata:
|
||||
OS << '<';
|
||||
|
|
|
@ -417,10 +417,7 @@ void MachineLICM::ProcessMI(MachineInstr *MI,
|
|||
// We can't hoist an instruction defining a physreg that is clobbered in
|
||||
// the loop.
|
||||
if (MO.isRegMask()) {
|
||||
if (const uint32_t *Mask = MO.getRegMask())
|
||||
PhysRegClobbers.setBitsNotInMask(Mask);
|
||||
else
|
||||
PhysRegClobbers.set();
|
||||
PhysRegClobbers.setBitsNotInMask(MO.getRegMask());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -2515,8 +2515,8 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
|||
// registers.
|
||||
if (UseRegMask) {
|
||||
const TargetRegisterInfo *TRI = getTargetMachine().getRegisterInfo();
|
||||
const uint32_t *Mask = TRI->getCallPreservedMask(CallConv);
|
||||
Ops.push_back(DAG.getRegisterMask(Mask));
|
||||
if (const uint32_t *Mask = TRI->getCallPreservedMask(CallConv))
|
||||
Ops.push_back(DAG.getRegisterMask(Mask));
|
||||
}
|
||||
|
||||
if (InFlag.getNode())
|
||||
|
|
Loading…
Reference in New Issue