Hi,
I have my own pass that is trying to insert some statements in the code; the
statements would be of the form var_name = constant_value;
This is gcc-4.0.0, on debian testing 2.6.8, on an Intel Pentium 4.
I am obviously missing something, but I am not sure what. I don't exactly
know how (or if I need) to create a new ssa number for that variable.
This happens for global and local variables.
What I am trying: (t->var_decl is the var_decl).
gcc_assert (DECL_P (t->var_decl)); //this succeeds...
new_var = duplicate_ssa_name (t->var_decl, NULL);
//this crashes in an assert: gcc_assert (DECL_P (var) || TREE_CODE (var) ==
INDIRECT_REF);
//I tried 2nd argument = NULL, and also SSA_NAME_DEF_STMT (t->var_decl).
If I do use duplicate_ssa_name(), I get the error pointed out above, i.e.,
in tree-flow-inline.h, in var_ann():
var_ann (tree t) {
gcc_assert (t);
gcc_assert (DECL_P (t)); //this assert fails
However, as you can see, t->var_decl IS a DECL, because it is a VAR_DECL,
since I evaluate it just above.
Ok, so I tried NOT using duplicate_ssa_name():
For global variables: if I don't use duplicate_ssa_name() (should I?),
I can create and print the statement, but it crashes when I try to insert
it. The current pass dump file is completely generated, however, after my
pass I rerun the alias pass, and that is the one crashing.
So I am guessing I am screwing up the alias analysis info somehow.
I tried using get_var_ann (t->var_decl), to replicate the annotation
information in the newly created statement, but it didn't produce any
noticeable effect.
For local variables, I can even insert the statement, but, after the
function is processed, I get the same error as I was getting when using
duplicate_ssa_name(): failed gcc assert in var_ann(), in tree-flow-inline.h,
line 34 (gcc_assert (DECL_P(t))).
Any feedback would be appreciated, as it is probably obvious I am not really
certain exactly what I need to be able to generate new statements in the ssa
form...
thank you
mihai