diff options
author | Cameron Zwarich <zwarich@apple.com> | 2011-02-24 10:00:16 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2011-02-24 10:00:16 +0000 |
commit | 324a24f6aa5d6752c57c39e1e19f00b8c8a4ceec (patch) | |
tree | 2213d3b2a4b860a0bb6fd2322c37a7f5a4bae52f /include/llvm/CodeGen/FunctionLoweringInfo.h | |
parent | a46cd97818ac6fa336b093adecf2006fb041ca1c (diff) |
Add a mechanism for invalidating the LiveOutInfo of a PHI, and use it whenever
a block is visited before all of its predecessors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126378 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/FunctionLoweringInfo.h')
-rw-r--r-- | include/llvm/CodeGen/FunctionLoweringInfo.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/FunctionLoweringInfo.h b/include/llvm/CodeGen/FunctionLoweringInfo.h index 8b1c852e4f..2d44a8beed 100644 --- a/include/llvm/CodeGen/FunctionLoweringInfo.h +++ b/include/llvm/CodeGen/FunctionLoweringInfo.h @@ -101,9 +101,11 @@ public: #endif struct LiveOutInfo { - unsigned NumSignBits; + unsigned NumSignBits : 31; + bool IsValid : 1; APInt KnownOne, KnownZero; - LiveOutInfo() : NumSignBits(0), KnownOne(1, 0), KnownZero(1, 0) {} + LiveOutInfo() : NumSignBits(0), IsValid(true), KnownOne(1, 0), + KnownZero(1, 0) {} }; /// VisitedBBs - The set of basic blocks visited thus far by instruction @@ -149,7 +151,12 @@ public: const LiveOutInfo *GetLiveOutRegInfo(unsigned Reg) { if (!LiveOutRegInfo.inBounds(Reg)) return NULL; - return &LiveOutRegInfo[Reg]; + + const LiveOutInfo *LOI = &LiveOutRegInfo[Reg]; + if (!LOI->IsValid) + return NULL; + + return LOI; } /// AddLiveOutRegInfo - Adds LiveOutInfo for a register. @@ -166,6 +173,14 @@ public: LOI.KnownZero = KnownZero; } + /// InvalidatePHILiveOutRegInfo - Invalidates a PHI's LiveOutInfo, to be + /// called when a block is visited before all of its predecessors. + void InvalidatePHILiveOutRegInfo(const PHINode *PN) { + unsigned Reg = ValueMap[PN]; + LiveOutRegInfo.grow(Reg); + LiveOutRegInfo[Reg].IsValid = false; + } + /// setByValArgumentFrameIndex - Record frame index for the byval /// argument. void setByValArgumentFrameIndex(const Argument *A, int FI); |