OLD | NEW |
1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// | 1 //===- subzero/src/IceCfg.cpp - Control flow graph 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 /// \file | 10 /// \file |
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 } | 1699 } |
1700 | 1700 |
1701 size_t Cfg::getLivenessMemoryMB() const { | 1701 size_t Cfg::getLivenessMemoryMB() const { |
1702 constexpr size_t _1MB = 1024 * 1024; | 1702 constexpr size_t _1MB = 1024 * 1024; |
1703 if (Live == nullptr) { | 1703 if (Live == nullptr) { |
1704 return 0; | 1704 return 0; |
1705 } | 1705 } |
1706 return Live->getAllocator()->getTotalMemory() / _1MB; | 1706 return Live->getAllocator()->getTotalMemory() / _1MB; |
1707 } | 1707 } |
1708 | 1708 |
| 1709 void Cfg::addVariable(Variable *Var) { |
| 1710 assert(Var); |
| 1711 Var->setIndex(getVariables().size()); |
| 1712 Variables.push_back(Var); |
| 1713 } |
| 1714 |
1709 // Dumps the IR with an optional introductory message. | 1715 // Dumps the IR with an optional introductory message. |
1710 void Cfg::dump(const char *Message) { | 1716 void Cfg::dump(const char *Message) { |
1711 if (!BuildDefs::dump()) | 1717 if (!BuildDefs::dump()) |
1712 return; | 1718 return; |
1713 if (!isVerbose()) | 1719 if (!isVerbose()) |
1714 return; | 1720 return; |
1715 OstreamLocker L(Ctx); | 1721 OstreamLocker L(Ctx); |
1716 Ostream &Str = Ctx->getStrDump(); | 1722 Ostream &Str = Ctx->getStrDump(); |
1717 if (Message[0]) | 1723 if (Message[0]) |
1718 Str << "================ " << Message << " ================\n"; | 1724 Str << "================ " << Message << " ================\n"; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 } | 1773 } |
1768 } | 1774 } |
1769 // Print each basic block | 1775 // Print each basic block |
1770 for (CfgNode *Node : Nodes) | 1776 for (CfgNode *Node : Nodes) |
1771 Node->dump(this); | 1777 Node->dump(this); |
1772 if (isVerbose(IceV_Instructions)) | 1778 if (isVerbose(IceV_Instructions)) |
1773 Str << "}\n"; | 1779 Str << "}\n"; |
1774 } | 1780 } |
1775 | 1781 |
1776 } // end of namespace Ice | 1782 } // end of namespace Ice |
OLD | NEW |