summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-04-05 21:40:43 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-04-05 21:40:43 +0000
commitc94fbee9f66ea7f5777accf421096808bbb083b1 (patch)
treea674fd273062f188f133abc37aca46c60d738e78 /llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp
parent2d390b6c8b1bdffbe5db91fa8372768415880cb4 (diff)
downloadbcm5719-llvm-c94fbee9f66ea7f5777accf421096808bbb083b1.tar.gz
bcm5719-llvm-c94fbee9f66ea7f5777accf421096808bbb083b1.zip
[RegisterBank] Add printable capabilities for future debugging.
llvm-svn: 265473
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp
index 4e0aa080039..9557bd0df78 100644
--- a/llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/RegisterBank.cpp
@@ -48,3 +48,37 @@ bool RegisterBank::operator==(const RegisterBank &OtherRB) const {
"ID does not uniquely identify a RegisterBank");
return &OtherRB == this;
}
+
+void RegisterBank::dump(const TargetRegisterInfo *TRI) const {
+ print(dbgs(), /* IsForDebug */ true, TRI);
+}
+
+void RegisterBank::print(raw_ostream &OS, bool IsForDebug,
+ const TargetRegisterInfo *TRI) const {
+ OS << getName();
+ if (!IsForDebug)
+ return;
+ OS << "(ID:" << getID() << ", Size:" << getSize() << ")\n"
+ << "isValid:" << isValid() << '\n'
+ << "Number of Covered register classes: " << ContainedRegClasses.count()
+ << '\n';
+ // Print all the subclasses if we can.
+ // This register classes may not be properly initialized yet.
+ if (!TRI || ContainedRegClasses.empty())
+ return;
+ assert(ContainedRegClasses.size() == TRI->getNumRegClasses() &&
+ "TRI does not match the initialization process?");
+ bool IsFirst = true;
+ OS << "Covered register classes:\n";
+ for (unsigned RCId = 0, End = TRI->getNumRegClasses(); RCId != End; ++RCId) {
+ const TargetRegisterClass &RC = *TRI->getRegClass(RCId);
+
+ if (!contains(RC))
+ continue;
+
+ if (!IsFirst)
+ OS << ", ";
+ OS << TRI->getRegClassName(&RC);
+ IsFirst = false;
+ }
+}
OpenPOWER on IntegriCloud