Assembler Optimizer

Page 33/42
26 | 27 | 28 | 29 | 30 | 31 | 32 | | 34 | 35 | 36 | 37 | 38

By Bengalack

Champion (331)

Bengalack's picture

21-02-2021, 11:33

Great progress, as usual.

I tested with SDCC-output. Same results as before. Most things work, but not "-ro", due to reused / local-scope symbols.

By jltursan

Prophet (2455)

jltursan's picture

21-02-2021, 13:29

Mmmm, seems that the last beta still generates this:

ld hl, ?const ; +mdl

By santiontanon

Paragon (1287)

santiontanon's picture

21-02-2021, 15:19

Thanks jltursan for the new example! Will be working on it this week!! It also contains examples of some sjasm syntax I had not yet implemented (e.g.: "::0"), which is neat!

I am surprised at the "?const" and the "-ro" issues though, I thought I had fixed both haha. But ok! I'll look into them later today! But first, let me double check that I didn't upload the wrong version by mistake (which is possible) hahaha Wink

In any case, any small snippets showing the particular cases where these instances happened would be great help so I can create test cases! Thanks a lot again for testing! Smile

By Huey

Prophet (2667)

Huey's picture

22-02-2021, 10:15

I just wanted to say thanks for the work on the optimizer. I am running it now in my IDE and I love it!!!

By santiontanon

Paragon (1287)

santiontanon's picture

22-02-2021, 15:58

Awesome!! Thanks for the kind words Huey! Big smile

By santiontanon

Paragon (1287)

santiontanon's picture

28-02-2021, 20:22

New weekend, new release (while I have the energy to do it hahaha): https://github.com/santiontanon/mdlz80optimizer/releases/tag...

In this new 1.6 version I hope to have fixed all of the issues we discussed above, and also added some new functionalities (like the -asm+:html or -po-ldo flags, which have been very useful to me).

- @bengalack: I think I have found the issues with the reorganizer that were causing troubles in your case (a similar report by @salutte gave me a hint!). Or at least I hope! haha
- @jltursan: I managed to get both AGD tests you shared fully parse with MDL and optimizations are generated! I also verified that the resulting optimized code can be compiled with sjasm, and it works for me on sjasm v0.42c. The only thing I had to do is to protect that "push hl/pop hl" case with "; mdl:no-opt" comments in the source, and that's it!

In both cases, instead of "-po-apply" (which is deprecated), I use the new "-asm-dialect". So, for example, for the AGD test, I run it like this:

java -jar mdl.jar AGD/test02/test.asm -dialect sjasm -ro -po -asm-dialect AGD/test02/test-mdl.asm

./sjasm AGD/test02/test-mdl.asm

Of course, you can also ask MDL to generate the binaries directly, instead of calling sjasm, but I would trust sjasm better than MDL for now, until MDL is more "battle-tested" haha

By jltursan

Prophet (2455)

jltursan's picture

28-02-2021, 20:31

Yep, understood, thanks!. As usual I'll get back to you ASAP Smile

By Bengalack

Champion (331)

Bengalack's picture

28-02-2021, 20:35

Very nice!

I don't have time right now to investigate exactly what happens, but it works!

java -jar mdl.jar Debug\objs\game.asm -dialect sdcc -ro -po speed -asm-dialect Debug\objs\game.asm.mdl.asm

Gives this:

INFO: PatternBasedOptimizer: 178 patterns applied, -62 bytes, 691 t-states saved.
INFO: mdl optimization summary: -25 bytes, 906 t-states saved. CodeReorganizer moves: 17. Pattern-based optimizer pattern applications: 178.

A quick test of the running game afterwards tells me that runtime works too. Well done!!

By santiontanon

Paragon (1287)

santiontanon's picture

28-02-2021, 22:40

Wohoo!!! Thanks both for all your help in testing this! Big smile

Slowly moving forward Smile

By salutte

Master (132)

salutte's picture

01-03-2021, 11:23

I can confirm that it works on Edelweiss!

Also:

santiontanon wrote:

Slowly moving forward Smile

slowly? progress is amazing!

Page 33/42
26 | 27 | 28 | 29 | 30 | 31 | 32 | | 34 | 35 | 36 | 37 | 38