diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-01-09 03:05:53 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-01-09 03:05:53 +0000 |
commit | 4314268128be6d54c9a7f0709680e5a5b40f3ab3 (patch) | |
tree | e9b258ca806b76fbeaa4a614c0f421e0ac26dea7 /lib/Target/TargetRegisterInfo.cpp | |
parent | 994c727b5790e5c976e32c75364d78eb9b22a568 (diff) | |
download | llvm-4314268128be6d54c9a7f0709680e5a5b40f3ab3.tar.gz llvm-4314268128be6d54c9a7f0709680e5a5b40f3ab3.tar.bz2 llvm-4314268128be6d54c9a7f0709680e5a5b40f3ab3.tar.xz |
Replace TargetRegisterInfo::printReg with a PrintReg class that also works without a TRI instance.
Print virtual registers numbered from 0 instead of the arbitrary
FirstVirtualRegister. The first virtual register is printed as %vreg0.
TRI::NoRegister is printed as %noreg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetRegisterInfo.cpp')
-rw-r--r-- | lib/Target/TargetRegisterInfo.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/Target/TargetRegisterInfo.cpp b/lib/Target/TargetRegisterInfo.cpp index 078320d42f..9c0bfa11b0 100644 --- a/lib/Target/TargetRegisterInfo.cpp +++ b/lib/Target/TargetRegisterInfo.cpp @@ -31,7 +31,7 @@ TargetRegisterInfo::TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, AliasesHash(aliases), AliasesHashSize(aliasessize), Desc(D), SubRegIndexNames(subregindexnames), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) { - assert(NumRegs < FirstVirtualRegister && + assert(isPhysicalRegister(NumRegs) && "Target has too many physical registers!"); CallFrameSetupOpcode = CFSO; @@ -40,11 +40,21 @@ 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; +void PrintReg::print(raw_ostream &OS) const { + if (!Reg) + OS << "%noreg"; + else if (TargetRegisterInfo::isVirtualRegister(Reg)) + OS << "%vreg" << TargetRegisterInfo::virtReg2Index(Reg); + else if (TRI) + OS << '%' << TRI->getName(Reg); else - OS << '%' << getName(Reg); + OS << "%physreg" << Reg; + if (SubIdx) { + if (TRI) + OS << ':' << TRI->getSubRegIndexName(SubIdx); + else + OS << ":sub(" << SubIdx << ')'; + } } /// getMinimalPhysRegClass - Returns the Register Class of a physical |