1 //===-- AttributesImpl.h - Attribute Internals -----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines various helper methods and classes used by LLVMContextImpl
11 // for creating and managing attributes.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_ATTRIBUTESIMPL_H
16 #define LLVM_ATTRIBUTESIMPL_H
18 #include "llvm/ADT/FoldingSet.h"
19 #include "llvm/Attributes.h"
23 class AttributesImpl : public FoldingSetNode {
24 uint64_t Bits; // FIXME: We will be expanding this.
26 AttributesImpl(uint64_t bits) : Bits(bits) {}
28 bool hasAttribute(uint64_t A) const;
30 bool hasAttributes() const;
31 bool hasAttributes(const Attribute &A) const;
33 uint64_t getAlignment() const;
34 uint64_t getStackAlignment() const;
36 uint64_t Raw() const { return Bits; } // FIXME: Remove.
38 static uint64_t getAttrMask(uint64_t Val);
40 void Profile(FoldingSetNodeID &ID) const {
43 static void Profile(FoldingSetNodeID &ID, uint64_t Bits) {
48 class AttributeListImpl : public FoldingSetNode {
49 // AttributesList is uniqued, these should not be publicly available.
50 void operator=(const AttributeListImpl &) LLVM_DELETED_FUNCTION;
51 AttributeListImpl(const AttributeListImpl &) LLVM_DELETED_FUNCTION;
53 SmallVector<AttributeWithIndex, 4> Attrs;
55 AttributeListImpl(ArrayRef<AttributeWithIndex> attrs)
56 : Attrs(attrs.begin(), attrs.end()) {}
58 void Profile(FoldingSetNodeID &ID) const {
61 static void Profile(FoldingSetNodeID &ID, ArrayRef<AttributeWithIndex> Attrs){
62 for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
63 ID.AddInteger(Attrs[i].Attrs.Raw());
64 ID.AddInteger(Attrs[i].Index);
69 } // end llvm namespace