diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-12-14 18:53:39 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-12-14 18:53:39 +0000 |
commit | 414e5023f8f8b22486313e2867fdb39c7c4f564b (patch) | |
tree | 794eb26f0296290687107f563baafc956e1fb08d /lib/Target/TargetRegisterInfo.cpp | |
parent | 475002078848d102b6577fe7283464c039b38af6 (diff) | |
download | llvm-414e5023f8f8b22486313e2867fdb39c7c4f564b.tar.gz llvm-414e5023f8f8b22486313e2867fdb39c7c4f564b.tar.bz2 llvm-414e5023f8f8b22486313e2867fdb39c7c4f564b.tar.xz |
Add TargetRegisterInfo::printReg() to pretty-print registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetRegisterInfo.cpp')
-rw-r--r-- | lib/Target/TargetRegisterInfo.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/TargetRegisterInfo.cpp b/lib/Target/TargetRegisterInfo.cpp index 3beddf5fc7..078320d42f 100644 --- a/lib/Target/TargetRegisterInfo.cpp +++ b/lib/Target/TargetRegisterInfo.cpp @@ -17,6 +17,7 @@ #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/ADT/BitVector.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -39,6 +40,13 @@ TargetRegisterInfo::TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, TargetRegisterInfo::~TargetRegisterInfo() {} +void TargetRegisterInfo::printReg(unsigned Reg, raw_ostream &OS) const { + if (Reg && isVirtualRegister(Reg)) + OS << "%reg" << Reg; + else + OS << '%' << getName(Reg); +} + /// getMinimalPhysRegClass - Returns the Register Class of a physical /// register of the given type, picking the most sub register class of /// the right type that contains this physreg. |