LLVM  13.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 
56  enum AvailabilityState {
57  StandardName = 3, // (memset to all ones)
58  CustomName = 1,
59  Unavailable = 0 // (memset to all zeros)
60  };
61  void setState(LibFunc F, AvailabilityState State) {
62  AvailableArray[F/4] &= ~(3 << 2*(F&3));
63  AvailableArray[F/4] |= State << 2*(F&3);
64  }
65  AvailabilityState getState(LibFunc F) const {
66  return static_cast<AvailabilityState>((AvailableArray[F/4] >> 2*(F&3)) & 3);
67  }
68 
69  /// Vectorization descriptors - sorted by ScalarFnName.
70  std::vector<VecDesc> VectorDescs;
71  /// Scalarization descriptors - same content as VectorDescs but sorted based
72  /// on VectorFnName rather than ScalarFnName.
73  std::vector<VecDesc> ScalarDescs;
74 
75  /// Return true if the function type FTy is valid for the library function
76  /// F, regardless of whether the function is available.
77  bool isValidProtoForLibFunc(const FunctionType &FTy, LibFunc F,
78  const DataLayout *DL) const;
79 
80 public:
81  /// List of known vector-functions libraries.
82  ///
83  /// The vector-functions library defines, which functions are vectorizable
84  /// and with which factor. The library can be specified by either frontend,
85  /// or a commandline option, and then used by
86  /// addVectorizableFunctionsFromVecLib for filling up the tables of
87  /// vectorizable functions.
89  NoLibrary, // Don't use any vector library.
90  Accelerate, // Use Accelerate framework.
91  LIBMVEC_X86,// GLIBC Vector Math library.
92  MASSV, // IBM MASS vector library.
93  SVML // Intel short vector math library.
94  };
95 
97  explicit TargetLibraryInfoImpl(const Triple &T);
98 
99  // Provide value semantics.
104 
105  /// Searches for a particular function name.
106  ///
107  /// If it is one of the known library functions, return true and set F to the
108  /// corresponding value.
109  bool getLibFunc(StringRef funcName, LibFunc &F) const;
110 
111  /// Searches for a particular function name, also checking that its type is
112  /// valid for the library function matching that name.
113  ///
114  /// If it is one of the known library functions, return true and set F to the
115  /// corresponding value.
116  bool getLibFunc(const Function &FDecl, LibFunc &F) const;
117 
118  /// Forces a function to be marked as unavailable.
120  setState(F, Unavailable);
121  }
122 
123  /// Forces a function to be marked as available.
125  setState(F, StandardName);
126  }
127 
128  /// Forces a function to be marked as available and provide an alternate name
129  /// that must be used.
131  if (StandardNames[F] != Name) {
132  setState(F, CustomName);
133  CustomNames[F] = std::string(Name);
134  assert(CustomNames.find(F) != CustomNames.end());
135  } else {
136  setState(F, StandardName);
137  }
138  }
139 
140  /// Disables all builtins.
141  ///
142  /// This can be used for options like -fno-builtin.
143  void disableAllFunctions();
144 
145  /// Add a set of scalar -> vector mappings, queryable via
146  /// getVectorizedFunction and getScalarizedFunction.
148 
149  /// Calls addVectorizableFunctions with a known preset of functions for the
150  /// given vector library.
152 
153  /// Return true if the function F has a vector equivalent with vectorization
154  /// factor VF.
156  return !getVectorizedFunction(F, VF).empty();
157  }
158 
159  /// Return true if the function F has a vector equivalent with any
160  /// vectorization factor.
161  bool isFunctionVectorizable(StringRef F) const;
162 
163  /// Return the name of the equivalent of F, vectorized with factor VF. If no
164  /// such mapping exists, return the empty string.
166 
167  /// Set to true iff i32 parameters to library functions should have signext
168  /// or zeroext attributes if they correspond to C-level int or unsigned int,
169  /// respectively.
170  void setShouldExtI32Param(bool Val) {
171  ShouldExtI32Param = Val;
172  }
173 
174  /// Set to true iff i32 results from library functions should have signext
175  /// or zeroext attributes if they correspond to C-level int or unsigned int,
176  /// respectively.
177  void setShouldExtI32Return(bool Val) {
178  ShouldExtI32Return = Val;
179  }
180 
181  /// Set to true iff i32 parameters to library functions should have signext
182  /// attribute if they correspond to C-level int or unsigned int.
183  void setShouldSignExtI32Param(bool Val) {
184  ShouldSignExtI32Param = Val;
185  }
186 
187  /// Returns the size of the wchar_t type in bytes or 0 if the size is unknown.
188  /// This queries the 'wchar_size' metadata.
189  unsigned getWCharSize(const Module &M) const;
190 
191  /// Returns the largest vectorization factor used in the list of
192  /// vector functions.
193  void getWidestVF(StringRef ScalarF, ElementCount &FixedVF,
194  ElementCount &Scalable) const;
195 
196  /// Returns true if call site / callee has cdecl-compatible calling
197  /// conventions.
198  static bool isCallingConvCCompatible(CallBase *CI);
200 };
201 
202 /// Provides information about what library functions are available for
203 /// the current target.
204 ///
205 /// This both allows optimizations to handle them specially and frontends to
206 /// disable such optimizations through -fno-builtin etc.
208  friend class TargetLibraryAnalysis;
210 
211  /// The global (module level) TLI info.
212  const TargetLibraryInfoImpl *Impl;
213 
214  /// Support for -fno-builtin* options as function attributes, overrides
215  /// information in global TargetLibraryInfoImpl.
216  BitVector OverrideAsUnavailable;
217 
218 public:
221  : Impl(&Impl), OverrideAsUnavailable(NumLibFuncs) {
222  if (!F)
223  return;
224  if ((*F)->hasFnAttribute("no-builtins"))
226  else {
227  // Disable individual libc/libm calls in TargetLibraryInfo.
228  LibFunc LF;
229  AttributeSet FnAttrs = (*F)->getAttributes().getFnAttributes();
230  for (const Attribute &Attr : FnAttrs) {
231  if (!Attr.isStringAttribute())
232  continue;
233  auto AttrStr = Attr.getKindAsString();
234  if (!AttrStr.consume_front("no-builtin-"))
235  continue;
236  if (getLibFunc(AttrStr, LF))
237  setUnavailable(LF);
238  }
239  }
240  }
241 
242  // Provide value semantics.
244  : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {}
246  : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {}
248  Impl = TLI.Impl;
249  OverrideAsUnavailable = TLI.OverrideAsUnavailable;
250  return *this;
251  }
253  Impl = TLI.Impl;
254  OverrideAsUnavailable = TLI.OverrideAsUnavailable;
255  return *this;
256  }
257 
258  /// Determine whether a callee with the given TLI can be inlined into
259  /// caller with this TLI, based on 'nobuiltin' attributes. When requested,
260  /// allow inlining into a caller with a superset of the callee's nobuiltin
261  /// attributes, which is conservatively correct.
262  bool areInlineCompatible(const TargetLibraryInfo &CalleeTLI,
263  bool AllowCallerSuperset) const {
264  if (!AllowCallerSuperset)
265  return OverrideAsUnavailable == CalleeTLI.OverrideAsUnavailable;
266  BitVector B = OverrideAsUnavailable;
267  B |= CalleeTLI.OverrideAsUnavailable;
268  // We can inline if the union of the caller and callee's nobuiltin
269  // attributes is no stricter than the caller's nobuiltin attributes.
270  return B == OverrideAsUnavailable;
271  }
272 
273  /// Searches for a particular function name.
274  ///
275  /// If it is one of the known library functions, return true and set F to the
276  /// corresponding value.
277  bool getLibFunc(StringRef funcName, LibFunc &F) const {
278  return Impl->getLibFunc(funcName, F);
279  }
280 
281  bool getLibFunc(const Function &FDecl, LibFunc &F) const {
282  return Impl->getLibFunc(FDecl, F);
283  }
284 
285  /// If a callbase does not have the 'nobuiltin' attribute, return if the
286  /// called function is a known library function and set F to that function.
287  bool getLibFunc(const CallBase &CB, LibFunc &F) const {
288  return !CB.isNoBuiltin() && CB.getCalledFunction() &&
289  getLibFunc(*(CB.getCalledFunction()), F);
290  }
291 
292  /// Disables all builtins.
293  ///
294  /// This can be used for options like -fno-builtin.
296  OverrideAsUnavailable.set();
297  }
298 
299  /// Forces a function to be marked as unavailable.
301  OverrideAsUnavailable.set(F);
302  }
303 
304  TargetLibraryInfoImpl::AvailabilityState getState(LibFunc F) const {
305  if (OverrideAsUnavailable[F])
306  return TargetLibraryInfoImpl::Unavailable;
307  return Impl->getState(F);
308  }
309 
310  /// Tests whether a library function is available.
311  bool has(LibFunc F) const {
312  return getState(F) != TargetLibraryInfoImpl::Unavailable;
313  }
315  return Impl->isFunctionVectorizable(F, VF);
316  }
318  return Impl->isFunctionVectorizable(F);
319  }
321  return Impl->getVectorizedFunction(F, VF);
322  }
323 
324  /// Tests if the function is both available and a candidate for optimized code
325  /// generation.
327  if (getState(F) == TargetLibraryInfoImpl::Unavailable)
328  return false;
329  switch (F) {
330  default: break;
331  case LibFunc_copysign: case LibFunc_copysignf: case LibFunc_copysignl:
332  case LibFunc_fabs: case LibFunc_fabsf: case LibFunc_fabsl:
333  case LibFunc_sin: case LibFunc_sinf: case LibFunc_sinl:
334  case LibFunc_cos: case LibFunc_cosf: case LibFunc_cosl:
335  case LibFunc_sqrt: case LibFunc_sqrtf: case LibFunc_sqrtl:
336  case LibFunc_sqrt_finite: case LibFunc_sqrtf_finite:
337  case LibFunc_sqrtl_finite:
338  case LibFunc_fmax: case LibFunc_fmaxf: case LibFunc_fmaxl:
339  case LibFunc_fmin: case LibFunc_fminf: case LibFunc_fminl:
340  case LibFunc_floor: case LibFunc_floorf: case LibFunc_floorl:
341  case LibFunc_nearbyint: case LibFunc_nearbyintf: case LibFunc_nearbyintl:
342  case LibFunc_ceil: case LibFunc_ceilf: case LibFunc_ceill:
343  case LibFunc_rint: case LibFunc_rintf: case LibFunc_rintl:
344  case LibFunc_round: case LibFunc_roundf: case LibFunc_roundl:
345  case LibFunc_trunc: case LibFunc_truncf: case LibFunc_truncl:
346  case LibFunc_log2: case LibFunc_log2f: case LibFunc_log2l:
347  case LibFunc_exp2: case LibFunc_exp2f: case LibFunc_exp2l:
348  case LibFunc_memcpy: case LibFunc_memset: case LibFunc_memmove:
349  case LibFunc_memcmp: case LibFunc_bcmp: case LibFunc_strcmp:
350  case LibFunc_strcpy: case LibFunc_stpcpy: case LibFunc_strlen:
351  case LibFunc_strnlen: case LibFunc_memchr: case LibFunc_mempcpy:
352  return true;
353  }
354  return false;
355  }
356 
358  auto State = getState(F);
359  if (State == TargetLibraryInfoImpl::Unavailable)
360  return StringRef();
361  if (State == TargetLibraryInfoImpl::StandardName)
362  return Impl->StandardNames[F];
363  assert(State == TargetLibraryInfoImpl::CustomName);
364  return Impl->CustomNames.find(F)->second;
365  }
366 
367  /// Returns extension attribute kind to be used for i32 parameters
368  /// corresponding to C-level int or unsigned int. May be zeroext, signext,
369  /// or none.
371  if (Impl->ShouldExtI32Param)
372  return Signed ? Attribute::SExt : Attribute::ZExt;
373  if (Impl->ShouldSignExtI32Param)
374  return Attribute::SExt;
375  return Attribute::None;
376  }
377 
378  /// Returns extension attribute kind to be used for i32 return values
379  /// corresponding to C-level int or unsigned int. May be zeroext, signext,
380  /// or none.
382  if (Impl->ShouldExtI32Return)
383  return Signed ? Attribute::SExt : Attribute::ZExt;
384  return Attribute::None;
385  }
386 
387  /// \copydoc TargetLibraryInfoImpl::getWCharSize()
388  unsigned getWCharSize(const Module &M) const {
389  return Impl->getWCharSize(M);
390  }
391 
392  /// Handle invalidation from the pass manager.
393  ///
394  /// If we try to invalidate this info, just return false. It cannot become
395  /// invalid even if the module or function changes.
398  return false;
399  }
402  return false;
403  }
404  /// Returns the largest vectorization factor used in the list of
405  /// vector functions.
406  void getWidestVF(StringRef ScalarF, ElementCount &FixedVF,
407  ElementCount &ScalableVF) const {
408  Impl->getWidestVF(ScalarF, FixedVF, ScalableVF);
409  }
410 
411  /// Check if the function "F" is listed in a library known to LLVM.
413  return this->isFunctionVectorizable(F);
414  }
415 };
416 
417 /// Analysis pass providing the \c TargetLibraryInfo.
418 ///
419 /// Note that this pass's result cannot be invalidated, it is immutable for the
420 /// life of the module.
421 class TargetLibraryAnalysis : public AnalysisInfoMixin<TargetLibraryAnalysis> {
422 public:
424 
425  /// Default construct the library analysis.
426  ///
427  /// This will use the module's triple to construct the library info for that
428  /// module.
430 
431  /// Construct a library analysis with baseline Module-level info.
432  ///
433  /// This will be supplemented with Function-specific info in the Result.
435  : BaselineInfoImpl(std::move(BaselineInfoImpl)) {}
436 
438 
439 private:
441  static AnalysisKey Key;
442 
443  Optional<TargetLibraryInfoImpl> BaselineInfoImpl;
444 };
445 
449 
450  virtual void anchor();
451 
452 public:
453  static char ID;
455  explicit TargetLibraryInfoWrapperPass(const Triple &T);
457 
459  FunctionAnalysisManager DummyFAM;
460  TLI = TLA.run(F, DummyFAM);
461  return *TLI;
462  }
463 };
464 
465 } // end namespace llvm
466 
467 #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:183
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:281
llvm::VecDesc
Describes a possible vectorization of a function.
Definition: TargetLibraryInfo.h:28
Signed
@ Signed
Definition: NVPTXISelLowering.cpp:4543
llvm::TargetLibraryInfoImpl::setAvailable
void setAvailable(LibFunc F)
Forces a function to be marked as available.
Definition: TargetLibraryInfo.h:124
llvm::TargetLibraryInfoImpl::SVML
@ SVML
Definition: TargetLibraryInfo.h:93
llvm
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:1763
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:156
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:287
llvm::Attribute
Definition: Attributes.h:52
llvm::TargetLibraryInfo::TargetLibraryInfo
TargetLibraryInfo(const TargetLibraryInfo &TLI)
Definition: TargetLibraryInfo.h:243
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:219
llvm::TargetLibraryInfoImpl::MASSV
@ MASSV
Definition: TargetLibraryInfo.h:92
llvm::TargetLibraryAnalysis::Result
TargetLibraryInfo Result
Definition: TargetLibraryInfo.h:423
llvm::TargetLibraryInfo::isFunctionVectorizable
bool isFunctionVectorizable(StringRef F, const ElementCount &VF) const
Definition: TargetLibraryInfo.h:314
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::TargetLibraryInfo::TargetLibraryInfo
TargetLibraryInfo(TargetLibraryInfo &&TLI)
Definition: TargetLibraryInfo.h:245
llvm::TargetLibraryInfo::disableAllFunctions
void disableAllFunctions() LLVM_ATTRIBUTE_UNUSED
Disables all builtins.
Definition: TargetLibraryInfo.h:295
DenseMap.h
Module.h
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:370
llvm::Optional
Definition: APInt.h:33
llvm::TargetLibraryInfoImpl::operator=
TargetLibraryInfoImpl & operator=(const TargetLibraryInfoImpl &TLI)
Definition: TargetLibraryInfo.cpp:653
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:1614
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:155
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:130
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:381
llvm::StringLiteral
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition: StringRef.h:872
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:1665
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:1720
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:1396
llvm::TargetLibraryInfo::operator=
TargetLibraryInfo & operator=(TargetLibraryInfo &&TLI)
Definition: TargetLibraryInfo.h:252
llvm::TargetLibraryInfo::getState
TargetLibraryInfoImpl::AvailabilityState getState(LibFunc F) const
Definition: TargetLibraryInfo.h:304
llvm::VecDesc::ScalarFnName
StringRef ScalarFnName
Definition: TargetLibraryInfo.h:29
llvm::TargetLibraryAnalysis::TargetLibraryAnalysis
TargetLibraryAnalysis()
Default construct the library analysis.
Definition: TargetLibraryInfo.h:429
llvm::TargetLibraryAnalysis::run
TargetLibraryInfo run(const Function &F, FunctionAnalysisManager &)
Definition: TargetLibraryInfo.cpp:1680
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:277
llvm::TargetLibraryInfo::operator=
TargetLibraryInfo & operator=(const TargetLibraryInfo &TLI)
Definition: TargetLibraryInfo.h:247
BitVector.h
llvm::TargetLibraryInfo::getName
StringRef getName(LibFunc F) const
Definition: TargetLibraryInfo.h:357
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:400
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:262
llvm::TargetLibraryInfoWrapperPass
Definition: TargetLibraryInfo.h:446
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:388
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:700
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:396
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:1540
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:177
llvm::TargetLibraryInfoImpl::addVectorizableFunctions
void addVectorizableFunctions(ArrayRef< VecDesc > Fns)
Add a set of scalar -> vector mappings, queryable via getVectorizedFunction and getScalarizedFunction...
Definition: TargetLibraryInfo.cpp:1606
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:311
llvm::TargetLibraryInfo::isKnownVectorFunctionInLibrary
bool isKnownVectorFunctionInLibrary(StringRef F) const
Check if the function "F" is listed in a library known to LLVM.
Definition: TargetLibraryInfo.h:412
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:90
llvm::TargetLibraryInfoWrapperPass::ID
static char ID
Definition: TargetLibraryInfo.h:453
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:434
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass
TargetLibraryInfoWrapperPass()
Definition: TargetLibraryInfo.cpp:1695
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::TargetLibraryInfoWrapperPass::getTLI
TargetLibraryInfo & getTLI(const Function &F)
Definition: TargetLibraryInfo.h:458
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:205
llvm::TargetLibraryInfoImpl::disableAllFunctions
void disableAllFunctions()
Disables all builtins.
Definition: TargetLibraryInfo.cpp:1590
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:119
Function.h
PassManager.h
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition: TargetLibraryInfo.h:207
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:170
llvm::TargetLibraryInfo::isFunctionVectorizable
bool isFunctionVectorizable(StringRef F) const
Definition: TargetLibraryInfo.h:317
llvm::TargetLibraryInfoImpl::LIBMVEC_X86
@ LIBMVEC_X86
Definition: TargetLibraryInfo.h:91
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:1688
llvm::TargetLibraryInfoImpl::getLibFunc
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
Definition: TargetLibraryInfo.cpp:683
llvm::AttributeSet
Definition: Attributes.h:254
llvm::TargetLibraryInfoImpl::NoLibrary
@ NoLibrary
Definition: TargetLibraryInfo.h:89
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:1164
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:406
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:99
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:326
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:300
llvm::TargetLibraryInfoImpl::VectorLibrary
VectorLibrary
List of known vector-functions libraries.
Definition: TargetLibraryInfo.h:88
llvm::TargetLibraryInfoImpl::TargetLibraryInfoImpl
TargetLibraryInfoImpl()
Definition: TargetLibraryInfo.cpp:619
llvm::TargetLibraryAnalysis
Analysis pass providing the TargetLibraryInfo.
Definition: TargetLibraryInfo.h:421
llvm::TargetLibraryInfo::getVectorizedFunction
StringRef getVectorizedFunction(StringRef F, const ElementCount &VF) const
Definition: TargetLibraryInfo.h:320