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