Chromium Code Reviews

Unified Diff: src/IceRegAlloc.cpp

Issue 1868543002: Subzero: Dump register numbers as signed quantities. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Use "NA" instead of "-1" for NoRegisterValue Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceRegAlloc.cpp
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp
index e7538525c1337f91abe73b03a0846c082c515f23..53aa91b49d2cad236a5acd616536ab284ee9823f 100644
--- a/src/IceRegAlloc.cpp
+++ b/src/IceRegAlloc.cpp
@@ -23,6 +23,8 @@
#include "IceOperand.h"
#include "IceTargetLowering.h"
+#include "llvm/Support/Format.h"
+
namespace Ice {
namespace {
@@ -70,10 +72,13 @@ void dumpLiveRange(const Variable *Var, const Cfg *Func) {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
- char buf[30];
- snprintf(buf, llvm::array_lengthof(buf), "%2u",
- unsigned(Var->getRegNumTmp()));
- Str << "R=" << buf << " V=";
+ Str << "R=";
+ if (Var->hasRegTmp()) {
+ Str << llvm::format("%2d", Var->getRegNumTmp());
+ } else {
+ Str << "NA";
+ }
+ Str << " V=";
Var->dump(Func);
Str << " Range=" << Var->getLiveRange();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine