summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorRuchira Sasanka <sasanka@students.uiuc.edu>2001-12-13 21:25:46 +0000
committerRuchira Sasanka <sasanka@students.uiuc.edu>2001-12-13 21:25:46 +0000
commit545cc35b828ce04573804cd9ce4e03d2a673108c (patch)
treeed67e29f5d272acc16a895c7e6b15aafcc4fa7f6 /lib/Analysis
parentf59ce9276349598ed46bbd1bdc0011b7e2b211b4 (diff)
downloadllvm-545cc35b828ce04573804cd9ce4e03d2a673108c.tar.gz
llvm-545cc35b828ce04573804cd9ce4e03d2a673108c.tar.bz2
llvm-545cc35b828ce04573804cd9ce4e03d2a673108c.tar.xz
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
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/LiveVar/README30
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/Analysis/LiveVar/README b/lib/Analysis/LiveVar/README
index 2c05e4f4ab..f85cbd425d 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.
+
+
+