Commit 639c9217 by Jim Stichnoth

Subzero: Add memory usage to "-szstats" output.

Requires the LLVM option -track-memory to get meaningful results. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/795063003
parent 1502e59a
......@@ -16,6 +16,8 @@
#include <locale> // locale
#include <unordered_map>
#include "llvm/Support/Timer.h"
#include "IceCfg.h"
#include "IceClFlags.h"
#include "IceDefs.h"
......@@ -105,6 +107,23 @@ public:
UndefPool Undefs;
};
void CodeStats::dump(const IceString &Name, Ostream &Str) {
if (!ALLOW_DUMP)
return;
Str << "|" << Name << "|Inst Count |" << InstructionsEmitted << "\n";
Str << "|" << Name << "|Regs Saved |" << RegistersSaved << "\n";
Str << "|" << Name << "|Frame Bytes |" << FrameBytes << "\n";
Str << "|" << Name << "|Spills |" << Spills << "\n";
Str << "|" << Name << "|Fills |" << Fills << "\n";
Str << "|" << Name << "|Spills+Fills|" << Spills + Fills << "\n";
Str << "|" << Name << "|Memory Usage|";
if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed())
Str << MemUsed;
else
Str << "(requires '-track-memory')";
Str << "\n";
}
GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit,
ELFStreamer *ELFStr, VerboseMask Mask,
TargetArch Arch, OptLevel Opt,
......
......@@ -47,16 +47,7 @@ public:
void updateFrameBytes(uint32_t Bytes) { FrameBytes += Bytes; }
void updateSpills() { ++Spills; }
void updateFills() { ++Fills; }
void dump(const IceString &Name, Ostream &Str) {
if (!ALLOW_DUMP)
return;
Str << "|" << Name << "|Inst Count |" << InstructionsEmitted << "\n";
Str << "|" << Name << "|Regs Saved |" << RegistersSaved << "\n";
Str << "|" << Name << "|Frame Bytes |" << FrameBytes << "\n";
Str << "|" << Name << "|Spills |" << Spills << "\n";
Str << "|" << Name << "|Fills |" << Fills << "\n";
Str << "|" << Name << "|Spills+Fills|" << Spills + Fills << "\n";
}
void dump(const IceString &Name, Ostream &Str);
private:
uint32_t InstructionsEmitted;
......
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