| 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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 deleteJumpTableInsts(); | 1079 deleteJumpTableInsts(); |
| 1080 const bool NeedSandboxing = Ctx->getFlags().getUseSandboxing(); | 1080 const bool NeedSandboxing = Ctx->getFlags().getUseSandboxing(); |
| 1081 for (CfgNode *Node : Nodes) { | 1081 for (CfgNode *Node : Nodes) { |
| 1082 if (NeedSandboxing && Node->needsAlignment()) | 1082 if (NeedSandboxing && Node->needsAlignment()) |
| 1083 getAssembler()->alignCfgNode(); | 1083 getAssembler()->alignCfgNode(); |
| 1084 Node->emitIAS(this); | 1084 Node->emitIAS(this); |
| 1085 } | 1085 } |
| 1086 emitJumpTables(); | 1086 emitJumpTables(); |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 size_t Cfg::getTotalMemoryMB() { | 1089 size_t Cfg::getTotalMemoryMB() const { |
| 1090 constexpr size_t OneMB = 1024 * 1024; | 1090 constexpr size_t _1MB = 1024 * 1024; |
| 1091 using ArbitraryType = int; | 1091 assert(Allocator != nullptr); |
| 1092 // CfgLocalAllocator draws from the same memory pool regardless of allocated | 1092 assert(CfgAllocatorTraits::current() == Allocator.get()); |
| 1093 // object type, so pick an arbitrary type for the template parameter. | 1093 return Allocator->getTotalMemory() / _1MB; |
| 1094 return CfgLocalAllocator<ArbitraryType>().current()->getTotalMemory() / OneMB; | 1094 } |
| 1095 |
| 1096 size_t Cfg::getLivenessMemoryMB() const { |
| 1097 constexpr size_t _1MB = 1024 * 1024; |
| 1098 if (Live == nullptr) { |
| 1099 return 0; |
| 1100 } |
| 1101 return Live->getAllocator()->getTotalMemory() / _1MB; |
| 1095 } | 1102 } |
| 1096 | 1103 |
| 1097 // Dumps the IR with an optional introductory message. | 1104 // Dumps the IR with an optional introductory message. |
| 1098 void Cfg::dump(const char *Message) { | 1105 void Cfg::dump(const char *Message) { |
| 1099 if (!BuildDefs::dump()) | 1106 if (!BuildDefs::dump()) |
| 1100 return; | 1107 return; |
| 1101 if (!isVerbose()) | 1108 if (!isVerbose()) |
| 1102 return; | 1109 return; |
| 1103 OstreamLocker L(Ctx); | 1110 OstreamLocker L(Ctx); |
| 1104 Ostream &Str = Ctx->getStrDump(); | 1111 Ostream &Str = Ctx->getStrDump(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 } | 1162 } |
| 1156 } | 1163 } |
| 1157 // Print each basic block | 1164 // Print each basic block |
| 1158 for (CfgNode *Node : Nodes) | 1165 for (CfgNode *Node : Nodes) |
| 1159 Node->dump(this); | 1166 Node->dump(this); |
| 1160 if (isVerbose(IceV_Instructions)) | 1167 if (isVerbose(IceV_Instructions)) |
| 1161 Str << "}\n"; | 1168 Str << "}\n"; |
| 1162 } | 1169 } |
| 1163 | 1170 |
| 1164 } // end of namespace Ice | 1171 } // end of namespace Ice |
| OLD | NEW |