Commit Graph

61 Commits

Author SHA1 Message Date
Alan
49610edd49
[OCaml][NPM] Add OCaml bindings to new pass manager 2023-09-16 16:06:14 -04:00
Alan Hu
30f423a543 [OCaml] Migrate from naked pointers to prepare for OCaml 5
The OCaml bindings currently return pointers to LLVM objects as-is to
OCaml. These "naked pointers" end up appearing as values of local
variables in OCaml code, stored as part of other OCaml values,
etc. The safety of this design relies on the OCaml runtime system's
ability to distinguish these pointers from pointers to memory on the
OCaml garbage collected heap. In particular, when the OCaml GC
encounters a pointer to memory known to not be part of the OCaml heap,
it does not follow it.

In OCaml 4.02 an optimized "no naked pointers" mode was introduced
where the runtime system does not perform such checks and requires
that no such naked pointers be passed to OCaml code, instead one of
several encodings needs to be used. In OCaml 5, the no naked pointers
mode is now the only mode. This diff uses one of the potential
encodings to eliminate naked pointers, making the LLVM OCaml bindings
compatible with the "no naked pointers" mode of OCaml >= 4.02 and 5.

The encoding implemented in this diff relies on LLVM objects to be at
least 2-byte aligned, meaning that the lsb of pointers will
necessarily be clear. The encoding sets the lsb when passing LLVM
pointers to OCaml, and clears it on the return path. Setting the lsb
causes the OCaml runtime system to interpret the resulting value as a
tagged integer, which does not participate in garbage collection.

In some cases, particularly functions that receive an OCaml array of
LLVM pointers, this encoding requires allocation of a temporary array,
but otherwise this diff aims to preserve the existing performance
characteristics of the OCaml bindings.

Reviewed By: jberdine

Differential Revision: https://reviews.llvm.org/D136400
2023-02-28 23:52:49 +00:00
Alan Hu
e0efe46b33 [OCaml] Remove all PassManager-related functions
Reviewed By: aeubanks, nikic

Differential Revision: https://reviews.llvm.org/D144751
2023-02-24 13:14:18 -08:00
Florian Hahn
e2cd0851fa
Recommit "[SCCP] Remove legacy SCCP pass."
This reverts commit a9a1950115.

The legacy PM uses in Polly have been removed, so recommit the patch.

Original message:
    This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.

    Reviewed By: aeubanks

    Differential Revision: https://reviews.llvm.org/D144201
2023-02-24 13:47:31 +01:00
Fangrui Song
d7c459070c [LoopIdiomRecognize] Remove legacy pass
Following recent changes to remove non-core legacy passes.
2023-02-19 21:39:47 -08:00
Fangrui Song
f62b084e92 [LoopDeletion] Remove legacy pass
Following recent changes to remove non-core legacy passes.
2023-02-15 23:31:05 -08:00
Fangrui Song
4eee77873b [LoopReroll] Remove legacy pass (unused in the pipeline)
Following recent changes to remove non-core legacy passes.
2023-02-15 16:09:32 -08:00
Arthur Eubanks
b677d0753c [IPSCCP] Remove legacy pass
This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-14 13:20:52 -08:00
Arthur Eubanks
aecb36c848 [GlobalOpt] Remove legacy pass
This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-14 12:51:45 -08:00
Arthur Eubanks
84728a3d75 [Inliner] Remove legacy simple inliner
It's part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-09 10:36:58 -08:00
Arthur Eubanks
15977742d3 Reland [LegacyPM] Remove some legacy passes
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.

Namely
* Internalize
* StripSymbols
* StripNonDebugSymbols
* StripDeadDebugInfo
* StripDeadPrototypes
* VectorCombine
* WarnMissedTransformations

Fixed previously failing ocaml tests (one of them seems to already be failing?)
2023-02-07 12:56:05 -08:00
Arthur Eubanks
1b254022b2 Revert "[LegacyPM] Remove some legacy passes"
This reverts commit a4b4f62beb.

Ocaml bindings tests failing.
2023-02-07 10:17:45 -08:00
Arthur Eubanks
a4b4f62beb [LegacyPM] Remove some legacy passes
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.

