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

Unified Diff: src/IceOperand.h

Issue 734053006: Subzero: Use std::vector<> instead of std::list for live range segments. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « src/IceDefs.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceOperand.h
diff --git a/src/IceOperand.h b/src/IceOperand.h
index d477ae0a03e5035425674855ee67a9814b781d47..c99b9d7a6f355405e6925f8532574c3a7d50b373 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -326,6 +326,13 @@ bool operator==(const RegWeight &A, const RegWeight &B);
class LiveRange {
public:
LiveRange() : Weight(0) {}
+ // Special constructor for building a kill set. The advantage is
+ // that we can reserve the right amount of space in advance.
+ LiveRange(const std::vector<InstNumberT> &Kills) : Weight(0) {
+ Range.reserve(Kills.size());
+ for (InstNumberT I : Kills)
+ addSegment(I, I);
+ }
LiveRange(const LiveRange &) = default;
LiveRange &operator=(const LiveRange &) = default;
@@ -353,19 +360,9 @@ public:
void addWeight(uint32_t Delta) { Weight.addWeight(Delta); }
void dump(Ostream &Str) const;
- // Defining USE_SET uses std::set to hold the segments instead of
- // std::list. Using std::list will be slightly faster, but is more
- // restrictive because new segments cannot be added in the middle.
-
- //#define USE_SET
-
private:
typedef std::pair<InstNumberT, InstNumberT> RangeElementType;
-#ifdef USE_SET
- typedef std::set<RangeElementType> RangeType;
-#else
- typedef std::list<RangeElementType> RangeType;
-#endif
+ typedef std::vector<RangeElementType> RangeType;
RangeType Range;
RegWeight Weight;
// TrimmedBegin is an optimization for the overlaps() computation.
« no previous file with comments | « src/IceDefs.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698