I've been exploring the differences between
Context Sensitive Analysis (CSA) and
Context Insensitive Analysis (CIA), members of inter-procedural static analysis. The problem I'm coming up against is when to use one over the other.
Namely, suppose the following context:
The input program is in Static Single Assignment form. We have a machine that has no memory hierarchy. All it can do is store things in registers. We want host languages to support functions, including non-tail recursion. Which is to imply, when we call a function, we need to save all variables live across the function into registers and then calculate space requirements to see if we have enough registers to execution the function.
To do so, we need to use both CIA and CSA. Though I'm not entirely sure why that is the case. I've speculated a few ideas:
- reaching definitions require a tighter bound,
- invalid paths through recursion could ruin analysis,
- there is some dark magic here that I'm unaware of.
But ultimately, given the context, I'm not sure why we need both CSA and CIA to compute space requirements across function calls.