ReplaceWithVeclib.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- ReplaceWithVeclib.h - Replace vector instrinsics with veclib calls -===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // Replaces calls to LLVM vector intrinsics (i.e., calls to LLVM intrinsics
  15. // with vector operands) with matching calls to functions from a vector
  16. // library (e.g., libmvec, SVML) according to TargetLibraryInfo.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_CODEGEN_REPLACEWITHVECLIB_H
  20. #define LLVM_CODEGEN_REPLACEWITHVECLIB_H
  21. #include "llvm/IR/PassManager.h"
  22. #include "llvm/InitializePasses.h"
  23. #include "llvm/Pass.h"
  24. namespace llvm {
  25. struct ReplaceWithVeclib : public PassInfoMixin<ReplaceWithVeclib> {
  26. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  27. };
  28. // Legacy pass
  29. struct ReplaceWithVeclibLegacy : public FunctionPass {
  30. static char ID;
  31. ReplaceWithVeclibLegacy() : FunctionPass(ID) {
  32. initializeReplaceWithVeclibLegacyPass(*PassRegistry::getPassRegistry());
  33. }
  34. void getAnalysisUsage(AnalysisUsage &AU) const override;
  35. bool runOnFunction(Function &F) override;
  36. };
  37. } // End namespace llvm
  38. #endif // LLVM_CODEGEN_REPLACEWITHVECLIB_H
  39. #ifdef __GNUC__
  40. #pragma GCC diagnostic pop
  41. #endif