Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: src/IceCfg.cpp

Issue 1641653004: Subzero: Make the register allocator more robust with -reg-use and -reg-exclude. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Test code accidentally left in Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfg.h ('k') | src/IceClFlags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfg.cpp
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 4e50248e7ff67e73c6ffb3d0e818c388125f95f8..99c55aca24d96eb50ed9eb6e3b6da24dde119861 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -55,6 +55,30 @@ Cfg::Cfg(GlobalContext *Ctx, uint32_t SequenceNumber)
Cfg::~Cfg() { assert(ICE_TLS_GET_FIELD(CurrentCfg) == nullptr); }
+/// Create a string like "foo(i=123:b=9)" indicating the function name, number
+/// of high-level instructions, and number of basic blocks. This string is only
+/// used for dumping and other diagnostics, and the idea is that given a set of
+/// functions to debug a problem on, it's easy to find the smallest or simplest
+/// function to attack. Note that the counts may change somewhat depending on
+/// what point it is called during the translation passes.
+IceString Cfg::getFunctionNameAndSize() const {
+ if (!BuildDefs::dump())
+ return getFunctionName();
+ SizeT NodeCount = 0;
+ SizeT InstCount = 0;
+ for (CfgNode *Node : getNodes()) {
+ ++NodeCount;
+ // Note: deleted instructions are *not* ignored.
+ InstCount += Node->getPhis().size();
+ for (Inst &I : Node->getInsts()) {
+ if (!llvm::isa<InstTarget>(&I))
+ ++InstCount;
+ }
+ }
+ return getFunctionName() + "(i=" + std::to_string(InstCount) + ":b=" +
+ std::to_string(NodeCount) + ")";
+}
+
void Cfg::setError(const IceString &Message) {
HasError = true;
ErrorMessage = Message;
@@ -1075,7 +1099,9 @@ void Cfg::dump(const IceString &Message) {
Str << Args[i]->getType() << " ";
Args[i]->dump(this);
}
- Str << ") {\n";
+ // Append an extra copy of the function name here, in order to print its
+ // size stats but not mess up lit tests.
+ Str << ") { # " << getFunctionNameAndSize() << "\n";
}
resetCurrentNode();
if (isVerbose(IceV_Liveness)) {
« no previous file with comments | « src/IceCfg.h ('k') | src/IceClFlags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698