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

Side by Side Diff: src/IceOperand.h

Issue 656023002: Subzero: Register allocator performance improvements and simplifications. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/IceLiveness.cpp ('k') | src/IceRegAlloc.h » ('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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 RegNum = NewRegNum; 405 RegNum = NewRegNum;
406 } 406 }
407 bool hasRegTmp() const { return getRegNumTmp() != NoRegister; } 407 bool hasRegTmp() const { return getRegNumTmp() != NoRegister; }
408 int32_t getRegNumTmp() const { return RegNumTmp; } 408 int32_t getRegNumTmp() const { return RegNumTmp; }
409 void setRegNumTmp(int32_t NewRegNum) { RegNumTmp = NewRegNum; } 409 void setRegNumTmp(int32_t NewRegNum) { RegNumTmp = NewRegNum; }
410 410
411 RegWeight getWeight() const { return Weight; } 411 RegWeight getWeight() const { return Weight; }
412 void setWeight(uint32_t NewWeight) { Weight = NewWeight; } 412 void setWeight(uint32_t NewWeight) { Weight = NewWeight; }
413 void setWeightInfinite() { Weight = RegWeight::Inf; } 413 void setWeightInfinite() { Weight = RegWeight::Inf; }
414 414
415 LiveRange &getLiveRange() { return Live; }
jvoung (off chromium) 2014/10/15 16:42:36 There's also the const LiveRange &getLiveRange() c
Jim Stichnoth 2014/10/15 16:47:41 Unfortunately, at least one caller needs the const
415 const LiveRange &getLiveRange() const { return Live; } 416 const LiveRange &getLiveRange() const { return Live; }
416 void setLiveRange(const LiveRange &Range) { Live = Range; } 417 void setLiveRange(const LiveRange &Range) { Live = Range; }
417 void resetLiveRange() { Live.reset(); } 418 void resetLiveRange() { Live.reset(); }
418 void addLiveRange(InstNumberT Start, InstNumberT End, uint32_t WeightDelta) { 419 void addLiveRange(InstNumberT Start, InstNumberT End, uint32_t WeightDelta) {
419 assert(WeightDelta != RegWeight::Inf); 420 assert(WeightDelta != RegWeight::Inf);
420 Live.addSegment(Start, End); 421 Live.addSegment(Start, End);
421 if (Weight.isInf()) 422 if (Weight.isInf())
422 Live.setWeight(RegWeight::Inf); 423 Live.setWeight(RegWeight::Inf);
423 else 424 else
424 Live.addWeight(WeightDelta * Weight.getWeight()); 425 Live.addWeight(WeightDelta * Weight.getWeight());
425 } 426 }
426 void setLiveRangeInfiniteWeight() { Live.setWeight(RegWeight::Inf); } 427 void setLiveRangeInfiniteWeight() { Live.setWeight(RegWeight::Inf); }
427 void trimLiveRange(InstNumberT Start) { Live.trim(Start); } 428 void trimLiveRange(InstNumberT Start) { Live.trim(Start); }
428 void untrimLiveRange() { Live.untrim(); } 429 void untrimLiveRange() { Live.untrim(); }
430 bool rangeEndsBefore(const Variable *Other) const {
431 return Live.endsBefore(Other->Live);
432 }
433 bool rangeOverlaps(const Variable *Other) const {
434 const bool UseTrimmed = true;
435 return Live.overlaps(Other->Live, UseTrimmed);
436 }
437 bool rangeOverlapsStart(const Variable *Other) const {
438 const bool UseTrimmed = true;
439 return Live.overlapsInst(Other->Live.getStart(), UseTrimmed);
440 }
429 441
430 Variable *getLo() const { return LoVar; } 442 Variable *getLo() const { return LoVar; }
431 Variable *getHi() const { return HiVar; } 443 Variable *getHi() const { return HiVar; }
432 void setLoHi(Variable *Lo, Variable *Hi) { 444 void setLoHi(Variable *Lo, Variable *Hi) {
433 assert(LoVar == NULL); 445 assert(LoVar == NULL);
434 assert(HiVar == NULL); 446 assert(HiVar == NULL);
435 LoVar = Lo; 447 LoVar = Lo;
436 HiVar = Hi; 448 HiVar = Hi;
437 } 449 }
438 // Creates a temporary copy of the variable with a different type. 450 // Creates a temporary copy of the variable with a different type.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 const Cfg *Func; 602 const Cfg *Func;
591 std::vector<VariableTracking> Metadata; 603 std::vector<VariableTracking> Metadata;
592 const static InstDefList NoDefinitions; 604 const static InstDefList NoDefinitions;
593 VariablesMetadata(const VariablesMetadata &) = delete; 605 VariablesMetadata(const VariablesMetadata &) = delete;
594 VariablesMetadata &operator=(const VariablesMetadata &) = delete; 606 VariablesMetadata &operator=(const VariablesMetadata &) = delete;
595 }; 607 };
596 608
597 } // end of namespace Ice 609 } // end of namespace Ice
598 610
599 #endif // SUBZERO_SRC_ICEOPERAND_H 611 #endif // SUBZERO_SRC_ICEOPERAND_H
OLDNEW
« no previous file with comments | « src/IceLiveness.cpp ('k') | src/IceRegAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698