aboutsummaryrefslogtreecommitdiff
path: root/llvm/include/llvm-c/Transforms
AgeCommit message (Collapse)AuthorFilesLines
2025-07-08[llvm] annotate interfaces in llvm-c for DLL export (#141701)Andrew Rogers1-32/+45
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm-c` interface with a new `LLVM_C_ABI` annotation, which behaves like the `LLVM_ABI`. This annotation currently has no meaningful impact on the LLVM build; however, it is a prerequisite to support an LLVM Windows DLL (shared library) build. ## Overview 1. Add a new `llvm-c/Visibility.h` header file that defines a new `LLVM_C_ABI` macro. The macro resolves to the proper DLL export/import annotation on Windows and a "default" visibility annotation elsewhere. 2. Add a new `LLVM_ENABLE_LLVM_C_EXPORT_ANNOTATIONS` `#cmakedefine` that is used to gate the definition of `LLVM_C_ABI`. 3. Remove the existing `LLVM_C_ABI` definition from `llvm/Support/Compiler.h`. Update the small number of `LLVM_C_ABI` references to get it from the new `llvm-c/Visibility.h` header. 4. Code-mod annotate the public `llvm-c` interface using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool. 5. Format the changes with `clang-format`. ## Background This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). ## Validation Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: - Windows with MSVC - Windows with Clang - Linux with GCC - Linux with Clang - Darwin with Clang
2024-08-19[LLVM][NewPM] Add C API for running the pipeline on a single function. (#103773)Tim Besard1-0/+10
By adding a new entrypoint, `LLVMRunPassesOnFunction`, as suggested in https://discourse.llvm.org/t/newpm-c-api-questions/80598. Also removes erroneous `LLVMConsumeError`s from the pass builder unit tests as the string conversion already consumes the error, causing an abort when the test would fail.
2024-08-14[LLVM][NewPM] Add a C API for setting the PassBuilder AA pipeline. (#102482)Tim Besard1-0/+8
This PR adds a field to the pass builder options struct, `AAPipeline`, exposed through a C API `LLVMPassBuilderOptionsSetAAPipeline`, that is used to set an alias analysis pipeline to be used in stead of the default one. x-ref https://discourse.llvm.org/t/newpm-c-api-questions/80598
2023-06-01Allow configuring InlinerThreshold in C bindings for the new pass managerDmitry Dolgov1-0/+3
C bindings for the new pass manager seem to allow to set any option from LLVMPassBuilderOptions, except InlinerThreshold. Allow to configure it as well. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D151832
2023-03-09[llvm-c] Remove PassManagerBuilder APIsNikita Popov1-81/+0
The legacy PM is only supported for codegen, and PassManagerBuilder is exclusively about the middle-end optimization pipeline. Drop it. Differential Revision: https://reviews.llvm.org/D145387
2023-03-02[llvm-c] Remove bindings for creating legacy passesNikita Popov5-334/+0
Legacy passes are only supported for codegen, and I don't believe it's possible to write backends using the C API, so we should drop all of those. Reduces the number of places that need to be modified when removing legacy passes. Differential Revision: https://reviews.llvm.org/D144970
2023-02-27[IPO] Remove various legacy passesArthur Eubanks1-6/+0
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated and being removed.
2023-02-24Recommit "[SCCP] Remove legacy SCCP pass."Florian Hahn1-3/+0
This reverts commit a9a1950115d7db95c7439128b14af2cefe8f796d. 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-19[LoopIdiomRecognize] Remove legacy passFangrui Song1-3/+0
Following recent changes to remove non-core legacy passes.
2023-02-18Revert "[SCCP] Remove legacy SCCP pass."Florian Hahn1-0/+3
This reverts commit 5356fefc19df3fbf32d180b1b10e6226e8743541. It looks like Polly still relies on the legacy SCCP pass. Bring it back until the best way forward is determined.
2023-02-18[SCCP] Remove legacy SCCP pass.Florian Hahn1-3/+0
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-15[LoopDeletion] Remove legacy passFangrui Song1-3/+0
Following recent changes to remove non-core legacy passes.
2023-02-15[LoopReroll] Remove legacy pass (unused in the pipeline)Fangrui Song1-3/+0
Following recent changes to remove non-core legacy passes.
2023-02-14[LoopUnrollAndJam] Remove legacy passFangrui Song1-3/+0
Following recent changes to remove non-core features of the legacy PM/optimization pipeline.
2023-02-14[IPSCCP] Remove legacy passArthur Eubanks1-3/+0
This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-14[GlobalOpt] Remove legacy passArthur Eubanks1-3/+0
This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-09[Inliner] Remove legacy simple inlinerArthur Eubanks1-3/+0
It's part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-07Reland [LegacyPM] Remove some legacy passesArthur Eubanks1-24/+0
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-07Revert "[LegacyPM] Remove some legacy passes"Arthur Eubanks1-0/+24
This reverts commit a4b4f62beb0bf40123181e5f5bdf32ef54f87166. Ocaml bindings tests failing.
2023-02-07[LegacyPM] Remove some legacy passesArthur Eubanks1-24/+0
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-06[IPO] Remove some legacy passesArthur Eubanks1-3/+0
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-06[MergeFunctions] Remove legacy passArthur Eubanks1-3/+0
It's part of the optimization pipeline, which the legacy pass manager version is deprecated.
2022-11-15[AggressiveInstCombine] Remove legacy PM passArthur Eubanks1-40/+0
As part of legacy PM optimization pipeline removal. This shouldn't be used in codegen pipelines so it should be ok to remove. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D137116
2022-09-26[NFC][2/n] Remove PrunePH passSebastian Peryt1-3/+0
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-06-27[ArgPromotion] Remove legacy PM supportNikita Popov1-3/+0
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-04-29[Passes] Remove legacy LoopUnswitch pass.Florian Hahn1-3/+0
The legacy LoopUnswitch pass is only used in the legacy pass manager pipeline, which is deprecated. The NewPM replacement is SimpleLoopUnswitch and I think it is time to remove the legacy LoopUnswitch code. Fixes #31000. Reviewed By: aeubanks, Meinersbur, asbirlea Differential Revision: https://reviews.llvm.org/D124376
2022-04-21[Pipelines] Remove Legacy Passes in CoroutinesChuanqi Xu1-56/+0
The legacy passes are deprecated now and would be removed in near future. This patch tries to remove legacy passes in coroutines. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D123918
2022-04-18[LegacyPM] Remove ThinLTO/LTO pipelinesArthur Eubanks1-6/+0
Using the legacy PM for the optimization pipeline was deprecated in 13.0.0. Following recent changes to remove non-core features of the legacy PM/optimization pipeline, remove the (Thin)LTO pipelines. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D123882
2021-11-07[NFC][Docs] Add missing Doxygen group comments for LLVM-CMats Larsen1-0/+11
The LLVM-C API is relatively small so we've previously added doxygen tags so it's easier to navigate the LLVM-C web docs. Over the years, more headers were added without proper doxygen tags, effectively hiding them from the main LLVM-C doxygen page. This patch adds comments to headers which did not have them. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D112474
2021-08-24Fix compilation errors in C API when using C compilerBen Langmuir1-1/+1
* Cannot use sizeof() on another union member * nullptr vs NULL * () vs (void) Incidentally, fix an incorrect comment about memory ownership on the argument to __orc_rt_CreateCWrapperFunctionResultFromOutOfBandError, which is copied, not moved.
2021-07-15[Coroutines] Run coroutine passes by defaultChuanqi Xu1-3/+0
This patch make coroutine passes run by default in LLVM pipeline. Now the clang and opt could handle IR inputs containing coroutine intrinsics without special options. It should be fine. On the one hand, the coroutine passes seems to be stable since there are already many projects using coroutine feature. On the other hand, the coroutine passes should do nothing for IR who doesn't contain coroutine intrinsic. Test Plan: check-llvm Reviewed by: lxfind, aeubanks Differential Revision: https://reviews.llvm.org/D105877
2021-05-17[NewPM] Add C bindings for new pass managerMats Larsen1-0/+105
This patch contains the bare minimum to run the new Pass Manager from the LLVM-C APIs. It does not feature PGOOptions, PassPlugins or Debugify in its current state. Bugzilla: PR48499 Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D102136
2021-05-17Revert "[NewPM] Add C bindings for new pass manager"Nico Weber1-105/+0
This reverts commit cd220a06782c3da13a53de2fdf10d928eef6460c. Doesn't build.
2021-05-17[NewPM] Add C bindings for new pass managerMats Larsen1-0/+105
This patch contains the bare minimum to run the new Pass Manager from the LLVM-C APIs. It does not feature PGOOptions, PassPlugins or Debugify in its current state. Bugzilla: PR48499 Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D102136
2020-09-01[Bindings] Add LLVMAddInstructionSimplifyPassArthur Eubanks1-0/+3
Reviewed By: sroland Differential Revision: https://reviews.llvm.org/D86764
2020-08-26[ConstProp] Remove ConstantPropagationArthur Eubanks1-3/+0
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-02Recommit "[IPConstProp] Remove and move tests to SCCP."Florian Hahn1-3/+0
This reverts commit 59d6e814ce0e7b40b7cc3ab136b9af2ffab9c6f8. The cause for the revert (3 clang tests running opt -ipconstprop) was fixed by removing those lines.
2020-07-30Revert "[IPConstProp] Remove and move tests to SCCP."Florian Hahn1-0/+3
This reverts commit e77624a3be942c7abba48942b3a8da3462070a3f. Looks like some clang tests manually invoke -ipconstprop via opt.....
2020-07-30[IPConstProp] Remove and move tests to SCCP.Florian Hahn1-3/+0
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-02-24[LLVM-C] Add bindings for addCoroutinePassesToExtensionPointsAyke van Laethem1-0/+4
This patch adds bindings to C and Go for addCoroutinePassesToExtensionPoints, which is used to add coroutine passes to the correct locations in PassManagerBuilder. Differential Revision: https://reviews.llvm.org/D51642
2020-01-01[Coroutines] Rename "legacy" passes (NFC)Brian Gesiak1-4/+4
A series of patches beginning with https://reviews.llvm.org/D71898 propose to add an implementation of the coroutine passes to the new pass manager. As part of these changes, the coroutine passes that implement the legacy pass manager interface are renamed, to `<PassName>Legacy`. This mirrors similar changes that have been made to many other passes in LLVM as they've been transitioned to support both old and new pass managers. This commit splits out the renaming portion of that patch and commits it in advance as an NFC (no functional change intended) commit. It renames: * `CoroEarly` => `CoroEarlyLegacy` * `CoroSplit` => `CoroSplitLegacy` * `CoroElide` => `CoroElideLegacy` * `CoroCleanup` => `CoroCleanupLegacy`
2019-11-19Wrap C APIs with pragmas enforcing -Werror=strict-prototypesDuncan P. N. Exon Smith8-48/+24
Force `-Werror=strict-prototypes` so that C API tests fail to compile if we add a non-prototype declaration. This should help avoid regressions like bddecba4b333f7772029b4937d2c34f9f2fda6ca was fixing. https://reviews.llvm.org/D70285 rdar://problem/57203137
2019-10-14Reapply r374743 with a fix for the ocaml bindingJoerg Sonnenberger1-0/+3
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-14Revert "Add a pass to lower is.constant and objectsize intrinsics"Dmitri Gribenko1-3/+0
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-13Add a pass to lower is.constant and objectsize intrinsicsJoerg Sonnenberger1-0/+3
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-09-29[LLVM-C][Ocaml] Add MergeFunctions and DCE passAditya Kumar2-0/+6
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-07-23[LLVM-C] Improve Bindings to The Internalize PassRobert Widmann1-0/+15
Summary: Adds a binding to the internalize pass that allows the caller to pass a function pointer that acts as the visibility-preservation predicate. Previously, one could only pass an unsigned value (not LLVMBool?) that directed the pass to consider "main" or not. Reviewers: whitequark, deadalnix, harlanhaskins Reviewed By: whitequark, harlanhaskins Subscribers: kren1, hiraditya, llvm-commits, harlanhaskins Tags: #llvm Differential Revision: https://reviews.llvm.org/D62456 llvm-svn: 366777
2019-03-15[LLVM-C] Expose the "Add Discriminators" Pass To LLVM-CRobert Widmann1-0/+3
Summary: Add bindings to create a wrapped "Add Discriminators" pass. Now that we have debug info support, this is a handy transform to have. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: dblaikie, aprantl, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58624 llvm-svn: 356272
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth8-32/+32
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
2018-09-28Revert "[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints"whitequark1-3/+0
This reverts commit c4baf7c2f06ff5459c4f5998ce980346e72bff97. Broke the bots, and should really be in Transforms/Coroutines instead. llvm-svn: 343337