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 DataLayout *DL) 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  bool getLibFunc(const Function &FDecl, LibFunc &F) const;
119 
120  /// Forces a function to be marked as unavailable.
122  setState(F, Unavailable);
123  }
124 
125  /// Forces a function to be marked as available.
127  setState(F, StandardName);
128  }
129 
130  /// Forces a function to be marked as available and provide an alternate name
131  /// that must be used.
133  if (StandardNames[F] != Name) {
134  setState(F, CustomName);
135  CustomNames[F] = std::string(Name);
136  assert(CustomNames.find(F) != CustomNames.end());
137  } else {
138  setState(F, StandardName);
139  }
140  }
141 
142  /// Disables all builtins.
143  ///
144  /// This can be used for options like -fno-builtin.
145  void disableAllFunctions();
146 
147  /// Add a set of scalar -> vector mappings, queryable via
148  /// getVectorizedFunction and getScalarizedFunction.
150 
151  /// Calls addVectorizableFunctions with a known preset of functions for the
152  /// given vector library.
154 
155  /// Return true if the function F has a vector equivalent with vectorization
156  /// factor VF.
158  return !getVectorizedFunction(F, VF).empty();
159  }
160 
161  /// Return true if the function F has a vector equivalent with any
162  /// vectorization factor.
163  bool isFunctionVectorizable(StringRef F) const;
164 
165  /// Return the name of the equivalent of F, vectorized with factor VF. If no
166  /// such mapping exists, return the empty string.
168 
169  /// Set to true iff i32 parameters to library functions should have signext
170  /// or zeroext attributes if they correspond to C-level int or unsigned int,
171  /// respectively.
172  void setShouldExtI32Param(bool Val) {
173  ShouldExtI32Param = Val;
174  }
175 
176  /// Set to true iff i32 results from library functions should have signext
177  /// or zeroext attributes if they correspond to C-level int or unsigned int,
178  /// respectively.
179  void setShouldExtI32Return(bool Val) {
180  ShouldExtI32Return = Val;
181  }
182 
183  /// Set to true iff i32 parameters to library functions should have signext
184  /// attribute if they correspond to C-level int or unsigned int.
185  void setShouldSignExtI32Param(bool Val) {
186  ShouldSignExtI32Param = Val;
187  }
188 
189  /// Returns the size of the wchar_t type in bytes or 0 if the size is unknown.
190  /// This queries the 'wchar_size' metadata.
191  unsigned getWCharSize(const Module &M) const;
192 
193  /// Get size of a C-level int or unsigned int, in bits.
194  unsigned getIntSize() const {
195  return SizeOfInt;
196  }
197 
198  /// Initialize the C-level size of an integer.
199  void setIntSize(unsigned Bits) {
200  SizeOfInt = Bits;
201  }
202 
203  /// Returns the largest vectorization factor used in the list of
204  /// vector functions.
205  void getWidestVF(StringRef ScalarF, ElementCount &FixedVF,
206  ElementCount &Scalable) const;
207 
208  /// Returns true if call site / callee has cdecl-compatible calling
209  /// conventions.
210  static bool isCallingConvCCompatible(CallBase *CI);
212 };
213 
214 /// Provides information about what library functions are available for
215 /// the current target.
216 ///
217 /// This both allows optimizations to handle them specially and frontends to
218 /// disable such optimizations through -fno-builtin etc.
220  friend class TargetLibraryAnalysis;
222 
223  /// The global (module level) TLI info.
224  const TargetLibraryInfoImpl *Impl;
225 
226  /// Support for -fno-builtin* options as function attributes, overrides
227  /// information in global TargetLibraryInfoImpl.
228  BitVector OverrideAsUnavailable;
229 
230 public:
233  : Impl(&Impl), OverrideAsUnavailable(NumLibFuncs) {
234  if (!F)
235  return;
236  if ((*F)->hasFnAttribute("no-builtins"))
238  else {
239  // Disable individual libc/libm calls in TargetLibraryInfo.
240  LibFunc LF;
241  AttributeSet FnAttrs = (*F)->getAttributes().getFnAttributes();
242  for (const Attribute &Attr : FnAttrs) {
243  if (!Attr.isStringAttribute())
244  continue;
245  auto AttrStr = Attr.getKindAsString();
246  if (!AttrStr.consume_front("no-builtin-"))
247  continue;
248  if (getLibFunc(AttrStr, LF))
249  setUnavailable(LF);
250  }
251  }
252  }
253 
254  // Provide value semantics.
256  : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {}
258  : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {}
260  Impl = TLI.Impl;
261  OverrideAsUnavailable = TLI.OverrideAsUnavailable;
262  return *this;
263  }
265  Impl = TLI.Impl;
266  OverrideAsUnavailable = TLI.OverrideAsUnavailable;
267  return *this;
268  }
269 
270  /// Determine whether a callee with the given TLI can be inlined into
271  /// caller with this TLI, based on 'nobuiltin' attributes. When requested,
272  /// allow inlining into a caller with a superset of the callee's nobuiltin
273  /// attributes, which is conservatively correct.
274  bool areInlineCompatible(const TargetLibraryInfo &CalleeTLI,
275  bool AllowCallerSuperset) const {
276  if (!AllowCallerSuperset)
277  return OverrideAsUnavailable == CalleeTLI.OverrideAsUnavailable;
278  BitVector B = OverrideAsUnavailable;
279  B |= CalleeTLI.OverrideAsUnavailable;
280  // We can inline if the union of the caller and callee's nobuiltin
281  // attributes is no stricter than the caller's nobuiltin attributes.
282  return B == OverrideAsUnavailable;
283  }
284 
285  /// Searches for a particular function name.
286  ///
287  /// If it is one of the known library functions, return true and set F to the
288  /// corresponding value.
289  bool getLibFunc(StringRef funcName, LibFunc &F) const {
290  return Impl->getLibFunc(funcName, F);
291  }
292 
293  bool getLibFunc(const Function &FDecl, LibFunc &F) const {
294  return Impl->getLibFunc(FDecl, F);
295  }
296 
297  /// If a callbase does not have the 'nobuiltin' attribute, return if the
298  /// called function is a known library function and set F to that function.
299  bool getLibFunc(const CallBase &CB, LibFunc &F) const {
300  return !CB.isNoBuiltin() && CB.getCalledFunction() &&
301  getLibFunc(*(CB.getCalledFunction()), F);
302  }
303 
304  /// Disables all builtins.
305  ///
306  /// This can be used for options like -fno-builtin.
308  OverrideAsUnavailable.set();
309  }
310 
311  /// Forces a function to be marked as unavailable.
313  OverrideAsUnavailable.set(F);
314  }
315 
316  TargetLibraryInfoImpl::AvailabilityState getState(LibFunc F) const {
317  if (OverrideAsUnavailable[F])
318  return TargetLibraryInfoImpl::Unavailable;
319  return Impl->getState(F);
320  }
321 
322  /// Tests whether a library function is available.
323  bool has(LibFunc F) const {
324  return getState(F) != TargetLibraryInfoImpl::Unavailable;
325  }
327  return Impl->isFunctionVectorizable(F, VF);
328  }
330  return Impl->isFunctionVectorizable(F);
331  }
333  return Impl->getVectorizedFunction(F, VF);
334  }
335 
336  /// Tests if the function is both available and a candidate for optimized code
337  /// generation.
339  if (getState(F) == TargetLibraryInfoImpl::Unavailable)
340  return false;
341  switch (F) {
342  default: break;
343  case LibFunc_copysign: case LibFunc_copysignf: case LibFunc_copysignl:
344  case LibFunc_fabs: case LibFunc_fabsf: case LibFunc_fabsl:
345  case LibFunc_sin: case LibFunc_sinf: case LibFunc_sinl:
346  case LibFunc_cos: case LibFunc_cosf: case LibFunc_cosl:
347  case LibFunc_sqrt: case LibFunc_sqrtf: case LibFunc_sqrtl:
348  case LibFunc_sqrt_finite: case LibFunc_sqrtf_finite:
349  case LibFunc_sqrtl_finite:
350  case LibFunc_fmax: case LibFunc_fmaxf: case LibFunc_fmaxl:
351  case LibFunc_fmin: case LibFunc_fminf: case LibFunc_fminl:
352  case LibFunc_floor: case LibFunc_floorf: case LibFunc_floorl:
353  case LibFunc_nearbyint: case LibFunc_nearbyintf: case LibFunc_nearbyintl:
354  case LibFunc_ceil: case LibFunc_ceilf: case LibFunc_ceill:
355  case LibFunc_rint: case LibFunc_rintf: case LibFunc_rintl:
356  case LibFunc_round: case LibFunc_roundf: case LibFunc_roundl:
357  case LibFunc_trunc: case LibFunc_truncf: case LibFunc_truncl:
358  case LibFunc_log2: case LibFunc_log2f: case LibFunc_log2l:
359  case LibFunc_exp2: case LibFunc_exp2f: case LibFunc_exp2l:
360  case LibFunc_memcpy: case LibFunc_memset: case LibFunc_memmove:
361  case LibFunc_memcmp: case LibFunc_bcmp: case LibFunc_strcmp:
362  case LibFunc_strcpy: case LibFunc_stpcpy: case LibFunc_strlen:
363  case LibFunc_strnlen: case LibFunc_memchr: case LibFunc_mempcpy:
364  return true;
365  }
366  return false;
367  }
368 
370  auto State = getState(F);
371  if (State == TargetLibraryInfoImpl::Unavailable)
372  return StringRef();
373  if (State == TargetLibraryInfoImpl::StandardName)
374  return Impl->StandardNames[F];
375  assert(State == TargetLibraryInfoImpl::CustomName);
376  return Impl->CustomNames.find(F)->second;
377  }
378 
379  /// Returns extension attribute kind to be used for i32 parameters
380  /// corresponding to C-level int or unsigned int. May be zeroext, signext,
381  /// or none.
383  if (Impl->ShouldExtI32Param)
384  return Signed ? Attribute::SExt : Attribute::ZExt;
385  if (Impl->ShouldSignExtI32Param)
386  return Attribute::SExt;
387  return Attribute::None;
388  }
389 
390  /// Returns extension attribute kind to be used for i32 return values
391  /// corresponding to C-level int or unsigned int. May be zeroext, signext,
392  /// or none.
394  if (Impl->ShouldExtI32Return)
395  return Signed ? Attribute::SExt : Attribute::ZExt;
396  return Attribute::None;
397  }
398 
399  /// \copydoc TargetLibraryInfoImpl::getWCharSize()
400  unsigned getWCharSize(const Module &M) const {
401  return Impl->getWCharSize(M);
402  }
403 
404  /// \copydoc TargetLibraryInfoImpl::getIntSize()
405  unsigned getIntSize() const {
406  return Impl->getIntSize();
407  }
408 
409  /// Handle invalidation from the pass manager.
410  ///
411  /// If we try to invalidate this info, just return false. It cannot become
412  /// invalid even if the module or function changes.
415  return false;
416  }
419  return false;
420  }
421  /// Returns the largest vectorization factor used in the list of
422  /// vector functions.
423  void getWidestVF(StringRef ScalarF, ElementCount &FixedVF,
424  ElementCount &ScalableVF) const {
425  Impl->getWidestVF(ScalarF, FixedVF, ScalableVF);
426  }
427 
428  /// Check if the function "F" is listed in a library known to LLVM.
430  return this->isFunctionVectorizable(F);
431  }
432 };
433 
434 /// Analysis pass providing the \c TargetLibraryInfo.
435 ///
436 /// Note that this pass's result cannot be invalidated, it is immutable for the
437 /// life of the module.
438 class TargetLibraryAnalysis : public AnalysisInfoMixin<TargetLibraryAnalysis> {
439 public:
441 
442  /// Default construct the library analysis.
443  ///
444  /// This will use the module's triple to construct the library info for that
445  /// module.
447 
448  /// Construct a library analysis with baseline Module-level info.
449  ///
450  /// This will be supplemented with Function-specific info in the Result.
452  : BaselineInfoImpl(std::move(BaselineInfoImpl)) {}
453 
455 
456 private:
458  static AnalysisKey Key;
459 
460  Optional<TargetLibraryInfoImpl> BaselineInfoImpl;
461 };
462 
466 
467  virtual void anchor();
468 
469 public:
470  static char ID;
472  explicit TargetLibraryInfoWrapperPass(const Triple &T);
474 
476  FunctionAnalysisManager DummyFAM;
477  TLI = TLA.run(F, DummyFAM);
478  return *TLI;
479  }
480 };
481 
482 } // end namespace llvm
483 
484 #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:185
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:293
llvm::VecDesc
Describes a possible vectorization of a function.
Definition: TargetLibraryInfo.h:28
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4630
llvm::TargetLibraryInfoImpl::setAvailable
void setAvailable(LibFunc F)
Forces a function to be marked as available.
Definition: TargetLibraryInfo.h:126
llvm::TargetLibraryInfoImpl::SVML
@ SVML
Definition: TargetLibraryInfo.h:95
llvm
---------------------— PointerInfo ------------------------------------—
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:1772
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:194
Optional.h
FunctionType
Definition: ItaniumDemangle.h:643
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:61
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:299
llvm::Attribute
Definition: Attributes.h:52
llvm::TargetLibraryInfo::TargetLibraryInfo
TargetLibraryInfo(const TargetLibraryInfo &TLI)
Definition: TargetLibraryInfo.h:255
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:231
llvm::TargetLibraryInfoImpl::MASSV
@ MASSV
Definition: TargetLibraryInfo.h:94
llvm::TargetLibraryAnalysis::Result
TargetLibraryInfo Result
Definition: TargetLibraryInfo.h:440
llvm::TargetLibraryInfo::isFunctionVectorizable
bool isFunctionVectorizable(StringRef F, const ElementCount &VF) const
Definition: TargetLibraryInfo.h:326
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::TargetLibraryInfo::TargetLibraryInfo
TargetLibraryInfo(TargetLibraryInfo &&TLI)
Definition: TargetLibraryInfo.h:257
llvm::TargetLibraryInfo::disableAllFunctions
void disableAllFunctions() LLVM_ATTRIBUTE_UNUSED
Disables all builtins.
Definition: TargetLibraryInfo.h:307
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:382
llvm::Optional
Definition: APInt.h:33
llvm::TargetLibraryInfoImpl::operator=
TargetLibraryInfoImpl & operator=(const TargetLibraryInfoImpl &TLI)
Definition: TargetLibraryInfo.cpp:670
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:1638
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:157
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:132
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:393
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:1697
llvm::TargetLibraryInfo::getIntSize
unsigned getIntSize() const
Get size of a C-level int or unsigned int, in bits.
Definition: TargetLibraryInfo.h:405
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:1752
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:1393
llvm::TargetLibraryInfo::operator=
TargetLibraryInfo & operator=(TargetLibraryInfo &&TLI)
Definition: TargetLibraryInfo.h:264
llvm::TargetLibraryInfo::getState
TargetLibraryInfoImpl::AvailabilityState getState(LibFunc F) const
Definition: TargetLibraryInfo.h:316
llvm::VecDesc::ScalarFnName
StringRef ScalarFnName
Definition: TargetLibraryInfo.h:29
llvm::TargetLibraryAnalysis::TargetLibraryAnalysis
TargetLibraryAnalysis()
Default construct the library analysis.
Definition: TargetLibraryInfo.h:446
llvm::TargetLibraryAnalysis::run
TargetLibraryInfo run(const Function &F, FunctionAnalysisManager &)
Definition: TargetLibraryInfo.cpp:1712
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:289
llvm::TargetLibraryInfo::operator=
TargetLibraryInfo & operator=(const TargetLibraryInfo &TLI)
Definition: TargetLibraryInfo.h:259
BitVector.h
llvm::TargetLibraryInfo::getName
StringRef getName(LibFunc F) const
Definition: TargetLibraryInfo.h:369
llvm::BitVector
Definition: BitVector.h:74
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:656
llvm::TargetLibraryInfo::invalidate
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
Definition: TargetLibraryInfo.h:417
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:274
llvm::TargetLibraryInfoWrapperPass
Definition: TargetLibraryInfo.h:463
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:400
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:698
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:413
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:1605
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:179
llvm::TargetLibraryInfoImpl::addVectorizableFunctions
void addVectorizableFunctions(ArrayRef< VecDesc > Fns)
Add a set of scalar -> vector mappings, queryable via getVectorizedFunction and getScalarizedFunction...
Definition: TargetLibraryInfo.cpp:1630
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:323
llvm::TargetLibraryInfo::isKnownVectorFunctionInLibrary
bool isKnownVectorFunctionInLibrary(StringRef F) const
Check if the function "F" is listed in a library known to LLVM.
Definition: TargetLibraryInfo.h:429
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:391
llvm::TargetLibraryInfoImpl::Accelerate
@ Accelerate
Definition: TargetLibraryInfo.h:91
llvm::TargetLibraryInfoWrapperPass::ID
static char ID
Definition: TargetLibraryInfo.h:470
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:451
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass
TargetLibraryInfoWrapperPass()
Definition: TargetLibraryInfo.cpp:1727
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::TargetLibraryInfoWrapperPass::getTLI
TargetLibraryInfo & getTLI(const Function &F)
Definition: TargetLibraryInfo.h:475
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:1614
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:121
Function.h
PassManager.h
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition: TargetLibraryInfo.h:219
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:172
llvm::TargetLibraryInfo::isFunctionVectorizable
bool isFunctionVectorizable(StringRef F) const
Definition: TargetLibraryInfo.h:329
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:1720
llvm::TargetLibraryInfoImpl::getLibFunc
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
Definition: TargetLibraryInfo.cpp:702
llvm::AttributeSet
Definition: Attributes.h:266
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:423
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:338
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:312
llvm::TargetLibraryInfoImpl::VectorLibrary
VectorLibrary
List of known vector-functions libraries.
Definition: TargetLibraryInfo.h:89
llvm::TargetLibraryInfoImpl::TargetLibraryInfoImpl
TargetLibraryInfoImpl()
Definition: TargetLibraryInfo.cpp:634
llvm::TargetLibraryInfoImpl::setIntSize
void setIntSize(unsigned Bits)
Initialize the C-level size of an integer.
Definition: TargetLibraryInfo.h:199
llvm::TargetLibraryAnalysis
Analysis pass providing the TargetLibraryInfo.
Definition: TargetLibraryInfo.h:438
llvm::TargetLibraryInfo::getVectorizedFunction
StringRef getVectorizedFunction(StringRef F, const ElementCount &VF) const
Definition: TargetLibraryInfo.h:332
llvm::TargetLibraryInfoImpl::DarwinLibSystemM
@ DarwinLibSystemM
Definition: TargetLibraryInfo.h:92