[cfe-dev] Lazy bindings

Zhongxing Xu xuzhongxing at gmail.com
Sun Dec 14 02:18:57 PST 2008


This is the complete email:

In current static analysis implementation, big array initializations takes a
very long time, because we create regions for every elements no matter if it
is used at all. Lazy binding is desirable for such cases. That is, when the
decl stmt is visited, only a VarRegion is created for the array.
ElementRegions will be created when it is first time read or written.

We have to distinguish the following cases if a region is not in
regionbindings:
* it is assigned unknown value (a.k.a. killed, we remove its binding in such
case)
* it is not initialized and it is local, we should return undefined value
for it
* it is not initialized and it is global, we should return symbolic value
for it

A tentative logic is proposed as follows:

Retrieve(Loc L)  {
  if L is in bindings
    return bind(L)
  else
    if L is not field or element
      return UnknownVal               // we initialize scalar variables, so
it must be killed.
    else
      if L is in killset
        return UnknownVal
      else
        if L is on the stack or heap
          return UndefinedVal
        else
           return SymbolicVal
}

Remove(Loc L) {
  remove as usual.
  if (L is element or field)
    add L to killset
}

Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081214/6a12b0b9/attachment.html>


More information about the cfe-dev mailing list