Damien Doligez
5b8df637d2
merge branch "safe-string"
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14705 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-29 11:56:17 +00:00
Xavier Leroy
3ce32fba4f
Wrong MASM syntax, try again.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14704 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-29 09:58:51 +00:00
Damien Doligez
35ec048ca7
add CSE.ml to ignore files
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14695 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-27 09:31:59 +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
95d98cd978
ID comments are so passé.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14687 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-26 09:38:29 +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
Xavier Leroy
452390e0ea
Follow-up to commit 14673: MASM has its own syntax for hex constants
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14683 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-26 07:11:11 +00:00
Xavier Leroy
2633ff77ce
Follow-up to commit 14673: Iconst_float now takes a float, no longer a string.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14675 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-25 14:02:43 +00:00
Xavier Leroy
29b34438e0
- Constant ropagation for float and int32/int64/nativeint arithmetic.
...
Constant propagation for floats can be turned off with option
-no-float-const-prop, for codes that change FP rounding modes at
run-time.
- Clambda / C-- / Mach: represent float constants as FP numbers of type
float rather than literals of type string.
- Tested for AMD64; other archs need testing.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14673 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-25 08:41:13 +00:00
Mark Shinwell
0b097e9a74
part 2: fix regression (extraneous moves) caused by previous Cconst_blockheader patch
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14649 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-21 06:55:48 +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
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
Damien Doligez
7303ac34ca
fix some of the whitespace problems in the source
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14582 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-12 10:17:02 +00:00
Luc Maranget
937e37ef1f
Suppressed some useless argument of switcher calls
...
(lifted as a functor argument)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14559 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-08 09:38:22 +00:00
Luc Maranget
fcf3571123
Folllowup to PR#6359, great cleanup of switch actions sharing.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14558 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-07 15:43:20 +00:00
Gabriel Scherer
192d8b44d1
Fix caml_string_{get,set}{16,32,64} bound checking in cmmgen
...
(Patch by Pierre Chambart)
Followup for trunk@14267:
bound checking bug with caml_string_{get,set}{16,32,64}: fix the runtime C code
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14556 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-07 15:07:35 +00:00
Luc Maranget
dd55c293ac
Fix PR#6359
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14520 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-02 13:22:21 +00:00
Damien Doligez
be92c8e70e
fix msvc64 port by removing unused open Misc (untested, esp. on other Windows ports)
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14501 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-27 15:06:28 +00:00
Luc Maranget
4aa013f82f
In cmmgen, use previously defined 'get_size' function to emit
...
the code that extract size of blocks.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14500 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-27 14:33:28 +00:00
Gabriel Scherer
d8d7ea94d4
PR#6351: minor arm64 fix (patch by Richard W.M. Jones)
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14487 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-25 10:49:24 +00:00
Alain Frisch
35ff978e3b
#6260 : fix unecessary boxing of let-bound floats/ints.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14486 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-25 08:57:26 +00:00
Luc Maranget
d89503fc6b
Oups
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14480 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-21 18:42:49 +00:00
Luc Maranget
c2a88c27fd
#PR6269 Optimized string matching
...
Noticed that I had to bootstrap to test on ARM, so I commit a new bootstrap
compiler.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14479 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-21 17:02:44 +00:00
Mark Shinwell
4eb7a8a644
fix error in previous register naming patch
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14472 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-20 14:36:12 +00:00
Alain Frisch
87e2ff9b06
#6345 : better compilation of optional arguments with default values.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14466 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-18 16:54:32 +00:00
Mark Shinwell
de489bde2f
improved abstractions for register naming in the native code backend
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14465 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-17 14:39:12 +00:00
Mark Shinwell
583bfd46c2
be explicit when constructing integers that are block headers
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14464 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-17 14:34:00 +00:00
Alain Frisch
1080fec868
Optimization: if a function doesn't use its environment, one can do as if it it doesn't have any free variables, and its closure can be statically allocated (we could be more precise and remove unused free variables from the closure).
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14453 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-10 10:05:02 +00:00
Alain Frisch
ebd01bc49e
#6343 , #5537 , #5573 : improving access to values in nested modules.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14452 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-10 10:02:31 +00:00
Alain Frisch
fd2911be13
Really remove debug output.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14446 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-07 08:13:55 +00:00
Jacques Garrigue
75b6553f15
remove debugging output
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14445 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-07 00:59:10 +00:00
Alain Frisch
4907f6ca76
#5779 : improve support for structured constants (better propagation, sharing, cleaner representation). Also fix #6337 (constants emitted several times).
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14444 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-06 17:03:16 +00:00
Gabriel Scherer
fba6c41771
Fix a typo in close_functions.
...
(Patch by Evgeny Roubinchtein)
The typo isn't a bug since the variables `arity' and `body' are never
actually referenced in the body of the function, but it does
(negatively) affect readability of the code.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14430 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-01-31 07:50:35 +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
Xavier Leroy
7984a93671
Bring stack backtraces up-to-date on PowerPC, incl. reraise.
...
Tested on PowerPC/Linux. Needs testing on PowerPC/MacOS X.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14324 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-28 14:43:56 +00:00
Xavier Leroy
140f620413
Debug info was lost when rescheduling "checkbound" instructions.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14323 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-28 14:42:34 +00:00
Xavier Leroy
3d7d4b9269
PR#6243: Make "ocamlopt -g" more resistant to ill-formed locations.
...
(Reflecting commit r14321 on version/4.01)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14322 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-28 14:34:45 +00:00
Xavier Leroy
948d520023
PR#6239: a "raise" in -g mode can end up calling a C function (stash_backtrace). Therefore the containing function must not be a leaf function, so that on x86-32/MacOSX and x86-64, the stack is properly 16-realigned on entrance to containing function.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14316 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-27 17:10:35 +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
Benedikt Meurer
e2827a1bd0
Revert "Don't use emit_parts_list for regular operations."
...
This reverts commit r14292.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14293 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-14 17:56:15 +00:00
Benedikt Meurer
7fab955f7b
Don't use emit_parts_list for regular operations.
...
Using emit_parts_list does not make sense for any
operation except Ialloc, where we can delay the
computation of simple expression until the allocation
is done. So we try to avoid using emit_parts_list for
regular operations, where the special treatment of
non simple expression conflicts with our special
instruction selection on arm (and arm64). For example
we cannot merge the add and shift operation required
for tagging as soon as there is at least one non
simple expression involved, even though both Cadd
and Clsl do not care at all whether its arguments are
simple or not.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14292 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-14 08:10:03 +00:00
Alain Frisch
f16534ef1a
Reintegrate raise_variants branch.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14289 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-13 13:55:13 +00:00
Benedikt Meurer
c3a2400954
[arm] Improve code selection for shifted arithmetic operations.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14283 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-11 14:10:40 +00:00
Xavier Leroy
e553dc225b
PR#6227 continued: problem with preferences between different register classes.
...
(Cherry-picking commit r14272 from 4.01 bugfix branch.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14273 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-08 15:08:34 +00:00
Alain Frisch
07e704dfd5
Remove use of deprecated features ( #6227 , patch by johnwhitington).
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14271 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-07 11:02:51 +00:00
Alain Frisch
ff18f681bc
#6042 : fix msvc64 port.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14268 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-05 14:24:37 +00:00
Benedikt Meurer
5b13c68f36
Improve code generation for subtraction.
...
Given integer constants x and n:
1. If n + x does not overflow, then (x - c) + n is compiled
to (x + n) - c.
2. If n - x does not overflow, then (c - x) + n is compiled
to c + (n - x).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14266 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 21:39:55 +00:00
Benedikt Meurer
c04e198410
[arm] Fix bug in div/mod by constant.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14265 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 21:38:49 +00:00
Benedikt Meurer
355e0359fd
Further refactor code generation for multiplication.
...
Recognize negation by multiplication with -1 and generate
subtraction in this case.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14264 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 19:19:07 +00:00