Namely
* Internalize
* StripSymbols
* StripNonDebugSymbols
* StripDeadDebugInfo
* StripDeadPrototypes
* VectorCombine
* WarnMissedTransformations
2023-02-07 09:57:48 -08:00
Arthur Eubanks
c972ed4d34 [MergeFunctions] Remove legacy pass
It's part of the optimization pipeline, which the legacy pass manager version is deprecated.
2023-02-06 13:11:08 -08:00
Sebastian Peryt
46fc75ab28 [NFC][2/n] Remove PrunePH pass
Second patch in the series to remove legacy PM and
associated -enable-new-pm=0 flag targets pass that
has not been ported to new PM - PruneEH.
Discussion about this can be found in D44415.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D134686
2022-09-26 18:38:04 -07:00
Nikita Popov
217e85761c [ArgPromotion] Remove legacy PM support
Support for the legacy pass manager in ArgPromotion causes
complications in D125485. As the legacy pass manager for middle-end
optimizations is unsupported, drop ArgPromotion from the legacy
pipeline, rather than introducing additional complexity to deal
with it.

Differential Revision: https://reviews.llvm.org/D128536
2022-06-27 09:42:17 +02:00
Florian Hahn
fc4bba2882
Remove loop-unswitch from various bindings.
LoopUnswitch has been removed in fb4113ef0c.

Also remove it from  various bindings.
2022-04-29 10:53:17 +01:00
Arthur Eubanks
e0736e7429 [ocaml bindings] Remove LTO bindings
Followup to D123882.
2022-04-18 10:22:26 -07:00
Josh Berdine
f4d156aed0 [NFC][OCaml] Reformat to clean up following CAMLprim removal
The removal of CAMLprim left the code in need of an application of
clang-format. There are various other changes made by clang-format
which it seems ought to be rolled together into this diff.

Differential Revision: https://reviews.llvm.org/D99477
2021-04-05 10:55:08 +01:00
Josh Berdine
8e4fc55a0e [NFC][OCaml] Remove vestigial CAMLprim declarations
The CAMLprim macro has not been needed since OCaml 3.11, and is
defined to the empty string. This diff removes all instances of it.

Differential Revision: https://reviews.llvm.org/D99476
2021-04-05 10:55:08 +01:00
serge-sans-paille
95537f4508 llvmbuildectomy - compatibility with ocaml bindings
Use exact component name in add_ocaml_library.
Make expand_topologically compatible with new architecture.
Fix quoting in is_llvm_target_library.
Fix LLVMipo component name.
Write release note.
2020-11-13 14:35:52 +01:00
Arthur Eubanks
dd04fa17d7 [OCaml] Remove add_constant_propagation
After https://reviews.llvm.org/D85159.
2020-08-27 09:30:21 -07:00
Arthur Eubanks
486ed88533 [ConstProp] Remove ConstantPropagation
As discussed in
http://lists.llvm.org/pipermail/llvm-dev/2020-July/143801.html.

Currently no users outside of unit tests.

Replace all instances in tests of -constprop with -instsimplify.
Notable changes in tests:
* vscale.ll - @llvm.sadd.sat.nxv16i8 is evaluated by instsimplify, use a fake intrinsic instead
* InsertElement.ll - insertelement undef is removed by instsimplify in @insertelement_undef
llvm/test/Transforms/ConstProp moved to llvm/test/Transforms/InstSimplify/ConstProp

Reviewed By: lattner, nikic

Differential Revision: https://reviews.llvm.org/D85159
2020-08-26 15:51:30 -07:00
Florian Hahn
4ffa6a27ac [Bindings] Remove ipc_propagation.
IPConstantPropagation has been removed, also remove the bindings.
2020-08-02 22:36:53 +01:00
Florian Hahn
599955eb56 Recommit "[IPConstProp] Remove and move tests to SCCP."
This reverts commit 59d6e814ce.

The cause for the revert (3 clang tests running opt -ipconstprop) was
fixed by removing those lines.
2020-08-02 22:23:54 +01:00
Florian Hahn
59d6e814ce Revert "[IPConstProp] Remove and move tests to SCCP."
This reverts commit e77624a3be.

