Commit 3dd1bb87 by Jim Stichnoth

Subzero: Print memory usage info when dumping.

Adds "-verbose mem" to enable printing the amount of CfgLocalAllocator memory allocated, each time Cfg::dump() is called. "-verbose mem,status" is a good way to get summary info. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1743043002 .
parent 352db935
......@@ -203,8 +203,10 @@ void Cfg::translate() {
FunctionTimer.reset(new TimerMarker(
getContext()->getTimerID(GlobalContext::TSK_Funcs, Name),
getContext(), GlobalContext::TSK_Funcs));
if (isVerbose(IceV_Status))
getContext()->getStrDump() << ">>>Translating " << Name << "\n";
if (isVerbose(IceV_Status)) {
getContext()->getStrDump() << ">>>Translating "
<< getFunctionNameAndSize() << "\n";
}
}
TimerMarker T(TimerStack::TT_translate, this);
......@@ -1084,6 +1086,12 @@ void Cfg::dump(const IceString &Message) {
Ostream &Str = Ctx->getStrDump();
if (!Message.empty())
Str << "================ " << Message << " ================\n";
if (isVerbose(IceV_Mem)) {
constexpr size_t OneMB = 1024 * 1024;
Str << "Memory size = "
<< (CfgLocalAllocator<int>().current()->getTotalMemory() / OneMB)
<< " MB\n";
}
setCurrentNode(getEntryNode());
// Print function name+args
if (isVerbose(IceV_Instructions)) {
......
......@@ -335,6 +335,7 @@ cl::list<Ice::VerboseItem> VerboseList(
"Print the name of the function being translated"),
clEnumValN(Ice::IceV_AvailableRegs, "registers",
"Show available registers for register allocation"),
clEnumValN(Ice::IceV_Mem, "mem", "Memory usage details"),
clEnumValN(Ice::IceV_All, "all", "Use all verbose options"),
clEnumValN(Ice::IceV_Most, "most",
"Use all verbose options except 'regalloc'"),
......
......@@ -213,6 +213,7 @@ enum VerboseItem {
IceV_Loop = 1 << 13,
IceV_Status = 1 << 14,
IceV_AvailableRegs = 1 << 15,
IceV_Mem = 1 << 16,
IceV_All = ~IceV_None,
IceV_Most = IceV_All & ~IceV_LinearScan
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment