| Index: src/IceCfg.cpp
|
| diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
|
| index b42f32645305491f665e38cb774f8311d1421cbc..1965fe2d5a82fffac65a1ac22d46cb640a10c774 100644
|
| --- a/src/IceCfg.cpp
|
| +++ b/src/IceCfg.cpp
|
| @@ -1086,12 +1086,19 @@ void Cfg::emitIAS() {
|
| emitJumpTables();
|
| }
|
|
|
| -size_t Cfg::getTotalMemoryMB() {
|
| - constexpr size_t OneMB = 1024 * 1024;
|
| - using ArbitraryType = int;
|
| - // CfgLocalAllocator draws from the same memory pool regardless of allocated
|
| - // object type, so pick an arbitrary type for the template parameter.
|
| - return CfgLocalAllocator<ArbitraryType>().current()->getTotalMemory() / OneMB;
|
| +size_t Cfg::getTotalMemoryMB() const {
|
| + constexpr size_t _1MB = 1024 * 1024;
|
| + assert(Allocator != nullptr);
|
| + assert(CfgAllocatorTraits::current() == Allocator.get());
|
| + return Allocator->getTotalMemory() / _1MB;
|
| +}
|
| +
|
| +size_t Cfg::getLivenessMemoryMB() const {
|
| + constexpr size_t _1MB = 1024 * 1024;
|
| + if (Live == nullptr) {
|
| + return 0;
|
| + }
|
| + return Live->getAllocator()->getTotalMemory() / _1MB;
|
| }
|
|
|
| // Dumps the IR with an optional introductory message.
|
|
|