Looks like some clang tests manually invoke -ipconstprop via opt.....
2020-07-30 13:06:54 +01:00
Florian Hahn
e77624a3be [IPConstProp] Remove and move tests to SCCP.
As far as I know, ipconstprop has not been used in years and ipsccp has
been used instead. This has the potential for confusion and sometimes
leads people to spend time finding & reporting bugs as well as
updating it to work with the latest API changes.

This patch moves the tests over to SCCP. There's one functional difference
I am aware of: ipconstprop propagates for each call-site individually, so
for functions that are called with different constant arguments it can sometimes
produce better results than ipsccp (at much higher compile-time cost).But
IPSCCP can be thought to do so as well for internal functions and as mentioned
earlier, the pass seems unused in practice (and there are no plans on working
towards enabling it anytime).

Also discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2020-July/143773.html

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D84447
2020-07-30 12:36:27 +01:00
Joerg Sonnenberger
9681ea9560 Reapply r374743 with a fix for the ocaml binding
Add a pass to lower is.constant and objectsize intrinsics

This pass lowers is.constant and objectsize intrinsics not simplified by
earlier constant folding, i.e. if the object given is not constant or if
not using the optimized pass chain. The result is recursively simplified
and constant conditionals are pruned, so that dead blocks are removed
even for -O0. This allows inline asm blocks with operand constraints to
work all the time.

The new pass replaces the existing lowering in the codegen-prepare pass
and fallbacks in SDAG/GlobalISEL and FastISel. The latter now assert
on the intrinsics.

Differential Revision: https://reviews.llvm.org/D65280

llvm-svn: 374784
2019-10-14 16:15:14 +00:00
Dmitri Gribenko
1a21f98ac3 Revert "Add a pass to lower is.constant and objectsize intrinsics"
This reverts commit r374743. It broke the build with Ocaml enabled:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/19218

llvm-svn: 374768
2019-10-14 12:22:48 +00:00
Joerg Sonnenberger
e4300c392d Add a pass to lower is.constant and objectsize intrinsics
This pass lowers is.constant and objectsize intrinsics not simplified by
earlier constant folding, i.e. if the object given is not constant or if
not using the optimized pass chain. The result is recursively simplified
and constant conditionals are pruned, so that dead blocks are removed
even for -O0. This allows inline asm blocks with operand constraints to
work all the time.

The new pass replaces the existing lowering in the codegen-prepare pass
and fallbacks in SDAG/GlobalISEL and FastISel. The latter now assert
on the intrinsics.

Differential Revision: https://reviews.llvm.org/D65280

llvm-svn: 374743
2019-10-13 23:00:15 +00:00
Aditya Kumar
a6d9d31279 [LLVM-C][Ocaml] Add MergeFunctions and DCE pass
MergeFunctions and DCE pass are missing from OCaml/C-api. This patch
adds them.

Differential Revision: https://reviews.llvm.org/D65071

Reviewers: whitequark, hiraditya, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

Tags: #llvm

Authored by: kren1

llvm-svn: 373170
2019-09-29 16:06:22 +00:00
Chandler Carruth
2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
whitequark
e7e14f464c [LLVM-C][OCaml] Add UnifyFunctionExitNodes pass to C and OCaml APIs
Summary:
Adds LLVMAddUnifyFunctionExitNodesPass to expose
createUnifyFunctionExitNodesPass to the C and OCaml APIs.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52212

llvm-svn: 342476
2018-09-18 13:36:03 +00:00
whitequark
1f50560e56 [LLVM-C][OCaml] Add LowerAtomic pass to C and OCaml APIs
Summary:
Adds LLVMAddLowerAtomicPass to expose createLowerAtomicPass in the C
and OCaml APIs.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: jfb, llvm-commits

Differential Revision: https://reviews.llvm.org/D52211

llvm-svn: 342475
2018-09-18 13:35:50 +00:00
whitequark
02da196c8c [NFC][OCaml] Fix copy paste error in file header
Summary: Just copypasta resulting in the wrong file name in the header.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52215

