Commit Graph

51 Commits (540996d21ee3793a1cecce252c81fb76a6b9fd61)

Author SHA1 Message Date
Nicolás Ojeda Bär 540996d21e Remove Spacetime 2020-10-08 20:28:12 +02:00
Xavier Leroy 8e246c41c2 Revised detection of arithmetic instructions with immediate operands, continued
- Rewrite the `is_immediate` methods in $ARCH/selection.ml in the style of
  other selection methods: operations that need platform-dependent handling
  are explicitly listed, all others fall through `super#is_immediate`.

- The `is_immediate` method from selectgen.ml knows how to handle shifts
  (and no other operation).  Remove the `select_shift_op` method,
  now unnecessary.

- ARM: remove special cases for multiply and multiply-high, no longer
  necessary.

- RISC-V: in emit.mlp, remove implementation of checkbound immediate,
  which is no longer generated.
2020-09-21 14:49:16 +02:00
Xavier Leroy 86fbea7fc3 Back-ends for 64-bit platforms do not need to be compilable on a 32-bit host
This commit simplifies a few integer constants that were obfuscated so
as to pass compilation on a 32-bit host, as "make check_all_arches"
would do if ran on a 32-bit host.  However, "make check_all_arches"
does not run on 32-bit hosts, unlike what is claimed in comments.

More generally, 32-bit hosts are no longer used for developing OCaml and
will not be used for cross-compilation.  So, let's not complicate the
back-ends unnecessarily.
2020-09-16 11:52:26 +02:00
Xavier Leroy 65544ffd1f Revised detection of arithmetic instructions with immediate operands
Replace the a single `is_immediate n` method that is supposed to apply
to all arithmetic instructions by two methods:

`is_immediate op n` : tests whether `n` is in the range of supported
   immediate arguments for integer operation `op`
`is_immediate_test cmp n` : tests whether `n` is in the range of supported
   immediate arguments for integer comparison `cmp`

This makes it easier to handle operations without immediate operands
(e.g. multiply or multiply-high on many platforms) and operations with
specific ranges of immediate operands (e.g. N-bit unsigned versus
N-bit signed).  Before, these operations had to be treated as special
cases in the platform-specific `select_operation` method.
2020-09-16 11:52:19 +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 2d92955749
Remove Const_pointer (#9578)
Since #9316 was merged, Cconst_pointer is compiled in exactly the same way as Cconst_int. This commit removes the now-redundant Cconst_pointer and Cconst_natpointer.
2020-05-19 15:31:08 +02: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 1c128fdf25 Make contains_calls into a reference instance variable 2019-09-12 12:58:54 +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
Mark Shinwell 618e5dbfbd More debugging information in Cmm terms (#2308)
Following on from GPR#851 and GPR#873, this pull request further enhances debugging information in Cmm terms. This was driven both by manually examining the debugger's behaviour and also by a report received from a user regarding substandard DWARF location information.
2019-03-13 15:40:04 +00:00
Mark Shinwell 24e12ad9e1 Propagate environments further in Selectgen 2019-03-08 13:06:31 +00:00
LemonBoy 86d1f0d714 Optimize 32->64 sign-extension for AMD64 (#1631) 2018-05-28 15:38:57 +02:00
Damien Doligez e52f39cbe9 Revert "Replace constant pointers by regular integers (#1580)"
This reverts commit 022051e7bd.
2018-04-06 16:09:53 +02:00
Vincent Laviron 022051e7bd Replace constant pointers by regular integers (#1580) 2018-03-15 09:57:53 +00:00
Mark Shinwell ea5fa10bac Fix evaluation order problem (#966) 2017-02-15 11:14:10 +00:00
Mark Shinwell f20634493f Remove Istore_symbol (plus some Win64 fixes) (#955) 2016-12-27 12:30:12 +00:00
Mark Shinwell 975f2e522d More debuginfo in Cmm 2016-10-12 14:13:05 +01:00
Mark Shinwell cd0bd8aa73 Spacetime: a new memory profiler (#585) 2016-07-29 15:07:10 +01:00
alainfrisch ff0d2345da Hacks so that check_all_arches works even with a 32-bit compiler. 2016-07-11 11:57:08 +02: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
Mark Shinwell 1d3a6c3038 Rename Cconst_blockheader to Cblockheader (#642) 2016-06-30 07:46:45 +01:00
Mark Shinwell ca03b4e500 Decorate more Cmm terms with location information (#627) 2016-06-27 08:49:26 +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 933fdb2687 Improved annotations on Psetfield etc 2015-12-18 16:42:40 +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
Gabriel Scherer eca0967403 PR#6167: OCAMLPARAM support for disabling PIC generation ('pic=0')
(Gabor Pali)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15793 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-01-24 16:35:26 +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
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
Mark Shinwell cceb1c7361 fix regression (extraneous moves) caused by previous Cconst_blockheader patch
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14648 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-21 06:28:16 +00:00
Gabriel Scherer d74aa291d3 on i386 and AMD64, mark 'morally tail' C function calls as non-leaf
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14610 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-16 08:34:21 +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 ab9f3e38fb PR#6042: optimize integer division and modulus when divisor is constant.
So far, implemented only for amd64.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14254 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-01 16:35:54 +00:00
Fabrice Le Fessant 89bdc10350 PR#5774: Add bswap primitives for amd64
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13106 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-29 09:55:00 +00:00
Fabrice Le Fessant d34a734947 PR#5795: Generate sqrtsd opcode instead of external call to sqrt on amd64
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13086 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-09 13:26:43 +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
Alain Frisch a0a14c08fa Enable and fix more warnings.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12498 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-29 11:47:28 +00:00
Benedikt Meurer 78e2ed88d8 [amd64] Don't override insert_op.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12122 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-02-04 10:00:09 +00:00
Benedikt Meurer fb327a7c2b Also pass Cmm.memory_chunk to select_addressing.
The rational behind this change is that for the ARM instruction sets, the
valid range for address offsets depends on the type of data being loaded
or stored.



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12120 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-02-04 09:43:33 +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
Jacques Garrigue ee36e1d1c5 merge branches/override
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10250 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-04-08 03:58:41 +00:00
Damien Doligez 1f95b17570 merge changes from 3.10.2merged to 3.11.0
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9153 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2008-12-03 18:09:09 +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
Damien Doligez f700284aac fusion des changements 3.09.3 -> release309_merge310
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7849 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2007-02-09 13:31:15 +00:00
Xavier Leroy 4b5512c74c Stack backtraces on uncaught exceptions in native code (merge of the opt_backtrace branch)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7812 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2007-01-29 12:11:18 +00:00
Xavier Leroy 5213cb0677 PR#4181: watch out for big constants in Ioffset_loc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7771 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2006-12-16 09:58:09 +00:00
Xavier Leroy cc11c0447a Ajout production de code relogeable (option -fPIC)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7121 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2005-10-13 03:53:52 +00:00
Xavier Leroy de53ed7fb7 Bugs dans intop_imm(Idiv | Imod)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5635 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-06-30 11:29:26 +00:00