Utils.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //===-- Utils.cpp - TransformUtils Infrastructure -------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines the common initialization infrastructure for the
  10. // TransformUtils library.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "llvm/Transforms/Utils.h"
  14. #include "llvm-c/Initialization.h"
  15. #include "llvm-c/Transforms/Utils.h"
  16. #include "llvm/IR/LegacyPassManager.h"
  17. #include "llvm/InitializePasses.h"
  18. #include "llvm/Pass.h"
  19. #include "llvm/PassRegistry.h"
  20. using namespace llvm;
  21. /// initializeTransformUtils - Initialize all passes in the TransformUtils
  22. /// library.
  23. void llvm::initializeTransformUtils(PassRegistry &Registry) {
  24. initializeAddDiscriminatorsLegacyPassPass(Registry);
  25. initializeAssumeSimplifyPassLegacyPassPass(Registry);
  26. initializeAssumeBuilderPassLegacyPassPass(Registry);
  27. initializeBreakCriticalEdgesPass(Registry);
  28. initializeCanonicalizeFreezeInLoopsPass(Registry);
  29. initializeInstNamerPass(Registry);
  30. initializeLCSSAWrapperPassPass(Registry);
  31. initializeLibCallsShrinkWrapLegacyPassPass(Registry);
  32. initializeLoopSimplifyPass(Registry);
  33. initializeLowerGlobalDtorsLegacyPassPass(Registry);
  34. initializeLowerInvokeLegacyPassPass(Registry);
  35. initializeLowerSwitchLegacyPassPass(Registry);
  36. initializePromoteLegacyPassPass(Registry);
  37. initializeStripNonLineTableDebugLegacyPassPass(Registry);
  38. initializeUnifyFunctionExitNodesLegacyPassPass(Registry);
  39. initializeMetaRenamerPass(Registry);
  40. initializeStripGCRelocatesLegacyPass(Registry);
  41. initializePredicateInfoPrinterLegacyPassPass(Registry);
  42. initializeInjectTLIMappingsLegacyPass(Registry);
  43. initializeFixIrreduciblePass(Registry);
  44. initializeUnifyLoopExitsLegacyPassPass(Registry);
  45. }
  46. /// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses.
  47. void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) {
  48. initializeTransformUtils(*unwrap(R));
  49. }
  50. void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM) {
  51. unwrap(PM)->add(createLowerSwitchPass());
  52. }
  53. void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
  54. unwrap(PM)->add(createPromoteMemoryToRegisterPass());
  55. }
  56. void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM) {
  57. unwrap(PM)->add(createAddDiscriminatorsPass());
  58. }