Discussion:
switch/case by MRST
Peter Kuschnerus
2014-05-06 16:23:45 UTC
Permalink
Hi !

Multi-way Radix Search Tree (MRST)


In arch powerpc, module code.c
there I did find a not finished implementation ( inactive by #if 0 )
of the MRST algorithm for generating code for switch/case

Reading the papers of the originators of that algorithm
I could understand this implementation.

I adapted this to my port.
I solved several issues.

A main issue was: this code supports only int as argument for switch,
while the standard allowes any width of integer.
I changed that.

I also rewrote the emitting of the "indexed jump"
by using XASM.

Then it seemed to work, but only without optimisation.
Optimizing threated all code that is referenced by pointers
as unreachable and removes it.

Then I did find the interface to keep deljumps from removing a label,
by setting a list of labels in epp->ip_labels.
This interface looks never beeing used.

I used this interface. Finaly it seemed to work.

Most of the code is arch independent,
exept the emitting of the instuction of "indexed jump".
If the arch has suitable instructions for that,
theese are not in table.c, but are instead expressable by XASM.
I made a version for i386 and for amd64 and tested it.

Of course all this needs more regession tests
before it can be used generally.

Now how to proceed with this ??
My idea is, that someone reviews it.


Regards
Peter Kuschnerus
Gregory McGarry
2014-05-07 09:51:18 UTC
Permalink
Yeah, I think that was another of my unfinished projects.

Thanks for reviving it! We should do it.
-------- Original Message --------
Subject: [Pcc] switch/case by MRST
Date: Tue, May 06, 2014 9:23 am
Hi !
Multi-way Radix Search Tree (MRST)
In arch powerpc, module code.c
there I did find a not finished implementation ( inactive by #if 0 )
of the MRST algorithm for generating code for switch/case
Reading the papers of the originators of that algorithm
I could understand this implementation.
I adapted this to my port.
I solved several issues.
A main issue was: this code supports only int as argument for switch,
while the standard allowes any width of integer.
I changed that.
I also rewrote the emitting of the "indexed jump"
by using XASM.
Then it seemed to work, but only without optimisation.
Optimizing threated all code that is referenced by pointers
as unreachable and removes it.
Then I did find the interface to keep deljumps from removing a label,
by setting a list of labels in epp->ip_labels.
This interface looks never beeing used.
I used this interface. Finaly it seemed to work.
Most of the code is arch independent,
exept the emitting of the instuction of "indexed jump".
If the arch has suitable instructions for that,
theese are not in table.c, but are instead expressable by XASM.
I made a version for i386 and for amd64 and tested it.
Of course all this needs more regession tests
before it can be used generally.
Now how to proceed with this ??
My idea is, that someone reviews it.
Regards
Peter Kuschnerus
_______________________________________________
Pcc mailing list
http://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc
Peter Kuschnerus
2014-06-01 18:49:31 UTC
Permalink
Hi Gregory
Post by Gregory McGarry
Yeah, I think that was another of my unfinished projects.
Thanks for reviving it! We should do it.
As you know that algoritm of MRST,
I think you are most qualified, to review what I did.
I placed the source in JIRA 425.

If you like, lease have a look at this.
I would like to know your opinion.


Regards
Peter Kuschnerus

Loading...