mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-09 20:13:35 +00:00
[RegBankSelect] Use the OperandMapper class to hold remap information.
Now that we have an entity that hold the remap information the rewritting should be easier to do. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cf4d78fc0d
commit
05d61b46ed
@ -108,6 +108,9 @@ void RegBankSelect::repairReg(
|
||||
RegBankSelect::RepairingPlacement &RepairPt,
|
||||
const iterator_range<SmallVectorImpl<unsigned>::const_iterator> &NewVRegs) {
|
||||
assert(ValMapping.BreakDown.size() == 1 && "Not yet implemented");
|
||||
// An empty range of new register means no repairing.
|
||||
assert(NewVRegs.begin() != NewVRegs.end() && "We should not have to repair");
|
||||
|
||||
// Assume we are repairing a use and thus, the original reg will be
|
||||
// the source of the repairing.
|
||||
unsigned Src = MO.getReg();
|
||||
@ -461,7 +464,9 @@ void RegBankSelect::applyMapping(
|
||||
"Rewriting of MI not implemented yet");
|
||||
// First, place the repairing code.
|
||||
bool NeedRewrite = false;
|
||||
SmallVector<unsigned, 8> NewVRegs;
|
||||
// OpdMapper will hold all the information needed for the rewritting.
|
||||
RegisterBankInfo::OperandsMapper OpdMapper(MI, InstrMapping, *MRI);
|
||||
|
||||
for (RepairingPlacement &RepairPt : RepairPts) {
|
||||
assert(RepairPt.canMaterialize() &&
|
||||
RepairPt.getKind() != RepairingPlacement::Impossible &&
|
||||
@ -483,15 +488,8 @@ void RegBankSelect::applyMapping(
|
||||
MRI->setRegBank(Reg, *ValMapping.BreakDown[0].RegBank);
|
||||
break;
|
||||
case RepairingPlacement::Insert:
|
||||
// We need as many new virtual registers as the number of partial mapping.
|
||||
for (const RegisterBankInfo::PartialMapping &PartMap :
|
||||
ValMapping.BreakDown) {
|
||||
unsigned Tmp = MRI->createGenericVirtualRegister(PartMap.Length);
|
||||
MRI->setRegBank(Tmp, *PartMap.RegBank);
|
||||
NewVRegs.push_back(Tmp);
|
||||
}
|
||||
repairReg(MO, ValMapping, RepairPt,
|
||||
make_range(NewVRegs.end() - BreakDownSize, NewVRegs.end()));
|
||||
OpdMapper.createVRegs(OpIdx);
|
||||
repairReg(MO, ValMapping, RepairPt, OpdMapper.getVRegs(OpIdx));
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("Other kind should not happen");
|
||||
|
Loading…
x
Reference in New Issue
Block a user