LLVM  mainline
Attributes.h
Go to the documentation of this file.
00001 //===-- llvm/Attributes.h - Container for Attributes ------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 ///
00010 /// \file
00011 /// \brief This file contains the simple types necessary to represent the
00012 /// attributes associated with functions and their calls.
00013 ///
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef LLVM_IR_ATTRIBUTES_H
00017 #define LLVM_IR_ATTRIBUTES_H
00018 
00019 #include "llvm/ADT/ArrayRef.h"
00020 #include "llvm/ADT/FoldingSet.h"
00021 #include "llvm/Support/Compiler.h"
00022 #include "llvm/Support/PointerLikeTypeTraits.h"
00023 #include <bitset>
00024 #include <cassert>
00025 #include <map>
00026 #include <string>
00027 
00028 namespace llvm {
00029 
00030 class AttrBuilder;
00031 class AttributeImpl;
00032 class AttributeSetImpl;
00033 class AttributeSetNode;
00034 class Constant;
00035 template<typename T> struct DenseMapInfo;
00036 class LLVMContext;
00037 class Type;
00038 
00039 //===----------------------------------------------------------------------===//
00040 /// \class
00041 /// \brief Functions, function parameters, and return types can have attributes
00042 /// to indicate how they should be treated by optimizations and code
00043 /// generation. This class represents one of those attributes. It's light-weight
00044 /// and should be passed around by-value.
00045 class Attribute {
00046 public:
00047   /// This enumeration lists the attributes that can be associated with
00048   /// parameters, function results, or the function itself.
00049   ///
00050   /// Note: The `uwtable' attribute is about the ABI or the user mandating an
00051   /// entry in the unwind table. The `nounwind' attribute is about an exception
00052   /// passing by the function.
00053   ///
00054   /// In a theoretical system that uses tables for profiling and SjLj for
00055   /// exceptions, they would be fully independent. In a normal system that uses
00056   /// tables for both, the semantics are:
00057   ///
00058   /// nil                = Needs an entry because an exception might pass by.
00059   /// nounwind           = No need for an entry
00060   /// uwtable            = Needs an entry because the ABI says so and because
00061   ///                      an exception might pass by.
00062   /// uwtable + nounwind = Needs an entry because the ABI says so.
00063 
00064   enum AttrKind {
00065     // IR-Level Attributes
00066     None,                  ///< No attributes have been set
00067     Alignment,             ///< Alignment of parameter (5 bits)
00068                            ///< stored as log2 of alignment with +1 bias
00069                            ///< 0 means unaligned (different from align(1))
00070     AlwaysInline,          ///< inline=always
00071     Builtin,               ///< Callee is recognized as a builtin, despite
00072                            ///< nobuiltin attribute on its declaration.
00073     ByVal,                 ///< Pass structure by value
00074     InAlloca,              ///< Pass structure in an alloca
00075     Cold,                  ///< Marks function as being in a cold path.
00076     Convergent,            ///< Can only be moved to control-equivalent blocks
00077     InlineHint,            ///< Source said inlining was desirable
00078     InReg,                 ///< Force argument to be passed in register
00079     JumpTable,             ///< Build jump-instruction tables and replace refs.
00080     MinSize,               ///< Function must be optimized for size first
00081     Naked,                 ///< Naked function
00082     Nest,                  ///< Nested function static chain
00083     NoAlias,               ///< Considered to not alias after call
00084     NoBuiltin,             ///< Callee isn't recognized as a builtin
00085     NoCapture,             ///< Function creates no aliases of pointer
00086     NoDuplicate,           ///< Call cannot be duplicated
00087     NoImplicitFloat,       ///< Disable implicit floating point insts
00088     NoInline,              ///< inline=never
00089     NonLazyBind,           ///< Function is called early and/or
00090                            ///< often, so lazy binding isn't worthwhile
00091     NonNull,               ///< Pointer is known to be not null
00092     Dereferenceable,       ///< Pointer is known to be dereferenceable
00093     DereferenceableOrNull, ///< Pointer is either null or dereferenceable
00094     NoRedZone,             ///< Disable redzone
00095     NoReturn,              ///< Mark the function as not returning
00096     NoUnwind,              ///< Function doesn't unwind stack
00097     OptimizeForSize,       ///< opt_size
00098     OptimizeNone,          ///< Function must not be optimized.
00099     ReadNone,              ///< Function does not access memory
00100     ReadOnly,              ///< Function only reads from memory
00101     Returned,              ///< Return value is always equal to this argument
00102     ReturnsTwice,          ///< Function can return twice
00103     SExt,                  ///< Sign extended before/after call
00104     StackAlignment,        ///< Alignment of stack for function (3 bits)
00105                            ///< stored as log2 of alignment with +1 bias 0
00106                            ///< means unaligned (different from
00107                            ///< alignstack=(1))
00108     StackProtect,          ///< Stack protection.
00109     StackProtectReq,       ///< Stack protection required.
00110     StackProtectStrong,    ///< Strong Stack protection.
00111     SafeStack,             ///< Safe Stack protection.
00112     StructRet,             ///< Hidden pointer to structure to return
00113     SanitizeAddress,       ///< AddressSanitizer is on.
00114     SanitizeThread,        ///< ThreadSanitizer is on.
00115     SanitizeMemory,        ///< MemorySanitizer is on.
00116     UWTable,               ///< Function must be in a unwind table
00117     ZExt,                  ///< Zero extended before/after call
00118 
00119     EndAttrKinds           ///< Sentinal value useful for loops
00120   };
00121 private:
00122   AttributeImpl *pImpl;
00123   Attribute(AttributeImpl *A) : pImpl(A) {}
00124 public:
00125   Attribute() : pImpl(nullptr) {}
00126 
00127   //===--------------------------------------------------------------------===//
00128   // Attribute Construction
00129   //===--------------------------------------------------------------------===//
00130 
00131   /// \brief Return a uniquified Attribute object.
00132   static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
00133   static Attribute get(LLVMContext &Context, StringRef Kind,
00134                        StringRef Val = StringRef());
00135 
00136   /// \brief Return a uniquified Attribute object that has the specific
00137   /// alignment set.
00138   static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align);
00139   static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align);
00140   static Attribute getWithDereferenceableBytes(LLVMContext &Context,
00141                                               uint64_t Bytes);
00142   static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context,
00143                                                      uint64_t Bytes);
00144 
00145   //===--------------------------------------------------------------------===//
00146   // Attribute Accessors
00147   //===--------------------------------------------------------------------===//
00148 
00149   /// \brief Return true if the attribute is an Attribute::AttrKind type.
00150   bool isEnumAttribute() const;
00151 
00152   /// \brief Return true if the attribute is an integer attribute.
00153   bool isIntAttribute() const;
00154 
00155   /// \brief Return true if the attribute is a string (target-dependent)
00156   /// attribute.
00157   bool isStringAttribute() const;
00158 
00159   /// \brief Return true if the attribute is present.
00160   bool hasAttribute(AttrKind Val) const;
00161 
00162   /// \brief Return true if the target-dependent attribute is present.
00163   bool hasAttribute(StringRef Val) const;
00164 
00165   /// \brief Return the attribute's kind as an enum (Attribute::AttrKind). This
00166   /// requires the attribute to be an enum or alignment attribute.
00167   Attribute::AttrKind getKindAsEnum() const;
00168 
00169   /// \brief Return the attribute's value as an integer. This requires that the
00170   /// attribute be an alignment attribute.
00171   uint64_t getValueAsInt() const;
00172 
00173   /// \brief Return the attribute's kind as a string. This requires the
00174   /// attribute to be a string attribute.
00175   StringRef getKindAsString() const;
00176 
00177   /// \brief Return the attribute's value as a string. This requires the
00178   /// attribute to be a string attribute.
00179   StringRef getValueAsString() const;
00180 
00181   /// \brief Returns the alignment field of an attribute as a byte alignment
00182   /// value.
00183   unsigned getAlignment() const;
00184 
00185   /// \brief Returns the stack alignment field of an attribute as a byte
00186   /// alignment value.
00187   unsigned getStackAlignment() const;
00188 
00189   /// \brief Returns the number of dereferenceable bytes from the
00190   /// dereferenceable attribute (or zero if unknown).
00191   uint64_t getDereferenceableBytes() const;
00192 
00193   /// \brief Returns the number of dereferenceable_or_null bytes from the
00194   /// dereferenceable_or_null attribute (or zero if unknown).
00195   uint64_t getDereferenceableOrNullBytes() const;
00196 
00197   /// \brief The Attribute is converted to a string of equivalent mnemonic. This
00198   /// is, presumably, for writing out the mnemonics for the assembly writer.
00199   std::string getAsString(bool InAttrGrp = false) const;
00200 
00201   /// \brief Equality and non-equality operators.
00202   bool operator==(Attribute A) const { return pImpl == A.pImpl; }
00203   bool operator!=(Attribute A) const { return pImpl != A.pImpl; }
00204 
00205   /// \brief Less-than operator. Useful for sorting the attributes list.
00206   bool operator<(Attribute A) const;
00207 
00208   void Profile(FoldingSetNodeID &ID) const {
00209     ID.AddPointer(pImpl);
00210   }
00211 };
00212 
00213 //===----------------------------------------------------------------------===//
00214 /// \class
00215 /// \brief This class holds the attributes for a function, its return value, and
00216 /// its parameters. You access the attributes for each of them via an index into
00217 /// the AttributeSet object. The function attributes are at index
00218 /// `AttributeSet::FunctionIndex', the return value is at index
00219 /// `AttributeSet::ReturnIndex', and the attributes for the parameters start at
00220 /// index `1'.
00221 class AttributeSet {
00222 public:
00223   enum AttrIndex : unsigned {
00224     ReturnIndex = 0U,
00225     FunctionIndex = ~0U
00226   };
00227 private:
00228   friend class AttrBuilder;
00229   friend class AttributeSetImpl;
00230   template <typename Ty> friend struct DenseMapInfo;
00231 
00232   /// \brief The attributes that we are managing. This can be null to represent
00233   /// the empty attributes list.
00234   AttributeSetImpl *pImpl;
00235 
00236   /// \brief The attributes for the specified index are returned.
00237   AttributeSetNode *getAttributes(unsigned Index) const;
00238 
00239   /// \brief Create an AttributeSet with the specified parameters in it.
00240   static AttributeSet get(LLVMContext &C,
00241                           ArrayRef<std::pair<unsigned, Attribute> > Attrs);
00242   static AttributeSet get(LLVMContext &C,
00243                           ArrayRef<std::pair<unsigned,
00244                                              AttributeSetNode*> > Attrs);
00245 
00246   static AttributeSet getImpl(LLVMContext &C,
00247                               ArrayRef<std::pair<unsigned,
00248                                                  AttributeSetNode*> > Attrs);
00249 
00250 
00251   explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {}
00252 public:
00253   AttributeSet() : pImpl(nullptr) {}
00254 
00255   //===--------------------------------------------------------------------===//
00256   // AttributeSet Construction and Mutation
00257   //===--------------------------------------------------------------------===//
00258 
00259   /// \brief Return an AttributeSet with the specified parameters in it.
00260   static AttributeSet get(LLVMContext &C, ArrayRef<AttributeSet> Attrs);
00261   static AttributeSet get(LLVMContext &C, unsigned Index,
00262                           ArrayRef<Attribute::AttrKind> Kind);
00263   static AttributeSet get(LLVMContext &C, unsigned Index, const AttrBuilder &B);
00264 
00265   /// \brief Add an attribute to the attribute set at the given index. Because
00266   /// attribute sets are immutable, this returns a new set.
00267   AttributeSet addAttribute(LLVMContext &C, unsigned Index,
00268                             Attribute::AttrKind Attr) const;
00269 
00270   /// \brief Add an attribute to the attribute set at the given index. Because
00271   /// attribute sets are immutable, this returns a new set.
00272   AttributeSet addAttribute(LLVMContext &C, unsigned Index,
00273                             StringRef Kind) const;
00274   AttributeSet addAttribute(LLVMContext &C, unsigned Index,
00275                             StringRef Kind, StringRef Value) const;
00276 
00277   /// \brief Add attributes to the attribute set at the given index. Because
00278   /// attribute sets are immutable, this returns a new set.
00279   AttributeSet addAttributes(LLVMContext &C, unsigned Index,
00280                              AttributeSet Attrs) const;
00281 
00282   /// \brief Remove the specified attribute at the specified index from this
00283   /// attribute list. Because attribute lists are immutable, this returns the
00284   /// new list.
00285   AttributeSet removeAttribute(LLVMContext &C, unsigned Index, 
00286                                Attribute::AttrKind Attr) const;
00287 
00288   /// \brief Remove the specified attributes at the specified index from this
00289   /// attribute list. Because attribute lists are immutable, this returns the
00290   /// new list.
00291   AttributeSet removeAttributes(LLVMContext &C, unsigned Index, 
00292                                 AttributeSet Attrs) const;
00293 
00294   /// \brief Remove the specified attributes at the specified index from this
00295   /// attribute list. Because attribute lists are immutable, this returns the
00296   /// new list.
00297   AttributeSet removeAttributes(LLVMContext &C, unsigned Index,
00298                                 const AttrBuilder &Attrs) const;
00299 
00300   /// \brief Add the dereferenceable attribute to the attribute set at the given
00301   /// index. Because attribute sets are immutable, this returns a new set.
00302   AttributeSet addDereferenceableAttr(LLVMContext &C, unsigned Index,
00303                                       uint64_t Bytes) const;
00304 
00305   /// \brief Add the dereferenceable_or_null attribute to the attribute set at
00306   /// the given index. Because attribute sets are immutable, this returns a new
00307   /// set.
00308   AttributeSet addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index,
00309                                             uint64_t Bytes) const;
00310 
00311   //===--------------------------------------------------------------------===//
00312   // AttributeSet Accessors
00313   //===--------------------------------------------------------------------===//
00314 
00315   /// \brief Retrieve the LLVM context.
00316   LLVMContext &getContext() const;
00317 
00318   /// \brief The attributes for the specified index are returned.
00319   AttributeSet getParamAttributes(unsigned Index) const;
00320 
00321   /// \brief The attributes for the ret value are returned.
00322   AttributeSet getRetAttributes() const;
00323 
00324   /// \brief The function attributes are returned.
00325   AttributeSet getFnAttributes() const;
00326 
00327   /// \brief Return true if the attribute exists at the given index.
00328   bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const;
00329 
00330   /// \brief Return true if the attribute exists at the given index.
00331   bool hasAttribute(unsigned Index, StringRef Kind) const;
00332 
00333   /// \brief Return true if attribute exists at the given index.
00334   bool hasAttributes(unsigned Index) const;
00335 
00336   /// \brief Return true if the specified attribute is set for at least one
00337   /// parameter or for the return value.
00338   bool hasAttrSomewhere(Attribute::AttrKind Attr) const;
00339 
00340   /// \brief Return the attribute object that exists at the given index.
00341   Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const;
00342 
00343   /// \brief Return the attribute object that exists at the given index.
00344   Attribute getAttribute(unsigned Index, StringRef Kind) const;
00345 
00346   /// \brief Return the alignment for the specified function parameter.
00347   unsigned getParamAlignment(unsigned Index) const;
00348 
00349   /// \brief Get the stack alignment.
00350   unsigned getStackAlignment(unsigned Index) const;
00351 
00352   /// \brief Get the number of dereferenceable bytes (or zero if unknown).
00353   uint64_t getDereferenceableBytes(unsigned Index) const;
00354 
00355   /// \brief Get the number of dereferenceable_or_null bytes (or zero if
00356   /// unknown).
00357   uint64_t getDereferenceableOrNullBytes(unsigned Index) const;
00358 
00359   /// \brief Return the attributes at the index as a string.
00360   std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
00361 
00362   typedef ArrayRef<Attribute>::iterator iterator;
00363 
00364   iterator begin(unsigned Slot) const;
00365   iterator end(unsigned Slot) const;
00366 
00367   /// operator==/!= - Provide equality predicates.
00368   bool operator==(const AttributeSet &RHS) const {
00369     return pImpl == RHS.pImpl;
00370   }
00371   bool operator!=(const AttributeSet &RHS) const {
00372     return pImpl != RHS.pImpl;
00373   }
00374 
00375   //===--------------------------------------------------------------------===//
00376   // AttributeSet Introspection
00377   //===--------------------------------------------------------------------===//
00378 
00379   // FIXME: Remove this.
00380   uint64_t Raw(unsigned Index) const;
00381 
00382   /// \brief Return a raw pointer that uniquely identifies this attribute list.
00383   void *getRawPointer() const {
00384     return pImpl;
00385   }
00386 
00387   /// \brief Return true if there are no attributes.
00388   bool isEmpty() const {
00389     return getNumSlots() == 0;
00390   }
00391 
00392   /// \brief Return the number of slots used in this attribute list.  This is
00393   /// the number of arguments that have an attribute set on them (including the
00394   /// function itself).
00395   unsigned getNumSlots() const;
00396 
00397   /// \brief Return the index for the given slot.
00398   unsigned getSlotIndex(unsigned Slot) const;
00399 
00400   /// \brief Return the attributes at the given slot.
00401   AttributeSet getSlotAttributes(unsigned Slot) const;
00402 
00403   void dump() const;
00404 };
00405 
00406 //===----------------------------------------------------------------------===//
00407 /// \class
00408 /// \brief Provide DenseMapInfo for AttributeSet.
00409 template<> struct DenseMapInfo<AttributeSet> {
00410   static inline AttributeSet getEmptyKey() {
00411     uintptr_t Val = static_cast<uintptr_t>(-1);
00412     Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
00413     return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
00414   }
00415   static inline AttributeSet getTombstoneKey() {
00416     uintptr_t Val = static_cast<uintptr_t>(-2);
00417     Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
00418     return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
00419   }
00420   static unsigned getHashValue(AttributeSet AS) {
00421     return (unsigned((uintptr_t)AS.pImpl) >> 4) ^
00422            (unsigned((uintptr_t)AS.pImpl) >> 9);
00423   }
00424   static bool isEqual(AttributeSet LHS, AttributeSet RHS) { return LHS == RHS; }
00425 };
00426 
00427 //===----------------------------------------------------------------------===//
00428 /// \class
00429 /// \brief This class is used in conjunction with the Attribute::get method to
00430 /// create an Attribute object. The object itself is uniquified. The Builder's
00431 /// value, however, is not. So this can be used as a quick way to test for
00432 /// equality, presence of attributes, etc.
00433 class AttrBuilder {
00434   std::bitset<Attribute::EndAttrKinds> Attrs;
00435   std::map<std::string, std::string> TargetDepAttrs;
00436   uint64_t Alignment;
00437   uint64_t StackAlignment;
00438   uint64_t DerefBytes;
00439   uint64_t DerefOrNullBytes;
00440 public:
00441   AttrBuilder()
00442       : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
00443         DerefOrNullBytes(0) {}
00444   explicit AttrBuilder(uint64_t Val)
00445       : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
00446         DerefOrNullBytes(0) {
00447     addRawValue(Val);
00448   }
00449   AttrBuilder(const Attribute &A)
00450       : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
00451         DerefOrNullBytes(0) {
00452     addAttribute(A);
00453   }
00454   AttrBuilder(AttributeSet AS, unsigned Idx);
00455 
00456   void clear();
00457 
00458   /// \brief Add an attribute to the builder.
00459   AttrBuilder &addAttribute(Attribute::AttrKind Val);
00460 
00461   /// \brief Add the Attribute object to the builder.
00462   AttrBuilder &addAttribute(Attribute A);
00463 
00464   /// \brief Add the target-dependent attribute to the builder.
00465   AttrBuilder &addAttribute(StringRef A, StringRef V = StringRef());
00466 
00467   /// \brief Remove an attribute from the builder.
00468   AttrBuilder &removeAttribute(Attribute::AttrKind Val);
00469 
00470   /// \brief Remove the attributes from the builder.
00471   AttrBuilder &removeAttributes(AttributeSet A, uint64_t Index);
00472 
00473   /// \brief Remove the target-dependent attribute to the builder.
00474   AttrBuilder &removeAttribute(StringRef A);
00475 
00476   /// \brief Add the attributes from the builder.
00477   AttrBuilder &merge(const AttrBuilder &B);
00478 
00479   /// \brief Remove the attributes from the builder.
00480   AttrBuilder &remove(const AttrBuilder &B);
00481 
00482   /// \brief Return true if the builder has any attribute that's in the
00483   /// specified builder.
00484   bool overlaps(const AttrBuilder &B) const;
00485 
00486   /// \brief Return true if the builder has the specified attribute.
00487   bool contains(Attribute::AttrKind A) const {
00488     assert((unsigned)A < Attribute::EndAttrKinds && "Attribute out of range!");
00489     return Attrs[A];
00490   }
00491 
00492   /// \brief Return true if the builder has the specified target-dependent
00493   /// attribute.
00494   bool contains(StringRef A) const;
00495 
00496   /// \brief Return true if the builder has IR-level attributes.
00497   bool hasAttributes() const;
00498 
00499   /// \brief Return true if the builder has any attribute that's in the
00500   /// specified attribute.
00501   bool hasAttributes(AttributeSet A, uint64_t Index) const;
00502 
00503   /// \brief Return true if the builder has an alignment attribute.
00504   bool hasAlignmentAttr() const;
00505 
00506   /// \brief Retrieve the alignment attribute, if it exists.
00507   uint64_t getAlignment() const { return Alignment; }
00508 
00509   /// \brief Retrieve the stack alignment attribute, if it exists.
00510   uint64_t getStackAlignment() const { return StackAlignment; }
00511 
00512   /// \brief Retrieve the number of dereferenceable bytes, if the dereferenceable
00513   /// attribute exists (zero is returned otherwise).
00514   uint64_t getDereferenceableBytes() const { return DerefBytes; }
00515 
00516   /// \brief Retrieve the number of dereferenceable_or_null bytes, if the
00517   /// dereferenceable_or_null attribute exists (zero is returned otherwise).
00518   uint64_t getDereferenceableOrNullBytes() const { return DerefOrNullBytes; }
00519 
00520   /// \brief This turns an int alignment (which must be a power of 2) into the
00521   /// form used internally in Attribute.
00522   AttrBuilder &addAlignmentAttr(unsigned Align);
00523 
00524   /// \brief This turns an int stack alignment (which must be a power of 2) into
00525   /// the form used internally in Attribute.
00526   AttrBuilder &addStackAlignmentAttr(unsigned Align);
00527 
00528   /// \brief This turns the number of dereferenceable bytes into the form used
00529   /// internally in Attribute.
00530   AttrBuilder &addDereferenceableAttr(uint64_t Bytes);
00531 
00532   /// \brief This turns the number of dereferenceable_or_null bytes into the
00533   /// form used internally in Attribute.
00534   AttrBuilder &addDereferenceableOrNullAttr(uint64_t Bytes);
00535 
00536   /// \brief Return true if the builder contains no target-independent
00537   /// attributes.
00538   bool empty() const { return Attrs.none(); }
00539 
00540   // Iterators for target-dependent attributes.
00541   typedef std::pair<std::string, std::string>                td_type;
00542   typedef std::map<std::string, std::string>::iterator       td_iterator;
00543   typedef std::map<std::string, std::string>::const_iterator td_const_iterator;
00544   typedef llvm::iterator_range<td_iterator>                  td_range;
00545   typedef llvm::iterator_range<td_const_iterator>            td_const_range;
00546 
00547   td_iterator td_begin()             { return TargetDepAttrs.begin(); }
00548   td_iterator td_end()               { return TargetDepAttrs.end(); }
00549 
00550   td_const_iterator td_begin() const { return TargetDepAttrs.begin(); }
00551   td_const_iterator td_end() const   { return TargetDepAttrs.end(); }
00552 
00553   td_range td_attrs() { return td_range(td_begin(), td_end()); }
00554   td_const_range td_attrs() const {
00555     return td_const_range(td_begin(), td_end());
00556   }
00557 
00558   bool td_empty() const              { return TargetDepAttrs.empty(); }
00559 
00560   bool operator==(const AttrBuilder &B);
00561   bool operator!=(const AttrBuilder &B) {
00562     return !(*this == B);
00563   }
00564 
00565   // FIXME: Remove this in 4.0.
00566 
00567   /// \brief Add the raw value to the internal representation.
00568   AttrBuilder &addRawValue(uint64_t Val);
00569 };
00570 
00571 namespace AttributeFuncs {
00572 
00573 /// \brief Which attributes cannot be applied to a type.
00574 AttrBuilder typeIncompatible(const Type *Ty);
00575 
00576 } // end AttributeFuncs namespace
00577 
00578 } // end llvm namespace
00579 
00580 #endif