• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-c/Types.h"
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/Optional.h"
22 #include "llvm/Support/Compiler.h"
23 #include "llvm/Support/PointerLikeTypeTraits.h"
24 #include <bitset>
25 #include <cassert>
26 #include <map>
27 #include <string>
28 
29 namespace llvm {
30 
31 class AttrBuilder;
32 class AttributeImpl;
33 class AttributeSetImpl;
34 class AttributeSetNode;
35 class Constant;
36 template<typename T> struct DenseMapInfo;
37 class Function;
38 class LLVMContext;
39 class Type;
40 
41 //===----------------------------------------------------------------------===//
42 /// \class
43 /// \brief Functions, function parameters, and return types can have attributes
44 /// to indicate how they should be treated by optimizations and code
45 /// generation. This class represents one of those attributes. It's light-weight
46 /// and should be passed around by-value.
47 class Attribute {
48 public:
49   /// This enumeration lists the attributes that can be associated with
50   /// parameters, function results, or the function itself.
51   ///
52   /// Note: The `uwtable' attribute is about the ABI or the user mandating an
53   /// entry in the unwind table. The `nounwind' attribute is about an exception
54   /// passing by the function.
55   ///
56   /// In a theoretical system that uses tables for profiling and SjLj for
57   /// exceptions, they would be fully independent. In a normal system that uses
58   /// tables for both, the semantics are:
59   ///
60   /// nil                = Needs an entry because an exception might pass by.
61   /// nounwind           = No need for an entry
62   /// uwtable            = Needs an entry because the ABI says so and because
63   ///                      an exception might pass by.
64   /// uwtable + nounwind = Needs an entry because the ABI says so.
65 
66   enum AttrKind {
67     // IR-Level Attributes
68     None,                  ///< No attributes have been set
69     #define GET_ATTR_ENUM
70     #include "llvm/IR/Attributes.gen"
71     EndAttrKinds           ///< Sentinal value useful for loops
72   };
73 
74 private:
75   AttributeImpl *pImpl;
Attribute(AttributeImpl * A)76   Attribute(AttributeImpl *A) : pImpl(A) {}
77 
78 public:
Attribute()79   Attribute() : pImpl(nullptr) {}
80 
81   //===--------------------------------------------------------------------===//
82   // Attribute Construction
83   //===--------------------------------------------------------------------===//
84 
85   /// \brief Return a uniquified Attribute object.
86   static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
87   static Attribute get(LLVMContext &Context, StringRef Kind,
88                        StringRef Val = StringRef());
89 
90   /// \brief Return a uniquified Attribute object that has the specific
91   /// alignment set.
92   static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align);
93   static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align);
94   static Attribute getWithDereferenceableBytes(LLVMContext &Context,
95                                               uint64_t Bytes);
96   static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context,
97                                                      uint64_t Bytes);
98   static Attribute getWithAllocSizeArgs(LLVMContext &Context,
99                                         unsigned ElemSizeArg,
100                                         const Optional<unsigned> &NumElemsArg);
101 
102   //===--------------------------------------------------------------------===//
103   // Attribute Accessors
104   //===--------------------------------------------------------------------===//
105 
106   /// \brief Return true if the attribute is an Attribute::AttrKind type.
107   bool isEnumAttribute() const;
108 
109   /// \brief Return true if the attribute is an integer attribute.
110   bool isIntAttribute() const;
111 
112   /// \brief Return true if the attribute is a string (target-dependent)
113   /// attribute.
114   bool isStringAttribute() const;
115 
116   /// \brief Return true if the attribute is present.
117   bool hasAttribute(AttrKind Val) const;
118 
119   /// \brief Return true if the target-dependent attribute is present.
120   bool hasAttribute(StringRef Val) const;
121 
122   /// \brief Return the attribute's kind as an enum (Attribute::AttrKind). This
123   /// requires the attribute to be an enum or integer attribute.
124   Attribute::AttrKind getKindAsEnum() const;
125 
126   /// \brief Return the attribute's value as an integer. This requires that the
127   /// attribute be an integer attribute.
128   uint64_t getValueAsInt() const;
129 
130   /// \brief Return the attribute's kind as a string. This requires the
131   /// attribute to be a string attribute.
132   StringRef getKindAsString() const;
133 
134   /// \brief Return the attribute's value as a string. This requires the
135   /// attribute to be a string attribute.
136   StringRef getValueAsString() const;
137 
138   /// \brief Returns the alignment field of an attribute as a byte alignment
139   /// value.
140   unsigned getAlignment() const;
141 
142   /// \brief Returns the stack alignment field of an attribute as a byte
143   /// alignment value.
144   unsigned getStackAlignment() const;
145 
146   /// \brief Returns the number of dereferenceable bytes from the
147   /// dereferenceable attribute.
148   uint64_t getDereferenceableBytes() const;
149 
150   /// \brief Returns the number of dereferenceable_or_null bytes from the
151   /// dereferenceable_or_null attribute.
152   uint64_t getDereferenceableOrNullBytes() const;
153 
154   /// Returns the argument numbers for the allocsize attribute (or pair(0, 0)
155   /// if not known).
156   std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const;
157 
158   /// \brief The Attribute is converted to a string of equivalent mnemonic. This
159   /// is, presumably, for writing out the mnemonics for the assembly writer.
160   std::string getAsString(bool InAttrGrp = false) const;
161 
162   /// \brief Equality and non-equality operators.
163   bool operator==(Attribute A) const { return pImpl == A.pImpl; }
164   bool operator!=(Attribute A) const { return pImpl != A.pImpl; }
165 
166   /// \brief Less-than operator. Useful for sorting the attributes list.
167   bool operator<(Attribute A) const;
168 
169   /// \brief Return a raw pointer that uniquely identifies this attribute.
getRawPointer()170   void *getRawPointer() const {
171     return pImpl;
172   }
173 
174   /// \brief Get an attribute from a raw pointer created by getRawPointer.
fromRawPointer(void * RawPtr)175   static Attribute fromRawPointer(void *RawPtr) {
176     return Attribute(reinterpret_cast<AttributeImpl*>(RawPtr));
177   }
178 };
179 
180 // Specialized opaque value conversions.
wrap(Attribute Attr)181 inline LLVMAttributeRef wrap(Attribute Attr) {
182   return reinterpret_cast<LLVMAttributeRef>(Attr.getRawPointer());
183 }
184 
185 // Specialized opaque value conversions.
unwrap(LLVMAttributeRef Attr)186 inline Attribute unwrap(LLVMAttributeRef Attr) {
187   return Attribute::fromRawPointer(Attr);
188 }
189 
190 //===----------------------------------------------------------------------===//
191 /// \class
192 /// \brief This class holds the attributes for a function, its return value, and
193 /// its parameters. You access the attributes for each of them via an index into
194 /// the AttributeSet object. The function attributes are at index
195 /// `AttributeSet::FunctionIndex', the return value is at index
196 /// `AttributeSet::ReturnIndex', and the attributes for the parameters start at
197 /// index `1'.
198 class AttributeSet {
199 public:
200   enum AttrIndex : unsigned {
201     ReturnIndex = 0U,
202     FunctionIndex = ~0U
203   };
204 
205 private:
206   friend class AttrBuilder;
207   friend class AttributeSetImpl;
208   friend class AttributeSetNode;
209   template <typename Ty> friend struct DenseMapInfo;
210 
211   /// \brief The attributes that we are managing. This can be null to represent
212   /// the empty attributes list.
213   AttributeSetImpl *pImpl;
214 
215   /// \brief The attributes for the specified index are returned.
216   AttributeSetNode *getAttributes(unsigned Index) const;
217 
218   /// \brief Create an AttributeSet with the specified parameters in it.
219   static AttributeSet get(LLVMContext &C,
220                           ArrayRef<std::pair<unsigned, Attribute> > Attrs);
221   static AttributeSet get(LLVMContext &C,
222                           ArrayRef<std::pair<unsigned,
223                                              AttributeSetNode*> > Attrs);
224 
225   static AttributeSet getImpl(LLVMContext &C,
226                               ArrayRef<std::pair<unsigned,
227                                                  AttributeSetNode*> > Attrs);
228 
AttributeSet(AttributeSetImpl * LI)229   explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {}
230 
231 public:
AttributeSet()232   AttributeSet() : pImpl(nullptr) {}
233 
234   //===--------------------------------------------------------------------===//
235   // AttributeSet Construction and Mutation
236   //===--------------------------------------------------------------------===//
237 
238   /// \brief Return an AttributeSet with the specified parameters in it.
239   static AttributeSet get(LLVMContext &C, ArrayRef<AttributeSet> Attrs);
240   static AttributeSet get(LLVMContext &C, unsigned Index,
241                           ArrayRef<Attribute::AttrKind> Kinds);
242   static AttributeSet get(LLVMContext &C, unsigned Index,
243                           ArrayRef<StringRef> Kind);
244   static AttributeSet get(LLVMContext &C, unsigned Index, const AttrBuilder &B);
245 
246   /// \brief Add an attribute to the attribute set at the given index. Because
247   /// attribute sets are immutable, this returns a new set.
248   AttributeSet addAttribute(LLVMContext &C, unsigned Index,
249                             Attribute::AttrKind Kind) const;
250 
251   /// \brief Add an attribute to the attribute set at the given index. Because
252   /// attribute sets are immutable, this returns a new set.
253   AttributeSet addAttribute(LLVMContext &C, unsigned Index, StringRef Kind,
254                             StringRef Value = StringRef()) const;
255 
256   /// Add an attribute to the attribute set at the given indices. Because
257   /// attribute sets are immutable, this returns a new set.
258   AttributeSet addAttribute(LLVMContext &C, ArrayRef<unsigned> Indices,
259                             Attribute A) const;
260 
261   /// \brief Add attributes to the attribute set at the given index. Because
262   /// attribute sets are immutable, this returns a new set.
263   AttributeSet addAttributes(LLVMContext &C, unsigned Index,
264                              AttributeSet Attrs) const;
265 
266   /// \brief Remove the specified attribute at the specified index from this
267   /// attribute list. Because attribute lists are immutable, this returns the
268   /// new list.
269   AttributeSet removeAttribute(LLVMContext &C, unsigned Index,
270                                Attribute::AttrKind Kind) const;
271 
272   /// \brief Remove the specified attribute at the specified index from this
273   /// attribute list. Because attribute lists are immutable, this returns the
274   /// new list.
275   AttributeSet removeAttribute(LLVMContext &C, unsigned Index,
276                                StringRef Kind) const;
277 
278   /// \brief Remove the specified attributes at the specified index from this
279   /// attribute list. Because attribute lists are immutable, this returns the
280   /// new list.
281   AttributeSet removeAttributes(LLVMContext &C, unsigned Index,
282                                 AttributeSet Attrs) const;
283 
284   /// \brief Remove the specified attributes at the specified index from this
285   /// attribute list. Because attribute lists are immutable, this returns the
286   /// new list.
287   AttributeSet removeAttributes(LLVMContext &C, unsigned Index,
288                                 const AttrBuilder &Attrs) const;
289 
290   /// \brief Add the dereferenceable attribute to the attribute set at the given
291   /// index. Because attribute sets are immutable, this returns a new set.
292   AttributeSet addDereferenceableAttr(LLVMContext &C, unsigned Index,
293                                       uint64_t Bytes) const;
294 
295   /// \brief Add the dereferenceable_or_null attribute to the attribute set at
296   /// the given index. Because attribute sets are immutable, this returns a new
297   /// set.
298   AttributeSet addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index,
299                                             uint64_t Bytes) const;
300 
301   /// Add the allocsize attribute to the attribute set at the given index.
302   /// Because attribute sets are immutable, this returns a new set.
303   AttributeSet addAllocSizeAttr(LLVMContext &C, unsigned Index,
304                                 unsigned ElemSizeArg,
305                                 const Optional<unsigned> &NumElemsArg);
306 
307   //===--------------------------------------------------------------------===//
308   // AttributeSet Accessors
309   //===--------------------------------------------------------------------===//
310 
311   /// \brief Retrieve the LLVM context.
312   LLVMContext &getContext() const;
313 
314   /// \brief The attributes for the specified index are returned.
315   AttributeSet getParamAttributes(unsigned Index) const;
316 
317   /// \brief The attributes for the ret value are returned.
318   AttributeSet getRetAttributes() const;
319 
320   /// \brief The function attributes are returned.
321   AttributeSet getFnAttributes() const;
322 
323   /// \brief Return true if the attribute exists at the given index.
324   bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const;
325 
326   /// \brief Return true if the attribute exists at the given index.
327   bool hasAttribute(unsigned Index, StringRef Kind) const;
328 
329   /// \brief Return true if attribute exists at the given index.
330   bool hasAttributes(unsigned Index) const;
331 
332   /// \brief Equivalent to hasAttribute(AttributeSet::FunctionIndex, Kind) but
333   /// may be faster.
334   bool hasFnAttribute(Attribute::AttrKind Kind) const;
335 
336   /// \brief Equivalent to hasAttribute(AttributeSet::FunctionIndex, Kind) but
337   /// may be faster.
338   bool hasFnAttribute(StringRef Kind) const;
339 
340   /// \brief Return true if the specified attribute is set for at least one
341   /// parameter or for the return value. If Index is not nullptr, the index
342   /// of a parameter with the specified attribute is provided.
343   bool hasAttrSomewhere(Attribute::AttrKind Kind,
344                         unsigned *Index = nullptr) const;
345 
346   /// \brief Return the attribute object that exists at the given index.
347   Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const;
348 
349   /// \brief Return the attribute object that exists at the given index.
350   Attribute getAttribute(unsigned Index, StringRef Kind) const;
351 
352   /// \brief Return the alignment for the specified function parameter.
353   unsigned getParamAlignment(unsigned Index) const;
354 
355   /// \brief Get the stack alignment.
356   unsigned getStackAlignment(unsigned Index) const;
357 
358   /// \brief Get the number of dereferenceable bytes (or zero if unknown).
359   uint64_t getDereferenceableBytes(unsigned Index) const;
360 
361   /// \brief Get the number of dereferenceable_or_null bytes (or zero if
362   /// unknown).
363   uint64_t getDereferenceableOrNullBytes(unsigned Index) const;
364 
365   /// Get the allocsize argument numbers (or pair(0, 0) if unknown).
366   std::pair<unsigned, Optional<unsigned>>
367   getAllocSizeArgs(unsigned Index) const;
368 
369   /// \brief Return the attributes at the index as a string.
370   std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
371 
372   typedef ArrayRef<Attribute>::iterator iterator;
373 
374   iterator begin(unsigned Slot) const;
375   iterator end(unsigned Slot) const;
376 
377   /// operator==/!= - Provide equality predicates.
378   bool operator==(const AttributeSet &RHS) const {
379     return pImpl == RHS.pImpl;
380   }
381   bool operator!=(const AttributeSet &RHS) const {
382     return pImpl != RHS.pImpl;
383   }
384 
385   //===--------------------------------------------------------------------===//
386   // AttributeSet Introspection
387   //===--------------------------------------------------------------------===//
388 
389   /// \brief Return a raw pointer that uniquely identifies this attribute list.
getRawPointer()390   void *getRawPointer() const {
391     return pImpl;
392   }
393 
394   /// \brief Return true if there are no attributes.
isEmpty()395   bool isEmpty() const {
396     return getNumSlots() == 0;
397   }
398 
399   /// \brief Return the number of slots used in this attribute list.  This is
400   /// the number of arguments that have an attribute set on them (including the
401   /// function itself).
402   unsigned getNumSlots() const;
403 
404   /// \brief Return the index for the given slot.
405   unsigned getSlotIndex(unsigned Slot) const;
406 
407   /// \brief Return the attributes at the given slot.
408   AttributeSet getSlotAttributes(unsigned Slot) const;
409 
410   void dump() const;
411 };
412 
413 //===----------------------------------------------------------------------===//
414 /// \class
415 /// \brief Provide DenseMapInfo for AttributeSet.
416 template<> struct DenseMapInfo<AttributeSet> {
417   static inline AttributeSet getEmptyKey() {
418     uintptr_t Val = static_cast<uintptr_t>(-1);
419     Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
420     return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
421   }
422   static inline AttributeSet getTombstoneKey() {
423     uintptr_t Val = static_cast<uintptr_t>(-2);
424     Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
425     return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
426   }
427   static unsigned getHashValue(AttributeSet AS) {
428     return (unsigned((uintptr_t)AS.pImpl) >> 4) ^
429            (unsigned((uintptr_t)AS.pImpl) >> 9);
430   }
431   static bool isEqual(AttributeSet LHS, AttributeSet RHS) { return LHS == RHS; }
432 };
433 
434 //===----------------------------------------------------------------------===//
435 /// \class
436 /// \brief This class is used in conjunction with the Attribute::get method to
437 /// create an Attribute object. The object itself is uniquified. The Builder's
438 /// value, however, is not. So this can be used as a quick way to test for
439 /// equality, presence of attributes, etc.
440 class AttrBuilder {
441   std::bitset<Attribute::EndAttrKinds> Attrs;
442   std::map<std::string, std::string> TargetDepAttrs;
443   uint64_t Alignment;
444   uint64_t StackAlignment;
445   uint64_t DerefBytes;
446   uint64_t DerefOrNullBytes;
447   uint64_t AllocSizeArgs;
448 
449 public:
450   AttrBuilder()
451       : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
452         DerefOrNullBytes(0), AllocSizeArgs(0) {}
453   AttrBuilder(const Attribute &A)
454       : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
455         DerefOrNullBytes(0), AllocSizeArgs(0) {
456     addAttribute(A);
457   }
458   AttrBuilder(AttributeSet AS, unsigned Idx);
459 
460   void clear();
461 
462   /// \brief Add an attribute to the builder.
463   AttrBuilder &addAttribute(Attribute::AttrKind Val);
464 
465   /// \brief Add the Attribute object to the builder.
466   AttrBuilder &addAttribute(Attribute A);
467 
468   /// \brief Add the target-dependent attribute to the builder.
469   AttrBuilder &addAttribute(StringRef A, StringRef V = StringRef());
470 
471   /// \brief Remove an attribute from the builder.
472   AttrBuilder &removeAttribute(Attribute::AttrKind Val);
473 
474   /// \brief Remove the attributes from the builder.
475   AttrBuilder &removeAttributes(AttributeSet A, uint64_t Index);
476 
477   /// \brief Remove the target-dependent attribute to the builder.
478   AttrBuilder &removeAttribute(StringRef A);
479 
480   /// \brief Add the attributes from the builder.
481   AttrBuilder &merge(const AttrBuilder &B);
482 
483   /// \brief Remove the attributes from the builder.
484   AttrBuilder &remove(const AttrBuilder &B);
485 
486   /// \brief Return true if the builder has any attribute that's in the
487   /// specified builder.
488   bool overlaps(const AttrBuilder &B) const;
489 
490   /// \brief Return true if the builder has the specified attribute.
491   bool contains(Attribute::AttrKind A) const {
492     assert((unsigned)A < Attribute::EndAttrKinds && "Attribute out of range!");
493     return Attrs[A];
494   }
495 
496   /// \brief Return true if the builder has the specified target-dependent
497   /// attribute.
498   bool contains(StringRef A) const;
499 
500   /// \brief Return true if the builder has IR-level attributes.
501   bool hasAttributes() const;
502 
503   /// \brief Return true if the builder has any attribute that's in the
504   /// specified attribute.
505   bool hasAttributes(AttributeSet A, uint64_t Index) const;
506 
507   /// \brief Return true if the builder has an alignment attribute.
508   bool hasAlignmentAttr() const;
509 
510   /// \brief Retrieve the alignment attribute, if it exists.
511   uint64_t getAlignment() const { return Alignment; }
512 
513   /// \brief Retrieve the stack alignment attribute, if it exists.
514   uint64_t getStackAlignment() const { return StackAlignment; }
515 
516   /// \brief Retrieve the number of dereferenceable bytes, if the
517   /// dereferenceable attribute exists (zero is returned otherwise).
518   uint64_t getDereferenceableBytes() const { return DerefBytes; }
519 
520   /// \brief Retrieve the number of dereferenceable_or_null bytes, if the
521   /// dereferenceable_or_null attribute exists (zero is returned otherwise).
522   uint64_t getDereferenceableOrNullBytes() const { return DerefOrNullBytes; }
523 
524   /// Retrieve the allocsize args, if the allocsize attribute exists.  If it
525   /// doesn't exist, pair(0, 0) is returned.
526   std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const;
527 
528   /// \brief This turns an int alignment (which must be a power of 2) into the
529   /// form used internally in Attribute.
530   AttrBuilder &addAlignmentAttr(unsigned Align);
531 
532   /// \brief This turns an int stack alignment (which must be a power of 2) into
533   /// the form used internally in Attribute.
534   AttrBuilder &addStackAlignmentAttr(unsigned Align);
535 
536   /// \brief This turns the number of dereferenceable bytes into the form used
537   /// internally in Attribute.
538   AttrBuilder &addDereferenceableAttr(uint64_t Bytes);
539 
540   /// \brief This turns the number of dereferenceable_or_null bytes into the
541   /// form used internally in Attribute.
542   AttrBuilder &addDereferenceableOrNullAttr(uint64_t Bytes);
543 
544   /// This turns one (or two) ints into the form used internally in Attribute.
545   AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg,
546                                 const Optional<unsigned> &NumElemsArg);
547 
548   /// Add an allocsize attribute, using the representation returned by
549   /// Attribute.getIntValue().
550   AttrBuilder &addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr);
551 
552   /// \brief Return true if the builder contains no target-independent
553   /// attributes.
554   bool empty() const { return Attrs.none(); }
555 
556   // Iterators for target-dependent attributes.
557   typedef std::pair<std::string, std::string>                td_type;
558   typedef std::map<std::string, std::string>::iterator       td_iterator;
559   typedef std::map<std::string, std::string>::const_iterator td_const_iterator;
560   typedef llvm::iterator_range<td_iterator>                  td_range;
561   typedef llvm::iterator_range<td_const_iterator>            td_const_range;
562 
563   td_iterator td_begin()             { return TargetDepAttrs.begin(); }
564   td_iterator td_end()               { return TargetDepAttrs.end(); }
565 
566   td_const_iterator td_begin() const { return TargetDepAttrs.begin(); }
567   td_const_iterator td_end() const   { return TargetDepAttrs.end(); }
568 
569   td_range td_attrs() { return td_range(td_begin(), td_end()); }
570   td_const_range td_attrs() const {
571     return td_const_range(td_begin(), td_end());
572   }
573 
574   bool td_empty() const              { return TargetDepAttrs.empty(); }
575 
576   bool operator==(const AttrBuilder &B);
577   bool operator!=(const AttrBuilder &B) {
578     return !(*this == B);
579   }
580 };
581 
582 namespace AttributeFuncs {
583 
584 /// \brief Which attributes cannot be applied to a type.
585 AttrBuilder typeIncompatible(Type *Ty);
586 
587 /// \returns Return true if the two functions have compatible target-independent
588 /// attributes for inlining purposes.
589 bool areInlineCompatible(const Function &Caller, const Function &Callee);
590 
591 /// \brief Merge caller's and callee's attributes.
592 void mergeAttributesForInlining(Function &Caller, const Function &Callee);
593 
594 } // end AttributeFuncs namespace
595 
596 } // end llvm namespace
597 
598 #endif
599