Hi, Daniel, thank you for your advice.
Yes, ALL_MEMORY points to ALL_MEMORY.
We use MD(memory descriptor) to abstract a memory location.
MD contains 4 main fields: id, base, offset, size.
For these special MD (ALL_MEMORY, GLOBAL_MEMORY, STACK_MEMORY, HEAP_MEMORY),
we give them id 1, 2, 3, 4, that means MD1 is ALL_MEMORY, MD2 is GLOBAL_MEMORY, the same goes for the rest.
Then we maintain a BITSET class to encapsulate the 'union', 'intersect', 'diff' etc to simply the operations bewteen special
MD and other general MDs.
Okay.
e.g: union operation bewteen special MD and general MD.
Given BITSET a, b;
a={MD1}
b={MD10}
c={MD20}
Here MD10, MD20 are general MD. They described the actually variable.
b.union(c) equal to {MD10, MD20}
a.union(b) equal to {MD1}
b.union(a) equal to {MD1}
Our flow-sensitive method is divided into 2 step:
1. Iterative solve flow-equation to compute POINT-TO for each stmt.
2. According to POINT-TO info, compute MayDef BITSET and MayUse BITSET for each stmt.
So, I have an question, after step 2 each stmt should own two BITSETs to record MayDef and MayUse.
Is that right or necessary?
It's fine, it's not strictly necessary, but it's not bad or harmful.
How to describe both MayDef, MayUse info if just have a single BITSET in each stmt?
Cut the universe in half. Assuming 64 bit ids:
bits 1-9223372036854775808 represent mayuses
bits 9223372036854775809-18446744073709551616 represent maydefs
(If your bitsets are sparse, and allow negative indexes, like gcc's,
you could just use positive and negative numbers).
This would need to be abstracted properly so that the
union/intersect/diff/iterators operated only on the proper portions of
the bitset.
I'm not sure why you'd want to do this as opposed to keeping two
bitsets, using bdds, or using sparse bitmaps.