Subzero: Dump register numbers as signed quantities.
Undo an overly aggression application of unsigned to register numbers in 8aa396610b7baf728631a43ea16ad3d13e38397a (https://codereview.chromium.org/1676123002).
Now, instead of -verbose=regalloc output like:
++++++ Unhandled:
R=jpp@chromium.org, kschimpf@google.com, 4294967295 V=%__4 Range=[2:7), 4294967295 V=%__5 Range=[7:8), 4294967295 V=%__6 Range=[9:11), -1 V=%__4 Range=[2:7), -1 V=%__5 Range=[7:8), -1 V=%__6 Range=[9:11)
we have the originally intended:
++++++ Unhandled:
BUG= none
Review URL: https://codereview.chromium.org/1868543002 .
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp
index e753852..53aa91b 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 @@
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();
}