LLVM  14.0.0git
TargetLibraryInfo.h
Go to the documentation of this file.
1 //===-- TargetLibraryInfo.h - Library information ---------------*- C++ -*-===//
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 #ifndef LLVM_ANALYSIS_TARGETLIBRARYINFO_H
10 #define LLVM_ANALYSIS_TARGETLIBRARYINFO_H
11 
12 #include "llvm/ADT/BitVector.h"
13 #include "llvm/ADT/DenseMap.h"
14 #include "llvm/ADT/Optional.h"
15 #include "llvm/IR/Function.h"
16 #include "llvm/IR/InstrTypes.h"
17 #include "llvm/IR/Module.h"
18 #include "llvm/IR/PassManager.h"
19 #include "llvm/Pass.h"
20 
21 namespace llvm {
22 template <typename T> class ArrayRef;
23 class Triple;
24 
25 /// Describes a possible vectorization of a function.
26 /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized
27 /// by a factor 'VectorizationFactor'.
28 struct VecDesc {
32 };
33 
34  enum LibFunc : unsigned {
35 #define TLI_DEFINE_ENUM
36 #include "llvm/Analysis/TargetLibraryInfo.def"
37 
40  };
41 
42 /// Implementation of the target library information.
43 ///
44 /// This class constructs tables that hold the target library information and
45 /// make it available. However, it is somewhat expensive to compute and only
46 /// depends on the triple. So users typically interact with the \c
47 /// TargetLibraryInfo wrapper below.
49  friend class TargetLibraryInfo;
50 
51  unsigned char AvailableArray[(NumLibFuncs+3)/4];
53  static StringLiteral const StandardNames[NumLibFuncs];
54  bool ShouldExtI32Param, ShouldExtI32Return, ShouldSignExtI32Param;
55  unsigned SizeOfInt;
56 
57  enum AvailabilityState {
58  StandardName = 3, // (memset to all ones)
59  CustomName = 1,
60  Unavailable = 0 // (memset to all zeros)
61  };
62  void setState(LibFunc F, AvailabilityState State) {
63  AvailableArray[F/4] &= ~(3 << 2*(F&3));
64  AvailableArray[F/4] |= State << 2*(F&3);
65  }
66  AvailabilityState getState(LibFunc F) const {
67  return static_cast<AvailabilityState>((AvailableArray[F/4] >> 2*(F&3)) & 3);
68  }
69 
70  /// Vectorization descriptors - sorted by ScalarFnName.
71  std::vector<VecDesc> VectorDescs;
72  /// Scalarization descriptors - same content as VectorDescs but sorted based
73  /// on VectorFnName rather than ScalarFnName.
74  std::vector<VecDesc> ScalarDescs;
75 
76  /// Return true if the function type FTy is valid for the library function
77  /// F, regardless of whether the function is available.
78  bool isValidProtoForLibFunc(const FunctionType &FTy, LibFunc F,
79  const Module &M) const;
80 
81 public:
82  /// List of known vector-functions libraries.
83  ///
84  /// The vector-functions library defines, which functions are vectorizable
85  /// and with which factor. The library can be specified by either frontend,
86  /// or a commandline option, and then used by
87  /// addVectorizableFunctionsFromVecLib for filling up the tables of
88  /// vectorizable functions.
90  NoLibrary, // Don't use any vector library.
91  Accelerate, // Use Accelerate framework.
92  DarwinLibSystemM, // Use Darwin's libsystem_m.
93  LIBMVEC_X86, // GLIBC Vector Math library.
94  MASSV, // IBM MASS vector library.
95  SVML // Intel short vector math library.
96  };
97 
99  explicit TargetLibraryInfoImpl(const Triple &T);
100 
101  // Provide value semantics.
106 
107  /// Searches for a particular function name.
108  ///
109  /// If it is one of the known library functions, return true and set F to the
110  /// corresponding value.
111  bool getLibFunc(StringRef funcName, LibFunc &F) const;
112 
113  /// Searches for a particular function name, also checking that its type is
114  /// valid for the library function matching that name.
115  ///
116  /// If it is one of the known library functions, return true and set F to the
117  /// corresponding value.
118  ///
119  /// FDecl is assumed to have a parent Module when using this function.
120  bool getLibFunc(const Function &FDecl, LibFunc &F) const;
121 
122  /// Forces a function to be marked as unavailable.
124  setState(F, Unavailable);
125  }
126 
127  /// Forces a function to be marked as available.
129  setState(F, StandardName);
130  }
131 
132  /// Forces a function to be marked as available and provide an alternate name
133  /// that must be used.
135  if (StandardNames[F] != Name) {
136  setState(F, CustomName);
137  CustomNames[F] = std::string(Name);
138  assert(CustomNames.find(F) != CustomNames.end());
139  } else {
140  setState(F, StandardName);
141  }
142  }
143 
144  /// Disables all builtins.
145  ///
146  /// This can be used for options like -fno-builtin.
147  void disableAllFunctions();
148 
149  /// Add a set of scalar -> vector mappings, queryable via
150  /// getVectorizedFunction and getScalarizedFunction.
152 
153  /// Calls addVectorizableFunctions with a known preset of functions for the
154  /// given vector library.
156 
157  /// Return true if the function F has a vector equivalent with vectorization
158  /// factor VF.
160  return !getVectorizedFunction(F, VF).empty();
161  }
162 
163  /// Return true if the function F has a vector equivalent with any
164  /// vectorization factor.
165  bool isFunctionVectorizable(StringRef F) const;
166 
167  /// Return the name of the equivalent of F, vectorized with factor VF. If no
168  /// such mapping exists, return the empty string.
170 
171  /// Set to true iff i32 parameters to library functions should have signext
172  /// or zeroext attributes if they correspond to C-level int or unsigned int,
173  /// respectively.
174  void setShouldExtI32Param(bool Val) {
175  ShouldExtI32Param = Val;
176  }
177 
178  /// Set to true iff i32 results from library functions should have signext
179  /// or zeroext attributes if they correspond to C-level int or unsigned int,
180  /// respectively.
181  void setShouldExtI32Return(bool Val) {
182  ShouldExtI32Return = Val;
183  }
184 
185  /// Set to true iff i32 parameters to library functions should have signext
186  /// attribute if they correspond to C-level int or unsigned int.
187  void setShouldSignExtI32Param(bool Val) {
188  ShouldSignExtI32Param = Val;
189  }
190 
191  /// Returns the size of the wchar_t type in bytes or 0 if the size is unknown.
192  /// This queries the 'wchar_size' metadata.
193  unsigned getWCharSize(const Module &M) const;
194 
195  /// Get size of a C-level int or unsigned int, in bits.
196  unsigned getIntSize() const {
197  return SizeOfInt;
198  }
199 
200  /// Initialize the C-level size of an integer.
201  void setIntSize(unsigned Bits) {
202  SizeOfInt = Bits;
203  }
204 
205  /// Returns the largest vectorization factor used in the list of
206  /// vector functions.
207  void getWidestVF(StringRef ScalarF, ElementCount &FixedVF,
208  ElementCount &Scalable) const;
209 
210  /// Returns true if call site / callee has cdecl-compatible calling
211  /// conventions.
212  static bool isCallingConvCCompatible(CallBase *CI);
214 };
215 
216 /// Provides information about what library functions are available for
217 /// the current target.
218 ///
219 /// This both allows optimizations to handle them specially and frontends to
220 /// disable such optimizations through -fno-builtin etc.
222  friend class TargetLibraryAnalysis;
224 
225  /// The global (module level) TLI info.
226  const TargetLibraryInfoImpl *Impl;
227 
228  /// Support for -fno-builtin* options as function attributes, overrides
229  /// information in global TargetLibraryInfoImpl.
230  BitVector OverrideAsUnavailable;
231 
232 public:
235  : Impl(&Impl), OverrideAsUnavailable(NumLibFuncs) {
236  if (!F)
237  return;
238  if ((*F)->hasFnAttribute("no-builtins"))
240  else {
241  // Disable individual libc/libm calls in TargetLibraryInfo.
242  LibFunc LF;
243  AttributeSet FnAttrs = (*F)->getAttributes().getFnAttrs();
244  for (const Attribute &Attr : FnAttrs) {
245  if (!Attr.isStringAttribute())
246  continue;
247  auto AttrStr = Attr.getKindAsString();
248  if (!AttrStr.consume_front("no-builtin-"))
249  continue;
250  if (getLibFunc(AttrStr, LF))
251  setUnavailable(LF);
252  }
253  }
254  }
255 
256  // Provide value semantics.
258  : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {}
260  : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {}
262  Impl = TLI.Impl;
263  OverrideAsUnavailable = TLI.OverrideAsUnavailable;
264  return *this;
265  }
267  Impl = TLI.Impl;
268  OverrideAsUnavailable = TLI.OverrideAsUnavailable;
269  return *this;
270  }
271 
272  /// Determine whether a callee with the given TLI can be inlined into
273  /// caller with this TLI, based on 'nobuiltin' attributes. When requested,
274  /// allow inlining into a caller with a superset of the callee's nobuiltin
275  /// attributes, which is conservatively correct.
276  bool areInlineCompatible(const TargetLibraryInfo &CalleeTLI,
277  bool AllowCallerSuperset) const {
278  if (!AllowCallerSuperset)
279  return OverrideAsUnavailable == CalleeTLI.OverrideAsUnavailable;
280  BitVector B = OverrideAsUnavailable;
281  B |= CalleeTLI.OverrideAsUnavailable;
282  // We can inline if the union of the caller and callee's nobuiltin
283  // attributes is no stricter than the caller's nobuiltin attributes.
284  return B == OverrideAsUnavailable;
285  }
286 
287  /// Searches for a particular function name.
288  ///
289  /// If it is one of the known library functions, return true and set F to the
290  /// corresponding value.
291  bool getLibFunc(StringRef funcName, LibFunc &F) const {
292  return Impl->getLibFunc(funcName, F);
293  }
294 
295  bool getLibFunc(const Function &FDecl, LibFunc &F) const {
296  return Impl->getLibFunc(FDecl, F);
297  }
298 
299  /// If a callbase does not have the 'nobuiltin' attribute, return if the
300  /// called function is a known library function and set F to that function.
301  bool getLibFunc(const CallBase &CB, LibFunc &F) const {
302  return !CB.isNoBuiltin() && CB.getCalledFunction() &&
303  getLibFunc(*(CB.getCalledFunction()), F);
304  }
305 
306  /// Disables all builtins.
307  ///
308  /// This can be used for options like -fno-builtin.
310  OverrideAsUnavailable.set();
311  }
312 
313  /// Forces a function to be marked as unavailable.
315  OverrideAsUnavailable.set(F);
316  }
317 
318  TargetLibraryInfoImpl::AvailabilityState getState(LibFunc F) const {
319  if (OverrideAsUnavailable[F])
320  return TargetLibraryInfoImpl::Unavailable;
321  return Impl->getState(F);
322  }
323 
324  /// Tests whether a library function is available.
325  bool has(LibFunc F) const {
326  return getState(F) != TargetLibraryInfoImpl::Unavailable;
327  }
329  return Impl->isFunctionVectorizable(F, VF);
330  }
332  return Impl->isFunctionVectorizable(F);
333  }
335  return Impl->getVectorizedFunction(F, VF);
336  }
337 
338  /// Tests if the function is both available and a candidate for optimized code
339  /// generation.
341  if (getState(F) == TargetLibraryInfoImpl::Unavailable)
342  return false;
343  switch (F) {
344  default: break;
345  case LibFunc_copysign: case LibFunc_copysignf: case LibFunc_copysignl:
346  case LibFunc_fabs: case LibFunc_fabsf: case LibFunc_fabsl:
347  case LibFunc_sin: case LibFunc_sinf: case LibFunc_sinl:
348  case LibFunc_cos: case LibFunc_cosf: case LibFunc_cosl:
349  case LibFunc_sqrt: case LibFunc_sqrtf: case LibFunc_sqrtl:
350  case LibFunc_sqrt_finite: case LibFunc_sqrtf_finite:
351  case LibFunc_sqrtl_finite:
352  case LibFunc_fmax: case LibFunc_fmaxf: case LibFunc_fmaxl:
353  case LibFunc_fmin: case LibFunc_fminf: case LibFunc_fminl:
354  case LibFunc_floor: case LibFunc_floorf: case LibFunc_floorl:
355  case LibFunc_nearbyint: case LibFunc_nearbyintf: case LibFunc_nearbyintl:
356  case LibFunc_ceil: case LibFunc_ceilf: case LibFunc_ceill:
357  case LibFunc_rint: case LibFunc_rintf: case LibFunc_rintl:
358  case LibFunc_round: case LibFunc_roundf: case LibFunc_roundl:
359  case LibFunc_trunc: case LibFunc_truncf: case LibFunc_truncl:
360  case LibFunc_log2: case LibFunc_log2f: case LibFunc_log2l:
361  case LibFunc_exp2: case LibFunc_exp2f: case LibFunc_exp2l:
362  case LibFunc_memcpy: case LibFunc_memset: case LibFunc_memmove:
363  case LibFunc_memcmp: case LibFunc_bcmp: case LibFunc_strcmp:
364  case LibFunc_strcpy: case LibFunc_stpcpy: case LibFunc_strlen:
365  case LibFunc_strnlen: case LibFunc_memchr: case LibFunc_mempcpy:
366  return true;
367  }
368  return false;
369  }
370 
372  auto State = getState(F);
373  if (State == TargetLibraryInfoImpl::Unavailable)
374  return StringRef();
375  if (State == TargetLibraryInfoImpl::StandardName)
376  return Impl->StandardNames[F];
377  assert(State == TargetLibraryInfoImpl::CustomName);
378  return Impl->CustomNames.find(F)->second;
379  }
380 
381  /// Returns extension attribute kind to be used for i32 parameters
382  /// corresponding to C-level int or unsigned int. May be zeroext, signext,
383  /// or none.
385  if (Impl->ShouldExtI32Param)
386  return Signed ? Attribute::SExt : Attribute::ZExt;
387  if (Impl->ShouldSignExtI32Param)
388  return Attribute::SExt;
389  return Attribute::None;
390  }
391 
392  /// Returns extension attribute kind to be used for i32 return values
393  /// corresponding to C-level int or unsigned int. May be zeroext, signext,
394  /// or none.
396  if (Impl->ShouldExtI32Return)
397  return Signed ? Attribute::SExt : Attribute::ZExt;
398  return Attribute::None;
399  }
400 
401  /// \copydoc TargetLibraryInfoImpl::getWCharSize()
402  unsigned getWCharSize(const Module &M) const {
403  return Impl->getWCharSize(M);
404  }
405 
406  /// \copydoc TargetLibraryInfoImpl::getIntSize()
407  unsigned getIntSize() const {
408  return Impl->getIntSize();
409  }
410 
411  /// Handle invalidation from the pass manager.
412  ///
413  /// If we try to invalidate this info, just return false. It cannot become
414  /// invalid even if the module or function changes.
417  return false;
418  }
421  return false;
422  }
423  /// Returns the largest vectorization factor used in the list of
424  /// vector functions.
425  void getWidestVF(StringRef ScalarF, ElementCount &FixedVF,
426  ElementCount &ScalableVF) const {
427  Impl->getWidestVF(ScalarF, FixedVF, ScalableVF);
428  }
429 
430  /// Check if the function "F" is listed in a library known to LLVM.
432  return this->isFunctionVectorizable(F);
433  }
434 };
435 
436 /// Analysis pass providing the \c TargetLibraryInfo.
437 ///
438 /// Note that this pass's result cannot be invalidated, it is immutable for the
439 /// life of the module.
440 class TargetLibraryAnalysis : public AnalysisInfoMixin<TargetLibraryAnalysis> {
441 public:
443 
444  /// Default construct the library analysis.
445  ///
446  /// This will use the module's triple to construct the library info for that
447  /// module.
449 
450  /// Construct a library analysis with baseline Module-level info.
451  ///
452  /// This will be supplemented with Function-specific info in the Result.
454  : BaselineInfoImpl(std::move(BaselineInfoImpl)) {}
455 
457 
458 private:
460  static AnalysisKey Key;
461 
462  Optional<TargetLibraryInfoImpl> BaselineInfoImpl;
463 };
464 
468 
469  virtual void anchor();
470 
471 public:
472  static char ID;
474  explicit TargetLibraryInfoWrapperPass(const Triple &T);
476 
478  FunctionAnalysisManager DummyFAM;
479  TLI = TLA.run(F, DummyFAM);
480  return *TLI;
481  }
482 };
483 
484 } // end namespace llvm
485 
486 #endif
llvm::TargetLibraryInfoImpl::setShouldSignExtI32Param
void setShouldSignExtI32Param(bool Val)
Set to true iff i32 parameters to library functions should have signext attribute if they correspond ...
Definition: TargetLibraryInfo.h:187
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm::TargetLibraryInfo::getLibFunc
bool getLibFunc(const Function &FDecl, LibFunc &F) const
Definition: TargetLibraryInfo.h:295
llvm::VecDesc
Describes a possible vectorization of a function.
Definition: TargetLibraryInfo.h:28
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4636
llvm::TargetLibraryInfoImpl::setAvailable
void setAvailable(LibFunc F)
Forces a function to be marked as available.
Definition: TargetLibraryInfo.h:128
llvm::TargetLibraryInfoImpl::SVML
@ SVML
Definition: TargetLibraryInfo.h:95
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::CallBase::isNoBuiltin
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
Definition: InstrTypes.h:1789
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
llvm::TargetLibraryInfoImpl::getIntSize
unsigned getIntSize() const
Get size of a C-level int or unsigned int, in bits.
Definition: TargetLibraryInfo.h:196
Optional.h
FunctionType
Definition: ItaniumDemangle.h:779
llvm::ImmutablePass
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition: Pass.h:269
llvm::ElementCount
Definition: TypeSize.h:386
llvm::Function
Definition: Function.h:62
llvm::TargetLibraryInfo::getLibFunc
bool getLibFunc(const CallBase &CB, LibFunc &F) const
If a callbase does not have the 'nobuiltin' attribute, return if the called function is a known libra...
Definition: TargetLibraryInfo.h:301
llvm::Attribute
Definition: Attributes.h:52
llvm::TargetLibraryInfo::TargetLibraryInfo
TargetLibraryInfo(const TargetLibraryInfo &TLI)
Definition: TargetLibraryInfo.h:257
Pass.h
llvm::BitVector::set
BitVector & set()
Definition: BitVector.h:343
llvm::VecDesc::VectorFnName
StringRef VectorFnName
Definition: TargetLibraryInfo.h:30
llvm::TargetLibraryInfo::TargetLibraryInfo
TargetLibraryInfo(const TargetLibraryInfoImpl &Impl, Optional< const Function * > F=None)
Definition: TargetLibraryInfo.h:233
llvm::TargetLibraryInfoImpl::MASSV
@ MASSV
Definition: TargetLibraryInfo.h:94
llvm::TargetLibraryAnalysis::Result
TargetLibraryInfo Result
Definition: TargetLibraryInfo.h:442
llvm::TargetLibraryInfo::isFunctionVectorizable
bool isFunctionVectorizable(StringRef F, const ElementCount &VF) const
Definition: TargetLibraryInfo.h:328
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::TargetLibraryInfo::TargetLibraryInfo
TargetLibraryInfo(TargetLibraryInfo &&TLI)
Definition: TargetLibraryInfo.h:259
llvm::TargetLibraryInfo::disableAllFunctions
void disableAllFunctions() LLVM_ATTRIBUTE_UNUSED
Disables all builtins.
Definition: TargetLibraryInfo.h:309
DenseMap.h
Module.h
llvm::tgtok::Bits
@ Bits
Definition: TGLexer.h:50
llvm::TargetLibraryInfo::getExtAttrForI32Param
Attribute::AttrKind getExtAttrForI32Param(bool Signed=true) const
Returns extension attribute kind to be used for i32 parameters corresponding to C-level int or unsign...
Definition: TargetLibraryInfo.h:384
llvm::Optional
Definition: APInt.h:33
llvm::TargetLibraryInfoImpl::operator=
TargetLibraryInfoImpl & operator=(const TargetLibraryInfoImpl &TLI)
Definition: TargetLibraryInfo.cpp:862
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::TargetLibraryInfoImpl
Implementation of the target library information.
Definition: TargetLibraryInfo.h:48
LLVM_ATTRIBUTE_UNUSED
#define LLVM_ATTRIBUTE_UNUSED
Definition: Compiler.h:188
llvm::NotLibFunc
@ NotLibFunc
Definition: TargetLibraryInfo.h:39
llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib
void addVectorizableFunctionsFromVecLib(enum VectorLibrary VecLib)
Calls addVectorizableFunctions with a known preset of functions for the given vector library.
Definition: TargetLibraryInfo.cpp:1834
llvm::TargetLibraryInfoImpl::isFunctionVectorizable
bool isFunctionVectorizable(StringRef F, const ElementCount &VF) const
Return true if the function F has a vector equivalent with vectorization factor VF.
Definition: TargetLibraryInfo.h:159
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::TargetLibraryInfoImpl::setAvailableWithName
void setAvailableWithName(LibFunc F, StringRef Name)
Forces a function to be marked as available and provide an alternate name that must be used.
Definition: TargetLibraryInfo.h:134
llvm::TargetLibraryInfo::getExtAttrForI32Return
Attribute::AttrKind getExtAttrForI32Return(bool Signed=true) const
Returns extension attribute kind to be used for i32 return values corresponding to C-level int or uns...
Definition: TargetLibraryInfo.h:395
llvm::StringLiteral
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition: StringRef.h:891
llvm::TargetLibraryInfoImpl::getVectorizedFunction
StringRef getVectorizedFunction(StringRef F, const ElementCount &VF) const
Return the name of the equivalent of F, vectorized with factor VF.
Definition: TargetLibraryInfo.cpp:1893
llvm::TargetLibraryInfo::getIntSize
unsigned getIntSize() const
Get size of a C-level int or unsigned int, in bits.
Definition: TargetLibraryInfo.h:407
llvm::TargetLibraryInfoImpl::getWidestVF
void getWidestVF(StringRef ScalarF, ElementCount &FixedVF, ElementCount &Scalable) const
Returns the largest vectorization factor used in the list of vector functions.
Definition: TargetLibraryInfo.cpp:1948
llvm::LibFunc
LibFunc
Definition: TargetLibraryInfo.h:34
InstrTypes.h
llvm::CallBase::getCalledFunction
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
Definition: InstrTypes.h:1383
llvm::TargetLibraryInfo::operator=
TargetLibraryInfo & operator=(TargetLibraryInfo &&TLI)
Definition: TargetLibraryInfo.h:266
llvm::TargetLibraryInfo::getState
TargetLibraryInfoImpl::AvailabilityState getState(LibFunc F) const
Definition: TargetLibraryInfo.h:318
llvm::VecDesc::ScalarFnName
StringRef ScalarFnName
Definition: TargetLibraryInfo.h:29
llvm::TargetLibraryAnalysis::TargetLibraryAnalysis
TargetLibraryAnalysis()
Default construct the library analysis.
Definition: TargetLibraryInfo.h:448
llvm::TargetLibraryAnalysis::run
TargetLibraryInfo run(const Function &F, FunctionAnalysisManager &)
Definition: TargetLibraryInfo.cpp:1908
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::TargetLibraryInfo::getLibFunc
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
Definition: TargetLibraryInfo.h:291
llvm::TargetLibraryInfo::operator=
TargetLibraryInfo & operator=(const TargetLibraryInfo &TLI)
Definition: TargetLibraryInfo.h:261
BitVector.h
llvm::TargetLibraryInfo::getName
StringRef getName(LibFunc F) const
Definition: TargetLibraryInfo.h:371
llvm::BitVector
Definition: BitVector.h:74
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:670
llvm::TargetLibraryInfo::invalidate
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
Definition: TargetLibraryInfo.h:419
llvm::None
const NoneType None
Definition: None.h:23
llvm::TargetLibraryInfo::areInlineCompatible
bool areInlineCompatible(const TargetLibraryInfo &CalleeTLI, bool AllowCallerSuperset) const
Determine whether a callee with the given TLI can be inlined into caller with this TLI,...
Definition: TargetLibraryInfo.h:276
llvm::TargetLibraryInfoWrapperPass
Definition: TargetLibraryInfo.h:465
llvm::Attribute::None
@ None
No attributes have been set.
Definition: Attributes.h:73
llvm::TargetLibraryInfo::getWCharSize
unsigned getWCharSize(const Module &M) const
Returns the size of the wchar_t type in bytes or 0 if the size is unknown.
Definition: TargetLibraryInfo.h:402
llvm::DenseMap< unsigned, std::string >
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:72
AvailabilityState
AvailabilityState
Definition: GVN.cpp:715
llvm::Attribute::AttrKind
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:71
llvm::TargetLibraryInfo::invalidate
bool invalidate(Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &)
Handle invalidation from the pass manager.
Definition: TargetLibraryInfo.h:415
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1609
llvm::TargetLibraryInfoImpl::setShouldExtI32Return
void setShouldExtI32Return(bool Val)
Set to true iff i32 results from library functions should have signext or zeroext attributes if they ...
Definition: TargetLibraryInfo.h:181
llvm::TargetLibraryInfoImpl::addVectorizableFunctions
void addVectorizableFunctions(ArrayRef< VecDesc > Fns)
Add a set of scalar -> vector mappings, queryable via getVectorizedFunction and getScalarizedFunction...
Definition: TargetLibraryInfo.cpp:1826
AvailabilityState::Unavailable
@ Unavailable
We know the block is not fully available. This is a fixpoint.
llvm::TargetLibraryInfo::has
bool has(LibFunc F) const
Tests whether a library function is available.
Definition: TargetLibraryInfo.h:325
llvm::TargetLibraryInfo::isKnownVectorFunctionInLibrary
bool isKnownVectorFunctionInLibrary(StringRef F) const
Check if the function "F" is listed in a library known to LLVM.
Definition: TargetLibraryInfo.h:431
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::AnalysisInfoMixin
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:397
llvm::TargetLibraryInfoImpl::Accelerate
@ Accelerate
Definition: TargetLibraryInfo.h:91
llvm::TargetLibraryInfoWrapperPass::ID
static char ID
Definition: TargetLibraryInfo.h:472
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::TargetLibraryAnalysis::TargetLibraryAnalysis
TargetLibraryAnalysis(TargetLibraryInfoImpl BaselineInfoImpl)
Construct a library analysis with baseline Module-level info.
Definition: TargetLibraryInfo.h:453
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass
TargetLibraryInfoWrapperPass()
Definition: TargetLibraryInfo.cpp:1923
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::TargetLibraryInfoWrapperPass::getTLI
TargetLibraryInfo & getTLI(const Function &F)
Definition: TargetLibraryInfo.h:477
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:206
llvm::TargetLibraryInfoImpl::disableAllFunctions
void disableAllFunctions()
Disables all builtins.
Definition: TargetLibraryInfo.cpp:1810
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
std
Definition: BitVector.h:838
llvm::TargetLibraryInfoImpl::setUnavailable
void setUnavailable(LibFunc F)
Forces a function to be marked as unavailable.
Definition: TargetLibraryInfo.h:123
Function.h
PassManager.h
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition: TargetLibraryInfo.h:221
llvm::TargetLibraryInfoImpl::setShouldExtI32Param
void setShouldExtI32Param(bool Val)
Set to true iff i32 parameters to library functions should have signext or zeroext attributes if they...
Definition: TargetLibraryInfo.h:174
llvm::TargetLibraryInfo::isFunctionVectorizable
bool isFunctionVectorizable(StringRef F) const
Definition: TargetLibraryInfo.h:331
llvm::TargetLibraryInfoImpl::LIBMVEC_X86
@ LIBMVEC_X86
Definition: TargetLibraryInfo.h:93
llvm::TargetLibraryInfoImpl::getWCharSize
unsigned getWCharSize(const Module &M) const
Returns the size of the wchar_t type in bytes or 0 if the size is unknown.
Definition: TargetLibraryInfo.cpp:1916
llvm::TargetLibraryInfoImpl::getLibFunc
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
Definition: TargetLibraryInfo.cpp:894
llvm::AttributeSet
Definition: Attributes.h:267
llvm::TargetLibraryInfoImpl::NoLibrary
@ NoLibrary
Definition: TargetLibraryInfo.h:90
llvm::NumLibFuncs
@ NumLibFuncs
Definition: TargetLibraryInfo.h:38
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1161
llvm::TargetLibraryInfo::getWidestVF
void getWidestVF(StringRef ScalarF, ElementCount &FixedVF, ElementCount &ScalableVF) const
Returns the largest vectorization factor used in the list of vector functions.
Definition: TargetLibraryInfo.h:425
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::TargetLibraryInfoImpl::isCallingConvCCompatible
static bool isCallingConvCCompatible(CallBase *CI)
Returns true if call site / callee has cdecl-compatible calling conventions.
Definition: TargetLibraryInfo.cpp:101
llvm::TargetLibraryInfo::hasOptimizedCodeGen
bool hasOptimizedCodeGen(LibFunc F) const
Tests if the function is both available and a candidate for optimized code generation.
Definition: TargetLibraryInfo.h:340
llvm::VecDesc::VectorizationFactor
ElementCount VectorizationFactor
Definition: TargetLibraryInfo.h:31
llvm::TargetLibraryInfo::setUnavailable
void setUnavailable(LibFunc F) LLVM_ATTRIBUTE_UNUSED
Forces a function to be marked as unavailable.
Definition: TargetLibraryInfo.h:314
llvm::TargetLibraryInfoImpl::VectorLibrary
VectorLibrary
List of known vector-functions libraries.
Definition: TargetLibraryInfo.h:89
llvm::TargetLibraryInfoImpl::TargetLibraryInfoImpl
TargetLibraryInfoImpl()
Definition: TargetLibraryInfo.cpp:826
llvm::TargetLibraryInfoImpl::setIntSize
void setIntSize(unsigned Bits)
Initialize the C-level size of an integer.
Definition: TargetLibraryInfo.h:201
llvm::TargetLibraryAnalysis
Analysis pass providing the TargetLibraryInfo.
Definition: TargetLibraryInfo.h:440
llvm::TargetLibraryInfo::getVectorizedFunction
StringRef getVectorizedFunction(StringRef F, const ElementCount &VF) const
Definition: TargetLibraryInfo.h:334
llvm::TargetLibraryInfoImpl::DarwinLibSystemM
@ DarwinLibSystemM
Definition: TargetLibraryInfo.h:92