From 545cc35b828ce04573804cd9ce4e03d2a673108c Mon Sep 17 00:00:00 2001 From: Ruchira Sasanka Date: Thu, 13 Dec 2001 21:25:46 +0000 Subject: [PATCH] added a section on how to modify live variable code to use LLVM instructions instead of machine instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1451 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/LiveVar/README | 30 +++++++++++++++++++++++++----- lib/Target/SparcV9/LiveVar/README | 30 +++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/lib/Analysis/LiveVar/README b/lib/Analysis/LiveVar/README index 2c05e4f4ab6..f85cbd425dd 100644 --- a/lib/Analysis/LiveVar/README +++ b/lib/Analysis/LiveVar/README @@ -96,19 +96,21 @@ Live variable analysis is done using machine instructions. The constructor to the class takes a pointer to a method, and machine instructions must be already available for this method before calling the constructor. +The preconditions are: - -5. Assumptions -============== 1. Instruction selection is complete (i.e., machine instructions are generated) for the method before the live variable analysis -2. There may be dummy phi machine instructions in the machine code. The code + + +5. Assumptions +============== +1. There may be dummy phi machine instructions in the machine code. The code works with and without dummy phi instructions (i.e., this code can be called before or after phi elimination). Currently, it is called without phi instructions. -3. Only the basic blocks that can be reached by the post-order iterator will +2. Only the basic blocks that can be reached by the post-order iterator will be analyzed (i.e., basic blocks for dead code will not be analyzed). The live variable sets returned for such basic blocks is not defined. @@ -182,6 +184,24 @@ The above algorithm is implemented in: those calculated LiveVarSets in caches ( MInst2LVSetBI/MInst2LVSetAI) +8. Future work +============== +If it is necessary to do live variable analysis using LLVM instructions rather +than using machine instructions, it is easy to modify the existing code to +do so. Current implementation use isDef() to find any MachineOperand is a +definition or a use. We just need to change all the places that check whether +a particular Value is a definition/use with MachineInstr. Instead, we +would check whether an LLVM value is a def/use using LLVM instructions. All +the underlying data structures will remain the same. However, iterators that +go over machine instructions must be changed to the corresponding iterators +that go over the LLVM instructions. The logic to support Phi's in LLVM +instructions is already there. In fact, live variable analysis was first +done using LLVM instructions and later changed to use machine instructions. +Hence, it is quite straightforward to revert it to LLVM instructions if +necessary. + + + diff --git a/lib/Target/SparcV9/LiveVar/README b/lib/Target/SparcV9/LiveVar/README index 2c05e4f4ab6..f85cbd425dd 100644 --- a/lib/Target/SparcV9/LiveVar/README +++ b/lib/Target/SparcV9/LiveVar/README @@ -96,19 +96,21 @@ Live variable analysis is done using machine instructions. The constructor to the class takes a pointer to a method, and machine instructions must be already available for this method before calling the constructor. +The preconditions are: - -5. Assumptions -============== 1. Instruction selection is complete (i.e., machine instructions are generated) for the method before the live variable analysis -2. There may be dummy phi machine instructions in the machine code. The code + + +5. Assumptions +============== +1. There may be dummy phi machine instructions in the machine code. The code works with and without dummy phi instructions (i.e., this code can be called before or after phi elimination). Currently, it is called without phi instructions. -3. Only the basic blocks that can be reached by the post-order iterator will +2. Only the basic blocks that can be reached by the post-order iterator will be analyzed (i.e., basic blocks for dead code will not be analyzed). The live variable sets returned for such basic blocks is not defined. @@ -182,6 +184,24 @@ The above algorithm is implemented in: those calculated LiveVarSets in caches ( MInst2LVSetBI/MInst2LVSetAI) +8. Future work +============== +If it is necessary to do live variable analysis using LLVM instructions rather +than using machine instructions, it is easy to modify the existing code to +do so. Current implementation use isDef() to find any MachineOperand is a +definition or a use. We just need to change all the places that check whether +a particular Value is a definition/use with MachineInstr. Instead, we +would check whether an LLVM value is a def/use using LLVM instructions. All +the underlying data structures will remain the same. However, iterators that +go over machine instructions must be changed to the corresponding iterators +that go over the LLVM instructions. The logic to support Phi's in LLVM +instructions is already there. In fact, live variable analysis was first +done using LLVM instructions and later changed to use machine instructions. +Hence, it is quite straightforward to revert it to LLVM instructions if +necessary. + + + -- 2.34.1