From b403b2c0193aa2226069faa1208676d3f6380bde Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Tue, 29 Jul 2003 19:38:22 +0000 Subject: [PATCH] Add const version of getLiveRangeForValue(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7386 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAlloc/LiveRangeInfo.h | 13 +++++++++---- lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.h b/lib/CodeGen/RegAlloc/LiveRangeInfo.h index 0425606b1c9..7b6ecb8db65 100644 --- a/lib/CodeGen/RegAlloc/LiveRangeInfo.h +++ b/lib/CodeGen/RegAlloc/LiveRangeInfo.h @@ -92,10 +92,15 @@ public: inline const LiveRangeMapType *getLiveRangeMap() const { return &LiveRangeMap; } - // Method sed to get the corresponding live range of a Value - // - inline LiveRange *getLiveRangeForValue( const Value *Val) - { return LiveRangeMap[Val]; } + // Method used to get the live range containing a Value. + // This may return NULL if no live range exists for a Value (eg, some consts) + inline LiveRange *getLiveRangeForValue(const Value *Val) { + return LiveRangeMap[Val]; + } + inline const LiveRange *getLiveRangeForValue(const Value *Val) const { + LiveRangeMapType::const_iterator I = LiveRangeMap.find(Val); + return I->second; + } // Method for coalescing live ranges. Called only after interference info // is calculated. diff --git a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h index 0425606b1c9..7b6ecb8db65 100644 --- a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h +++ b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h @@ -92,10 +92,15 @@ public: inline const LiveRangeMapType *getLiveRangeMap() const { return &LiveRangeMap; } - // Method sed to get the corresponding live range of a Value - // - inline LiveRange *getLiveRangeForValue( const Value *Val) - { return LiveRangeMap[Val]; } + // Method used to get the live range containing a Value. + // This may return NULL if no live range exists for a Value (eg, some consts) + inline LiveRange *getLiveRangeForValue(const Value *Val) { + return LiveRangeMap[Val]; + } + inline const LiveRange *getLiveRangeForValue(const Value *Val) const { + LiveRangeMapType::const_iterator I = LiveRangeMap.find(Val); + return I->second; + } // Method for coalescing live ranges. Called only after interference info // is calculated. -- 2.34.1