Commit Graph

39 Commits (c3b4e9aa93255ddcc13c68e6c4ca7600ce85642d)

Author SHA1 Message Date
alainfrisch ff0d2345da Hacks so that check_all_arches works even with a 32-bit compiler. 2016-07-11 11:57:08 +02:00
Gabriel Scherer 99db3207e7 fallout from #645: remove emit_data_label (unused, breaks the build) 2016-07-10 10:14:40 -04:00
Alain Frisch e3ee2805b7 Merge pull request #645 from mshinwell/delete_cmm_label_stuff
Remove Cdefine_label and Clabel_address
2016-07-10 14:52:07 +02:00
Mark Shinwell 5f00ce793e Improve location handling in the middle end (version for merging) (#666) 2016-07-06 15:42:29 +01:00
Mark Shinwell c843ca0691 Labels after calls, call GC points and checkbound points (again) (#660) 2016-07-06 11:44:00 +01:00
Mark Shinwell 8e16cdd85d Remove Cdefine_label and Clabel_address 2016-06-29 10:01:03 +01:00
Fabrice Le Fessant 80c4576f03 Add line directives to preprocessed files 2016-06-29 10:43:00 +02:00
Xavier Leroy 5d02ca6f28 In frame tables, distinguish data pointers from code pointers
Since GPR#247 (stack backtraces aware of inlining) was merged, frame tables contain two kinds of addresses of labels: code labels (as before) and data labels (new, pointing to sub-frames).

On ARM in Thumb mode, the two kinds of pointers must be distinguished, because pointers to Thumb code have the low bit set, and the assembler needs to know whether a label denotes code or data to set the low bit or not.

This commit fixes this problem by splitting the "efa_label" action of record Emitaux.emit_frame_actions into two actions, "efa_code_label" and "efa_data_label".  On all ports except ARM, the two actions are identical.  On ARM, the actions add the appropriate ".type" declaration.

Tested on ARM-32 and x86-64 only.  CI will test the other platforms.
2016-06-27 09:14:54 +02:00
alainfrisch 502e4f9336 More warnings when compiling the compiler. 2016-03-15 22:46:35 +01:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Damien Doligez ee8f71101b clean up whitespace and cut long lines 2016-02-17 13:36:27 +01:00
Mark Shinwell bde2bdd206 Reformatting only (to the standards of tools/check-typo) 2016-02-10 18:28:38 +01:00
Mark Shinwell 05f1746cb5 Rename to max_arguments_for_tailcalls; revise numbers assuming no unboxed floats using the OCaml calling conventions 2016-02-08 15:02:40 +01:00
Mark Shinwell b5618e8642 max_arguments_without_passing_on-stack 2016-01-29 15:57:36 +00:00
Xavier Leroy 098e69aa66 Add notes and pointers to reference documents for each ocamlopt architecture. 2015-12-20 12:48:28 +01:00
Xavier Leroy eef84c432a PR#7037: don't put temporary asm file names into object files.
This way, builds are reproducible.
2015-12-13 18:40:04 +01:00
Xavier Leroy 644ee022f9 zSystems port: mark stack as nonexecutable, like in other Linux ports. 2015-12-13 12:21:52 -05:00
Xavier Leroy 64ab62221b z port: update emit.mlp to new format for FP literals 2015-11-19 08:21:38 -05:00
Xavier Leroy 770853b3f1 z port: fix up tabs and spaces (cosmetic)
House rules.
2015-11-01 06:30:30 -05:00
Xavier Leroy 0196d724da z port: adjust instruction latencies for basic-block scheduling
The latencies are based on wild guesses for the z10.  Since newer z processors are out-of-order, basic-block scheduling could also be turned off entirely.
2015-11-01 05:51:51 -05:00
Xavier Leroy 99067ad1e7 z port: do not use locgr instruction for Boolean-valued comparisons
The locgr instruction is not available in z10, the baseline for this port.
Instead, generate pedestrian code with a conditional branch.
Pass -march=z10 to the assembler to enforce z10 compliance.
2015-10-31 07:34:27 -04:00
Xavier Leroy 414fc47a3c z port: simpler implementation of multiply-high-signed
Following Hacker's Delight section 8.3.
2015-10-31 06:48:29 -04:00
Xavier Leroy 89475be999 z port: round toward 0 for float -> int conversions. 2015-10-31 06:47:50 -04:00
Xavier Leroy 3f26d0e375 z port: reloading must preserve 2-address instructions
Without the special reloading implemented here, a 2-address instruction such as x := x + y' could be reloaded as 'x1 := x2 + y' with two different temporaries x1, x2 for x.
2015-10-30 12:17:56 -04:00
Xavier Leroy cc9c12dff3 z port: fix issue with PIC code and dynamic loading
In PIC mode, Itailcall_imm should jumpt to the PLT of the called function.

Also: use %r7 rather than %r1 to pass the function pointer argument to caml_c_call.  It can be that caml_c_call is in a different shared object than the caller.  In this case, %r0 and %r1 can be destroyed by PLT stub code, according to the ELF ABI.
2015-10-30 11:30:39 -04:00
Xavier Leroy 88fb625050 z port: revise two-address instructions and integer immediate operations
Use la/lay when possible for add immediate and sub immediate,
because these instructions support the case result <> argument.

Use 'and/or/xor immediate over low 32 bits' instructions.
Do this only if the top 32 bits of the constant are 0 (or/xor) or -1 (and).
2015-10-30 11:02:43 -04:00
Xavier Leroy 39cd68fd0d z port: use unsigned comparison for Icheckbound instructions
This avoids testing the "< 0" case separately.
2015-10-30 10:00:59 -04:00
Xavier Leroy b149f661cd z port: use 'test under mask' instruction for even/odd conditional branches
This saves one instruction.  These cond branches are heavily used by pattern-matching compilation.
2015-10-30 09:47:37 -04:00
Xavier Leroy 54ff5d0377 z port: use lghi when possible to load integer constants
lghi is 4 bytes, lgfi is 6.
2015-10-30 09:33:42 -04:00
Xavier Leroy 88fd26f63c z port: streamline the heap allocation code
Move the cold path (the one that calls the GC when alloc_ptr < alloc_limit)
as much as possible to the end of the function.

Use la and lay to produce shorter code.
2015-10-30 09:26:11 -04:00
Xavier Leroy ad3a967660 zSeries port: factor out adjustments to the stack pointer
New function emit_stack_adjust, which chooses the shortest instruction
that performs the required adjustment.

Later, this will be a good place to put cfi_adjust directives.
2015-10-30 09:00:37 -04:00
Xavier Leroy d6742ea271 zSeries port: hardcode register names (cosmetic)
In emit.mlp, write %rN and %fN directly in `...` strings, instead of going through emit_gpr and emit_fpr.

Justification: for other ports like Power, several concrete asm syntaxes for register names exist, so it makes sense to abstract over them.  This is not the case for z systems under Linux.  Plus, using the concrete syntax directly makes it easier to review emit.mlp.
2015-10-30 08:34:50 -04:00
Xavier Leroy 1e4aedd404 zSystem port: use %r12 as normal register + extcall conventions
Following the previous commit, %r12 becomes usable as a normal register.
However it must be saved in caml_call_gc.

Independently: change Proc.loc_external_arguments to account for the
160 reserved bytes at bottom of stack.  Then, caml_c_call and
emission of code for Iextcall(false) no longer need to account for
those reserved bytes.
2015-10-30 06:57:10 -04:00
Xavier Leroy 862347f0f4 zSystem port: do not use %r12 as GOT pointer
Taking a leaf from recent versions of GCC, in PIC mode, we use a PC-relative load with GOTENT relocation to access the global offset table.  This way, we don't have to save, setup and reload %r12 as GOT pointer in every function.
2015-10-30 05:53:37 -04:00
Xavier Leroy 52742044fa zSystem port: remove special case "stey" in Emit.emit_load_store
Instead, do the binary64->binary32 conversion before, and use emit_load_store with %f15 as source register.
2015-10-29 10:22:55 -04:00
Xavier Leroy bcb696a260 zSystem port: revise addressing modes
- Ibased addressing is removed.  The code generated for an Ibased load/store is no better than the code we generate for an Iindexed load/store preceded by a Iconst_symbol instruction that loads the address of the global variable.  Plus, we now get opportunities for CSE of the Iconst_symbol.

- Iindexed2 addressing is extended with a constant displacement, to take full advantage of the ofs(%r1, %r2) addressing mode of the processor.

- During selection instruction, make sure that the constant displacement of Iindexed and Iindexed2 is within range (20 bit signed).
2015-10-29 10:09:09 -04:00
Xavier Leroy f6a0392f57 zSystem port: do not mark return addresses
Using the low bit of return addresses to mark already-scanned stack frames improves GC time on architectures that ignore this bit in 'return' instructions, like Power.  Otherwise, as is the case for zSystem, clearing up this bit before every 'return' instruction costs too much in running time.

asmrun/stack.h: turn off the marking of return addresses for z
asmcomp/s390x/emit.mlp: suppress clearing of low bit of return addresses
2015-10-29 05:44:01 -04:00
Xavier Leroy b79f88ea73 zSystem port: minimal fixes so that it compiles wrt the trunk
Plus a few simplifications:
- emit.mlp: assume target is ELF
- proc.ml & emit.mlp: use asm register names for 'register_name'
2015-10-29 10:07:30 +01:00
Xavier Leroy 58db11e051 IBM zSystem port of OCaml
Import of Bill O'Farrell's port, rebased from 4.02.1 to trunk.
2015-10-29 09:55:19 +01:00