Index: clang/docs/tools/clang-formatted-files.txt =================================================================== --- clang/docs/tools/clang-formatted-files.txt +++ clang/docs/tools/clang-formatted-files.txt @@ -5706,7 +5706,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 Index: llvm/bindings/python/llvm/core.py =================================================================== --- llvm/bindings/python/llvm/core.py +++ 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() Index: llvm/include/llvm-c/Core.h =================================================================== --- llvm/include/llvm-c/Core.h +++ 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 */ @@ -4163,21 +4161,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); - /** * @} */ Index: llvm/include/llvm-c/Initialization.h =================================================================== --- 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 Index: llvm/include/llvm-c/Types.h =================================================================== --- llvm/include/llvm-c/Types.h +++ 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. * Index: llvm/include/llvm/PassRegistry.h =================================================================== --- llvm/include/llvm/PassRegistry.h +++ 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 Index: llvm/lib/Analysis/Analysis.cpp =================================================================== --- llvm/lib/Analysis/Analysis.cpp +++ 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; Index: llvm/lib/CodeGen/CodeGen.cpp =================================================================== --- llvm/lib/CodeGen/CodeGen.cpp +++ 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)); -} Index: llvm/lib/IR/Core.cpp =================================================================== --- llvm/lib/IR/Core.cpp +++ llvm/lib/IR/Core.cpp @@ -53,10 +53,6 @@ initializeVerifierLegacyPassPass(Registry); } -void LLVMInitializeCore(LLVMPassRegistryRef R) { - initializeCore(*unwrap(R)); -} - void LLVMShutdown() { llvm_shutdown(); } @@ -4081,12 +4077,6 @@ delete unwrap(MemBuf); } -/*===-- Pass Registry -----------------------------------------------------===*/ - -LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void) { - return wrap(PassRegistry::getPassRegistry()); -} - /*===-- Pass Manager ------------------------------------------------------===*/ LLVMPassManagerRef LLVMCreatePassManager() { Index: llvm/lib/Target/Target.cpp =================================================================== --- llvm/lib/Target/Target.cpp +++ 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()); } Index: llvm/lib/Transforms/IPO/IPO.cpp =================================================================== --- llvm/lib/Transforms/IPO/IPO.cpp +++ llvm/lib/Transforms/IPO/IPO.cpp @@ -12,7 +12,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm-c/Initialization.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/InitializePasses.h" #include "llvm/Transforms/IPO.h" @@ -29,7 +28,3 @@ initializeSingleLoopExtractorPass(Registry); initializeBarrierNoopPass(Registry); } - -void LLVMInitializeIPO(LLVMPassRegistryRef R) { - initializeIPO(*unwrap(R)); -} Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp =================================================================== --- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ 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" @@ -4748,10 +4747,6 @@ initializeInstructionCombiningPassPass(Registry); } -void LLVMInitializeInstCombine(LLVMPassRegistryRef R) { - initializeInstructionCombiningPassPass(*unwrap(R)); -} - FunctionPass *llvm::createInstructionCombiningPass() { return new InstructionCombiningPass(); } Index: llvm/lib/Transforms/Instrumentation/Instrumentation.cpp =================================================================== --- llvm/lib/Transforms/Instrumentation/Instrumentation.cpp +++ 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; Index: llvm/lib/Transforms/Scalar/Scalar.cpp =================================================================== --- llvm/lib/Transforms/Scalar/Scalar.cpp +++ 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" @@ -96,7 +95,3 @@ initializeFloat2IntLegacyPassPass(Registry); initializeLoopSimplifyCFGLegacyPassPass(Registry); } - -void LLVMInitializeScalarOpts(LLVMPassRegistryRef R) { - initializeScalarOpts(*unwrap(R)); -} Index: llvm/lib/Transforms/Utils/Utils.cpp =================================================================== --- llvm/lib/Transforms/Utils/Utils.cpp +++ llvm/lib/Transforms/Utils/Utils.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils.h" -#include "llvm-c/Initialization.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/InitializePasses.h" #include "llvm/Pass.h" @@ -44,8 +43,3 @@ initializeFixIrreduciblePass(Registry); initializeUnifyLoopExitsLegacyPassPass(Registry); } - -/// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses. -void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) { - initializeTransformUtils(*unwrap(R)); -} Index: llvm/lib/Transforms/Vectorize/Vectorize.cpp =================================================================== --- llvm/lib/Transforms/Vectorize/Vectorize.cpp +++ llvm/lib/Transforms/Vectorize/Vectorize.cpp @@ -13,7 +13,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Vectorize.h" -#include "llvm-c/Initialization.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/InitializePasses.h" #include "llvm/PassRegistry.h" @@ -26,7 +25,3 @@ initializeSLPVectorizerPass(Registry); initializeLoadStoreVectorizerLegacyPassPass(Registry); } - -void LLVMInitializeVectorization(LLVMPassRegistryRef R) { - initializeVectorization(*unwrap(R)); -} Index: llvm/tools/llvm-c-test/include-all.c =================================================================== --- llvm/tools/llvm-c-test/include-all.c +++ 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" Index: llvm/tools/llvm-c-test/main.c =================================================================== --- llvm/tools/llvm-c-test/main.c +++ 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")) {