added a section on how to modify live variable code to use LLVM instructions
authorRuchira Sasanka <sasanka@students.uiuc.edu>
Thu, 13 Dec 2001 21:25:46 +0000 (21:25 +0000)
committerRuchira Sasanka <sasanka@students.uiuc.edu>
Thu, 13 Dec 2001 21:25:46 +0000 (21:25 +0000)
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
lib/Target/SparcV9/LiveVar/README

index 2c05e4f4ab66874b7c0426d1bc4096625de4483b..f85cbd425dd165c1749398d21422fefb63e730dd 100644 (file)
@@ -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.
+
+
+
 
 
 
index 2c05e4f4ab66874b7c0426d1bc4096625de4483b..f85cbd425dd165c1749398d21422fefb63e730dd 100644 (file)
@@ -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.
+
+
+