aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/IR/AttributeImpl.h15
-rw-r--r--lib/IR/Attributes.cpp48
2 files changed, 33 insertions, 30 deletions
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h
index 91f5005639..7be5a162f1 100644
--- a/lib/IR/AttributeImpl.h
+++ b/lib/IR/AttributeImpl.h
@@ -31,15 +31,15 @@ class LLVMContext;
/// could be a single enum, a tuple, or a string.
class AttributeImpl : public FoldingSetNode {
LLVMContext &Context;
- Constant *Data;
+ Constant *Kind;
SmallVector<Constant*, 0> Vals;
// AttributesImpl is uniqued, these should not be publicly available.
void operator=(const AttributeImpl &) LLVM_DELETED_FUNCTION;
AttributeImpl(const AttributeImpl &) LLVM_DELETED_FUNCTION;
public:
- AttributeImpl(LLVMContext &C, Constant *Data)
- : Context(C), Data(Data) {}
+ AttributeImpl(LLVMContext &C, Constant *Kind)
+ : Context(C), Kind(Kind) {}
explicit AttributeImpl(LLVMContext &C, Attribute::AttrKind data);
AttributeImpl(LLVMContext &C, Attribute::AttrKind data,
ArrayRef<Constant*> values);
@@ -48,6 +48,9 @@ public:
bool hasAttribute(Attribute::AttrKind A) const;
bool hasAttributes() const;
+ Constant *getAttributeKind() const { return Kind; }
+ ArrayRef<Constant*> getAttributeValues() const { return Vals; }
+
LLVMContext &getContext() { return Context; }
ArrayRef<Constant*> getValues() const { return Vals; }
@@ -63,11 +66,11 @@ public:
bool operator<(const AttributeImpl &AI) const;
void Profile(FoldingSetNodeID &ID) const {
- Profile(ID, Data, Vals);
+ Profile(ID, Kind, Vals);
}
- static void Profile(FoldingSetNodeID &ID, Constant *Data,
+ static void Profile(FoldingSetNodeID &ID, Constant *Kind,
ArrayRef<Constant*> Vals) {
- ID.AddPointer(Data);
+ ID.AddPointer(Kind);
for (unsigned I = 0, E = Vals.size(); I != E; ++I)
ID.AddPointer(Vals[I]);
}
diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp
index 2cf76213e0..a3f62ae076 100644
--- a/lib/IR/Attributes.cpp
+++ b/lib/IR/Attributes.cpp
@@ -195,20 +195,20 @@ uint64_t Attribute::Raw() const {
// AttributeImpl Definition
//===----------------------------------------------------------------------===//
-AttributeImpl::AttributeImpl(LLVMContext &C, Attribute::AttrKind data)
+AttributeImpl::AttributeImpl(LLVMContext &C, Attribute::AttrKind kind)
: Context(C) {
- Data = ConstantInt::get(Type::getInt64Ty(C), data);
+ Kind = ConstantInt::get(Type::getInt64Ty(C), kind);
}
-AttributeImpl::AttributeImpl(LLVMContext &C, Attribute::AttrKind data,
+AttributeImpl::AttributeImpl(LLVMContext &C, Attribute::AttrKind kind,
ArrayRef<Constant*> values)
: Context(C) {
- Data = ConstantInt::get(Type::getInt64Ty(C), data);
+ Kind = ConstantInt::get(Type::getInt64Ty(C), kind);
Vals.reserve(values.size());
Vals.append(values.begin(), values.end());
}
-AttributeImpl::AttributeImpl(LLVMContext &C, StringRef data)
+AttributeImpl::AttributeImpl(LLVMContext &C, StringRef kind)
: Context(C) {
- Data = ConstantDataArray::getString(C, data);
+ Kind = ConstantDataArray::getString(C, kind);
}
bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const {
@@ -229,36 +229,36 @@ uint64_t AttributeImpl::getStackAlignment() const {
return 1ULL << ((Mask >> 26) - 1);
}
-bool AttributeImpl::operator==(Attribute::AttrKind Kind) const {
- if (ConstantInt *CI = dyn_cast<ConstantInt>(Data))
- return CI->getZExtValue() == Kind;
+bool AttributeImpl::operator==(Attribute::AttrKind kind) const {
+ if (ConstantInt *CI = dyn_cast<ConstantInt>(Kind))
+ return CI->getZExtValue() == kind;
return false;
}
-bool AttributeImpl::operator!=(Attribute::AttrKind Kind) const {
- return !(*this == Kind);
+bool AttributeImpl::operator!=(Attribute::AttrKind kind) const {
+ return !(*this == kind);
}
-bool AttributeImpl::operator==(StringRef Kind) const {
- if (ConstantDataArray *CDA = dyn_cast<ConstantDataArray>(Data))
+bool AttributeImpl::operator==(StringRef kind) const {
+ if (ConstantDataArray *CDA = dyn_cast<ConstantDataArray>(Kind))
if (CDA->isString())
- return CDA->getAsString() == Kind;
+ return CDA->getAsString() == kind;
return false;
}
-bool AttributeImpl::operator!=(StringRef Kind) const {
- return !(*this == Kind);
+bool AttributeImpl::operator!=(StringRef kind) const {
+ return !(*this == kind);
}
bool AttributeImpl::operator<(const AttributeImpl &AI) const {
- if (!Data && !AI.Data) return false;
- if (!Data && AI.Data) return true;
- if (Data && !AI.Data) return false;
+ if (!Kind && !AI.Kind) return false;
+ if (!Kind && AI.Kind) return true;
+ if (Kind && !AI.Kind) return false;
- ConstantInt *ThisCI = dyn_cast<ConstantInt>(Data);
- ConstantInt *ThatCI = dyn_cast<ConstantInt>(AI.Data);
+ ConstantInt *ThisCI = dyn_cast<ConstantInt>(Kind);
+ ConstantInt *ThatCI = dyn_cast<ConstantInt>(AI.Kind);
- ConstantDataArray *ThisCDA = dyn_cast<ConstantDataArray>(Data);
- ConstantDataArray *ThatCDA = dyn_cast<ConstantDataArray>(AI.Data);
+ ConstantDataArray *ThisCDA = dyn_cast<ConstantDataArray>(Kind);
+ ConstantDataArray *ThatCDA = dyn_cast<ConstantDataArray>(AI.Kind);
if (ThisCI && ThatCI)
return ThisCI->getZExtValue() < ThatCI->getZExtValue();
@@ -274,7 +274,7 @@ bool AttributeImpl::operator<(const AttributeImpl &AI) const {
uint64_t AttributeImpl::Raw() const {
// FIXME: Remove this.
- return cast<ConstantInt>(Data)->getZExtValue();
+ return cast<ConstantInt>(Kind)->getZExtValue();
}
uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {