diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt --- a/clang/docs/tools/clang-formatted-files.txt +++ b/clang/docs/tools/clang-formatted-files.txt @@ -5707,7 +5707,6 @@ llvm/include/llvm-c/Error.h llvm/include/llvm-c/ErrorHandling.h llvm/include/llvm-c/ExternC.h -llvm/include/llvm-c/Initialization.h llvm/include/llvm-c/IRReader.h llvm/include/llvm-c/LLJIT.h llvm/include/llvm-c/OrcEE.h diff --git a/llvm/bindings/python/llvm/core.py b/llvm/bindings/python/llvm/core.py --- a/llvm/bindings/python/llvm/core.py +++ b/llvm/bindings/python/llvm/core.py @@ -31,7 +31,6 @@ "BasicBlock", "Instruction", "Context", - "PassRegistry" ] lib = get_library() @@ -440,49 +439,11 @@ def GetGlobalContext(cls): return Context(lib.LLVMGetGlobalContext()) -class PassRegistry(LLVMObject): - """Represents an opaque pass registry object.""" - - def __init__(self): - LLVMObject.__init__(self, - lib.LLVMGetGlobalPassRegistry()) - def register_library(library): # Initialization/Shutdown declarations. - library.LLVMInitializeCore.argtypes = [PassRegistry] - library.LLVMInitializeCore.restype = None - - library.LLVMInitializeTransformUtils.argtypes = [PassRegistry] - library.LLVMInitializeTransformUtils.restype = None - - library.LLVMInitializeScalarOpts.argtypes = [PassRegistry] - library.LLVMInitializeScalarOpts.restype = None - - library.LLVMInitializeVectorization.argtypes = [PassRegistry] - library.LLVMInitializeVectorization.restype = None - - library.LLVMInitializeInstCombine.argtypes = [PassRegistry] - library.LLVMInitializeInstCombine.restype = None - - library.LLVMInitializeIPO.argtypes = [PassRegistry] - library.LLVMInitializeIPO.restype = None - - library.LLVMInitializeAnalysis.argtypes = [PassRegistry] - library.LLVMInitializeAnalysis.restype = None - - library.LLVMInitializeCodeGen.argtypes = [PassRegistry] - library.LLVMInitializeCodeGen.restype = None - - library.LLVMInitializeTarget.argtypes = [PassRegistry] - library.LLVMInitializeTarget.restype = None - library.LLVMShutdown.argtypes = [] library.LLVMShutdown.restype = None - # Pass Registry declarations. - library.LLVMGetGlobalPassRegistry.argtypes = [] - library.LLVMGetGlobalPassRegistry.restype = c_object_p - # Context declarations. library.LLVMContextCreate.argtypes = [] library.LLVMContextCreate.restype = c_object_p @@ -613,16 +574,6 @@ def initialize_llvm(): Context.GetGlobalContext() - p = PassRegistry() - lib.LLVMInitializeCore(p) - lib.LLVMInitializeTransformUtils(p) - lib.LLVMInitializeScalarOpts(p) - lib.LLVMInitializeVectorization(p) - lib.LLVMInitializeInstCombine(p) - lib.LLVMInitializeIPO(p) - lib.LLVMInitializeAnalysis(p) - lib.LLVMInitializeCodeGen(p) - lib.LLVMInitializeTarget(p) register_library(lib) Enums = register_enumerations() diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -191,6 +191,11 @@ have been removed. * Removed ``LLVMPassManagerBuilderRef`` and functions interacting with it. These belonged to the no longer supported legacy pass manager. +* Functions for initializing legacy passes like ``LLVMInitializeInstCombine`` + have been removed. Calls to such functions can simply be dropped, as they are + no longer necessary. +* ``LLVMPassRegistryRef`` and ``LLVMGetGlobalPassRegistry``, which were only + useful in conjunction with initialization functions, have been removed. * As part of the opaque pointer transition, ``LLVMGetElementType`` no longer gives the pointee type of a pointer type. * The following functions for creating constant expressions have been removed, diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -474,8 +474,6 @@ * @} */ -void LLVMInitializeCore(LLVMPassRegistryRef R); - /** Deallocate and destroy all ManagedStatic variables. @see llvm::llvm_shutdown @see ManagedStatic */ @@ -4158,21 +4156,6 @@ size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf); void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf); -/** - * @} - */ - -/** - * @defgroup LLVMCCorePassRegistry Pass Registry - * @ingroup LLVMCCore - * - * @{ - */ - -/** Return the global pass registry, for use with initialization functions. - @see llvm::PassRegistry::getPassRegistry */ -LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void); - /** * @} */ diff --git a/llvm/include/llvm-c/Initialization.h b/llvm/include/llvm-c/Initialization.h deleted file mode 100644 --- a/llvm/include/llvm-c/Initialization.h +++ /dev/null @@ -1,50 +0,0 @@ -/*===-- llvm-c/Initialization.h - Initialization C Interface ------*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares the C interface to LLVM initialization routines, *| -|* which must be called before you can use the functionality provided by *| -|* the corresponding LLVM library. *| -|* *| -\*===----------------------------------------------------------------------===*/ - -#ifndef LLVM_C_INITIALIZATION_H -#define LLVM_C_INITIALIZATION_H - -#include "llvm-c/ExternC.h" -#include "llvm-c/Types.h" - -LLVM_C_EXTERN_C_BEGIN - -/** - * @defgroup LLVMCInitialization Initialization Routines - * @ingroup LLVMC - * - * This module contains routines used to initialize the LLVM system. - * - * @{ - */ - -void LLVMInitializeCore(LLVMPassRegistryRef R); -void LLVMInitializeTransformUtils(LLVMPassRegistryRef R); -void LLVMInitializeScalarOpts(LLVMPassRegistryRef R); -void LLVMInitializeVectorization(LLVMPassRegistryRef R); -void LLVMInitializeInstCombine(LLVMPassRegistryRef R); -void LLVMInitializeIPO(LLVMPassRegistryRef R); -void LLVMInitializeAnalysis(LLVMPassRegistryRef R); -void LLVMInitializeIPA(LLVMPassRegistryRef R); -void LLVMInitializeCodeGen(LLVMPassRegistryRef R); -void LLVMInitializeTarget(LLVMPassRegistryRef R); - -/** - * @} - */ - -LLVM_C_EXTERN_C_END - -#endif diff --git a/llvm/include/llvm-c/Types.h b/llvm/include/llvm-c/Types.h --- a/llvm/include/llvm-c/Types.h +++ b/llvm/include/llvm-c/Types.h @@ -126,9 +126,6 @@ /** @see llvm::PassManagerBase */ typedef struct LLVMOpaquePassManager *LLVMPassManagerRef; -/** @see llvm::PassRegistry */ -typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef; - /** * Used to get the users and usees of a Value. * diff --git a/llvm/include/llvm/PassRegistry.h b/llvm/include/llvm/PassRegistry.h --- a/llvm/include/llvm/PassRegistry.h +++ b/llvm/include/llvm/PassRegistry.h @@ -19,7 +19,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/RWMutex.h" #include #include @@ -89,9 +88,6 @@ void removeRegistrationListener(PassRegistrationListener *L); }; -// Create wrappers for C Binding types (see CBindingWrapping.h). -DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassRegistry, LLVMPassRegistryRef) - } // end namespace llvm #endif // LLVM_PASSREGISTRY_H diff --git a/llvm/lib/Analysis/Analysis.cpp b/llvm/lib/Analysis/Analysis.cpp --- a/llvm/lib/Analysis/Analysis.cpp +++ b/llvm/lib/Analysis/Analysis.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "llvm-c/Analysis.h" -#include "llvm-c/Initialization.h" #include "llvm/IR/Module.h" #include "llvm/IR/Verifier.h" #include "llvm/InitializePasses.h" @@ -85,14 +84,6 @@ initializeMemorySSAPrinterLegacyPassPass(Registry); } -void LLVMInitializeAnalysis(LLVMPassRegistryRef R) { - initializeAnalysis(*unwrap(R)); -} - -void LLVMInitializeIPA(LLVMPassRegistryRef R) { - initializeAnalysis(*unwrap(R)); -} - LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action, char **OutMessages) { raw_ostream *DebugOS = Action != LLVMReturnStatusAction ? &errs() : nullptr; diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp --- a/llvm/lib/CodeGen/CodeGen.cpp +++ b/llvm/lib/CodeGen/CodeGen.cpp @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm-c/Initialization.h" #include "llvm/InitializePasses.h" #include "llvm/PassRegistry.h" @@ -141,7 +140,3 @@ initializeWinEHPreparePass(Registry); initializeXRayInstrumentationPass(Registry); } - -void LLVMInitializeCodeGen(LLVMPassRegistryRef R) { - initializeCodeGen(*unwrap(R)); -} diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -53,10 +53,6 @@ initializeVerifierLegacyPassPass(Registry); } -void LLVMInitializeCore(LLVMPassRegistryRef R) { - initializeCore(*unwrap(R)); -} - void LLVMShutdown() { llvm_shutdown(); } @@ -4071,12 +4067,6 @@ delete unwrap(MemBuf); } -/*===-- Pass Registry -----------------------------------------------------===*/ - -LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void) { - return wrap(PassRegistry::getPassRegistry()); -} - /*===-- Pass Manager ------------------------------------------------------===*/ LLVMPassManagerRef LLVMCreatePassManager() { diff --git a/llvm/lib/Target/Target.cpp b/llvm/lib/Target/Target.cpp --- a/llvm/lib/Target/Target.cpp +++ b/llvm/lib/Target/Target.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm-c/Target.h" -#include "llvm-c/Initialization.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/LLVMContext.h" @@ -40,10 +39,6 @@ initializeTargetTransformInfoWrapperPassPass(Registry); } -void LLVMInitializeTarget(LLVMPassRegistryRef R) { - initializeTarget(*unwrap(R)); -} - LLVMTargetDataRef LLVMGetModuleDataLayout(LLVMModuleRef M) { return wrap(&unwrap(M)->getDataLayout()); } diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp --- a/llvm/lib/Transforms/IPO/IPO.cpp +++ b/llvm/lib/Transforms/IPO/IPO.cpp @@ -12,7 +12,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm-c/Initialization.h" #include "llvm/InitializePasses.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO/AlwaysInliner.h" @@ -28,7 +27,3 @@ initializeSingleLoopExtractorPass(Registry); initializeBarrierNoopPass(Registry); } - -void LLVMInitializeIPO(LLVMPassRegistryRef R) { - initializeIPO(*unwrap(R)); -} diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -33,7 +33,6 @@ //===----------------------------------------------------------------------===// #include "InstCombineInternal.h" -#include "llvm-c/Initialization.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" @@ -4401,10 +4400,6 @@ initializeInstructionCombiningPassPass(Registry); } -void LLVMInitializeInstCombine(LLVMPassRegistryRef R) { - initializeInstructionCombiningPassPass(*unwrap(R)); -} - FunctionPass *llvm::createInstructionCombiningPass() { return new InstructionCombiningPass(); } diff --git a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp --- a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp @@ -12,11 +12,8 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Instrumentation.h" -#include "llvm-c/Initialization.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" -#include "llvm/InitializePasses.h" -#include "llvm/PassRegistry.h" #include "llvm/TargetParser/Triple.h" using namespace llvm; diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp --- a/llvm/lib/Transforms/Scalar/Scalar.cpp +++ b/llvm/lib/Transforms/Scalar/Scalar.cpp @@ -13,7 +13,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar.h" -#include "llvm-c/Initialization.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/ScopedNoAliasAA.h" #include "llvm/Analysis/TypeBasedAliasAnalysis.h" @@ -83,7 +82,3 @@ initializePlaceSafepointsLegacyPassPass(Registry); initializeLoopSimplifyCFGLegacyPassPass(Registry); } - -void LLVMInitializeScalarOpts(LLVMPassRegistryRef R) { - initializeScalarOpts(*unwrap(R)); -} diff --git a/llvm/lib/Transforms/Utils/Utils.cpp b/llvm/lib/Transforms/Utils/Utils.cpp --- a/llvm/lib/Transforms/Utils/Utils.cpp +++ b/llvm/lib/Transforms/Utils/Utils.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils.h" -#include "llvm-c/Initialization.h" #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/PassRegistry.h" @@ -42,8 +41,3 @@ initializeFixIrreduciblePass(Registry); initializeUnifyLoopExitsLegacyPassPass(Registry); } - -/// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses. -void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) { - initializeTransformUtils(*unwrap(R)); -} diff --git a/llvm/lib/Transforms/Vectorize/Vectorize.cpp b/llvm/lib/Transforms/Vectorize/Vectorize.cpp --- a/llvm/lib/Transforms/Vectorize/Vectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/Vectorize.cpp @@ -13,7 +13,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Vectorize.h" -#include "llvm-c/Initialization.h" #include "llvm/InitializePasses.h" #include "llvm/PassRegistry.h" @@ -23,7 +22,3 @@ void llvm::initializeVectorization(PassRegistry &Registry) { initializeLoadStoreVectorizerLegacyPassPass(Registry); } - -void LLVMInitializeVectorization(LLVMPassRegistryRef R) { - initializeVectorization(*unwrap(R)); -} diff --git a/llvm/tools/llvm-c-test/include-all.c b/llvm/tools/llvm-c-test/include-all.c --- a/llvm/tools/llvm-c-test/include-all.c +++ b/llvm/tools/llvm-c-test/include-all.c @@ -26,7 +26,6 @@ #include "llvm-c/Error.h" #include "llvm-c/ErrorHandling.h" #include "llvm-c/ExecutionEngine.h" -#include "llvm-c/Initialization.h" #include "llvm-c/IRReader.h" #include "llvm-c/Linker.h" #include "llvm-c/Object.h" diff --git a/llvm/tools/llvm-c-test/main.c b/llvm/tools/llvm-c-test/main.c --- a/llvm/tools/llvm-c-test/main.c +++ b/llvm/tools/llvm-c-test/main.c @@ -68,10 +68,6 @@ } int main(int argc, char **argv) { - LLVMPassRegistryRef pr = LLVMGetGlobalPassRegistry(); - - LLVMInitializeCore(pr); - if (argc == 2 && !strcmp(argv[1], "--lazy-new-module-dump")) { return llvm_module_dump(true, true); } else if (argc == 2 && !strcmp(argv[1], "--new-module-dump")) {