omicrondelta / atalan

Automatically exported from code.google.com/p/atalan
MIT License
0 stars 0 forks source link

Issue with optimization of lda #1 lsr to lda #0 #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There is an issue, that optimiser (unfold constants module) replaces:

lda #1
lsr a

to 

lda #0

which is wrong, because the carry flag is not set after optimisation.

I know, that this is problem with optimizer architecture which does know 
nothing about processor flags and easily overridden by new div rule.

But there's an issue 20 which is unsolvable this way, I think.

Original issue reported on code.google.com by jakub.hu...@gmail.com on 7 Sep 2010 at 11:24

GoogleCodeExporter commented 9 years ago
It all depends on how the code is generated.
I think Atalan will not generate any code, that would rely on lsr a setting 
carry.

However, I am planning on full support for flags. My idea is provide support 
for variable lists. It would then be possible to define for example _azc:list 
_a,_z,_c.

Then we can define rules and instructions like:

rule add _azc, _ac, %A =
...

With this support, we should be able to define what flags are used and 
generated with what instruction.
That may also provide advanced optimization of carry, remove instructions cmp 
#0 etc.

Original comment by rudla.ku...@gmail.com on 9 Sep 2010 at 8:53

GoogleCodeExporter commented 9 years ago

Original comment by rudla.ku...@gmail.com on 28 Jul 2011 at 9:33