Commit Graph

39 Commits (master)

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 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
Fourchaux 44e6cf4e0f
typos (#9806) 2020-07-28 12:22:03 +01: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 de9e630852 Assert that Cassign is only used on Clet_mut-bound variables 2020-02-25 15:23:38 +00:00
Stephen Dolan 1336ce0c0d Use typing information from Clambda for mutable Cmm variables 2020-02-25 15:03:14 +00: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
Mark Shinwell 2b5f13c913 GPR#2056 (Backend_var) 2018-09-28 17:59:01 +02:00
Gabriel Scherer a62dd60dee Merge pull request #1040 from dhekir/trunk
fix several typos in comments
2017-02-22 20:26:50 -05:00
Mark Shinwell ea5fa10bac Fix evaluation order problem (#966) 2017-02-15 11:14:10 +00:00
Daniel b9dd14cdaf fix several typos in comments 2017-02-13 17:09:50 +01:00
Pierre Chambart c3d056de68 Change Cmm Ccatch construct to allow recursive cases 2016-10-28 13:03:59 +02: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
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
Xavier Leroy fcc2da3848 PR#6501: harden the native-code generator against certain uses of "%identity".
Technically: when a C-- let-bound variable is assigned to, update its type
so that it is the lub of the types of the initial value and all values
assigned to it, with the type ordering Int <: Addr.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15078 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-11 07:46:25 +00:00
Fabrice Le Fessant 457958a9e6 Add reset functions to make modules reentrant when used through compiler-libs
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14770 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-09 12:01:21 +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
Gabriel Scherer fa0f96ab2b selectgen.ml: cross-cutting handling of Proc.contains_calls
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14609 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-16 08:34:19 +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
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
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
Damien Doligez 5e67123bf6 PR#4975: spelling mistakes "overriden" and "informations"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10450 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-05-21 12:00:49 +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
Xavier Leroy 1a7d4a3293 Added and used Reg.createv_like.
Selectgen: new methods regs_for, enables ports to store float values
in pairs of integer registers.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9210 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2009-03-31 09:44:50 +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
Damien Doligez 1279ab4b76 fusion des changements 3.09.1 -> 3.09.2
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7382 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2006-04-16 23:28:22 +00:00
Xavier Leroy 7e5e058030 Revu compilation des 'raise' et des 'exit' en position d'argument de fonction ou de primitives (PR#1367). A tester soigneusement
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5239 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-11-04 16:25:09 +00:00
Xavier Leroy 68b5b9b5b5 Revu emit_stores pour pouvoir le redefinir pour certains processeurs
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3217 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2000-06-29 11:44:36 +00:00
Xavier Leroy cc0f32b054 Changement de la licence
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2553 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-11-17 18:59:06 +00:00
Jérôme Vouillon 87b17301f4 Nouvelle syntaxe des classes
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1997 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-06-24 19:22:26 +00:00
Xavier Leroy 839a164991 Marquer le plus possible de methodes "private" et ne pas les exporter.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1755 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-11-06 17:25:24 +00:00
Xavier Leroy 119c8eeb67 Nouvelle architecture pour les fichiers dependant du processeur
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1655 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-07-24 11:49:12 +00:00