// AttributeList Accessors
//===--------------------------------------------------------------------===//
- /// Retrieve the LLVM context.
- LLVMContext &getContext() const;
-
/// The attributes for the specified index are returned.
AttributeSet getAttributes(unsigned Index) const;
friend TrailingObjects;
private:
- LLVMContext &Context;
unsigned NumAttrSets; ///< Number of entries in this set.
/// Bitset with a bit for each available attribute Attribute::AttrKind.
uint8_t AvailableFunctionAttrs[12] = {};
size_t numTrailingObjects(OverloadToken<AttributeSet>) { return NumAttrSets; }
public:
- AttributeListImpl(LLVMContext &C, ArrayRef<AttributeSet> Sets);
+ AttributeListImpl(ArrayRef<AttributeSet> Sets);
// AttributesSetImpt is uniqued, these should not be available.
AttributeListImpl(const AttributeListImpl &) = delete;
AttributeListImpl &operator=(const AttributeListImpl &) = delete;
- /// Get the context that created this AttributeListImpl.
- LLVMContext &getContext() { return Context; }
-
/// Return true if the AttributeSet or the FunctionIndex has an
/// enum attribute of the given kind.
bool hasFnAttribute(Attribute::AttrKind Kind) const {
return Index == AttributeList::FunctionIndex ? 0 : Index + 1;
}
-AttributeListImpl::AttributeListImpl(LLVMContext &C,
- ArrayRef<AttributeSet> Sets)
- : Context(C), NumAttrSets(Sets.size()) {
+AttributeListImpl::AttributeListImpl(ArrayRef<AttributeSet> Sets)
+ : NumAttrSets(Sets.size()) {
assert(!Sets.empty() && "pointless AttributeListImpl");
// There's memory after the node where we can store the entries in.
void *Mem = pImpl->Alloc.Allocate(
AttributeListImpl::totalSizeToAlloc<AttributeSet>(AttrSets.size()),
alignof(AttributeListImpl));
- PA = new (Mem) AttributeListImpl(C, AttrSets);
+ PA = new (Mem) AttributeListImpl(AttrSets);
pImpl->AttrsLists.InsertNode(PA, InsertPoint);
}
// AttributeList Accessor Methods
//===----------------------------------------------------------------------===//
-LLVMContext &AttributeList::getContext() const { return pImpl->getContext(); }
-
AttributeSet AttributeList::getParamAttributes(unsigned ArgNo) const {
return getAttributes(ArgNo + FirstArgIndex);
}
// Create new attribute set containing only attributes which can be transferred
// from original call to the safepoint.
-static AttributeList legalizeCallAttributes(AttributeList AL) {
+static AttributeList legalizeCallAttributes(LLVMContext &Ctx,
+ AttributeList AL) {
if (AL.isEmpty())
return AL;
}
// Just skip parameter and return attributes for now
- LLVMContext &Ctx = AL.getContext();
return AttributeList::get(Ctx, AttributeList::FunctionIndex,
AttributeSet::get(Ctx, FnAttrs));
}
// function attributes. In case if we can handle this set of attributes -
// set up function attrs directly on statepoint and return attrs later for
// gc_result intrinsic.
- SPCall->setAttributes(legalizeCallAttributes(CI->getAttributes()));
+ SPCall->setAttributes(
+ legalizeCallAttributes(CI->getContext(), CI->getAttributes()));
Token = SPCall;
// function attributes. In case if we can handle this set of attributes -
// set up function attrs directly on statepoint and return attrs later for
// gc_result intrinsic.
- SPInvoke->setAttributes(legalizeCallAttributes(II->getAttributes()));
+ SPInvoke->setAttributes(
+ legalizeCallAttributes(II->getContext(), II->getAttributes()));
Token = SPInvoke;