Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | MLRISCLibrary |
2 | ============= | |
3 | ||
4 | The http://www.cs.nyu.edu/leunga/www/MLRISC/Doc/html/index.html[MLRISC | |
5 | Library] is a framework for retargetable and optimizing compiler back | |
6 | ends. The MLRISC Library is distributed with SML/NJ. Due to | |
7 | differences between SML/NJ and MLton, this library will not work | |
8 | out-of-the box with MLton. | |
9 | ||
10 | As of 20180119, MLton includes a port of the MLRISC Library | |
11 | synchronized with SML/NJ version 110.82. | |
12 | ||
13 | == Usage == | |
14 | ||
15 | * You can import a sub-library of the MLRISC Library into an MLB file with: | |
16 | + | |
17 | [options="header"] | |
18 | |==== | |
19 | |MLB file|Description | |
20 | |`$(SML_LIB)/mlrisc-lib/mlb/ALPHA.mlb`|The ALPHA backend | |
21 | |`$(SML_LIB)/mlrisc-lib/mlb/AMD64.mlb`|The AMD64 backend | |
22 | |`$(SML_LIB)/mlrisc-lib/mlb/AMD64-Peephole.mlb`|The AMD64 peephole optimizer | |
23 | |`$(SML_LIB)/mlrisc-lib/mlb/CCall.mlb`| | |
24 | |`$(SML_LIB)/mlrisc-lib/mlb/CCall-sparc.mlb`| | |
25 | |`$(SML_LIB)/mlrisc-lib/mlb/CCall-x86-64.mlb`| | |
26 | |`$(SML_LIB)/mlrisc-lib/mlb/CCall-x86.mlb`| | |
27 | |`$(SML_LIB)/mlrisc-lib/mlb/Control.mlb`| | |
28 | |`$(SML_LIB)/mlrisc-lib/mlb/Graphs.mlb`| | |
29 | |`$(SML_LIB)/mlrisc-lib/mlb/HPPA.mlb`|The HPPA backend | |
30 | |`$(SML_LIB)/mlrisc-lib/mlb/IA32.mlb`|The IA32 backend | |
31 | |`$(SML_LIB)/mlrisc-lib/mlb/IA32-Peephole.mlb`|The IA32 peephole optimizer | |
32 | |`$(SML_LIB)/mlrisc-lib/mlb/Lib.mlb`| | |
33 | |`$(SML_LIB)/mlrisc-lib/mlb/MLRISC.mlb`| | |
34 | |`$(SML_LIB)/mlrisc-lib/mlb/MLTREE.mlb`| | |
35 | |`$(SML_LIB)/mlrisc-lib/mlb/Peephole.mlb`| | |
36 | |`$(SML_LIB)/mlrisc-lib/mlb/PPC.mlb`|The PPC backend | |
37 | |`$(SML_LIB)/mlrisc-lib/mlb/RA.mlb`| | |
38 | |`$(SML_LIB)/mlrisc-lib/mlb/SPARC.mlb`|The Sparc backend | |
39 | |`$(SML_LIB)/mlrisc-lib/mlb/StagedAlloc.mlb`| | |
40 | |`$(SML_LIB)/mlrisc-lib/mlb/Visual.mlb`| | |
41 | |===== | |
42 | ||
43 | * If you are porting a project from SML/NJ's <:CompilationManager:> to | |
44 | MLton's <:MLBasis: ML Basis system> using `cm2mlb`, note that the | |
45 | following map is included by default: | |
46 | + | |
47 | ---- | |
48 | # MLRISC Library | |
49 | $SMLNJ-MLRISC $(SML_LIB)/mlrisc-lib/mlb | |
50 | ---- | |
51 | + | |
52 | This will automatically convert a `$SMLNJ-MLRISC/MLRISC.cm` import in | |
53 | an input `.cm` file into a `$(SML_LIB)/mlrisc-lib/mlb/MLRISC.mlb` | |
54 | import in the output `.mlb` file. | |
55 | ||
56 | == Details == | |
57 | ||
58 | The following changes were made to the MLRISC Library, in addition to | |
59 | deriving the `.mlb` files from the `.cm` files: | |
60 | ||
61 | * eliminate sequential `withtype` expansions: Most could be rewritten as a sequence of type definitions and datatype definitions. | |
62 | * eliminate higher-order functors: Every higher-order functor definition and application could be uncurried in the obvious way. | |
63 | * eliminate `where <str> = <str>`: Quite painful to expand out all the flexible types in the respective structures. Furthermore, many of the implied type equalities aren't needed, but it's too hard to pick out the right ones. | |
64 | * `library/array-noneq.sml` (added, not exported): Implements `signature ARRAY_NONEQ`, similar to `signature ARRAY` from the <:BasisLibrary:Basis Library>, but replacing the latter's `eqtype 'a array = 'a array` and `type 'a vector = 'a Vector.vector` with `type 'a array` and `type 'a vector`. Thus, array-like containers may match `ARRAY_NONEQ`, whereas only the pervasive `'a array` container may math `ARRAY`. (SML/NJ's implementation of `signature ARRAY` omits the type realizations.) | |
65 | * `library/dynamic-array.sml` and `library/hash-array.sml` (modifed): Replace `include ARRAY` with `include ARRAY_NONEQ`; see above. | |
66 | ||
67 | == Patch == | |
68 | ||
69 | * <!ViewGitFile(mlton,master,lib/mlrisc-lib/MLRISC.patch)> |