> This patch adds simple constant propagation to imcc.
First thanks, seconds I modified and applied it - but third, its
disabled and doesn't work and forth - it needs a lot of tests to really
get activated.
I did add some comments, and an example, why it will not work.
I think its better, to have the midifed patch applied and leave this as
some piece of documentation in the code.
> I am a little confused as to why I had to do
> for(i = ins2->opsize - 2; i >= 0; i--)
> rather than
> for(i = ins2->opsize - 1; i >= 0; i--)
Parrots opsize contains the opcode too. So opsize-1 is the arg count.
> Comments welcome,
> Matt
leo
Shortly after trying to go to bed last night [this morning], I realized
a case (or class of cases) in which this would be broken. I will try to
hack at dealing with that later; however, I am still relatively new to
this. Is there a way to determine what things will get branched to and
from what possible places?
Thanks,
Matt
> Shortly after trying to go to bed last night [this morning], I realized
> a case (or class of cases) in which this would be broken. I will try to
> hack at dealing with that later; however, I am still relatively new to
> this. Is there a way to determine what things will get branched to and
> from what possible places?
First I'd like to say again, that I really like the patch and the
effort - and I know its hard to get into this kind of imcc internals.
The whole branch information starts in cfg.c:find_basic_blocks() and
build_cfg() where "struct Edge" is added, which connects all branch
targets with all branch sources. This is all complicated and currently
somehow broken due to register branches (jsr, invoke ...) where the
branch destination is not a label.
Examples of the usage of this info is e.g. in
optimizer.c:unused_label().
The next thing is just to get used to the debug output:
$ imcc -d 70 the.imc
writes CFG and optmizer info to stderr.
$ imcc -d 70 the.imc >the.log 2>&1
or such gets this into a file for bigger then non trivial programs.
[ Some technical side notes: please diff against the root of parrot (or
one directory below, so that all patches can go in with either -p0 or
-p1. And try to use an editor that somwhow conforms to the documented
coding standards.
And please write tests, many + 1 tests
Thanks
]
> Thanks,
> Matt
leo