| OLD | NEW |
| 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// | 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// |
| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 OstreamLocker _(Ctx); | 251 OstreamLocker _(Ctx); |
| 252 Ostream &Str = Ctx->getStrDump(); | 252 Ostream &Str = Ctx->getStrDump(); |
| 253 const std::string Name = | 253 const std::string Name = |
| 254 (Func == nullptr ? "_FINAL_" : Func->getFunctionNameAndSize()); | 254 (Func == nullptr ? "_FINAL_" : Func->getFunctionNameAndSize()); |
| 255 #define X(str, tag) \ | 255 #define X(str, tag) \ |
| 256 Str << "|" << Name << "|" str "|" << Stats[CS_##tag] << "\n"; | 256 Str << "|" << Name << "|" str "|" << Stats[CS_##tag] << "\n"; |
| 257 CODESTATS_TABLE | 257 CODESTATS_TABLE |
| 258 #undef X | 258 #undef X |
| 259 Str << "|" << Name << "|Spills+Fills|" | 259 Str << "|" << Name << "|Spills+Fills|" |
| 260 << Stats[CS_NumSpills] + Stats[CS_NumFills] << "\n"; | 260 << Stats[CS_NumSpills] + Stats[CS_NumFills] << "\n"; |
| 261 Str << "|" << Name << "|Memory Usage|"; | 261 Str << "|" << Name << "|Memory Usage |"; |
| 262 if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed()) | 262 if (const auto MemUsed = static_cast<size_t>( |
| 263 Str << MemUsed; | 263 llvm::TimeRecord::getCurrentTime(false).getMemUsed())) { |
| 264 else | 264 static constexpr size_t _1MB = 1024 * 1024; |
| 265 Str << (MemUsed / _1MB) << " MB"; |
| 266 } else { |
| 265 Str << "(requires '-track-memory')"; | 267 Str << "(requires '-track-memory')"; |
| 268 } |
| 266 Str << "\n"; | 269 Str << "\n"; |
| 267 Str << "|" << Name << "|CPool Sizes "; | 270 Str << "|" << Name << "|CPool Sizes "; |
| 268 { | 271 { |
| 269 auto Pool = Ctx->getConstPool(); | 272 auto Pool = Ctx->getConstPool(); |
| 270 Str << "|f32=" << Pool->Floats.size(); | 273 Str << "|f32=" << Pool->Floats.size(); |
| 271 Str << "|f64=" << Pool->Doubles.size(); | 274 Str << "|f64=" << Pool->Doubles.size(); |
| 272 Str << "|i1=" << Pool->Integers1.size(); | 275 Str << "|i1=" << Pool->Integers1.size(); |
| 273 Str << "|i8=" << Pool->Integers8.size(); | 276 Str << "|i8=" << Pool->Integers8.size(); |
| 274 Str << "|i16=" << Pool->Integers16.size(); | 277 Str << "|i16=" << Pool->Integers16.size(); |
| 275 Str << "|i32=" << Pool->Integers32.size(); | 278 Str << "|i32=" << Pool->Integers32.size(); |
| 276 Str << "|i64=" << Pool->Integers64.size(); | 279 Str << "|i64=" << Pool->Integers64.size(); |
| 277 Str << "|Rel=" << Pool->Relocatables.size(); | 280 Str << "|Rel=" << Pool->Relocatables.size(); |
| 278 Str << "|ExtRel=" << Pool->ExternRelocatables.size(); | 281 Str << "|ExtRel=" << Pool->ExternRelocatables.size(); |
| 279 } | 282 } |
| 280 Str << "\n"; | 283 Str << "\n"; |
| 281 if (Func != nullptr) { | 284 if (Func != nullptr) { |
| 282 Str << "|" << Name << "|Cfg Memory |" << Func->getTotalMemoryMB() | 285 Str << "|" << Name << "|Cfg Memory |" << Func->getTotalMemoryMB() |
| 286 << " MB\n"; |
| 287 Str << "|" << Name << "|Liveness Memory |" << Func->getLivenessMemoryMB() |
| 283 << " MB\n"; | 288 << " MB\n"; |
| 284 } | 289 } |
| 285 } | 290 } |
| 286 | 291 |
| 287 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError, | 292 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError, |
| 288 ELFStreamer *ELFStr) | 293 ELFStreamer *ELFStr) |
| 289 : Strings(new StringPool()), ConstPool(new ConstantPool()), ErrorStatus(), | 294 : Strings(new StringPool()), ConstPool(new ConstantPool()), ErrorStatus(), |
| 290 StrDump(OsDump), StrEmit(OsEmit), StrError(OsError), IntrinsicsInfo(this), | 295 StrDump(OsDump), StrEmit(OsEmit), StrError(OsError), IntrinsicsInfo(this), |
| 291 ObjectWriter(), | 296 ObjectWriter(), |
| 292 OptQ(/*Sequential=*/Flags.isSequential(), | 297 OptQ(/*Sequential=*/Flags.isSequential(), |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 Ctx = Func->getContext(); | 1010 Ctx = Func->getContext(); |
| 1006 Active = | 1011 Active = |
| 1007 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 1012 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
| 1008 if (Active) | 1013 if (Active) |
| 1009 Ctx->pushTimer(ID, StackID); | 1014 Ctx->pushTimer(ID, StackID); |
| 1010 } | 1015 } |
| 1011 | 1016 |
| 1012 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1017 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
| 1013 | 1018 |
| 1014 } // end of namespace Ice | 1019 } // end of namespace Ice |
| OLD | NEW |