mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
Eliminate some deep std::vector copies. NFC.
llvm-svn: 218999
This commit is contained in:
parent
27271aeb95
commit
4c9fb3d669
@ -2547,11 +2547,10 @@ public:
|
|||||||
unsigned getMatchedOperand() const;
|
unsigned getMatchedOperand() const;
|
||||||
|
|
||||||
/// Copy constructor for copying from a ConstraintInfo.
|
/// Copy constructor for copying from a ConstraintInfo.
|
||||||
AsmOperandInfo(const InlineAsm::ConstraintInfo &info)
|
AsmOperandInfo(InlineAsm::ConstraintInfo Info)
|
||||||
: InlineAsm::ConstraintInfo(info),
|
: InlineAsm::ConstraintInfo(std::move(Info)),
|
||||||
ConstraintType(TargetLowering::C_Unknown),
|
ConstraintType(TargetLowering::C_Unknown), CallOperandVal(nullptr),
|
||||||
CallOperandVal(nullptr), ConstraintVT(MVT::Other) {
|
ConstraintVT(MVT::Other) {}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<AsmOperandInfo> AsmOperandInfoVector;
|
typedef std::vector<AsmOperandInfo> AsmOperandInfoVector;
|
||||||
|
@ -143,9 +143,6 @@ namespace {
|
|||||||
RegPressure.clear();
|
RegPressure.clear();
|
||||||
RegLimit.clear();
|
RegLimit.clear();
|
||||||
BackTrace.clear();
|
BackTrace.clear();
|
||||||
for (DenseMap<unsigned,std::vector<const MachineInstr*> >::iterator
|
|
||||||
CI = CSEMap.begin(), CE = CSEMap.end(); CI != CE; ++CI)
|
|
||||||
CI->second.clear();
|
|
||||||
CSEMap.clear();
|
CSEMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1300,15 +1297,7 @@ void MachineLICM::InitCSEMap(MachineBasicBlock *BB) {
|
|||||||
for (MachineBasicBlock::iterator I = BB->begin(),E = BB->end(); I != E; ++I) {
|
for (MachineBasicBlock::iterator I = BB->begin(),E = BB->end(); I != E; ++I) {
|
||||||
const MachineInstr *MI = &*I;
|
const MachineInstr *MI = &*I;
|
||||||
unsigned Opcode = MI->getOpcode();
|
unsigned Opcode = MI->getOpcode();
|
||||||
DenseMap<unsigned, std::vector<const MachineInstr*> >::iterator
|
CSEMap[Opcode].push_back(MI);
|
||||||
CI = CSEMap.find(Opcode);
|
|
||||||
if (CI != CSEMap.end())
|
|
||||||
CI->second.push_back(MI);
|
|
||||||
else {
|
|
||||||
std::vector<const MachineInstr*> CSEMIs;
|
|
||||||
CSEMIs.push_back(MI);
|
|
||||||
CSEMap.insert(std::make_pair(Opcode, CSEMIs));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1448,11 +1437,8 @@ bool MachineLICM::Hoist(MachineInstr *MI, MachineBasicBlock *Preheader) {
|
|||||||
// Add to the CSE map.
|
// Add to the CSE map.
|
||||||
if (CI != CSEMap.end())
|
if (CI != CSEMap.end())
|
||||||
CI->second.push_back(MI);
|
CI->second.push_back(MI);
|
||||||
else {
|
else
|
||||||
std::vector<const MachineInstr*> CSEMIs;
|
CSEMap[Opcode].push_back(MI);
|
||||||
CSEMIs.push_back(MI);
|
|
||||||
CSEMap.insert(std::make_pair(Opcode, CSEMIs));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++NumHoisted;
|
++NumHoisted;
|
||||||
|
@ -2241,14 +2241,11 @@ TargetLowering::AsmOperandInfoVector TargetLowering::ParseConstraints(
|
|||||||
|
|
||||||
// Do a prepass over the constraints, canonicalizing them, and building up the
|
// Do a prepass over the constraints, canonicalizing them, and building up the
|
||||||
// ConstraintOperands list.
|
// ConstraintOperands list.
|
||||||
InlineAsm::ConstraintInfoVector
|
|
||||||
ConstraintInfos = IA->ParseConstraints();
|
|
||||||
|
|
||||||
unsigned ArgNo = 0; // ArgNo - The argument of the CallInst.
|
unsigned ArgNo = 0; // ArgNo - The argument of the CallInst.
|
||||||
unsigned ResNo = 0; // ResNo - The result number of the next output.
|
unsigned ResNo = 0; // ResNo - The result number of the next output.
|
||||||
|
|
||||||
for (unsigned i = 0, e = ConstraintInfos.size(); i != e; ++i) {
|
for (InlineAsm::ConstraintInfo &CI : IA->ParseConstraints()) {
|
||||||
ConstraintOperands.push_back(AsmOperandInfo(ConstraintInfos[i]));
|
ConstraintOperands.emplace_back(std::move(CI));
|
||||||
AsmOperandInfo &OpInfo = ConstraintOperands.back();
|
AsmOperandInfo &OpInfo = ConstraintOperands.back();
|
||||||
|
|
||||||
// Update multiple alternative constraint count.
|
// Update multiple alternative constraint count.
|
||||||
@ -2327,7 +2324,7 @@ TargetLowering::AsmOperandInfoVector TargetLowering::ParseConstraints(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we have multiple alternative constraints, select the best alternative.
|
// If we have multiple alternative constraints, select the best alternative.
|
||||||
if (ConstraintInfos.size()) {
|
if (ConstraintOperands.size()) {
|
||||||
if (maCount) {
|
if (maCount) {
|
||||||
unsigned bestMAIndex = 0;
|
unsigned bestMAIndex = 0;
|
||||||
int bestWeight = -1;
|
int bestWeight = -1;
|
||||||
|
@ -202,7 +202,7 @@ CoverageMapping::load(ObjectFileCoverageMappingReader &CoverageReader,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Coverage->Functions.push_back(Function);
|
Coverage->Functions.push_back(std::move(Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(Coverage);
|
return std::move(Coverage);
|
||||||
|
@ -111,7 +111,6 @@ void InstrProfWriter::write(raw_fd_ostream &OS) {
|
|||||||
OnDiskChainedHashTableGenerator<InstrProfRecordTrait> Generator;
|
OnDiskChainedHashTableGenerator<InstrProfRecordTrait> Generator;
|
||||||
|
|
||||||
// Populate the hash table generator.
|
// Populate the hash table generator.
|
||||||
std::vector<uint64_t> CounterBuffer;
|
|
||||||
for (const auto &I : FunctionData)
|
for (const auto &I : FunctionData)
|
||||||
Generator.insert(I.getKey(), &I.getValue());
|
Generator.insert(I.getKey(), &I.getValue());
|
||||||
|
|
||||||
|
@ -2262,7 +2262,7 @@ bool TGParser::ParseTopLevelLet(MultiClass *CurMultiClass) {
|
|||||||
// Add this entry to the let stack.
|
// Add this entry to the let stack.
|
||||||
std::vector<LetRecord> LetInfo = ParseLetList();
|
std::vector<LetRecord> LetInfo = ParseLetList();
|
||||||
if (LetInfo.empty()) return true;
|
if (LetInfo.empty()) return true;
|
||||||
LetStack.push_back(LetInfo);
|
LetStack.push_back(std::move(LetInfo));
|
||||||
|
|
||||||
if (Lex.getCode() != tgtok::In)
|
if (Lex.getCode() != tgtok::In)
|
||||||
return TokError("expected 'in' at end of top-level 'let'");
|
return TokError("expected 'in' at end of top-level 'let'");
|
||||||
|
@ -352,7 +352,7 @@ bool AArch64A57FPLoadBalancing::runOnBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
for (auto I = EC.begin(), E = EC.end(); I != E; ++I) {
|
for (auto I = EC.begin(), E = EC.end(); I != E; ++I) {
|
||||||
std::vector<Chain*> Cs(EC.member_begin(I), EC.member_end());
|
std::vector<Chain*> Cs(EC.member_begin(I), EC.member_end());
|
||||||
if (Cs.empty()) continue;
|
if (Cs.empty()) continue;
|
||||||
V.push_back(Cs);
|
V.push_back(std::move(Cs));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we have a set of sets, order them by start address so
|
// Now we have a set of sets, order them by start address so
|
||||||
@ -377,7 +377,7 @@ bool AArch64A57FPLoadBalancing::runOnBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
int Parity = 0;
|
int Parity = 0;
|
||||||
|
|
||||||
for (auto &I : V)
|
for (auto &I : V)
|
||||||
Changed |= colorChainSet(I, MBB, Parity);
|
Changed |= colorChainSet(std::move(I), MBB, Parity);
|
||||||
|
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
@ -556,9 +556,7 @@ ARMConstantIslands::doInitialPlacement(std::vector<MachineInstr*> &CPEMIs) {
|
|||||||
InsPoint[a] = CPEMI;
|
InsPoint[a] = CPEMI;
|
||||||
|
|
||||||
// Add a new CPEntry, but no corresponding CPUser yet.
|
// Add a new CPEntry, but no corresponding CPUser yet.
|
||||||
std::vector<CPEntry> CPEs;
|
CPEntries.emplace_back(1, CPEntry(CPEMI, i));
|
||||||
CPEs.push_back(CPEntry(CPEMI, i));
|
|
||||||
CPEntries.push_back(CPEs);
|
|
||||||
++NumCPEs;
|
++NumCPEs;
|
||||||
DEBUG(dbgs() << "Moved CPI#" << i << " to end of function, size = "
|
DEBUG(dbgs() << "Moved CPI#" << i << " to end of function, size = "
|
||||||
<< Size << ", align = " << Align <<'\n');
|
<< Size << ", align = " << Align <<'\n');
|
||||||
|
@ -590,9 +590,7 @@ MipsConstantIslands::doInitialPlacement(std::vector<MachineInstr*> &CPEMIs) {
|
|||||||
if (InsPoint[a] == InsAt)
|
if (InsPoint[a] == InsAt)
|
||||||
InsPoint[a] = CPEMI;
|
InsPoint[a] = CPEMI;
|
||||||
// Add a new CPEntry, but no corresponding CPUser yet.
|
// Add a new CPEntry, but no corresponding CPUser yet.
|
||||||
std::vector<CPEntry> CPEs;
|
CPEntries.emplace_back(1, CPEntry(CPEMI, i));
|
||||||
CPEs.push_back(CPEntry(CPEMI, i));
|
|
||||||
CPEntries.push_back(CPEs);
|
|
||||||
++NumCPEs;
|
++NumCPEs;
|
||||||
DEBUG(dbgs() << "Moved CPI#" << i << " to end of function, size = "
|
DEBUG(dbgs() << "Moved CPI#" << i << " to end of function, size = "
|
||||||
<< Size << ", align = " << Align <<'\n');
|
<< Size << ", align = " << Align <<'\n');
|
||||||
|
@ -336,7 +336,7 @@ private:
|
|||||||
getHWInstrDesc(IsTex?CF_TC:CF_VC))
|
getHWInstrDesc(IsTex?CF_TC:CF_VC))
|
||||||
.addImm(0) // ADDR
|
.addImm(0) // ADDR
|
||||||
.addImm(AluInstCount - 1); // COUNT
|
.addImm(AluInstCount - 1); // COUNT
|
||||||
return ClauseFile(MIb, ClauseContent);
|
return ClauseFile(MIb, std::move(ClauseContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
void getLiteral(MachineInstr *MI, std::vector<int64_t> &Lits) const {
|
void getLiteral(MachineInstr *MI, std::vector<int64_t> &Lits) const {
|
||||||
@ -426,7 +426,7 @@ private:
|
|||||||
}
|
}
|
||||||
assert(ClauseContent.size() < 128 && "ALU clause is too big");
|
assert(ClauseContent.size() < 128 && "ALU clause is too big");
|
||||||
ClauseHead->getOperand(7).setImm(ClauseContent.size() - 1);
|
ClauseHead->getOperand(7).setImm(ClauseContent.size() - 1);
|
||||||
return ClauseFile(ClauseHead, ClauseContent);
|
return ClauseFile(ClauseHead, std::move(ClauseContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -571,7 +571,7 @@ R600InstrInfo::fitsReadPortLimitations(const std::vector<MachineInstr *> &IG,
|
|||||||
if (!isLastAluTrans)
|
if (!isLastAluTrans)
|
||||||
return FindSwizzleForVectorSlot(IGSrcs, ValidSwizzle, TransOps, TransBS);
|
return FindSwizzleForVectorSlot(IGSrcs, ValidSwizzle, TransOps, TransBS);
|
||||||
|
|
||||||
TransOps = IGSrcs.back();
|
TransOps = std::move(IGSrcs.back());
|
||||||
IGSrcs.pop_back();
|
IGSrcs.pop_back();
|
||||||
ValidSwizzle.pop_back();
|
ValidSwizzle.pop_back();
|
||||||
|
|
||||||
|
@ -280,9 +280,8 @@ bool R600VectorRegMerger::tryMergeUsingCommonSlot(RegSeqInfo &RSI,
|
|||||||
continue;
|
continue;
|
||||||
if (PreviousRegSeqByReg[MOp->getReg()].empty())
|
if (PreviousRegSeqByReg[MOp->getReg()].empty())
|
||||||
continue;
|
continue;
|
||||||
std::vector<MachineInstr *> MIs = PreviousRegSeqByReg[MOp->getReg()];
|
for (MachineInstr *MI : PreviousRegSeqByReg[MOp->getReg()]) {
|
||||||
for (unsigned i = 0, e = MIs.size(); i < e; i++) {
|
CompatibleRSI = PreviousRegSeq[MI];
|
||||||
CompatibleRSI = PreviousRegSeq[MIs[i]];
|
|
||||||
if (RSI == CompatibleRSI)
|
if (RSI == CompatibleRSI)
|
||||||
continue;
|
continue;
|
||||||
if (tryMergeVector(&CompatibleRSI, &RSI, RemapChan))
|
if (tryMergeVector(&CompatibleRSI, &RSI, RemapChan))
|
||||||
|
@ -312,11 +312,10 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF) const {
|
|||||||
|
|
||||||
if (emitFrameMoves) {
|
if (emitFrameMoves) {
|
||||||
// Frame moves for callee saved.
|
// Frame moves for callee saved.
|
||||||
auto SpillLabels = XFI->getSpillLabels();
|
for (const auto &SpillLabel : XFI->getSpillLabels()) {
|
||||||
for (unsigned I = 0, E = SpillLabels.size(); I != E; ++I) {
|
MachineBasicBlock::iterator Pos = SpillLabel.first;
|
||||||
MachineBasicBlock::iterator Pos = SpillLabels[I].first;
|
|
||||||
++Pos;
|
++Pos;
|
||||||
CalleeSavedInfo &CSI = SpillLabels[I].second;
|
const CalleeSavedInfo &CSI = SpillLabel.second;
|
||||||
int Offset = MFI->getObjectOffset(CSI.getFrameIdx());
|
int Offset = MFI->getObjectOffset(CSI.getFrameIdx());
|
||||||
unsigned DRegNum = MRI->getDwarfRegNum(CSI.getReg(), true);
|
unsigned DRegNum = MRI->getDwarfRegNum(CSI.getReg(), true);
|
||||||
EmitCfiOffset(MBB, Pos, dl, TII, MMI, DRegNum, Offset);
|
EmitCfiOffset(MBB, Pos, dl, TII, MMI, DRegNum, Offset);
|
||||||
|
@ -530,7 +530,7 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg,
|
|||||||
// of elements of the aggregate.
|
// of elements of the aggregate.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ToPromote.insert(Operands);
|
ToPromote.insert(std::move(Operands));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user