From 042f01039b7808be286b95911554c6e1d370ece9 Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Tue, 24 Feb 2004 06:30:36 +0000 Subject: [PATCH] Add predicates for checking if a virtual register has a physical register mapping or a stack slot mapping. llvm-svn: 11795 --- lib/CodeGen/VirtRegMap.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/CodeGen/VirtRegMap.h b/lib/CodeGen/VirtRegMap.h index 90bd2af4e74..f6a1cecd67b 100644 --- a/lib/CodeGen/VirtRegMap.h +++ b/lib/CodeGen/VirtRegMap.h @@ -57,6 +57,10 @@ namespace llvm { v2ssMap_(mf.getSSARegMap()->getNumVirtualRegs(), NO_STACK_SLOT) { } + bool hasPhys(unsigned virtReg) const { + return getPhys(virtReg) != NO_PHYS_REG; + } + unsigned getPhys(unsigned virtReg) const { assert(MRegisterInfo::isVirtualRegister(virtReg)); return v2pMap_[toIndex(virtReg)]; @@ -78,6 +82,10 @@ namespace llvm { v2pMap_[toIndex(virtReg)] = NO_PHYS_REG; } + bool hasStackSlot(unsigned virtReg) const { + return getStackSlot(virtReg) != NO_STACK_SLOT; + } + int getStackSlot(unsigned virtReg) const { assert(MRegisterInfo::isVirtualRegister(virtReg)); return v2ssMap_[toIndex(virtReg)];