aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Attributes.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-12-30 02:22:16 +0000
committerBill Wendling <isanbard@gmail.com>2012-12-30 02:22:16 +0000
commit979aff6399a79d155e98bbbe064f4a183a237f23 (patch)
treef56d4513e8f4f7f01799355c129b696891290ebd /lib/VMCore/Attributes.cpp
parenta51edf0986567bd81e261950f75a72b7462b2274 (diff)
Add a few more c'tors:
* One that accepts a single Attribute::AttrKind. * One that accepts an Attribute::AttrKind plus a list of values. This is for attributes defined like this: #1 = attributes { align = 4 } * One that accepts a string, for target-specific attributes like this: #2 = attributes { "cpu=cortex-a8" } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Attributes.cpp')
-rw-r--r--lib/VMCore/Attributes.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 52405f25ae..0db1eb5ed4 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -301,6 +301,18 @@ uint64_t AttrBuilder::getStackAlignment() const {
AttributeImpl::AttributeImpl(LLVMContext &C, uint64_t data) {
Data = ConstantInt::get(Type::getInt64Ty(C), data);
}
+AttributeImpl::AttributeImpl(LLVMContext &C, Attribute::AttrKind data) {
+ Data = ConstantInt::get(Type::getInt64Ty(C), data);
+}
+AttributeImpl::AttributeImpl(LLVMContext &C, Attribute::AttrKind data,
+ ArrayRef<Constant*> values) {
+ Data = ConstantInt::get(Type::getInt64Ty(C), data);
+ Vals.reserve(values.size());
+ Vals.append(values.begin(), values.end());
+}
+AttributeImpl::AttributeImpl(LLVMContext &C, StringRef data) {
+ Data = ConstantDataArray::getString(C, data);
+}
bool AttributeImpl::contains(Attribute::AttrKind Kind) const {
if (ConstantInt *CI = dyn_cast<ConstantInt>(Data))