Commit 3d5e08dc by Jim Stichnoth

Subzero: Print constant pool info with --szstats.

BUG= none R=eholk@chromium.org, jpp@chromium.org Review URL: https://codereview.chromium.org/1747333002 .
parent b82d79aa
...@@ -160,6 +160,7 @@ public: ...@@ -160,6 +160,7 @@ public:
std::sort(Constants.begin(), Constants.end(), KeyCompareLess<ValueType>()); std::sort(Constants.begin(), Constants.end(), KeyCompareLess<ValueType>());
return Constants; return Constants;
} }
size_t size() const { return Pool.size(); }
private: private:
// Use the default hash function, and a custom key comparison function. The // Use the default hash function, and a custom key comparison function. The
...@@ -215,9 +216,11 @@ public: ...@@ -215,9 +216,11 @@ public:
UndefPool Undefs; UndefPool Undefs;
}; };
void GlobalContext::CodeStats::dump(const IceString &Name, Ostream &Str) { void GlobalContext::CodeStats::dump(const IceString &Name, GlobalContext *Ctx) {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
OstreamLocker _(Ctx);
Ostream &Str = Ctx->getStrDump();
#define X(str, tag) \ #define X(str, tag) \
Str << "|" << Name << "|" str "|" << Stats[CS_##tag] << "\n"; Str << "|" << Name << "|" str "|" << Stats[CS_##tag] << "\n";
CODESTATS_TABLE CODESTATS_TABLE
...@@ -230,6 +233,20 @@ void GlobalContext::CodeStats::dump(const IceString &Name, Ostream &Str) { ...@@ -230,6 +233,20 @@ void GlobalContext::CodeStats::dump(const IceString &Name, Ostream &Str) {
else else
Str << "(requires '-track-memory')"; Str << "(requires '-track-memory')";
Str << "\n"; Str << "\n";
Str << "|" << Name << "|CPool Sizes ";
{
auto Pool = Ctx->getConstPool();
Str << "|f32=" << Pool->Floats.size();
Str << "|f64=" << Pool->Doubles.size();
Str << "|i1=" << Pool->Integers1.size();
Str << "|i8=" << Pool->Integers8.size();
Str << "|i16=" << Pool->Integers16.size();
Str << "|i32=" << Pool->Integers32.size();
Str << "|i64=" << Pool->Integers64.size();
Str << "|Rel=" << Pool->Relocatables.size();
Str << "|ExtRel=" << Pool->ExternRelocatables.size();
}
Str << "\n";
} }
GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError, GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError,
...@@ -997,11 +1014,10 @@ EmitterWorkItem *GlobalContext::emitQueueBlockingPop() { ...@@ -997,11 +1014,10 @@ EmitterWorkItem *GlobalContext::emitQueueBlockingPop() {
void GlobalContext::dumpStats(const IceString &Name, bool Final) { void GlobalContext::dumpStats(const IceString &Name, bool Final) {
if (!getFlags().getDumpStats()) if (!getFlags().getDumpStats())
return; return;
OstreamLocker OL(this);
if (Final) { if (Final) {
getStatsCumulative()->dump(Name, getStrDump()); getStatsCumulative()->dump(Name, this);
} else { } else {
ICE_TLS_GET_FIELD(TLS)->StatsFunction.dump(Name, getStrDump()); ICE_TLS_GET_FIELD(TLS)->StatsFunction.dump(Name, this);
} }
} }
......
...@@ -99,7 +99,7 @@ class GlobalContext { ...@@ -99,7 +99,7 @@ class GlobalContext {
for (uint32_t i = 0; i < Stats.size(); ++i) for (uint32_t i = 0; i < Stats.size(); ++i)
Stats[i] += Other.Stats[i]; Stats[i] += Other.Stats[i];
} }
void dump(const IceString &Name, Ostream &Str); void dump(const IceString &Name, GlobalContext *Ctx);
private: private:
std::array<uint32_t, CS_NUM> Stats; std::array<uint32_t, CS_NUM> Stats;
......
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