diff options
author | Quentin Colombet <qcolombet@apple.com> | 2016-06-08 16:30:55 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2016-06-08 16:30:55 +0000 |
commit | f33e36545b10b9269c1463ed664b53bb6fc36098 (patch) | |
tree | 40a22fed9f4fb76aed05cf165b8fa914dc93ee0e /llvm/lib | |
parent | 06ef4e209d0e42f9cb465f795b36977b05a996ac (diff) | |
download | bcm5719-llvm-f33e36545b10b9269c1463ed664b53bb6fc36098.tar.gz bcm5719-llvm-f33e36545b10b9269c1463ed664b53bb6fc36098.zip |
[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.
llvm-svn: 272164
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp index daf1685b067..37af5066768 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp @@ -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"); |