mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-05 13:09:10 +00:00
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
This commit is contained in:
parent
a51edf0986
commit
979aff6399
@ -27,12 +27,20 @@ class LLVMContext;
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// \class
|
||||
/// \brief This class represents a single, uniqued attribute. That attribute
|
||||
/// could be a single enum, a tuple, or a string. It uses a discriminated union
|
||||
/// to distinguish them.
|
||||
/// could be a single enum, a tuple, or a string.
|
||||
class AttributeImpl : public FoldingSetNode {
|
||||
Constant *Data;
|
||||
SmallVector<Constant*, 0> Vals;
|
||||
public:
|
||||
AttributeImpl(LLVMContext &C, uint64_t data);
|
||||
explicit AttributeImpl(LLVMContext &C, uint64_t data);
|
||||
explicit AttributeImpl(LLVMContext &C, Attribute::AttrKind data);
|
||||
AttributeImpl(LLVMContext &C, Attribute::AttrKind data,
|
||||
ArrayRef<Constant*> values);
|
||||
AttributeImpl(LLVMContext &C, StringRef data);
|
||||
|
||||
ArrayRef<Constant*> getValues() const {
|
||||
return Vals;
|
||||
}
|
||||
|
||||
bool contains(Attribute::AttrKind Kind) const;
|
||||
bool contains(StringRef Kind) const;
|
||||
@ -64,10 +72,14 @@ public:
|
||||
static uint64_t getAttrMask(uint64_t Val);
|
||||
|
||||
void Profile(FoldingSetNodeID &ID) const {
|
||||
Profile(ID, Data);
|
||||
Profile(ID, Data, Vals);
|
||||
}
|
||||
static void Profile(FoldingSetNodeID &ID, Constant *Data) {
|
||||
static void Profile(FoldingSetNodeID &ID, Constant *Data,
|
||||
ArrayRef<Constant*> Vals) {
|
||||
ID.AddPointer(Data);
|
||||
for (ArrayRef<Constant*>::iterator I = Vals.begin(), E = Vals.end();
|
||||
I != E; ++I)
|
||||
ID.AddPointer(*I);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user