Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 619893002: Subzero: Auto-awesome iterators. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Make some iterator element names more uniform Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index b9d3170d2182e41a5fd847af566f7f52ee0fddb2..7b4c690f99548e78ea0011f4cb1e46f23c72d9b1 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -545,9 +545,7 @@ void TargetX8632::sortByAlignment(VarList &Dest, const VarList &Source) const {
X86_LOG2_OF_MAX_STACK_SLOT_SIZE - X86_LOG2_OF_MIN_STACK_SLOT_SIZE + 1;
VarList Buckets[NumBuckets];
- for (VarList::const_iterator I = Source.begin(), E = Source.end(); I != E;
- ++I) {
- Variable *Var = *I;
+ for (auto &Var : Source) {
uint32_t NaturalAlignment = typeWidthInBytesOnStack(Var->getType());
SizeT LogNaturalAlignment = llvm::findFirstSet(NaturalAlignment);
assert(LogNaturalAlignment >= X86_LOG2_OF_MIN_STACK_SLOT_SIZE);
@@ -688,9 +686,7 @@ void TargetX8632::addProlog(CfgNode *Node) {
// The entire spill locations area gets aligned to largest natural
// alignment of the variables that have a spill slot.
uint32_t SpillAreaAlignmentBytes = 0;
- for (VarList::const_iterator I = Variables.begin(), E = Variables.end();
- I != E; ++I) {
- Variable *Var = *I;
+ for (auto &Var : Variables) {
if (Var->hasReg()) {
RegsUsed[Var->getRegNum()] = true;
continue;
@@ -716,10 +712,7 @@ void TargetX8632::addProlog(CfgNode *Node) {
SortedSpilledVariables.reserve(SpilledVariables.size());
sortByAlignment(SortedSpilledVariables, SpilledVariables);
- for (VarList::const_iterator I = SortedSpilledVariables.begin(),
- E = SortedSpilledVariables.end();
- I != E; ++I) {
- Variable *Var = *I;
+ for (auto &Var : SortedSpilledVariables) {
size_t Increment = typeWidthInBytesOnStack(Var->getType());
if (!SpillAreaAlignmentBytes)
SpillAreaAlignmentBytes = Increment;
@@ -827,10 +820,7 @@ void TargetX8632::addProlog(CfgNode *Node) {
size_t GlobalsSpaceUsed = SpillAreaPaddingBytes;
LocalsSize.assign(LocalsSize.size(), 0);
size_t NextStackOffset = GlobalsSpaceUsed;
- for (VarList::const_iterator I = SortedSpilledVariables.begin(),
- E = SortedSpilledVariables.end();
- I != E; ++I) {
- Variable *Var = *I;
+ for (auto &Var : SortedSpilledVariables) {
size_t Increment = typeWidthInBytesOnStack(Var->getType());
if (SimpleCoalescing && VMetadata->isTracked(Var)) {
if (VMetadata->isMultiBlock(Var)) {
@@ -856,10 +846,7 @@ void TargetX8632::addProlog(CfgNode *Node) {
// Assign stack offsets to variables that have been linked to spilled
// variables.
- for (VarList::const_iterator I = VariablesLinkedToSpillSlots.begin(),
- E = VariablesLinkedToSpillSlots.end();
- I != E; ++I) {
- Variable *Var = *I;
+ for (auto &Var : VariablesLinkedToSpillSlots) {
Variable *Linked = (llvm::cast<SpillVariable>(Var))->getLinkedTo();
Var->setStackOffset(Linked->getStackOffset());
}
@@ -969,9 +956,8 @@ template <typename T> void TargetX8632::emitConstantPool() const {
Str << "\t.section\t.rodata.cst" << Align << ",\"aM\",@progbits," << Align
<< "\n";
Str << "\t.align\t" << Align << "\n";
- for (ConstantList::const_iterator I = Pool.begin(), E = Pool.end(); I != E;
- ++I) {
- typename T::IceType *Const = llvm::cast<typename T::IceType>(*I);
+ for (auto &I : Pool) {
+ typename T::IceType *Const = llvm::cast<typename T::IceType>(I);
typename T::PrimitiveFpType Value = Const->getValue();
// Use memcpy() to copy bits from Value into RawValue in a way
// that avoids breaking strict-aliasing rules.
@@ -4323,8 +4309,7 @@ void TargetX8632::postLower() {
// The first pass also keeps track of which instruction is the last
// use for each infinite-weight variable. After the last use, the
// variable is released to the free list.
- for (InstList::iterator I = Context.getCur(), E = Context.getEnd(); I != E;
- ++I) {
+ for (auto I = Context.getCur(), E = Context.getEnd(); I != E; ++I) {
const Inst *Inst = *I;
if (Inst->isDeleted())
continue;
@@ -4357,8 +4342,7 @@ void TargetX8632::postLower() {
// The second pass colors infinite-weight variables.
llvm::SmallBitVector AvailableRegisters = WhiteList;
llvm::SmallBitVector FreedRegisters(WhiteList.size());
- for (InstList::iterator I = Context.getCur(), E = Context.getEnd(); I != E;
- ++I) {
+ for (auto I = Context.getCur(), E = Context.getEnd(); I != E; ++I) {
FreedRegisters.reset();
const Inst *Inst = *I;
if (Inst->isDeleted())
« src/IceRegAlloc.cpp ('K') | « src/IceRegAlloc.cpp ('k') | src/IceTimerTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698