output.ml 566 B

1234567891011121314151617181920
  1. open Types
  2. open Util
  3. let rec phase input =
  4. log_line 1 "- Output assembly";
  5. match input with
  6. | Assembly instrs ->
  7. (match args.outfile with
  8. | Some filename ->
  9. let oc = open_out filename in
  10. Print.print_assembly oc instrs;
  11. close_out oc
  12. | None ->
  13. if args.verbose >= 2 then (
  14. prerr_endline "--------------------------------------------------"
  15. );
  16. Print.print_assembly stdout instrs
  17. );
  18. Empty
  19. | _ -> raise (InvalidInput "output")