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

Side by Side Diff: src/IceOperand.h

Issue 720343003: Subzero: Simplify the FakeKill instruction. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Hoist KillsMask out of the loop Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « src/IceInst.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// 1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file declares the Operand class and its target-independent 10 // This file declares the Operand class and its target-independent
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 bool operator<=(const RegWeight &A, const RegWeight &B); 302 bool operator<=(const RegWeight &A, const RegWeight &B);
303 bool operator==(const RegWeight &A, const RegWeight &B); 303 bool operator==(const RegWeight &A, const RegWeight &B);
304 304
305 // LiveRange is a set of instruction number intervals representing 305 // LiveRange is a set of instruction number intervals representing
306 // a variable's live range. Generally there is one interval per basic 306 // a variable's live range. Generally there is one interval per basic
307 // block where the variable is live, but adjacent intervals get 307 // block where the variable is live, but adjacent intervals get
308 // coalesced into a single interval. LiveRange also includes a 308 // coalesced into a single interval. LiveRange also includes a
309 // weight, in case e.g. we want a live range to have higher weight 309 // weight, in case e.g. we want a live range to have higher weight
310 // inside a loop. 310 // inside a loop.
311 class LiveRange { 311 class LiveRange {
312 // LiveRange(const LiveRange &) = delete;
313 // LiveRange &operator=(const LiveRange &) = delete;
314
315 public: 312 public:
316 LiveRange() : Weight(0), IsNonpoints(false) {} 313 LiveRange() : Weight(0) {}
314 LiveRange(const LiveRange &) = default;
315 LiveRange &operator=(const LiveRange &) = default;
317 316
318 void reset() { 317 void reset() {
319 Range.clear(); 318 Range.clear();
320 Weight.setWeight(0); 319 Weight.setWeight(0);
321 untrim(); 320 untrim();
322 IsNonpoints = false;
323 } 321 }
324 void addSegment(InstNumberT Start, InstNumberT End); 322 void addSegment(InstNumberT Start, InstNumberT End);
325 323
326 bool endsBefore(const LiveRange &Other) const; 324 bool endsBefore(const LiveRange &Other) const;
327 bool overlaps(const LiveRange &Other, bool UseTrimmed = false) const; 325 bool overlaps(const LiveRange &Other, bool UseTrimmed = false) const;
328 bool overlapsInst(InstNumberT OtherBegin, bool UseTrimmed = false) const; 326 bool overlapsInst(InstNumberT OtherBegin, bool UseTrimmed = false) const;
329 bool containsValue(InstNumberT Value, bool IsDest) const; 327 bool containsValue(InstNumberT Value, bool IsDest) const;
330 bool isEmpty() const { return Range.empty(); } 328 bool isEmpty() const { return Range.empty(); }
331 bool isNonpoints() const { return IsNonpoints; }
332 InstNumberT getStart() const { 329 InstNumberT getStart() const {
333 return Range.empty() ? -1 : Range.begin()->first; 330 return Range.empty() ? -1 : Range.begin()->first;
334 } 331 }
335 332
336 void untrim() { TrimmedBegin = Range.begin(); } 333 void untrim() { TrimmedBegin = Range.begin(); }
337 void trim(InstNumberT Lower); 334 void trim(InstNumberT Lower);
338 335
339 RegWeight getWeight() const { return Weight; } 336 RegWeight getWeight() const { return Weight; }
340 void setWeight(const RegWeight &NewWeight) { Weight = NewWeight; } 337 void setWeight(const RegWeight &NewWeight) { Weight = NewWeight; }
341 void addWeight(uint32_t Delta) { Weight.addWeight(Delta); } 338 void addWeight(uint32_t Delta) { Weight.addWeight(Delta); }
(...skipping 16 matching lines...) Expand all
358 RegWeight Weight; 355 RegWeight Weight;
359 // TrimmedBegin is an optimization for the overlaps() computation. 356 // TrimmedBegin is an optimization for the overlaps() computation.
360 // Since the linear-scan algorithm always calls it as overlaps(Cur) 357 // Since the linear-scan algorithm always calls it as overlaps(Cur)
361 // and Cur advances monotonically according to live range start, we 358 // and Cur advances monotonically according to live range start, we
362 // can optimize overlaps() by ignoring all segments that end before 359 // can optimize overlaps() by ignoring all segments that end before
363 // the start of Cur's range. The linear-scan code enables this by 360 // the start of Cur's range. The linear-scan code enables this by
364 // calling trim() on the ranges of interest as Cur advances. Note 361 // calling trim() on the ranges of interest as Cur advances. Note
365 // that linear-scan also has to initialize TrimmedBegin at the 362 // that linear-scan also has to initialize TrimmedBegin at the
366 // beginning by calling untrim(). 363 // beginning by calling untrim().
367 RangeType::const_iterator TrimmedBegin; 364 RangeType::const_iterator TrimmedBegin;
368 // IsNonpoints keeps track of whether the live range contains at
369 // least one interval where Start!=End. If it is empty or has the
370 // form [x,x),[y,y),...,[z,z), then overlaps(InstNumberT) is
371 // trivially false.
372 bool IsNonpoints;
373 }; 365 };
374 366
375 Ostream &operator<<(Ostream &Str, const LiveRange &L); 367 Ostream &operator<<(Ostream &Str, const LiveRange &L);
376 368
377 // Variable represents an operand that is register-allocated or 369 // Variable represents an operand that is register-allocated or
378 // stack-allocated. If it is register-allocated, it will ultimately 370 // stack-allocated. If it is register-allocated, it will ultimately
379 // have a non-negative RegNum field. 371 // have a non-negative RegNum field.
380 class Variable : public Operand { 372 class Variable : public Operand {
381 Variable(const Variable &) = delete; 373 Variable(const Variable &) = delete;
382 Variable &operator=(const Variable &) = delete; 374 Variable &operator=(const Variable &) = delete;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 private: 620 private:
629 const Cfg *Func; 621 const Cfg *Func;
630 MetadataKind Kind; 622 MetadataKind Kind;
631 std::vector<VariableTracking> Metadata; 623 std::vector<VariableTracking> Metadata;
632 const static InstDefList NoDefinitions; 624 const static InstDefList NoDefinitions;
633 }; 625 };
634 626
635 } // end of namespace Ice 627 } // end of namespace Ice
636 628
637 #endif // SUBZERO_SRC_ICEOPERAND_H 629 #endif // SUBZERO_SRC_ICEOPERAND_H
OLDNEW
« no previous file with comments | « src/IceInst.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698