On 03/25/06 09:12, Duncan Sands wrote: > I'm quite interested in trying out this scheme. Unfortunately it's not clear > to me how I would go about finding which variables are subroutine parameters, > and adding ASSERT_EXPRs for them; any hints would be welcome. > Probably not a bad idea to test. You can recognize parameters with the predicate TREE_CODE (sym) == PARM_DECL. The SSA name on which you want to add the assertion is the so called "default definition" for that PARM_DECL.
A default definition is an SSA name that is created for a variable SYM when the very first reference to SYM is a load/read. For instance foo (int i) { return i - 1; } The SSA form for the above is: foo (int i) { return i_1 - 1; } i_1 is the "default definition" for 'i'. You find that out with the predicate 'name == default_def (sym)'. Start by looking at tree-vrp.c:infer_value_range.