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

Side by Side Diff: src/IceOperand.h

Issue 1253833002: Subzero: Cleanly implement register allocation after phi lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleanup Created 5 years, 5 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
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 /// \file 10 /// \file
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 void addSegment(InstNumberT Start, InstNumberT End); 370 void addSegment(InstNumberT Start, InstNumberT End);
371 371
372 bool endsBefore(const LiveRange &Other) const; 372 bool endsBefore(const LiveRange &Other) const;
373 bool overlaps(const LiveRange &Other, bool UseTrimmed = false) const; 373 bool overlaps(const LiveRange &Other, bool UseTrimmed = false) const;
374 bool overlapsInst(InstNumberT OtherBegin, bool UseTrimmed = false) const; 374 bool overlapsInst(InstNumberT OtherBegin, bool UseTrimmed = false) const;
375 bool containsValue(InstNumberT Value, bool IsDest) const; 375 bool containsValue(InstNumberT Value, bool IsDest) const;
376 bool isEmpty() const { return Range.empty(); } 376 bool isEmpty() const { return Range.empty(); }
377 InstNumberT getStart() const { 377 InstNumberT getStart() const {
378 return Range.empty() ? -1 : Range.begin()->first; 378 return Range.empty() ? -1 : Range.begin()->first;
379 } 379 }
380 InstNumberT getEnd() const {
381 return Range.empty() ? -1 : Range.rbegin()->second;
382 }
380 383
381 void untrim() { TrimmedBegin = Range.begin(); } 384 void untrim() { TrimmedBegin = Range.begin(); }
382 void trim(InstNumberT Lower); 385 void trim(InstNumberT Lower);
383 386
384 RegWeight getWeight() const { return Weight; } 387 RegWeight getWeight() const { return Weight; }
385 void setWeight(const RegWeight &NewWeight) { Weight = NewWeight; } 388 void setWeight(const RegWeight &NewWeight) { Weight = NewWeight; }
386 void addWeight(uint32_t Delta) { Weight.addWeight(Delta); } 389 void addWeight(uint32_t Delta) { Weight.addWeight(Delta); }
387 void dump(Ostream &Str) const; 390 void dump(Ostream &Str) const;
388 391
389 private: 392 private:
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 MDS_MultiDefMultiBlock 573 MDS_MultiDefMultiBlock
571 }; 574 };
572 enum MultiBlockState { MBS_Unknown, MBS_SingleBlock, MBS_MultiBlock }; 575 enum MultiBlockState { MBS_Unknown, MBS_SingleBlock, MBS_MultiBlock };
573 VariableTracking() = default; 576 VariableTracking() = default;
574 VariableTracking(const VariableTracking &) = default; 577 VariableTracking(const VariableTracking &) = default;
575 MultiDefState getMultiDef() const { return MultiDef; } 578 MultiDefState getMultiDef() const { return MultiDef; }
576 MultiBlockState getMultiBlock() const { return MultiBlock; } 579 MultiBlockState getMultiBlock() const { return MultiBlock; }
577 const Inst *getFirstDefinition() const; 580 const Inst *getFirstDefinition() const;
578 const Inst *getSingleDefinition() const; 581 const Inst *getSingleDefinition() const;
579 const InstDefList &getLatterDefinitions() const { return Definitions; } 582 const InstDefList &getLatterDefinitions() const { return Definitions; }
580 const CfgNode *getNode() const { return SingleUseNode; } 583 CfgNode *getNode() const { return SingleUseNode; }
581 void markUse(MetadataKind TrackingKind, const Inst *Instr, 584 void markUse(MetadataKind TrackingKind, const Inst *Instr, CfgNode *Node,
582 const CfgNode *Node, bool IsFromDef, bool IsImplicit); 585 bool IsImplicit);
583 void markDef(MetadataKind TrackingKind, const Inst *Instr, 586 void markDef(MetadataKind TrackingKind, const Inst *Instr, CfgNode *Node);
584 const CfgNode *Node);
585 587
586 private: 588 private:
587 MultiDefState MultiDef = MDS_Unknown; 589 MultiDefState MultiDef = MDS_Unknown;
588 MultiBlockState MultiBlock = MBS_Unknown; 590 MultiBlockState MultiBlock = MBS_Unknown;
589 const CfgNode *SingleUseNode = nullptr; 591 CfgNode *SingleUseNode = nullptr;
590 const CfgNode *SingleDefNode = nullptr; 592 CfgNode *SingleDefNode = nullptr;
591 /// All definitions of the variable are collected here, in increasing 593 /// All definitions of the variable are collected here, in increasing
592 /// order of instruction number. 594 /// order of instruction number.
593 InstDefList Definitions; /// Only used if Kind==VMK_All 595 InstDefList Definitions; /// Only used if Kind==VMK_All
594 const Inst *FirstOrSingleDefinition = 596 const Inst *FirstOrSingleDefinition =
595 nullptr; /// Is a copy of Definitions[0] if Kind==VMK_All 597 nullptr; /// Is a copy of Definitions[0] if Kind==VMK_All
596 }; 598 };
597 599
598 /// VariablesMetadata analyzes and summarizes the metadata for the 600 /// VariablesMetadata analyzes and summarizes the metadata for the
599 /// complete set of Variables. 601 /// complete set of Variables.
600 class VariablesMetadata { 602 class VariablesMetadata {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 /// Returns whether the given Variable is live across multiple 640 /// Returns whether the given Variable is live across multiple
639 /// blocks. Mainly, this is used to partition Variables into 641 /// blocks. Mainly, this is used to partition Variables into
640 /// single-block versus multi-block sets for leveraging sparsity in 642 /// single-block versus multi-block sets for leveraging sparsity in
641 /// liveness analysis, and for implementing simple stack slot 643 /// liveness analysis, and for implementing simple stack slot
642 /// coalescing. As a special case, function arguments are always 644 /// coalescing. As a special case, function arguments are always
643 /// considered multi-block because they are live coming into the 645 /// considered multi-block because they are live coming into the
644 /// entry block. 646 /// entry block.
645 bool isMultiBlock(const Variable *Var) const; 647 bool isMultiBlock(const Variable *Var) const;
646 /// Returns the node that the given Variable is used in, assuming 648 /// Returns the node that the given Variable is used in, assuming
647 /// isMultiBlock() returns false. Otherwise, nullptr is returned. 649 /// isMultiBlock() returns false. Otherwise, nullptr is returned.
648 const CfgNode *getLocalUseNode(const Variable *Var) const; 650 CfgNode *getLocalUseNode(const Variable *Var) const;
649 651
650 private: 652 private:
651 const Cfg *Func; 653 const Cfg *Func;
652 MetadataKind Kind; 654 MetadataKind Kind;
653 std::vector<VariableTracking> Metadata; 655 std::vector<VariableTracking> Metadata;
654 const static InstDefList NoDefinitions; 656 const static InstDefList NoDefinitions;
655 }; 657 };
656 658
657 } // end of namespace Ice 659 } // end of namespace Ice
658 660
659 #endif // SUBZERO_SRC_ICEOPERAND_H 661 #endif // SUBZERO_SRC_ICEOPERAND_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698