I'm trying to decide whether to use either the MIPS or ARM back ends for course projects in our introductory compiler class. I'd like to use something that has a stable back end, so that the students can use the selector, probably without changes, and do a project on register allocation and stack layout. We don't have MIPS or ARM hardware (other than possibly a few donated Android phones to play with), so a simulator like Spim will be essential. 1. Is there a similar open-source or free simulator for ARM that would run llc- or lli-generated code on Linux? 2. How stable is the MIPS back end? We need the whole thing for testing, and as a reference implementation. Thanks! --Vikram Professor, Computer Science University of Illinois at Urbana-Champaign http://llvm.org/~vadve
On Aug 15, 2011, at 11:20 AM, Adve, Vikram Sadanand wrote:> I'm trying to decide whether to use either the MIPS or ARM back ends for course projects in our introductory compiler class. I'd like to use something that has a stable back end, so that the students can use the selector, probably without changes, and do a project on register allocation and stack layout. We don't have MIPS or ARM hardware (other than possibly a few donated Android phones to play with), so a simulator like Spim will be essential. > > 1. Is there a similar open-source or free simulator for ARM that would run llc- or lli-generated code on Linux?Would QEMU work, perhaps? Caveat: I haven't used it personally for this sort of thing. Static code-gen (via llc) may change, but it's production quality and correctness is continually tested, so should stay reasonably so even on top-of-tree. The JIT (used by lli) for ARM is in a bit of a state of flux right now. I wouldn't count on it being very stable. For projects like you're talking about, I'd think using the JIT would be unneeded complexity, so this is probably OK for your use?> 2. How stable is the MIPS back end? We need the whole thing for testing, and as a reference implementation.I'm much less familiar with the MIPS backend, so I can't really speak to its suitability. Regards, Jim> Thanks! > > --Vikram > Professor, Computer Science > University of Illinois at Urbana-Champaign > http://llvm.org/~vadve > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Mon, Aug 15, 2011 at 11:20 AM, Adve, Vikram Sadanand <vadve at illinois.edu> wrote:> I'm trying to decide whether to use either the MIPS or ARM back ends for course projects in our introductory compiler class. I'd like to use something that has a stable back end, so that the students can use the selector, probably without changes, and do a project on register allocation and stack layout. We don't have MIPS or ARM hardware (other than possibly a few donated Android phones to play with), so a simulator like Spim will be essential. > > 1. Is there a similar open-source or free simulator for ARM that would run llc- or lli-generated code on Linux?Off the top of my head, QEMU will run ARM code; not sure if that's quite what you need, though.> 2. How stable is the MIPS back end? We need the whole thing for testing, and as a reference implementation.It's not as mature as the ARM backend, but the basics should work. (Note that there has been some substantial work going into the MIPS backend on trunk.) -Eli
I can confirm that QEMU works for Linux ARM. We use Debian armel in-house for Linux Arm testing. http://www.debian.org/ports/arm We recently also purchased Beagleboards which are a low-cost way to get an ARM development environment. http://www.beagleboard.org Joe On Aug 15, 2011, at 2:40 PM, Eli Friedman <eli.friedman at gmail.com> wrote:> On Mon, Aug 15, 2011 at 11:20 AM, Adve, Vikram Sadanand > <vadve at illinois.edu> wrote: >> I'm trying to decide whether to use either the MIPS or ARM back ends for course projects in our introductory compiler class. I'd like to use something that has a stable back end, so that the students can use the selector, probably without changes, and do a project on register allocation and stack layout. We don't have MIPS or ARM hardware (other than possibly a few donated Android phones to play with), so a simulator like Spim will be essential. >> >> 1. Is there a similar open-source or free simulator for ARM that would run llc- or lli-generated code on Linux? > > Off the top of my head, QEMU will run ARM code; not sure if that's > quite what you need, though. > >> 2. How stable is the MIPS back end? We need the whole thing for testing, and as a reference implementation. > > It's not as mature as the ARM backend, but the basics should work. > (Note that there has been some substantial work going into the MIPS > backend on trunk.) > > -Eli > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
As for the status of the MIPS backend, we have been testing it for a while using commercial and open source test suites, including llvm's test-suite, and other open source projects (mainly targeting little endian mips32r2 and o32). We've gotten to the point where we rarely find new bugs and we are able to compile and run fairly large programs or projects. On Mon, Aug 15, 2011 at 11:20 AM, Adve, Vikram Sadanand <vadve at illinois.edu> wrote:> I'm trying to decide whether to use either the MIPS or ARM back ends for course projects in our introductory compiler class. I'd like to use something that has a stable back end, so that the students can use the selector, probably without changes, and do a project on register allocation and stack layout. We don't have MIPS or ARM hardware (other than possibly a few donated Android phones to play with), so a simulator like Spim will be essential. > > 1. Is there a similar open-source or free simulator for ARM that would run llc- or lli-generated code on Linux? > > 2. How stable is the MIPS back end? We need the whole thing for testing, and as a reference implementation. > > Thanks! > > --Vikram > Professor, Computer Science > University of Illinois at Urbana-Champaign > http://llvm.org/~vadve > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Aug 15, 2011, at 11:20 AM, Adve, Vikram Sadanand wrote:> I'm trying to decide whether to use either the MIPS or ARM back ends for course projects in our introductory compiler class. I'd like to use something that has a stable back end, so that the students can use the selector, probably without changes, and do a project on register allocation and stack layout. We don't have MIPS or ARM hardware (other than possibly a few donated Android phones to play with), so a simulator like Spim will be essential.You should also consider that the ARM architecture offers more interesting problems for stack layout and register allocation than Mips does: - There are multiple different ARM load/store instructions with differing maximum stack pointer offsets, while Mips is very regular. - The ARM backend can create extra virtual base registers for stack regions that are out of reach for normal load/store instructions. Mips will simply use the AT register for offsets larger than 16 bits. - The ARM NEON register bank has interesting aliases and register classes. It doesn't really make sense to talk about a K-coloring of the interference graph, or even modeling register pressure as a single number. There are some research projects in there: - Cluster stack objects in a way that minimizes the number of live virtual base registers at the hot spots in the code. - Accurately model register pressure for overlapping register classes and complicated aliasing. /jakob
Hello Vikram,> I'm trying to decide whether to use either the MIPS or ARM back ends for course projects in our introductory compiler class. I'd like to use something that has a stable back end, so that the students can use the selector, probably without changes, and do a project on register allocation and stack layout. We don't have MIPS or ARM hardware (other than possibly a few donated Android phones to play with), so a simulator like Spim will be essential. > > 1. Is there a similar open-source or free simulator for ARM that would run llc- or lli-generated code on Linux? > > 2. How stable is the MIPS back end? We need the whole thing for testing, and as a reference implementation.Everything depends on what you want to use the backend for. Actually I thought MSP430 backend as an example for such "educational" backend (instruction set it only 25 or something like this instructions, RISC, etc.), it even works for simple cases, but I don't have time right now to finish it up to "fully usable" state. Surely, if you're planning to teach some complex stuff (as Jacob pointed for ARM case), then surely MSP430 is too simple for such a purpose :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
On Monday, August 15, 2011 01:38:32 PM Jim Grosbach wrote:> On Aug 15, 2011, at 11:20 AM, Adve, Vikram Sadanand wrote: > > I'm trying to decide whether to use either the MIPS or ARM back ends for > > course projects in our introductory compiler class. I'd like to use > > something that has a stable back end, so that the students can use the > > selector, probably without changes, and do a project on register > > allocation and stack layout. We don't have MIPS or ARM hardware (other > > than possibly a few donated Android phones to play with), so a simulator > > like Spim will be essential. > > > > 1. Is there a similar open-source or free simulator for ARM that would > > run llc- or lli-generated code on Linux? > > Would QEMU work, perhaps? Caveat: I haven't used it personally for this > sort of thing. >I've used QEMU to run Linux user space programs compiled with clang/LLVM for both Mips and ARM: http://ellcc.org -Rich
Thank you, all, for the responses to my question -- they have been very helpful. What I'm teaching this Fall is an introductory compiler class and the complexity of ARM is a more than what I am looking for. The goal of this project is not to deal with a lot of bells and whistles but to understand the general principles of writing (part of) a back-end. Given that the MIPS back-end seems to be in reasonably good shape, I'll go with a MIPS project. --Vikram Professor, Computer Science University of Illinois at Urbana-Champaign http://llvm.org/ http://llvm.cs.illinois.edu/~vadve On Aug 16, 2011, at 4:57 PM, Anton Korobeynikov wrote:> Hello Vikram, > >> I'm trying to decide whether to use either the MIPS or ARM back ends for course projects in our introductory compiler class. I'd like to use something that has a stable back end, so that the students can use the selector, probably without changes, and do a project on register allocation and stack layout. We don't have MIPS or ARM hardware (other than possibly a few donated Android phones to play with), so a simulator like Spim will be essential. >> >> 1. Is there a similar open-source or free simulator for ARM that would run llc- or lli-generated code on Linux? >> >> 2. How stable is the MIPS back end? We need the whole thing for testing, and as a reference implementation. > Everything depends on what you want to use the backend for. Actually I > thought MSP430 backend as an example for such "educational" backend > (instruction set it only 25 or something like this instructions, RISC, > etc.), it even works for simple cases, but I don't have time right now > to finish it up to "fully usable" state. > > Surely, if you're planning to teach some complex stuff (as Jacob > pointed for ARM case), then surely MSP430 is too simple for such a > purpose :) > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University