Index: src/IceGlobalContext.cpp |
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp |
index 84d7b685b75bc3b08833f7e12fa0420b36d5c928..2903ddedc82fef6b1fc872e62fec46969b0dd89a 100644 |
--- a/src/IceGlobalContext.cpp |
+++ b/src/IceGlobalContext.cpp |
@@ -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, |