mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
Remove unnecessary copying or replace it with moves in a bunch of places.
NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219061 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
53b95f3fb1
commit
dbc6d9b9d7
@ -152,9 +152,9 @@ private:
|
||||
LiveOutVec LiveOuts;
|
||||
CallsiteInfo() : CSOffsetExpr(nullptr), ID(0) {}
|
||||
CallsiteInfo(const MCExpr *CSOffsetExpr, uint64_t ID,
|
||||
LocationVec &Locations, LiveOutVec &LiveOuts)
|
||||
: CSOffsetExpr(CSOffsetExpr), ID(ID), Locations(Locations),
|
||||
LiveOuts(LiveOuts) {}
|
||||
LocationVec &&Locations, LiveOutVec &&LiveOuts)
|
||||
: CSOffsetExpr(CSOffsetExpr), ID(ID), Locations(std::move(Locations)),
|
||||
LiveOuts(std::move(LiveOuts)) {}
|
||||
};
|
||||
|
||||
typedef std::vector<CallsiteInfo> CallsiteInfoList;
|
||||
|
@ -221,7 +221,9 @@ public:
|
||||
SmallVectorImpl<RangeSpan> &getRanges() { return CURanges; }
|
||||
|
||||
/// addRangeList - Add an address range list to the list of range lists.
|
||||
void addRangeList(RangeSpanList Ranges) { CURangeLists.push_back(Ranges); }
|
||||
void addRangeList(RangeSpanList Ranges) {
|
||||
CURangeLists.push_back(std::move(Ranges));
|
||||
}
|
||||
|
||||
/// getRangeLists - Get the vector of range lists.
|
||||
const SmallVectorImpl<RangeSpanList> &getRangeLists() const {
|
||||
|
@ -1881,7 +1881,8 @@ ExpandBVWithShuffles(SDNode *Node, SelectionDAG &DAG,
|
||||
ShuffleVec.data());
|
||||
else if (!TLI.isShuffleMaskLegal(ShuffleVec, VT))
|
||||
return false;
|
||||
NewIntermedVals.push_back(std::make_pair(Shuffle, FinalIndices));
|
||||
NewIntermedVals.push_back(
|
||||
std::make_pair(Shuffle, std::move(FinalIndices)));
|
||||
}
|
||||
|
||||
// If we had an odd number of defined values, then append the last
|
||||
|
@ -2617,12 +2617,12 @@ bool SelectionDAGBuilder::handleBitTestsSwitchCase(CaseRec& CR,
|
||||
|
||||
BitTestBlock BTB(lowBound, cmpRange, SV,
|
||||
-1U, MVT::Other, (CR.CaseBB == SwitchBB),
|
||||
CR.CaseBB, Default, BTC);
|
||||
CR.CaseBB, Default, std::move(BTC));
|
||||
|
||||
if (CR.CaseBB == SwitchBB)
|
||||
visitBitTestHeader(BTB, SwitchBB);
|
||||
|
||||
BitTestCases.push_back(BTB);
|
||||
BitTestCases.push_back(std::move(BTB));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -276,9 +276,9 @@ private:
|
||||
BitTestBlock(APInt F, APInt R, const Value* SV,
|
||||
unsigned Rg, MVT RgVT, bool E,
|
||||
MachineBasicBlock* P, MachineBasicBlock* D,
|
||||
const BitTestInfo& C):
|
||||
BitTestInfo C):
|
||||
First(F), Range(R), SValue(SV), Reg(Rg), RegVT(RgVT), Emitted(E),
|
||||
Parent(P), Default(D), Cases(C) { }
|
||||
Parent(P), Default(D), Cases(std::move(C)) { }
|
||||
APInt First;
|
||||
APInt Range;
|
||||
const Value *SValue;
|
||||
|
@ -235,7 +235,8 @@ void StackMaps::recordStackMapOpers(const MachineInstr &MI, uint64_t ID,
|
||||
MCSymbolRefExpr::Create(AP.CurrentFnSym, OutContext),
|
||||
OutContext);
|
||||
|
||||
CSInfos.push_back(CallsiteInfo(CSOffsetExpr, ID, Locations, LiveOuts));
|
||||
CSInfos.emplace_back(CSOffsetExpr, ID, std::move(Locations),
|
||||
std::move(LiveOuts));
|
||||
|
||||
// Record the stack size of the current function.
|
||||
const MachineFrameInfo *MFI = AP.MF->getFrameInfo();
|
||||
|
@ -30,7 +30,6 @@ bool DWARFAbbreviationDeclarationSet::extract(DataExtractor Data,
|
||||
DWARFAbbreviationDeclaration AbbrDecl;
|
||||
uint32_t PrevAbbrCode = 0;
|
||||
while (AbbrDecl.extract(Data, OffsetPtr)) {
|
||||
Decls.push_back(AbbrDecl);
|
||||
if (FirstAbbrCode == 0) {
|
||||
FirstAbbrCode = AbbrDecl.getCode();
|
||||
} else {
|
||||
@ -40,6 +39,7 @@ bool DWARFAbbreviationDeclarationSet::extract(DataExtractor Data,
|
||||
}
|
||||
}
|
||||
PrevAbbrCode = AbbrDecl.getCode();
|
||||
Decls.push_back(std::move(AbbrDecl));
|
||||
}
|
||||
return BeginOffset != *OffsetPtr;
|
||||
}
|
||||
@ -82,7 +82,7 @@ void DWARFDebugAbbrev::extract(DataExtractor Data) {
|
||||
uint32_t CUAbbrOffset = Offset;
|
||||
if (!AbbrDecls.extract(Data, &Offset))
|
||||
break;
|
||||
AbbrDeclSets[CUAbbrOffset] = AbbrDecls;
|
||||
AbbrDeclSets[CUAbbrOffset] = std::move(AbbrDecls);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,8 @@ public:
|
||||
SmallString<8> Augmentation, uint64_t CodeAlignmentFactor,
|
||||
int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister)
|
||||
: FrameEntry(FK_CIE, Offset, Length), Version(Version),
|
||||
Augmentation(Augmentation), CodeAlignmentFactor(CodeAlignmentFactor),
|
||||
Augmentation(std::move(Augmentation)),
|
||||
CodeAlignmentFactor(CodeAlignmentFactor),
|
||||
DataAlignmentFactor(DataAlignmentFactor),
|
||||
ReturnAddressRegister(ReturnAddressRegister) {}
|
||||
|
||||
|
@ -145,23 +145,23 @@ namespace {
|
||||
bool PromoteToDotNew(MachineInstr* MI, SDep::Kind DepType,
|
||||
MachineBasicBlock::iterator &MII,
|
||||
const TargetRegisterClass* RC);
|
||||
bool CanPromoteToDotNew(MachineInstr* MI, SUnit* PacketSU,
|
||||
unsigned DepReg,
|
||||
std::map <MachineInstr*, SUnit*> MIToSUnit,
|
||||
bool CanPromoteToDotNew(MachineInstr *MI, SUnit *PacketSU, unsigned DepReg,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit,
|
||||
MachineBasicBlock::iterator &MII,
|
||||
const TargetRegisterClass* RC);
|
||||
bool CanPromoteToNewValue(MachineInstr* MI, SUnit* PacketSU,
|
||||
unsigned DepReg,
|
||||
std::map <MachineInstr*, SUnit*> MIToSUnit,
|
||||
MachineBasicBlock::iterator &MII);
|
||||
bool CanPromoteToNewValueStore(MachineInstr* MI, MachineInstr* PacketMI,
|
||||
unsigned DepReg,
|
||||
std::map <MachineInstr*, SUnit*> MIToSUnit);
|
||||
bool DemoteToDotOld(MachineInstr* MI);
|
||||
bool ArePredicatesComplements(MachineInstr* MI1, MachineInstr* MI2,
|
||||
std::map <MachineInstr*, SUnit*> MIToSUnit);
|
||||
bool RestrictingDepExistInPacket(MachineInstr*,
|
||||
unsigned, std::map <MachineInstr*, SUnit*>);
|
||||
const TargetRegisterClass *RC);
|
||||
bool
|
||||
CanPromoteToNewValue(MachineInstr *MI, SUnit *PacketSU, unsigned DepReg,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit,
|
||||
MachineBasicBlock::iterator &MII);
|
||||
bool CanPromoteToNewValueStore(
|
||||
MachineInstr *MI, MachineInstr *PacketMI, unsigned DepReg,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit);
|
||||
bool DemoteToDotOld(MachineInstr *MI);
|
||||
bool ArePredicatesComplements(
|
||||
MachineInstr *MI1, MachineInstr *MI2,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit);
|
||||
bool RestrictingDepExistInPacket(MachineInstr *, unsigned,
|
||||
const std::map<MachineInstr *, SUnit *> &);
|
||||
bool isNewifiable(MachineInstr* MI);
|
||||
bool isCondInst(MachineInstr* MI);
|
||||
bool tryAllocateResourcesForConstExt(MachineInstr* MI);
|
||||
@ -534,9 +534,9 @@ static MachineOperand& GetStoreValueOperand(MachineInstr *MI) {
|
||||
// if there is a new value store in the packet. Corollary, if there is
|
||||
// already a store in a packet, there can not be a new value store.
|
||||
// Arch Spec: 3.4.4.2
|
||||
bool HexagonPacketizerList::CanPromoteToNewValueStore( MachineInstr *MI,
|
||||
MachineInstr *PacketMI, unsigned DepReg,
|
||||
std::map <MachineInstr*, SUnit*> MIToSUnit) {
|
||||
bool HexagonPacketizerList::CanPromoteToNewValueStore(
|
||||
MachineInstr *MI, MachineInstr *PacketMI, unsigned DepReg,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit) {
|
||||
const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
|
||||
// Make sure we are looking at the store, that can be promoted.
|
||||
if (!QII->mayBeNewStore(MI))
|
||||
@ -559,7 +559,7 @@ bool HexagonPacketizerList::CanPromoteToNewValueStore( MachineInstr *MI,
|
||||
for (std::vector<MachineInstr*>::iterator VI = CurrentPacketMIs.begin(),
|
||||
VE = CurrentPacketMIs.end();
|
||||
(VI != VE); ++VI) {
|
||||
SUnit* PacketSU = MIToSUnit[*VI];
|
||||
SUnit *PacketSU = MIToSUnit.find(*VI)->second;
|
||||
if (PacketSU->getInstr()->getDesc().mayStore() ||
|
||||
// if we have mayStore = 1 set on ALLOCFRAME and DEALLOCFRAME,
|
||||
// then we don't need this
|
||||
@ -659,7 +659,7 @@ bool HexagonPacketizerList::CanPromoteToNewValueStore( MachineInstr *MI,
|
||||
|
||||
for (VI=CurrentPacketMIs.begin(), VE = CurrentPacketMIs.end();
|
||||
(VI != VE); ++VI) {
|
||||
SUnit* TempSU = MIToSUnit[*VI];
|
||||
SUnit *TempSU = MIToSUnit.find(*VI)->second;
|
||||
MachineInstr* TempMI = TempSU->getInstr();
|
||||
|
||||
// Following condition is true for all the instructions until PacketMI is
|
||||
@ -715,11 +715,10 @@ bool HexagonPacketizerList::CanPromoteToNewValueStore( MachineInstr *MI,
|
||||
|
||||
// can this MI to promoted to either
|
||||
// new value store or new value jump
|
||||
bool HexagonPacketizerList::CanPromoteToNewValue( MachineInstr *MI,
|
||||
SUnit *PacketSU, unsigned DepReg,
|
||||
std::map <MachineInstr*, SUnit*> MIToSUnit,
|
||||
MachineBasicBlock::iterator &MII)
|
||||
{
|
||||
bool HexagonPacketizerList::CanPromoteToNewValue(
|
||||
MachineInstr *MI, SUnit *PacketSU, unsigned DepReg,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit,
|
||||
MachineBasicBlock::iterator &MII) {
|
||||
|
||||
const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
|
||||
const HexagonRegisterInfo *QRI =
|
||||
@ -744,12 +743,10 @@ bool HexagonPacketizerList::CanPromoteToNewValue( MachineInstr *MI,
|
||||
// 1. dot new on predicate - V2/V3/V4
|
||||
// 2. dot new on stores NV/ST - V4
|
||||
// 3. dot new on jump NV/J - V4 -- This is generated in a pass.
|
||||
bool HexagonPacketizerList::CanPromoteToDotNew( MachineInstr *MI,
|
||||
SUnit *PacketSU, unsigned DepReg,
|
||||
std::map <MachineInstr*, SUnit*> MIToSUnit,
|
||||
MachineBasicBlock::iterator &MII,
|
||||
const TargetRegisterClass* RC )
|
||||
{
|
||||
bool HexagonPacketizerList::CanPromoteToDotNew(
|
||||
MachineInstr *MI, SUnit *PacketSU, unsigned DepReg,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit,
|
||||
MachineBasicBlock::iterator &MII, const TargetRegisterClass *RC) {
|
||||
const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
|
||||
// Already a dot new instruction.
|
||||
if (QII->isDotNewInst(MI) && !QII->mayBeNewStore(MI))
|
||||
@ -801,12 +798,12 @@ bool HexagonPacketizerList::CanPromoteToDotNew( MachineInstr *MI,
|
||||
// The P3 from a) and d) will be complements after
|
||||
// a)'s P3 is converted to .new form
|
||||
// Anti Dep between c) and b) is irrelevant for this case
|
||||
bool HexagonPacketizerList::RestrictingDepExistInPacket (MachineInstr* MI,
|
||||
unsigned DepReg,
|
||||
std::map <MachineInstr*, SUnit*> MIToSUnit) {
|
||||
bool HexagonPacketizerList::RestrictingDepExistInPacket(
|
||||
MachineInstr *MI, unsigned DepReg,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit) {
|
||||
|
||||
const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
|
||||
SUnit* PacketSUDep = MIToSUnit[MI];
|
||||
SUnit *PacketSUDep = MIToSUnit.find(MI)->second;
|
||||
|
||||
for (std::vector<MachineInstr*>::iterator VIN = CurrentPacketMIs.begin(),
|
||||
VEN = CurrentPacketMIs.end(); (VIN != VEN); ++VIN) {
|
||||
@ -815,7 +812,7 @@ bool HexagonPacketizerList::RestrictingDepExistInPacket (MachineInstr* MI,
|
||||
if(!QII->isPredicated(*VIN)) continue;
|
||||
|
||||
// Scheduling Unit for current insn in the packet
|
||||
SUnit* PacketSU = MIToSUnit[*VIN];
|
||||
SUnit *PacketSU = MIToSUnit.find(*VIN)->second;
|
||||
|
||||
// Look at dependencies between current members of the packet
|
||||
// and predicate defining instruction MI.
|
||||
@ -859,8 +856,9 @@ static unsigned getPredicatedRegister(MachineInstr *MI,
|
||||
|
||||
// Given two predicated instructions, this function detects whether
|
||||
// the predicates are complements
|
||||
bool HexagonPacketizerList::ArePredicatesComplements (MachineInstr* MI1,
|
||||
MachineInstr* MI2, std::map <MachineInstr*, SUnit*> MIToSUnit) {
|
||||
bool HexagonPacketizerList::ArePredicatesComplements(
|
||||
MachineInstr *MI1, MachineInstr *MI2,
|
||||
const std::map<MachineInstr *, SUnit *> &MIToSUnit) {
|
||||
|
||||
const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
|
||||
|
||||
@ -871,7 +869,7 @@ bool HexagonPacketizerList::ArePredicatesComplements (MachineInstr* MI1,
|
||||
return false;
|
||||
|
||||
// Scheduling unit for candidate
|
||||
SUnit* SU = MIToSUnit[MI1];
|
||||
SUnit *SU = MIToSUnit.find(MI1)->second;
|
||||
|
||||
// One corner case deals with the following scenario:
|
||||
// Trying to add
|
||||
@ -896,7 +894,7 @@ bool HexagonPacketizerList::ArePredicatesComplements (MachineInstr* MI1,
|
||||
VEN = CurrentPacketMIs.end(); (VIN != VEN); ++VIN) {
|
||||
|
||||
// Scheduling Unit for current insn in the packet
|
||||
SUnit* PacketSU = MIToSUnit[*VIN];
|
||||
SUnit *PacketSU = MIToSUnit.find(*VIN)->second;
|
||||
|
||||
// If this instruction in the packet is succeeded by the candidate...
|
||||
if (PacketSU->isSucc(SU)) {
|
||||
@ -1101,7 +1099,7 @@ bool HexagonPacketizerList::isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ) {
|
||||
VI = CurrentPacketMIs.begin(),
|
||||
VE = CurrentPacketMIs.end();
|
||||
(VI != VE && maintainNewValueJump); ++VI) {
|
||||
SUnit* PacketSU = MIToSUnit[*VI];
|
||||
SUnit *PacketSU = MIToSUnit.find(*VI)->second;
|
||||
|
||||
// NVJ can not be part of the dual jump - Arch Spec: section 7.8
|
||||
if (PacketSU->getInstr()->getDesc().isCall()) {
|
||||
|
@ -72,7 +72,8 @@ void MipsAnalyzeImmediate::GetInstSeqLs(uint64_t Imm, unsigned RemSize,
|
||||
if (Imm & 0x8000) {
|
||||
InstSeqLs SeqLsORi;
|
||||
GetInstSeqLsORi(Imm, RemSize, SeqLsORi);
|
||||
SeqLs.insert(SeqLs.end(), SeqLsORi.begin(), SeqLsORi.end());
|
||||
SeqLs.append(std::make_move_iterator(SeqLsORi.begin()),
|
||||
std::make_move_iterator(SeqLsORi.end()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,11 +90,11 @@ static void cacheAnnotationFromMD(const Module *m, const GlobalValue *gv) {
|
||||
return;
|
||||
|
||||
if ((*annotationCache).find(m) != (*annotationCache).end())
|
||||
(*annotationCache)[m][gv] = tmp;
|
||||
(*annotationCache)[m][gv] = std::move(tmp);
|
||||
else {
|
||||
global_val_annot_t tmp1;
|
||||
tmp1[gv] = tmp;
|
||||
(*annotationCache)[m] = tmp1;
|
||||
tmp1[gv] = std::move(tmp);
|
||||
(*annotationCache)[m] = std::move(tmp1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,14 +105,16 @@ static VectorType *arrayTypeToVecType(const Type *ArrayTy) {
|
||||
ArrayTy->getArrayNumElements());
|
||||
}
|
||||
|
||||
static Value* calculateVectorIndex(Value *Ptr,
|
||||
std::map<GetElementPtrInst*, Value*> GEPIdx) {
|
||||
static Value *
|
||||
calculateVectorIndex(Value *Ptr,
|
||||
const std::map<GetElementPtrInst *, Value *> &GEPIdx) {
|
||||
if (isa<AllocaInst>(Ptr))
|
||||
return Constant::getNullValue(Type::getInt32Ty(Ptr->getContext()));
|
||||
|
||||
GetElementPtrInst *GEP = cast<GetElementPtrInst>(Ptr);
|
||||
|
||||
return GEPIdx[GEP];
|
||||
auto I = GEPIdx.find(GEP);
|
||||
return I == GEPIdx.end() ? nullptr : I->second;
|
||||
}
|
||||
|
||||
static Value* GEPToVectorIndex(GetElementPtrInst *GEP) {
|
||||
|
@ -459,11 +459,9 @@ private:
|
||||
void CounterPropagateAddr(MachineInstr *MI, unsigned Addr) const {
|
||||
MI->getOperand(0).setImm(Addr + MI->getOperand(0).getImm());
|
||||
}
|
||||
void CounterPropagateAddr(std::set<MachineInstr *> MIs, unsigned Addr)
|
||||
const {
|
||||
for (std::set<MachineInstr *>::iterator It = MIs.begin(), E = MIs.end();
|
||||
It != E; ++It) {
|
||||
MachineInstr *MI = *It;
|
||||
void CounterPropagateAddr(const std::set<MachineInstr *> &MIs,
|
||||
unsigned Addr) const {
|
||||
for (MachineInstr *MI : MIs) {
|
||||
CounterPropagateAddr(MI, Addr);
|
||||
}
|
||||
}
|
||||
@ -543,7 +541,7 @@ public:
|
||||
std::pair<unsigned, std::set<MachineInstr *> > Pair(CfCount,
|
||||
std::set<MachineInstr *>());
|
||||
Pair.second.insert(MIb);
|
||||
LoopStack.push_back(Pair);
|
||||
LoopStack.push_back(std::move(Pair));
|
||||
MI->eraseFromParent();
|
||||
CfCount++;
|
||||
break;
|
||||
@ -551,7 +549,7 @@ public:
|
||||
case AMDGPU::ENDLOOP: {
|
||||
CFStack.popLoop();
|
||||
std::pair<unsigned, std::set<MachineInstr *> > Pair =
|
||||
LoopStack.back();
|
||||
std::move(LoopStack.back());
|
||||
LoopStack.pop_back();
|
||||
CounterPropagateAddr(Pair.second, CfCount);
|
||||
BuildMI(MBB, MI, MBB.findDebugLoc(MI), getHWInstrDesc(CF_END_LOOP))
|
||||
|
@ -782,7 +782,7 @@ LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
|
||||
return Chain;
|
||||
}
|
||||
|
||||
static bool canUseSiblingCall(CCState ArgCCInfo,
|
||||
static bool canUseSiblingCall(const CCState &ArgCCInfo,
|
||||
SmallVectorImpl<CCValAssign> &ArgLocs) {
|
||||
// Punt if there are any indirect or stack arguments, or if the call
|
||||
// needs the call-saved argument register R6.
|
||||
|
@ -91,7 +91,7 @@ struct RebasedConstantInfo {
|
||||
Constant *Offset;
|
||||
|
||||
RebasedConstantInfo(ConstantUseListType &&Uses, Constant *Offset)
|
||||
: Uses(Uses), Offset(Offset) { }
|
||||
: Uses(std::move(Uses)), Offset(Offset) { }
|
||||
};
|
||||
|
||||
/// \brief A base constant and all its rebased constants.
|
||||
@ -395,7 +395,7 @@ void ConstantHoisting::findAndMakeBaseConstant(ConstCandVecType::iterator S,
|
||||
ConstInfo.RebasedConstants.push_back(
|
||||
RebasedConstantInfo(std::move(ConstCand->Uses), Offset));
|
||||
}
|
||||
ConstantVec.push_back(ConstInfo);
|
||||
ConstantVec.push_back(std::move(ConstInfo));
|
||||
}
|
||||
|
||||
/// \brief Finds and combines constant candidates that can be easily
|
||||
|
Loading…
Reference in New Issue
Block a user