Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceRegAlloc.cpp - Linear-scan implementation -----------===// | 1 //===- subzero/src/IceRegAlloc.cpp - Linear-scan implementation -----------===// |
| 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 implements the LinearScan class, which performs the | 10 // This file implements the LinearScan class, which performs the |
| 11 // linear-scan register allocation after liveness analysis has been | 11 // linear-scan register allocation after liveness analysis has been |
| 12 // performed. | 12 // performed. |
| 13 // | 13 // |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #include "IceRegAlloc.h" | |
| 17 | |
| 16 #include "IceCfg.h" | 18 #include "IceCfg.h" |
| 17 #include "IceCfgNode.h" | 19 #include "IceCfgNode.h" |
| 18 #include "IceInst.h" | 20 #include "IceInst.h" |
| 19 #include "IceOperand.h" | 21 #include "IceOperand.h" |
| 20 #include "IceRegAlloc.h" | |
| 21 #include "IceTargetLowering.h" | 22 #include "IceTargetLowering.h" |
| 22 | 23 |
| 23 namespace Ice { | 24 namespace Ice { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 // TODO(stichnot): Statically choose the size based on the target | 28 // TODO(stichnot): Statically choose the size based on the target |
| 28 // being compiled. | 29 // being compiled. |
| 29 const size_t REGS_SIZE = 32; | 30 const size_t REGS_SIZE = 32; |
|
Jim Stichnoth
2015/06/24 21:35:33
constexpr here too...
John
2015/06/25 17:13:12
Done.
| |
| 30 | 31 |
| 31 // Returns true if Var has any definitions within Item's live range. | 32 // Returns true if Var has any definitions within Item's live range. |
| 32 // TODO(stichnot): Consider trimming the Definitions list similar to | 33 // TODO(stichnot): Consider trimming the Definitions list similar to |
| 33 // how the live ranges are trimmed, since all the overlapsDefs() tests | 34 // how the live ranges are trimmed, since all the overlapsDefs() tests |
| 34 // are whether some variable's definitions overlap Cur, and trimming | 35 // are whether some variable's definitions overlap Cur, and trimming |
| 35 // is with respect Cur.start. Initial tests show no measurable | 36 // is with respect Cur.start. Initial tests show no measurable |
| 36 // performance difference, so we'll keep the code simple for now. | 37 // performance difference, so we'll keep the code simple for now. |
| 37 bool overlapsDefs(const Cfg *Func, const Variable *Item, const Variable *Var) { | 38 bool overlapsDefs(const Cfg *Func, const Variable *Item, const Variable *Var) { |
| 38 const bool UseTrimmed = true; | 39 const bool UseTrimmed = true; |
| 39 VariablesMetadata *VMetadata = Func->getVMetadata(); | 40 VariablesMetadata *VMetadata = Func->getVMetadata(); |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 Str << "\n"; | 759 Str << "\n"; |
| 759 } | 760 } |
| 760 Str << "++++++ Inactive:\n"; | 761 Str << "++++++ Inactive:\n"; |
| 761 for (const Variable *Item : Inactive) { | 762 for (const Variable *Item : Inactive) { |
| 762 dumpLiveRange(Item, Func); | 763 dumpLiveRange(Item, Func); |
| 763 Str << "\n"; | 764 Str << "\n"; |
| 764 } | 765 } |
| 765 } | 766 } |
| 766 | 767 |
| 767 } // end of namespace Ice | 768 } // end of namespace Ice |
| OLD | NEW |