//===-- TargetLibraryInfo.h - Library information ---------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_TARGETLIBRARYINFO_H #define LLVM_ANALYSIS_TARGETLIBRARYINFO_H #include "llvm/ADT/DenseMap.h" #include "llvm/IR/InstrTypes.h" #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" #include "llvm/TargetParser/Triple.h" #include <bitset> #include <optional> namespace llvm { template <typename T> class ArrayRef; /// Provides info so a possible vectorization of a function can be /// computed. Function 'VectorFnName' is equivalent to 'ScalarFnName' /// vectorized by a factor 'VectorizationFactor'. /// The VABIPrefix string holds information about isa, mask, vlen, /// and vparams so a scalar-to-vector mapping of the form: /// _ZGV<isa><mask><vlen><vparams>_<scalarname>(<vectorname>) /// can be constructed where: /// /// <isa> = "_LLVM_" /// <mask> = "M" if masked, "N" if no mask. /// <vlen> = Number of concurrent lanes, stored in the `VectorizationFactor` /// field of the `VecDesc` struct. If the number of lanes is scalable /// then 'x' is printed instead. /// <vparams> = "v", as many as are the numArgs. /// <scalarname> = the name of the scalar function. /// <vectorname> = the name of the vector function. class VecDesc { … }; enum LibFunc : unsigned { … }; /// Implementation of the target library information. /// /// This class constructs tables that hold the target library information and /// make it available. However, it is somewhat expensive to compute and only /// depends on the triple. So users typically interact with the \c /// TargetLibraryInfo wrapper below. class TargetLibraryInfoImpl { … }; /// Provides information about what library functions are available for /// the current target. /// /// This both allows optimizations to handle them specially and frontends to /// disable such optimizations through -fno-builtin etc. class TargetLibraryInfo { … }; /// Analysis pass providing the \c TargetLibraryInfo. /// /// Note that this pass's result cannot be invalidated, it is immutable for the /// life of the module. class TargetLibraryAnalysis : public AnalysisInfoMixin<TargetLibraryAnalysis> { … }; class TargetLibraryInfoWrapperPass : public ImmutablePass { … }; } // end namespace llvm #endif