Commit Graph

51 Commits (082bdf545d178ac87e48f26db5b9bf34df05b675)

Author SHA1 Message Date
Nicolás Ojeda Bär 43883ae4bc Remove labels after calls, checkbound, and GC points 2020-10-08 20:28:15 +02:00
Nicolás Ojeda Bär 540996d21e Remove Spacetime 2020-10-08 20:28:12 +02:00
Xavier Leroy 9fcb295b98 Revised passing of arguments to external C functions
Introduce the type Cmm.exttype to precisely describe arguments to
external C functions, especially unboxed numerical arguments.

Annotate Cmm.Cextcall with the types of the arguments (Cmm.exttype list).
An empty list means "all arguments have default type XInt".

Annotate Mach.Iextcall with the type of the result (Cmm.machtype)
and the types of the arguments (Cmm.exttype list).

Change (slightly) the API for describing calling conventions in Proc:
- loc_external_arguments now takes a Cmm.exttype list,
  in order to know more precisely the types of the arguments.
- loc_arguments, loc_parameters, loc_results, loc_external_results
  now take a Cmm.machype instead of an array of pseudoregisters.
  (Only the types of the pseudoregisters mattered anyway.)

Update the implementations of module Proc accordingly, in every port.

Introduce a new overridable method in Selectgen, insert_move_extcall_arg,
to produce the code that moves an argument of an external C function
to the locations returned by Proc.loc_external_arguments.

