LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Attributes.h
Go to the documentation of this file.
1 //===-- llvm/Attributes.h - Container for Attributes ------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief This file contains the simple types necessary to represent the
12 /// attributes associated with functions and their calls.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_IR_ATTRIBUTES_H
17 #define LLVM_IR_ATTRIBUTES_H
18 
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/FoldingSet.h"
21 #include "llvm/Support/Compiler.h"
23 #include <bitset>
24 #include <cassert>
25 #include <map>
26 #include <string>
27 
28 namespace llvm {
29 
30 class AttrBuilder;
31 class AttributeImpl;
32 class AttributeSetImpl;
33 class AttributeSetNode;
34 class Constant;
35 template<typename T> struct DenseMapInfo;
36 class LLVMContext;
37 class Type;
38 
39 //===----------------------------------------------------------------------===//
40 /// \class
41 /// \brief Functions, function parameters, and return types can have attributes
42 /// to indicate how they should be treated by optimizations and code
43 /// generation. This class represents one of those attributes. It's light-weight
44 /// and should be passed around by-value.
45 class Attribute {
46 public:
47  /// This enumeration lists the attributes that can be associated with
48  /// parameters, function results, or the function itself.
49  ///
50  /// Note: The `uwtable' attribute is about the ABI or the user mandating an
51  /// entry in the unwind table. The `nounwind' attribute is about an exception
52  /// passing by the function.
53  ///
54  /// In a theoretical system that uses tables for profiling and SjLj for
55  /// exceptions, they would be fully independent. In a normal system that uses
56  /// tables for both, the semantics are:
57  ///
58  /// nil = Needs an entry because an exception might pass by.
59  /// nounwind = No need for an entry
60  /// uwtable = Needs an entry because the ABI says so and because
61  /// an exception might pass by.
62  /// uwtable + nounwind = Needs an entry because the ABI says so.
63 
64  enum AttrKind {
65  // IR-Level Attributes
66  None, ///< No attributes have been set
67  Alignment, ///< Alignment of parameter (5 bits)
68  ///< stored as log2 of alignment with +1 bias
69  ///< 0 means unaligned (different from align(1))
70  AlwaysInline, ///< inline=always
71  Builtin, ///< Callee is recognized as a builtin, despite
72  ///< nobuiltin attribute on its declaration.
73  ByVal, ///< Pass structure by value
74  Cold, ///< Marks function as being in a cold path.
75  InlineHint, ///< Source said inlining was desirable
76  InReg, ///< Force argument to be passed in register
77  MinSize, ///< Function must be optimized for size first
78  Naked, ///< Naked function
79  Nest, ///< Nested function static chain
80  NoAlias, ///< Considered to not alias after call
81  NoBuiltin, ///< Callee isn't recognized as a builtin
82  NoCapture, ///< Function creates no aliases of pointer
83  NoDuplicate, ///< Call cannot be duplicated
84  NoImplicitFloat, ///< Disable implicit floating point insts
85  NoInline, ///< inline=never
86  NonLazyBind, ///< Function is called early and/or
87  ///< often, so lazy binding isn't worthwhile
88  NoRedZone, ///< Disable redzone
89  NoReturn, ///< Mark the function as not returning
90  NoUnwind, ///< Function doesn't unwind stack
91  OptimizeForSize, ///< opt_size
92  OptimizeNone, ///< Function must not be optimized.
93  ReadNone, ///< Function does not access memory
94  ReadOnly, ///< Function only reads from memory
95  Returned, ///< Return value is always equal to this argument
96  ReturnsTwice, ///< Function can return twice
97  SExt, ///< Sign extended before/after call
98  StackAlignment, ///< Alignment of stack for function (3 bits)
99  ///< stored as log2 of alignment with +1 bias 0
100  ///< means unaligned (different from
101  ///< alignstack=(1))
102  StackProtect, ///< Stack protection.
103  StackProtectReq, ///< Stack protection required.
104  StackProtectStrong, ///< Strong Stack protection.
105  StructRet, ///< Hidden pointer to structure to return
106  SanitizeAddress, ///< AddressSanitizer is on.
107  SanitizeThread, ///< ThreadSanitizer is on.
108  SanitizeMemory, ///< MemorySanitizer is on.
109  UWTable, ///< Function must be in a unwind table
110  ZExt, ///< Zero extended before/after call
111 
112  EndAttrKinds ///< Sentinal value useful for loops
113  };
114 private:
115  AttributeImpl *pImpl;
116  Attribute(AttributeImpl *A) : pImpl(A) {}
117 public:
118  Attribute() : pImpl(0) {}
119 
120  //===--------------------------------------------------------------------===//
121  // Attribute Construction
122  //===--------------------------------------------------------------------===//
123 
124  /// \brief Return a uniquified Attribute object.
125  static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
126  static Attribute get(LLVMContext &Context, StringRef Kind,
127  StringRef Val = StringRef());
128 
129  /// \brief Return a uniquified Attribute object that has the specific
130  /// alignment set.
131  static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align);
132  static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align);
133 
134  //===--------------------------------------------------------------------===//
135  // Attribute Accessors
136  //===--------------------------------------------------------------------===//
137 
138  /// \brief Return true if the attribute is an Attribute::AttrKind type.
139  bool isEnumAttribute() const;
140 
141  /// \brief Return true if the attribute is an alignment attribute.
142  bool isAlignAttribute() const;
143 
144  /// \brief Return true if the attribute is a string (target-dependent)
145  /// attribute.
146  bool isStringAttribute() const;
147 
148  /// \brief Return true if the attribute is present.
149  bool hasAttribute(AttrKind Val) const;
150 
151  /// \brief Return true if the target-dependent attribute is present.
152  bool hasAttribute(StringRef Val) const;
153 
154  /// \brief Return the attribute's kind as an enum (Attribute::AttrKind). This
155  /// requires the attribute to be an enum or alignment attribute.
157 
158  /// \brief Return the attribute's value as an integer. This requires that the
159  /// attribute be an alignment attribute.
160  uint64_t getValueAsInt() const;
161 
162  /// \brief Return the attribute's kind as a string. This requires the
163  /// attribute to be a string attribute.
164  StringRef getKindAsString() const;
165 
166  /// \brief Return the attribute's value as a string. This requires the
167  /// attribute to be a string attribute.
168  StringRef getValueAsString() const;
169 
170  /// \brief Returns the alignment field of an attribute as a byte alignment
171  /// value.
172  unsigned getAlignment() const;
173 
174  /// \brief Returns the stack alignment field of an attribute as a byte
175  /// alignment value.
176  unsigned getStackAlignment() const;
177 
178  /// \brief The Attribute is converted to a string of equivalent mnemonic. This
179  /// is, presumably, for writing out the mnemonics for the assembly writer.
180  std::string getAsString(bool InAttrGrp = false) const;
181 
182  /// \brief Equality and non-equality operators.
183  bool operator==(Attribute A) const { return pImpl == A.pImpl; }
184  bool operator!=(Attribute A) const { return pImpl != A.pImpl; }
185 
186  /// \brief Less-than operator. Useful for sorting the attributes list.
187  bool operator<(Attribute A) const;
188 
189  void Profile(FoldingSetNodeID &ID) const {
190  ID.AddPointer(pImpl);
191  }
192 };
193 
194 //===----------------------------------------------------------------------===//
195 /// \class
196 /// \brief This class holds the attributes for a function, its return value, and
197 /// its parameters. You access the attributes for each of them via an index into
198 /// the AttributeSet object. The function attributes are at index
199 /// `AttributeSet::FunctionIndex', the return value is at index
200 /// `AttributeSet::ReturnIndex', and the attributes for the parameters start at
201 /// index `1'.
203 public:
204  enum AttrIndex LLVM_ENUM_INT_TYPE(unsigned) {
205  ReturnIndex = 0U,
206  FunctionIndex = ~0U
207  };
208 private:
209  friend class AttrBuilder;
210  friend class AttributeSetImpl;
211  template <typename Ty> friend struct DenseMapInfo;
212 
213  /// \brief The attributes that we are managing. This can be null to represent
214  /// the empty attributes list.
215  AttributeSetImpl *pImpl;
216 
217  /// \brief The attributes for the specified index are returned.
218  AttributeSetNode *getAttributes(unsigned Index) const;
219 
220  /// \brief Create an AttributeSet with the specified parameters in it.
221  static AttributeSet get(LLVMContext &C,
223  static AttributeSet get(LLVMContext &C,
224  ArrayRef<std::pair<unsigned,
225  AttributeSetNode*> > Attrs);
226 
227  static AttributeSet getImpl(LLVMContext &C,
228  ArrayRef<std::pair<unsigned,
229  AttributeSetNode*> > Attrs);
230 
231 
232  explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {}
233 public:
234  AttributeSet() : pImpl(0) {}
235 
236  //===--------------------------------------------------------------------===//
237  // AttributeSet Construction and Mutation
238  //===--------------------------------------------------------------------===//
239 
240  /// \brief Return an AttributeSet with the specified parameters in it.
241  static AttributeSet get(LLVMContext &C, ArrayRef<AttributeSet> Attrs);
242  static AttributeSet get(LLVMContext &C, unsigned Index,
244  static AttributeSet get(LLVMContext &C, unsigned Index, AttrBuilder &B);
245 
246  /// \brief Add an attribute to the attribute set at the given index. Since
247  /// attribute sets are immutable, this returns a new set.
248  AttributeSet addAttribute(LLVMContext &C, unsigned Index,
249  Attribute::AttrKind Attr) const;
250 
251  /// \brief Add an attribute to the attribute set at the given index. Since
252  /// attribute sets are immutable, this returns a new set.
253  AttributeSet addAttribute(LLVMContext &C, unsigned Index,
254  StringRef Kind) const;
255  AttributeSet addAttribute(LLVMContext &C, unsigned Index,
256  StringRef Kind, StringRef Value) const;
257 
258  /// \brief Add attributes to the attribute set at the given index. Since
259  /// attribute sets are immutable, this returns a new set.
260  AttributeSet addAttributes(LLVMContext &C, unsigned Index,
261  AttributeSet Attrs) const;
262 
263  /// \brief Remove the specified attribute at the specified index from this
264  /// attribute list. Since attribute lists are immutable, this returns the new
265  /// list.
266  AttributeSet removeAttribute(LLVMContext &C, unsigned Index,
267  Attribute::AttrKind Attr) const;
268 
269  /// \brief Remove the specified attributes at the specified index from this
270  /// attribute list. Since attribute lists are immutable, this returns the new
271  /// list.
272  AttributeSet removeAttributes(LLVMContext &C, unsigned Index,
273  AttributeSet Attrs) const;
274 
275  //===--------------------------------------------------------------------===//
276  // AttributeSet Accessors
277  //===--------------------------------------------------------------------===//
278 
279  /// \brief Retrieve the LLVM context.
280  LLVMContext &getContext() const;
281 
282  /// \brief The attributes for the specified index are returned.
283  AttributeSet getParamAttributes(unsigned Index) const;
284 
285  /// \brief The attributes for the ret value are returned.
287 
288  /// \brief The function attributes are returned.
290 
291  /// \brief Return true if the attribute exists at the given index.
292  bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const;
293 
294  /// \brief Return true if the attribute exists at the given index.
295  bool hasAttribute(unsigned Index, StringRef Kind) const;
296 
297  /// \brief Return true if attribute exists at the given index.
298  bool hasAttributes(unsigned Index) const;
299 
300  /// \brief Return true if the specified attribute is set for at least one
301  /// parameter or for the return value.
302  bool hasAttrSomewhere(Attribute::AttrKind Attr) const;
303 
304  /// \brief Return the attribute object that exists at the given index.
305  Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const;
306 
307  /// \brief Return the attribute object that exists at the given index.
308  Attribute getAttribute(unsigned Index, StringRef Kind) const;
309 
310  /// \brief Return the alignment for the specified function parameter.
311  unsigned getParamAlignment(unsigned Index) const;
312 
313  /// \brief Get the stack alignment.
314  unsigned getStackAlignment(unsigned Index) const;
315 
316  /// \brief Return the attributes at the index as a string.
317  std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
318 
320 
321  iterator begin(unsigned Slot) const;
322  iterator end(unsigned Slot) const;
323 
324  /// operator==/!= - Provide equality predicates.
325  bool operator==(const AttributeSet &RHS) const {
326  return pImpl == RHS.pImpl;
327  }
328  bool operator!=(const AttributeSet &RHS) const {
329  return pImpl != RHS.pImpl;
330  }
331 
332  //===--------------------------------------------------------------------===//
333  // AttributeSet Introspection
334  //===--------------------------------------------------------------------===//
335 
336  // FIXME: Remove this.
337  uint64_t Raw(unsigned Index) const;
338 
339  /// \brief Return a raw pointer that uniquely identifies this attribute list.
340  void *getRawPointer() const {
341  return pImpl;
342  }
343 
344  /// \brief Return true if there are no attributes.
345  bool isEmpty() const {
346  return getNumSlots() == 0;
347  }
348 
349  /// \brief Return the number of slots used in this attribute list. This is
350  /// the number of arguments that have an attribute set on them (including the
351  /// function itself).
352  unsigned getNumSlots() const;
353 
354  /// \brief Return the index for the given slot.
355  unsigned getSlotIndex(unsigned Slot) const;
356 
357  /// \brief Return the attributes at the given slot.
358  AttributeSet getSlotAttributes(unsigned Slot) const;
359 
360  void dump() const;
361 };
362 
363 //===----------------------------------------------------------------------===//
364 /// \class
365 /// \brief Provide DenseMapInfo for AttributeSet.
366 template<> struct DenseMapInfo<AttributeSet> {
367  static inline AttributeSet getEmptyKey() {
368  uintptr_t Val = static_cast<uintptr_t>(-1);
369  Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
370  return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
371  }
372  static inline AttributeSet getTombstoneKey() {
373  uintptr_t Val = static_cast<uintptr_t>(-2);
374  Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
375  return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
376  }
377  static unsigned getHashValue(AttributeSet AS) {
378  return (unsigned((uintptr_t)AS.pImpl) >> 4) ^
379  (unsigned((uintptr_t)AS.pImpl) >> 9);
380  }
381  static bool isEqual(AttributeSet LHS, AttributeSet RHS) { return LHS == RHS; }
382 };
383 
384 //===----------------------------------------------------------------------===//
385 /// \class
386 /// \brief This class is used in conjunction with the Attribute::get method to
387 /// create an Attribute object. The object itself is uniquified. The Builder's
388 /// value, however, is not. So this can be used as a quick way to test for
389 /// equality, presence of attributes, etc.
390 class AttrBuilder {
391  std::bitset<Attribute::EndAttrKinds> Attrs;
392  std::map<std::string, std::string> TargetDepAttrs;
393  uint64_t Alignment;
394  uint64_t StackAlignment;
395 public:
396  AttrBuilder() : Attrs(0), Alignment(0), StackAlignment(0) {}
397  explicit AttrBuilder(uint64_t Val)
398  : Attrs(0), Alignment(0), StackAlignment(0) {
399  addRawValue(Val);
400  }
401  AttrBuilder(const Attribute &A) : Attrs(0), Alignment(0), StackAlignment(0) {
402  addAttribute(A);
403  }
404  AttrBuilder(AttributeSet AS, unsigned Idx);
406  : Attrs(B.Attrs),
407  TargetDepAttrs(B.TargetDepAttrs.begin(), B.TargetDepAttrs.end()),
408  Alignment(B.Alignment), StackAlignment(B.StackAlignment) {}
409 
410  void clear();
411 
412  /// \brief Add an attribute to the builder.
414 
415  /// \brief Add the Attribute object to the builder.
417 
418  /// \brief Add the target-dependent attribute to the builder.
420 
421  /// \brief Remove an attribute from the builder.
423 
424  /// \brief Remove the attributes from the builder.
425  AttrBuilder &removeAttributes(AttributeSet A, uint64_t Index);
426 
427  /// \brief Remove the target-dependent attribute to the builder.
429 
430  /// \brief Add the attributes from the builder.
431  AttrBuilder &merge(const AttrBuilder &B);
432 
433  /// \brief Return true if the builder has the specified attribute.
435  assert((unsigned)A < Attribute::EndAttrKinds && "Attribute out of range!");
436  return Attrs[A];
437  }
438 
439  /// \brief Return true if the builder has the specified target-dependent
440  /// attribute.
441  bool contains(StringRef A) const;
442 
443  /// \brief Return true if the builder has IR-level attributes.
444  bool hasAttributes() const;
445 
446  /// \brief Return true if the builder has any attribute that's in the
447  /// specified attribute.
448  bool hasAttributes(AttributeSet A, uint64_t Index) const;
449 
450  /// \brief Return true if the builder has an alignment attribute.
451  bool hasAlignmentAttr() const;
452 
453  /// \brief Retrieve the alignment attribute, if it exists.
454  uint64_t getAlignment() const { return Alignment; }
455 
456  /// \brief Retrieve the stack alignment attribute, if it exists.
457  uint64_t getStackAlignment() const { return StackAlignment; }
458 
459  /// \brief This turns an int alignment (which must be a power of 2) into the
460  /// form used internally in Attribute.
462 
463  /// \brief This turns an int stack alignment (which must be a power of 2) into
464  /// the form used internally in Attribute.
466 
467  /// \brief Return true if the builder contains no target-independent
468  /// attributes.
469  bool empty() const { return Attrs.none(); }
470 
471  // Iterators for target-dependent attributes.
472  typedef std::pair<std::string, std::string> td_type;
473  typedef std::map<std::string, std::string>::iterator td_iterator;
474  typedef std::map<std::string, std::string>::const_iterator td_const_iterator;
475 
476  td_iterator td_begin() { return TargetDepAttrs.begin(); }
477  td_iterator td_end() { return TargetDepAttrs.end(); }
478 
479  td_const_iterator td_begin() const { return TargetDepAttrs.begin(); }
480  td_const_iterator td_end() const { return TargetDepAttrs.end(); }
481 
482  bool td_empty() const { return TargetDepAttrs.empty(); }
483 
484  bool operator==(const AttrBuilder &B);
485  bool operator!=(const AttrBuilder &B) {
486  return !(*this == B);
487  }
488 
489  // FIXME: Remove this in 4.0.
490 
491  /// \brief Add the raw value to the internal representation.
492  AttrBuilder &addRawValue(uint64_t Val);
493 };
494 
495 namespace AttributeFuncs {
496 
497 /// \brief Which attributes cannot be applied to a type.
498 AttributeSet typeIncompatible(Type *Ty, uint64_t Index);
499 
500 } // end AttributeFuncs namespace
501 
502 } // end llvm namespace
503 
504 #endif
void AddPointer(const void *Ptr)
Definition: FoldingSet.cpp:52
COFF::RelocationTypeX86 Type
Definition: COFFYAML.cpp:227
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:181
void * getRawPointer() const
Return a raw pointer that uniquely identifies this attribute list.
Definition: Attributes.h:340
static AttributeSet getEmptyKey()
Definition: Attributes.h:367
AttributeSet getParamAttributes(unsigned Index) const
The attributes for the specified index are returned.
Definition: Attributes.cpp:792
unsigned getStackAlignment(unsigned Index) const
Get the stack alignment.
Definition: Attributes.cpp:864
Sign extended before/after call.
Definition: Attributes.h:97
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
Definition: Attributes.cpp:869
enum AttrIndex LLVM_ENUM_INT_TYPE(unsigned)
Definition: Attributes.h:204
static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align)
Return a uniquified Attribute object that has the specific alignment set.
Definition: Attributes.cpp:77
Force argument to be passed in register.
Definition: Attributes.h:76
Nested function static chain.
Definition: Attributes.h:79
static unsigned getHashValue(AttributeSet AS)
Definition: Attributes.h:377
td_iterator td_end()
Definition: Attributes.h:477
uint64_t getAlignment() const
Retrieve the alignment attribute, if it exists.
Definition: Attributes.h:454
uint64_t getValueAsInt() const
Return the attribute's value as an integer. This requires that the attribute be an alignment attribut...
Definition: Attributes.cpp:113
Source said inlining was desirable.
Definition: Attributes.h:75
iterator begin(unsigned Slot) const
Definition: Attributes.cpp:887
const_iterator begin(StringRef path)
Get begin iterator over path.
Definition: Path.cpp:173
unsigned getParamAlignment(unsigned Index) const
Return the alignment for the specified function parameter.
Definition: Attributes.cpp:859
unsigned getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
Definition: Attributes.cpp:144
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
Definition: Attributes.cpp:968
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
Definition: Attributes.cpp:818
bool hasAlignmentAttr() const
Return true if the builder has an alignment attribute.
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
Definition: Attributes.h:434
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
Definition: Attributes.cpp:134
Naked function.
Definition: Attributes.h:78
AttrBuilder & addRawValue(uint64_t Val)
Add the raw value to the internal representation.
LoopInfoBase< BlockT, LoopT > * LI
Definition: LoopInfoImpl.h:411
AttributeSet getRetAttributes() const
The attributes for the ret value are returned.
Definition: Attributes.cpp:800
bool td_empty() const
Definition: Attributes.h:482
StringRef getKindAsString() const
Return the attribute's kind as a string. This requires the attribute to be a string attribute...
Definition: Attributes.cpp:120
AttributeSet removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Attr) const
Remove the specified attribute at the specified index from this attribute list. Since attribute lists...
Definition: Attributes.cpp:733
std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic. This is, presumably, for writing out the mnemonics for the assembly writer.
Definition: Attributes.cpp:158
No attributes have been set.
Definition: Attributes.h:66
Function must be in a unwind table.
Definition: Attributes.h:109
ID
LLVM Calling Convention Representation.
Definition: CallingConv.h:26
AttributeSet typeIncompatible(Type *Ty, uint64_t Index)
Which attributes cannot be applied to a type.
Function does not access memory.
Definition: Attributes.h:93
Hidden pointer to structure to return.
Definition: Attributes.h:105
Function creates no aliases of pointer.
Definition: Attributes.h:82
td_const_iterator td_begin() const
Definition: Attributes.h:479
std::map< std::string, std::string >::iterator td_iterator
Definition: Attributes.h:473
static AttributeSet getTombstoneKey()
Definition: Attributes.h:372
unsigned getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
Definition: Attributes.cpp:152
Pass structure by value.
Definition: Attributes.h:73
Stack protection.
Definition: Attributes.h:102
Considered to not alias after call.
Definition: Attributes.h:80
static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align)
Definition: Attributes.cpp:83
bool isAlignAttribute() const
Return true if the attribute is an alignment attribute.
Definition: Attributes.cpp:98
std::pair< std::string, std::string > td_type
Definition: Attributes.h:472
unsigned getNumSlots() const
Return the number of slots used in this attribute list. This is the number of arguments that have an ...
Definition: Attributes.cpp:906
bool operator==(const AttrBuilder &B)
AttributeSet getSlotAttributes(unsigned Slot) const
Return the attributes at the given slot.
Definition: Attributes.cpp:916
bool operator!=(const AttrBuilder &B)
Definition: Attributes.h:485
Return value is always equal to this argument.
Definition: Attributes.h:95
td_iterator td_begin()
Definition: Attributes.h:476
Zero extended before/after call.
Definition: Attributes.h:110
Function doesn't unwind stack.
Definition: Attributes.h:90
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
Definition: Attributes.cpp:94
bool operator==(Attribute A) const
Equality and non-equality operators.
Definition: Attributes.h:183
Marks function as being in a cold path.
Definition: Attributes.h:74
Sentinal value useful for loops.
Definition: Attributes.h:112
Mark the function as not returning.
Definition: Attributes.h:89
void dump() const
Definition: Attributes.cpp:927
Call cannot be duplicated.
Definition: Attributes.h:83
LLVMContext & getContext() const
Retrieve the LLVM context.
Definition: Attributes.cpp:788
AttrBuilder(const AttrBuilder &B)
Definition: Attributes.h:405
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
Definition: Attributes.cpp:997
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind). This requires the attribute to be an en...
Definition: Attributes.cpp:106
iterator end(unsigned Slot) const
Definition: Attributes.cpp:893
void Profile(FoldingSetNodeID &ID) const
Definition: Attributes.h:189
bool empty() const
Return true if the builder contains no target-independent attributes.
Definition: Attributes.h:469
AttrBuilder(const Attribute &A)
Definition: Attributes.h:401
AttributeSet removeAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Remove the specified attributes at the specified index from this attribute list. Since attribute list...
Definition: Attributes.cpp:739
Function must not be optimized.
Definition: Attributes.h:92
Function only reads from memory.
Definition: Attributes.h:94
std::map< std::string, std::string >::const_iterator td_const_iterator
Definition: Attributes.h:474
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(DefaultAlign), cl::values(clEnumValN(DefaultAlign,"arm-default-align","Generate unaligned accesses only on hardware/OS ""combinations that are known to support them"), clEnumValN(StrictAlign,"arm-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"arm-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
Definition: Attributes.cpp:278
bool operator==(const AttributeSet &RHS) const
operator==/!= - Provide equality predicates.
Definition: Attributes.h:325
Disable redzone.
Definition: Attributes.h:88
ThreadSanitizer is on.
Definition: Attributes.h:107
AttributeSet addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Attr) const
Add an attribute to the attribute set at the given index. Since attribute sets are immutable...
Definition: Attributes.cpp:664
unsigned getSlotIndex(unsigned Slot) const
Return the index for the given slot.
Definition: Attributes.cpp:910
bool hasAttrSomewhere(Attribute::AttrKind Attr) const
Return true if the specified attribute is set for at least one parameter or for the return value...
Definition: Attributes.cpp:835
bool hasAttributes(unsigned Index) const
Return true if attribute exists at the given index.
Definition: Attributes.cpp:828
Callee isn't recognized as a builtin.
Definition: Attributes.h:81
AttrBuilder(uint64_t Val)
Definition: Attributes.h:397
ArrayRef< Attribute >::iterator iterator
Definition: Attributes.h:319
AddressSanitizer is on.
Definition: Attributes.h:106
Strong Stack protection.
Definition: Attributes.h:104
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
Definition: Attributes.cpp:102
AttributeSet getAttributes(LLVMContext &C, ID id)
AttrBuilder & removeAttributes(AttributeSet A, uint64_t Index)
Remove the attributes from the builder.
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
Definition: Attributes.cpp:847
AttrBuilder & merge(const AttrBuilder &B)
Add the attributes from the builder.
StringRef getValueAsString() const
Return the attribute's value as a string. This requires the attribute to be a string attribute...
Definition: Attributes.cpp:127
Function can return twice.
Definition: Attributes.h:96
LLVM Value Representation.
Definition: Value.h:66
uint64_t Raw(unsigned Index) const
Definition: Attributes.cpp:922
bool hasAttributes() const
Return true if the builder has IR-level attributes.
Disable implicit floating point insts.
Definition: Attributes.h:84
AttrBuilder & addStackAlignmentAttr(unsigned Align)
This turns an int stack alignment (which must be a power of 2) into the form used internally in Attri...
AttrBuilder & addAlignmentAttr(unsigned Align)
This turns an int alignment (which must be a power of 2) into the form used internally in Attribute...
bool operator!=(Attribute A) const
Definition: Attributes.h:184
static bool isEqual(AttributeSet LHS, AttributeSet RHS)
Definition: Attributes.h:381
AttributeSet addAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Add attributes to the attribute set at the given index. Since attribute sets are immutable, this returns a new set.
Definition: Attributes.cpp:684
Stack protection required.
Definition: Attributes.h:103
td_const_iterator td_end() const
Definition: Attributes.h:480
MemorySanitizer is on.
Definition: Attributes.h:108
bool isEmpty() const
Return true if there are no attributes.
Definition: Attributes.h:345
uint64_t getStackAlignment() const
Retrieve the stack alignment attribute, if it exists.
Definition: Attributes.h:457
AttributeSet getFnAttributes() const
The function attributes are returned.
Definition: Attributes.cpp:809
bool operator!=(const AttributeSet &RHS) const
Definition: Attributes.h:328
Function must be optimized for size first.
Definition: Attributes.h:77