]> Joshua Wise's Git repositories - snipe.git/blame - codegen/stringifier.sml
Initial import of l3c
[snipe.git] / codegen / stringifier.sml
CommitLineData
6ade8b0a 1(* L3 compiler
0a24e44d 2 * stringifier
12aa4087 3 * turns a list of x86 insns into the assembly code to generate them
0a24e44d 4 * Author: Chris Lu <czl@andrew.cmu.edu>
12aa4087
JW
5 *)
6
7signature STRINGIFY =
8sig
0a24e44d 9 type asm = x86.insn list
6ade8b0a 10 val stringify : (string -> string) -> asm -> string
12aa4087
JW
11end
12
13structure Stringify :> STRINGIFY =
14struct
0a24e44d 15 type asm = x86.insn list
12aa4087
JW
16 structure X = x86
17
0a24e44d 18 (* val stringify : asm -> string
12aa4087
JW
19 * turns a x86 instruction list into a string of assembly code for these instructions *)
20
6ade8b0a
JW
21 fun stringify' rn (X.CALL (l, n)) = X.prettyprint X.Long (X.CALL ((Symbol.symbol (rn (Symbol.name l))), n))
22 | stringify' rn x = X.prettyprint X.Long x
12aa4087 23
0a24e44d 24 (* val stringify : asm -> string *)
6ade8b0a 25 fun stringify realname l = foldr (fn (a,b) => (stringify' realname a) ^ b) ("") l
12aa4087
JW
26
27end
This page took 0.025709 seconds and 4 git commands to generate.