1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

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:
Jakob Stoklund Olesen 2012-02-02 23:52:57 +00:00
parent 7cce894e5d
commit b84880cf78
6 changed files with 12 additions and 15 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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;
}
}

View File

@ -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 << '<';

View File

@ -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;
}

View File

@ -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())