1 / 5

Live Variable Analysis

Live Variable Analysis. Determines for each “point” in a program what (variable’s) values are live at that point. Program “points” are defined before and after each statement of a basic block. A value is “ live ” iff It has been written (defined)

iolani
Download Presentation

Live Variable Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Live Variable Analysis • Determines for each “point” in a program what (variable’s) values are live at that point. • Program “points” are defined before and after each statement of a basic block. • A value is “live” iff • It has been written (defined) • It might be read (used) on some path later in the control flow graph

  2. Statement Dataflow • Consider a statement, S, • dest = src1 operator src2, OR • dest = operator(src1, src2, … srcN) • Keep two sets for each statement • Written (defined) • Read (used)

  3. Live Variables – Basic Block • For each block, BB, compute • Written, read, readB4written, for BB • Initialize each BB • Live-in = readB4written, Live-out = Ø • Repeat until neither live-in, live-out change • For each BB • Live-out(BB) U= U Live-in(Successor) • Live-in(BB) U= Live-out(BB) – written(BB)

  4. Live Analysis – Statements

  5. Whole Algorithm • Traverse each statement, S, in function • Compute S->written, S->read • For each basic block, BB, compute BB->live-in and BB->live-out (See Live Variables – Basic Block) • For each basic block, BB • Live = BB->live-out • Traverse each statement, S, of BB, in reverse • Live = Live – S->written • S->live = Live • Live = Live ∨ S->read

More Related