1//===- ReplaceWithVeclib.h - Replace vector intrinsics with veclib calls --===// 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// Replaces calls to LLVM vector intrinsics (i.e., calls to LLVM intrinsics 10// with vector operands) with matching calls to functions from a vector 11// library (e.g., libmvec, SVML) according to TargetLibraryInfo. 12// 13//===----------------------------------------------------------------------===// 14#ifndef LLVM_CODEGEN_REPLACEWITHVECLIB_H 15#define LLVM_CODEGEN_REPLACEWITHVECLIB_H 16 17#include "llvm/IR/PassManager.h" 18#include "llvm/InitializePasses.h" 19#include "llvm/Pass.h" 20#include "llvm/PassRegistry.h" 21 22namespace llvm { 23class Function; 24struct ReplaceWithVeclib : public PassInfoMixin<ReplaceWithVeclib> { 25 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 26}; 27 28// Legacy pass 29struct 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 38} // End namespace llvm 39#endif // LLVM_CODEGEN_REPLACEWITHVECLIB_H 40