Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBM z Systems port of ocamlopt #275

Merged
merged 28 commits into from
Nov 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
58db11e
IBM zSystem port of OCaml
xavierleroy Oct 28, 2015
b79f88e
zSystem port: minimal fixes so that it compiles wrt the trunk
xavierleroy Oct 29, 2015
f6a0392
zSystem port: do not mark return addresses
xavierleroy Oct 29, 2015
bcb696a
zSystem port: revise addressing modes
xavierleroy Oct 29, 2015
5274204
zSystem port: remove special case "stey" in Emit.emit_load_store
xavierleroy Oct 29, 2015
862347f
zSystem port: do not use %r12 as GOT pointer
xavierleroy Oct 30, 2015
1e4aedd
zSystem port: use %r12 as normal register + extcall conventions
xavierleroy Oct 30, 2015
d6742ea
zSeries port: hardcode register names (cosmetic)
xavierleroy Oct 30, 2015
ad3a967
zSeries port: factor out adjustments to the stack pointer
xavierleroy Oct 30, 2015
88fd26f
z port: streamline the heap allocation code
xavierleroy Oct 30, 2015
54ff5d0
z port: use lghi when possible to load integer constants
xavierleroy Oct 30, 2015
b149f66
z port: use 'test under mask' instruction for even/odd conditional br…
xavierleroy Oct 30, 2015
39cd68f
z port: use unsigned comparison for Icheckbound instructions
xavierleroy Oct 30, 2015
88fb625
z port: revise two-address instructions and integer immediate operations
xavierleroy Oct 30, 2015
cc9c12d
z port: fix issue with PIC code and dynamic loading
xavierleroy Oct 30, 2015
9ff553d
z port: update caml_ml_bound_error
xavierleroy Oct 30, 2015
3f26d0e
z port: reloading must preserve 2-address instructions
xavierleroy Oct 30, 2015
1ef188e
tests/asmcomp: improve the arith test
xavierleroy Oct 31, 2015
2cdb500
z port: update the tests/asmcomp test
xavierleroy Oct 31, 2015
89475be
z port: round toward 0 for float -> int conversions.
xavierleroy Oct 31, 2015
414fc47
z port: simpler implementation of multiply-high-signed
xavierleroy Oct 31, 2015
99067ad
z port: do not use locgr instruction for Boolean-valued comparisons
xavierleroy Oct 31, 2015
8e88351
z port: simplify caml_start_program (cosmetic)
xavierleroy Nov 1, 2015
0196d72
z port: adjust instruction latencies for basic-block scheduling
xavierleroy Nov 1, 2015
770853b
z port: fix up tabs and spaces (cosmetic)
xavierleroy Nov 1, 2015
51104fc
Update zsystem branch wrt upstream trunk.
xavierleroy Nov 19, 2015
64ab622
z port: update emit.mlp to new format for FP literals
xavierleroy Nov 19, 2015
32def14
z port: update Changes
xavierleroy Nov 19, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ Compilers:
(Mark Shinwell)
- GPR#270: Make [transl_exception_constructor] generate [Immutable] blocks
(Mark Shinwell)
- GPR#275: native-code generator for IBM z System running Linux
(Bill O'Farrell, Tristan Amini, Xavier Leroy)
- GPR#282: relax short-paths safety check in presence of module aliases, take
penalty into account while building the printing map.
(Thomas Refis, Leo White)
Expand Down
39 changes: 39 additions & 0 deletions asmcomp/s390x/CSE.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
(***********************************************************************)
(* *)
(* OCaml *)
(* *)
(* Xavier Leroy, projet Gallium, INRIA Rocquencourt *)
(* Bill O'Farrell, IBM *)
(* *)
(* Copyright 2015 Institut National de Recherche en Informatique *)
(* et en Automatique. Copyright 2015 IBM (Bill O'Farrell with *)
(* help from Tristan Amini). All rights reserved. This file is *)
(* distributed under the terms of the Q Public License version 1.0. *)
(* *)
(***********************************************************************)

(* CSE for the Z Processor *)

open Arch
open Mach
open CSEgen

class cse = object (self)

inherit cse_generic as super

method! class_of_operation op =
match op with
| Ispecific(Imultaddf | Imultsubf) -> Op_pure
| _ -> super#class_of_operation op

method! is_cheap_operation op =
match op with
| Iconst_int n | Iconst_blockheader n ->
n >= -0x8000_0000n && n <= 0x7FFF_FFFFn
| _ -> false

end

let fundecl f =
(new cse)#fundecl f
86 changes: 86 additions & 0 deletions asmcomp/s390x/arch.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
(***********************************************************************)
(* *)
(* OCaml *)
(* *)
(* Xavier Leroy, projet Gallium, INRIA Rocquencourt *)
(* Bill O'Farrell, IBM *)
(* *)
(* Copyright 2015 Institut National de Recherche en Informatique *)
(* et en Automatique. Copyright 2015 IBM (Bill O'Farrell with *)
(* help from Tristan Amini). All rights reserved. This file is *)
(* distributed under the terms of the Q Public License version 1.0. *)
(* *)
(***********************************************************************)

(* Specific operations for the Z processor *)

open Format

(* Machine-specific command-line options *)

let pic_code = ref true

let command_line_options =
[ "-fPIC", Arg.Set pic_code,
" Generate position-independent machine code (default)";
"-fno-PIC", Arg.Clear pic_code,
" Generate position-dependent machine code" ]

(* Specific operations *)

type specific_operation =
Imultaddf (* multiply and add *)
| Imultsubf (* multiply and subtract *)

(* Addressing modes *)

type addressing_mode =
| Iindexed of int (* reg + displ *)
| Iindexed2 of int (* reg + reg + displ *)

(* Sizes, endianness *)

let big_endian = true

let size_addr = 8
let size_int = size_addr
let size_float = 8

let allow_unaligned_access = false

(* Behavior of division *)

let division_crashes_on_overflow = true

(* Operations on addressing modes *)

let identity_addressing = Iindexed 0

let offset_addressing addr delta =
match addr with
| Iindexed n -> Iindexed(n + delta)
| Iindexed2 n -> Iindexed2(n + delta)

let num_args_addressing = function
| Iindexed n -> 1
| Iindexed2 n -> 2

(* Printing operations and addressing modes *)

let print_addressing printreg addr ppf arg =
match addr with
| Iindexed n ->
let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
fprintf ppf "%a%s" printreg arg.(0) idx
| Iindexed2 n ->
let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
fprintf ppf "%a + %a%s" printreg arg.(0) printreg arg.(1) idx

let print_specific_operation printreg op ppf arg =
match op with
| Imultaddf ->
fprintf ppf "%a *f %a +f %a"
printreg arg.(0) printreg arg.(1) printreg arg.(2)
| Imultsubf ->
fprintf ppf "%a *f %a -f %a"
printreg arg.(0) printreg arg.(1) printreg arg.(2)
Loading