Vectorize.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //===-- Vectorize.cpp -----------------------------------------------------===//
  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 implements common infrastructure for libLLVMVectorizeOpts.a, which
  10. // implements several vectorization transformations over the LLVM intermediate
  11. // representation, including the C bindings for that library.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #include "llvm/Transforms/Vectorize.h"
  15. #include "llvm-c/Initialization.h"
  16. #include "llvm-c/Transforms/Vectorize.h"
  17. #include "llvm/Analysis/Passes.h"
  18. #include "llvm/IR/LegacyPassManager.h"
  19. #include "llvm/InitializePasses.h"
  20. #include "llvm/PassRegistry.h"
  21. using namespace llvm;
  22. /// Initialize all passes linked into the Vectorization library.
  23. void llvm::initializeVectorization(PassRegistry &Registry) {
  24. initializeLoopVectorizePass(Registry);
  25. initializeSLPVectorizerPass(Registry);
  26. initializeLoadStoreVectorizerLegacyPassPass(Registry);
  27. initializeVectorCombineLegacyPassPass(Registry);
  28. }
  29. void LLVMInitializeVectorization(LLVMPassRegistryRef R) {
  30. initializeVectorization(*unwrap(R));
  31. }
  32. void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM) {
  33. unwrap(PM)->add(createLoopVectorizePass());
  34. }
  35. void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM) {
  36. unwrap(PM)->add(createSLPVectorizerPass());
  37. }