* remove the unused is_native_tail_call_heuristic forward reference
This forward-reference from Lambda to Asmcomp was used to generate
machine-specific tailcall information in -annot output; this only use
was removed in 57d329e07b, so we can now
remove it to simplify the codebase.
The logic was non-trivial and might be useful again in the future.
* [minor] testsuite: convert warnings/w51.ml to an expect-test
* [minor] translattribute: refactor attribute payload deconstruction
* [@tailcall false]: warn if the call *is* a tailcall
(+ constructor renaming suggested by Nicolás during review)
* Changes
* testsuite: add an example with the 'invalid payload' exception
(suggested by Nicolás during review)
The Spacetime memory profiler is not going to be supported in Multicore OCaml, and is already broken by some of the related changes in OCaml 4.12. The core development team decided to remove Spacetime support from OCaml 4.12.
- 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.
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.
- Support a wider range of immediate values for ADD and SUB,
using two instructions when needed (add/sub middle 12 bits then low 12 bits).
- Do not rely on the assembler to convert CMP immediate negative to
CMN immediate.
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.
* Prologue size does not depend on stack_offset (power, arm64)
Define `initial_stack_offset` of a function, independently
of stack_offset, and use it to compute both frame_size and
prologue_size.
Unboxed arguments of type `int32` that are passed on the stack
are passed in 32-bit words instead of 64-bit words as in the AAPCS64 ABI.
To support this, we introduce a new specific operation, `Imove32`,
that compiles down to 32-bit moves or 32-bit stack loads or 32-bit
stack stores.
In the Selection pass, method `insert_move_extcall_arg`,
we generate `Imove32` instructions when required, i.e. if the
argument is an unboxed `int32` and needs to be passed on stack.
We then update `Proc.loc_external_arguments` to use 32-bit stack words
for `int32` arguments.
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).
Software emulation of floating-point arithmetic, as in the ARM EABI port,
use pairs of pseudoregisters of type Int to represent values of type Float.
This is achieved by the `regs_for` method of class `selector_generic`,
which defaults to `Reg.createv` but is overriden for ARM EABI so
as to perform the transformation Float -> Int,Int on the fly.
The method `bind_let_mut` uses `Reg.createv` to associate
pseudoregisters to bound variables. This is incorrect in a soft FP
context, as a bound variable of type Float will get a Float register
nonetheless. `self#regs_for` must be used instead. This is what this
commit does.
MSVC .lib format doesn't support having no .obj files in the library, so
ocamlopt -o foo.cmxa -a generates foo.cmxa but not foo.lib (there's no
error from the Microsoft Linker). The resulting foo.cmxa is unlinkable,
since OCaml passes foo.lib on to the linker.
This patch relaxes the requirement for foo.lib if the .cmxa contains no
units.
Lambda and Clambda distinguish Const_int from Const_pointer only so
that they can pass the information to Cmm. But now that that
Const_pointer is gone from Cmm (#9578), there's no need for the
distinction in Lambda either.
This PR requires a bootstrap, because the .cmo format changes:
Lambda.structured_constant has one fewer constructor. The bootstrap
is in the following commit.
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.
The original implementation of loc_external_arguments and
loc_external_results was following an older ABI,
where an FP argument passed in an FP register "burns" an integer register.
In the ELF psABI, integer registers and FP registers are used independently,
as in the OCaml calling convention. Plus, if all FP registers are used
but an integer register remains, the integer register is used to pass
the next FP argument.
Fixes: #9515
Using instruction fmv.x.d.
This is necessary to implement the ELF psABI calling conventions,
whereas some FP arguments may have to be passed in integer registers.