Subzero: Auto-awesome iterators.
Use C++11 'auto' where practical to make iteration more concise.
Use C++11 range-based for loops where possible.
BUG= none
R=jfb@chromium.org, kschimpf@google.com
Review URL: https://codereview.chromium.org/619893002
diff --git a/src/IceTargetLowering.h b/src/IceTargetLowering.h
index 1995124..43e6a01 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -24,6 +24,8 @@
namespace Ice {
+typedef uint8_t AsmCodeByte;
+
class Assembler;
// LoweringContext makes it easy to iterate through non-deleted
@@ -52,6 +54,9 @@
bool atEnd() const { return Cur == End; }
InstList::iterator getCur() const { return Cur; }
InstList::iterator getEnd() const { return End; }
+ // Adaptor to enable range-based for loops.
+ InstList::iterator begin() const { return getCur(); }
+ InstList::iterator end() const { return getEnd(); }
void insert(Inst *Inst);
Inst *getLastInserted() const;
void advanceCur() { Cur = Next; }
@@ -145,7 +150,7 @@
virtual SizeT getFrameOrStackReg() const = 0;
virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0;
virtual SizeT getBundleAlignLog2Bytes() const = 0;
- virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const = 0;
+ virtual llvm::ArrayRef<AsmCodeByte> getNonExecBundlePadding() const = 0;
bool hasComputedFrame() const { return HasComputedFrame; }
bool shouldDoNopInsertion() const;
// Returns true if this function calls a function that has the