| 1 |
What's in Here |
| 2 |
-------------- |
| 3 |
|
| 4 |
This is a simple demo backend for MLRISC. It only includes instruction |
| 5 |
selection and register allocation. It takes MLTREE statements as input |
| 6 |
and emit assembly code in AMD64, Alpha, or Sparc format. A lot of things |
| 7 |
are ignored here: for example, how the stack frame is laid out. So don't |
| 8 |
expect the assembly output to run without some changes. |
| 9 |
|
| 10 |
You can probably use this as a starting point for developing your backend, |
| 11 |
as a lot of stuff here is just boilerplate functor instantiation. |
| 12 |
|
| 13 |
Note: you do not need to have an AMD64 or Alpha or Sparc machine to use the system. |
| 14 |
|
| 15 |
How to Build the System for Alpha or Sparc |
| 16 |
----------------------- |
| 17 |
|
| 18 |
I assume you already have either SML/NJ version 110.0.6, 110.25 or 110.29+ |
| 19 |
Unfortunately, the building process are slightly different across |
| 20 |
the versions because of changes to CM. So three different build files |
| 21 |
are provided. |
| 22 |
|
| 23 |
1. Run sml in this directory |
| 24 |
2. Type: |
| 25 |
|
| 26 |
use "build-<version>.sml" |
| 27 |
|
| 28 |
Once you have done this all the code generator definitions are loaded |
| 29 |
into memory. |
| 30 |
|
| 31 |
3. You can try: |
| 32 |
|
| 33 |
use "eg-sparc.sml" |
| 34 |
use "eg-alpha.sml" |
| 35 |
|
| 36 |
to load the test inputs. |
| 37 |
Running eg1() and eg2() should produce the assembly. |
| 38 |
|
| 39 |
|
| 40 |
How to Build the System for AMD64 |
| 41 |
----------------------- |
| 42 |
1. Run sml in this directory |
| 43 |
2. Type "CM.make "sources-amd64.cm" |
| 44 |
3. Try generating code by typing |
| 45 |
AMD64Demo.eg(); |