LLVM to SUIF-MACH VM binary (Chris Lattner, John Cortes)

Dear friends,

I have been using the SUIF Machine infrastructure for sometime. Some optimizations are available without using a target machine, i.e. at the SUIFvm level. At this level you have "infinite" registers. Other optimizations, including analyses as for profiling require the use of a target library, a complete backend. It is very sad, that they have discontinued their MIPS backend years ago, and only Alpha, and backends for the ugly x86. In terms of research, the most necessary backends are the following (personal opinion).

1. MIPS R3000, R4400, R10000
2. SPARC V7 to V9 (very close to no. 1)
3. PowerPC
4. ARM7, ARM9, ARM11
5. Alphas, but since the Alpha has very low sales in Europe, and talking

If a backend is to be used you have to do at least the following:
do_gen ... with option -target_lib <my_target>
do_raga ... this does the register allocation
do_fin ... this finalizes code

Anyway usually i print out of the MachSUIF IR the information I need in the form of data-dependence graphs. There is no such tool in their 02.07.15 distribution so i have written a small pass to do the job. Interfacing to the SUIF IR (kind of object file format) is somewhat complex. It would need some work to convert between LLVM IR and SUIF IR in their internal format.

At their SUIFvm (virtual machine instruction set) level you have some optimizations:

1. Passes in their distribution
Constant propagation
SSA-to-CFG and CFG-to-SSA
C backend (this is very buggy, e.g. functions returning void or struct types are not properly reproduced)
Peephole optim.
Libraries to use for data-flow analysis (dfa), control-flow analysis (cfa) based on Muchnick's book

2. A few of the available external passes (including mine)
DAG extraction tool (at Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos) named as 'bbpart'
Passes at EPFL (best is their unused code for local-CSE and their if-conversion pass)

CONCLUSIONS: MachineSUIF requires several addons that the user oughts to write in order to get his work done. LLVM seems much more COMPLETE and much more ACTIVE. MachSUIF is pretty much DEAD since late 2002-mid 2003.

LLVM can become the first widely used RISC-like VM. It has much potential.

Regards

Nikolaos Kavvadias
Aristotle University of Thessaloniki
Electronics Lab
Department of Physics
Thessaloniki, Greece

Nikolaos Kavvadias wrote:

Dear friends,

I have been using the SUIF Machine infrastructure for sometime. Some optimizations are available without using a target machine, i.e. at the SUIFvm level. At this level you have "infinite" registers. Other optimizations, including analyses as for profiling require the use of a target library, a complete backend. It is very sad, that they have discontinued their MIPS backend years ago, and only Alpha, and backends for the ugly x86. In terms of research, the most necessary backends are the following (personal opinion).

1. MIPS R3000, R4400, R10000
2. SPARC V7 to V9 (very close to no. 1)
3. PowerPC
4. ARM7, ARM9, ARM11
5. Alphas, but since the Alpha has very low sales in Europe, and talking from my point of view it is not that necessary.

If a backend is to be used you have to do at least the following:
do_gen ... with option -target_lib <my_target>
do_raga ... this does the register allocation
do_fin ... this finalizes code

Anyway usually i print out of the MachSUIF IR the information I need in the form of data-dependence graphs. There is no such tool in their 02.07.15 distribution so i have written a small pass to do the job. Interfacing to the SUIF IR (kind of object file format) is somewhat complex. It would need some work to convert between LLVM IR and SUIF IR in their internal format.

Yeah, i figured it was a hassle. I tried including the SUIFvm header files and got more errors than I bargained for. Looks like it hasn't been updated to be portable. I need some help in getting these suifvm references into the code I'm writing. Could you have any specific information on the suifvm or suif ir so I could write it by hand? The documentation available on the mach-suif website doesn't seem to be enough.

At their SUIFvm (virtual machine instruction set) level you have some optimizations:

1. Passes in their distribution
Constant propagation
SSA-to-CFG and CFG-to-SSA
C backend (this is very buggy, e.g. functions returning void or struct types are not properly reproduced)
Peephole optim.
Libraries to use for data-flow analysis (dfa), control-flow analysis (cfa) based on Muchnick's book

2. A few of the available external passes (including mine)
DAG extraction tool (at Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos) named as 'bbpart'
Passes at EPFL (best is their unused code for local-CSE and their if-conversion pass)

CONCLUSIONS: MachineSUIF requires several addons that the user oughts to write in order to get his work done. LLVM seems much more COMPLETE and much more ACTIVE. MachSUIF is pretty much DEAD since late 2002-mid 2003.

LLVM can become the first widely used RISC-like VM. It has much potential.

Regards

Nikolaos Kavvadias
Aristotle University of Thessaloniki
Electronics Lab
Department of Physics
Thessaloniki, Greece

- John

I tried including the SUIFvm header files and got more errors than I
bargained for. Looks like it hasn't been updated to be portable. I
need some help in getting these suifvm references into the code I'm
writing.

While I understand that your current goal is translating LLVM -> SUIF,
it seems that you're running into problems with the SUIF IR itself.

Could you explain the overall goals of your project? It may be possible
to do it all within LLVM, possibly with some extensions. As I see it,
you're looking either at writing SUIF additions or LLVM additions, and
given the wealth of LLVM documentation and the fact that it's very
actively maintained, that may be the better route. However, it all
depends on what you want, what LLVM currently provides, and what it can
be extended to do within reasonable amount of time...

Could you have any specific information on the suifvm or suif ir so I
could write it by hand? The documentation available on the mach-suif
website doesn't seem to be enough.

This might make things somewhat difficult...

Misha Brukman wrote:

I tried including the SUIFvm header files and got more errors than I
bargained for. Looks like it hasn't been updated to be portable. I
need some help in getting these suifvm references into the code I'm
writing.

While I understand that your current goal is translating LLVM -> SUIF,
it seems that you're running into problems with the SUIF IR itself.

Could you explain the overall goals of your project? It may be possible
to do it all within LLVM, possibly with some extensions. As I see it,
you're looking either at writing SUIF additions or LLVM additions, and
given the wealth of LLVM documentation and the fact that it's very
actively maintained, that may be the better route. However, it all
depends on what you want, what LLVM currently provides, and what it can
be extended to do within reasonable amount of time...

Well currently our project is made up of the following. A SUIF Frontend + SUIF-MACH backend which generates VHDL. All the optimization passes currently reside on the SUIF frontend, but due to it's non-maintenance, and problems with moving to a newer OS version, we wanted to move that over to LLVM, but still keep on using the MACH-SUIF backend. We want to compare how much better LLVM is to SUIF (a prototype of course). If we succeed in that, then I believe that we may merge the work from MACH-SUIF into LLVM.

John