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