Revise the selection of external calls accordingly
(method emit_extcall_args in Selectgen).
2020-07-24 17:39:22 +02:00
Stephen Dolan 4d4a056bc7
Micro-optimise allocations on amd64 to save a register (#9280)
There's no need for allocation on amd64 to clobber the %rax register. It's only used in one case (-compact out-of-line allocation of >3 words), and only used there to do a single subtraction. That subtraction can be done by the caller at no code size penalty, freeing up %rax.

Inside amd64.S functions, %r11 can be used instead of %rax as temporary.  %r11 is destroyed by PLT stub code, so on ELF platforms it costs nothing to use.
2020-03-09 19:52:36 +01:00
Stephen Dolan 0852266a07 Improve code-generation for 32-to-64-bit zero-extension on amd64. 2019-10-14 10:45:15 +01:00
Greta Yorsh aeebb62e9b Move contains_calls and num_stack_slots from Proc to Mach.fundecl 2019-09-09 11:33:03 +01:00
KC Sivaramakrishnan ee2bcfe1ad Optimising poptrap in i386 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan ddf400b1e9 Destroy r11 at Itrywith 2019-08-23 09:50:05 +05:30
Mark Shinwell 4334b2de87
Position [Lprologue] correctly (#2292) 2019-03-29 11:47:53 +00:00
Mark Shinwell 770e662e96
Add [Proc.destroyed_at_reloadretaddr] (#2065) 2018-10-15 12:53:27 +01:00
Mark Shinwell dacb2240a4
DWARF register numberings (#2080) 2018-10-04 11:30:52 +01:00
LemonBoy 86d1f0d714 Optimize 32->64 sign-extension for AMD64 (#1631) 2018-05-28 15:38:57 +02:00
Mark Shinwell 70c585d5eb Take PLT-clobbered registers into account at Ialloc (#1304)
Mark PLT-clobbered registers as destroyed across the Ialloc instruction.

Currently only x86-64 is affected, in PIC mode only, and only with the glibc dynamic loader.
2017-08-28 19:09:57 +02:00
Mark Shinwell f20634493f Remove Istore_symbol (plus some Win64 fixes) (#955) 2016-12-27 12:30:12 +00:00
Mark Shinwell cd0bd8aa73 Spacetime: a new memory profiler (#585) 2016-07-29 15:07:10 +01:00
Mark Shinwell c843ca0691 Labels after calls, call GC points and checkbound points (again) (#660) 2016-07-06 11:44:00 +01:00
Alain Frisch c3c523109e Revert "Labels after calls, call GC points and checkbound points" 2016-07-01 18:42:51 +02:00
Mark Shinwell 432f87f077 Labels after calls, call GC points and checkbound points (#644) 2016-07-01 15:16:03 +01: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
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
Jérémie Dimino e7593340c1 Split 64-bit integers on 32-bit architectures
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16385 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-08-25 16:18:50 +00:00
Xavier Leroy 53231bcdc3 Update to trunk r16267.
A change on trunk in cmmgen was causing problems: the use of array_indexing
in bigarray_indexing was constructing derived pointers of Addr type
instead of the correct Int type.  (Because bigarray inner pointers
are outside the heap, and because they are live across allocations.)
Added an optional argument to array_indexing to specify expected
pointer type, and adapted bigarray_indexing to use it with type Int.


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/cmm-mach-types@16268 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-27 08:18:53 +00:00
Alain Frisch 9decba7731 Rename Intel_* to X86_*.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/abstract_intel_emit@15612 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-27 17:12:21 +00:00
Xavier Leroy ac02f56351 More precise typing at the C-- and Mach level:
- Register type "Addr" is split into
    . "Val" (well-formed OCaml values, appropriate as GC roots)
    . "Addr" (derived pointers within the heap, must not survive a GC)
- memory_chunk "Word" is split into
    . "Word_val" (OCaml value)
    . "Word_int" (native-sized integer, not a pointer into the heap)

Cmmgen was updated to use Word_val or Word_int as appropriate.

Application #1: fail at compile-time if a derived pointer within the heap
survives a GC point (cf. PR#6484).

Application #2: CSE can do a better job across allocation points
(keep factoring expressions of type Int, Val, Float, but not Addr).


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/cmm-mach-types@15568 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-06 08:54:14 +00:00
Alain Frisch 9248774af5 Synchronize with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/abstract_intel_emit@15147 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-29 10:37:43 +00:00
Damien Doligez cbfe627f92 merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev 15121)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-22 13:45:02 +00:00
Fabrice Le Fessant c6d4264a09 import new intel emit branch
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/abstract_intel_emit@15097 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-18 09:32:20 +00:00
Xavier Leroy 657ba73021 Liveness & Deadcode: fix i386-specific issue with move instructions accessing
the x87 FP stack, which must not be eliminated.
CSEgen: harden against the same x87-specific issue + against reuse of
  values in fixed hardware registers that were destroyed by a prior
  operation.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14877 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-16 14:37:22 +00:00
Xavier Leroy 558f40e344 New back-end optimization pass: common subexpression elimination (CSE).
(Reuses results of previous computations instead of recomputing them.)
(Cherry-picked from branch backend-optim.)
Tested on amd64/linux and i386/linux.
Other back-ends compile (after assorted updates) but are untested.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14688 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-26 10:40:22 +00:00
Xavier Leroy 9c1d005ebb New back-end optimization pass: dead code elimination.
(Removes arithmetic and load instructions whose results are unused.)
(Cherry-picked from branch backend-optim.)


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14686 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-26 09:31:18 +00:00
Damien Doligez aa58e55958 port to cygwin-64
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14337 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-12-03 14:43:02 +00:00
Benedikt Meurer 3bb161216b Perform constant optimizations for integer division and modulus on the C-- level.
This way we can avoid having to duplicate the same functionality for
every backend, and we may also benefit from other optimizations performed
during C-- generation.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14303 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-19 07:01:54 +00:00
Xavier Leroy e32b161074 Follow-up to commit r14254: update destroyed_at_oper and max_register_pressure
for immediate Idiv and Imod.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14255 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-01 17:05:21 +00:00
Fabrice Le Fessant 9b53f8b10d Re-add configure option -with-frame-pointers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13738 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-03 18:03:59 +00:00
Fabrice Le Fessant 97bc1fa9e2 Reverting -with-frame-pointers
Fails to compile alt-ergo without frame-pointers. No time to debug
before tonight, so I revert and will merge again after fixing the
problem.



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13732 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-03 06:29:33 +00:00
Fabrice Le Fessant 1b2667b9f2 Add -with-frame-pointers to ./configure
This option can be used to tell the native compiler that it should
update frame pointers, so that debuggers and profiling tools 
(especially Linux perf) can use them. For now, it is only supported
by the Unix/amd64 port.



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13730 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-03 04:42:42 +00:00
Damien Doligez def31744f9 remove all $Id keywords
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +00:00
Xavier Leroy 9ac1d4937b PR#5707: in AMD64 port, exchange the roles of r10-r11 and r12-r13,
so that r10 and r11 are no longer used for parameter passing,
  and can therefore be destroyed by the dynamic loader without harm.
(Cherry-picked from version/4.00, commit 12907).


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12908 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-09-08 16:53:39 +00:00
Damien Doligez 997a678d5e clean up TABs and whitespace
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12799 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-07-30 18:04:46 +00:00
Damien Doligez e7f5b858c2 More renaming to OCaml
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12149 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-02-10 16:15:24 +00:00
Xavier Leroy e10723e701 Merged proc_nt.ml into proc.ml in directories asmcomp/i386 and asmcomp/amd64.
This avoids much code duplication and is a baby step towards Mingw-64 bits 
support (PR#5179).  (There will be no need to create a third proc_xxx.ml
file for this configuration.)
Also, in amd64/emit_nt.mlp, the ml64 assembler didn't like my label subtractions, so I put the jumptable in code area instead of in data area.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11319 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-12-16 17:02:48 +00:00
Damien Doligez 3b507dd1aa renaming of Objective Caml to OCaml and cleanup of copyright headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-07-27 14:17:02 +00:00
Damien Doligez 04b1656222 clean up spaces and tabs
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9547 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-01-22 12:48:24 +00:00
Damien Doligez bdc0fadee2 merge changes from release/3.11.1 to release/3.11.2
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9540 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-01-20 16:26:46 +00:00
Damien Doligez ed32f569e3 merge changes from ocaml3110 to ocaml3111rc0
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9270 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2009-05-20 11:52:42 +00:00
Alain Frisch 3958a92c72 Merge the natdynlink branch into HEAD.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8477 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2007-11-06 15:16:56 +00:00
Xavier Leroy 9ccb911666 Can select which assembler to use at configuration time (PR#4171)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8462 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2007-10-30 12:37:16 +00:00
Damien Doligez 125ea40d4c fusion 3.09.0 -> 3.09.1
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7307 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2006-01-04 16:55:50 +00:00