ReplaceWithVeclib.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 intrinsics 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. #include "llvm/PassRegistry.h"
  25. namespace llvm {
  26. class Function;
  27. struct ReplaceWithVeclib : public PassInfoMixin<ReplaceWithVeclib> {
  28. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  29. };
  30. // Legacy pass
  31. struct ReplaceWithVeclibLegacy : public FunctionPass {
  32. static char ID;
  33. ReplaceWithVeclibLegacy() : FunctionPass(ID) {
  34. initializeReplaceWithVeclibLegacyPass(*PassRegistry::getPassRegistry());
  35. }
  36. void getAnalysisUsage(AnalysisUsage &AU) const override;
  37. bool runOnFunction(Function &F) override;
  38. };
  39. } // End namespace llvm
  40. #endif // LLVM_CODEGEN_REPLACEWITHVECLIB_H
  41. #ifdef __GNUC__
  42. #pragma GCC diagnostic pop
  43. #endif