llvm-svn: 342437
2018-09-18 01:47:53 +00:00
whitequark
f02eae7487 [NFC][OCaml] Fix implicit declaration compilation warnings
Summary:
2dd4f35c7fc75639920ebc473a4a57ea91864c10 moved LLVMAddLowerSwitchPass
and LLVMAddPromoteMemoryToRegisterPass declarations from
llvm-c/Transforms/Scalar.h to llvm-c/Transforms/Utils.h

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52214

llvm-svn: 342436
2018-09-18 01:47:44 +00:00
Fangrui Song
afa95ee03d [LLVM-C] [OCaml] Remove LLVMAddBBVectorizePass
Summary: It was fully replaced back in 2014, and the implementation was removed 11 months ago by r306797.

Reviewers: hfinkel, chandlerc, whitequark, deadalnix

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D47436

llvm-svn: 333378
2018-05-28 16:58:10 +00:00
David Majnemer
cbf614a93b Remove the ScalarReplAggregates pass
Nearly all the changes to this pass have been done while maintaining and
updating other parts of LLVM.  LLVM has had another pass, SROA, which
has superseded ScalarReplAggregates for quite some time.

Differential Revision: http://reviews.llvm.org/D21316

llvm-svn: 272737
2016-06-15 00:19:09 +00:00
Chris Bieneman
e49730d4ba Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

Differential Revision: http://reviews.llvm.org/D16471

llvm-svn: 258861
2016-01-26 21:29:08 +00:00
Peter Zotov
0d040f66a5 [OCaml] Move Llvm.clone_module to its own Llvm_transform_utils module.
This way most code won't link this (substantially large) library,
if compiled statically with LLVM.

llvm-svn: 223072
2014-12-01 19:50:39 +00:00
Peter Zotov
b20073c63c [OCaml] [cmake] Add CMake buildsystem for OCaml.
Closes PR15325.

llvm-svn: 223071
2014-12-01 19:50:23 +00:00
Peter Zotov
e2b8b1431c [OCaml] Ensure consistent naming.
Specifically:
  * Directories match module names.
  * Test names match module names.
  * The language is called "OCaml", not "Ocaml".

llvm-svn: 220958
2014-10-31 09:19:03 +00:00
Peter Zotov
662538ac40 [OCaml] Drop support for 3.12.1 and earlier.
In practice this means:
  * Always using -g flag.
  * Embedding -cclib -lstdc++ into the corresponding cma/cmxa file.
    This also moves -lstdc++ in a single place.
  * Using caml_named_value instead of a homegrown mechanism.

llvm-svn: 220843
2014-10-29 08:15:54 +00:00
Peter Zotov
e447b61c50 [OCaml] Synchronize transformations with LLVM-C.
Also, rearrange the functions in a way that allows to quickly
compare C headers and .mli/glue files.

llvm-svn: 220842
2014-10-29 08:15:21 +00:00
Peter Zotov
110f62912b [OCaml] Fix whitespace.
llvm-svn: 220766
2014-10-28 06:15:18 +00:00
Gerolf Hoflehner
f27ae6cdcf MergedLoadStoreMotion pass
Merges equivalent loads on both sides of a hammock/diamond
and hoists into into the header.
Merges equivalent stores on both sides of a hammock/diamond
and sinks it to the footer.
Can enable if conversion and tolerate better load misses
and store operand latencies.

llvm-svn: 213396
2014-07-18 19:13:09 +00:00
Alp Toker
171b0c36a3 Fix documentation typos
llvm-svn: 197757
2013-12-20 00:33:39 +00:00
Peter Zotov
7fc270a171 [OCaml] implement Llvm_passmgr_builder, bindings for PassManagerBuilder
llvm-svn: 193968
2013-11-04 01:39:42 +00:00
Peter Zotov
cbae39416f [OCaml] Implement Llvm_vectorize bindings
llvm-svn: 193950
2013-11-03 08:27:22 +00:00
Peter Zotov
3e0c21ed53 [OCaml] Llvm_scalar_opts: add missing transforms
llvm-svn: 193946
2013-11-03 07:54:17 +00:00