mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
Add special 'get' methods to create an Attribute with an alignment. Also do some random cleanup. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173635 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
970a479c02
commit
c08a5ef658
@ -107,11 +107,15 @@ private:
|
|||||||
public:
|
public:
|
||||||
Attribute() : pImpl(0) {}
|
Attribute() : pImpl(0) {}
|
||||||
|
|
||||||
/// \brief Return a uniquified Attribute object. This takes the uniquified
|
/// \brief Return a uniquified Attribute object.
|
||||||
/// value from the Builder and wraps it in the Attribute class.
|
|
||||||
static Attribute get(LLVMContext &Context, ArrayRef<AttrKind> Kinds);
|
static Attribute get(LLVMContext &Context, ArrayRef<AttrKind> Kinds);
|
||||||
static Attribute get(LLVMContext &Context, AttrBuilder &B);
|
static Attribute get(LLVMContext &Context, AttrBuilder &B);
|
||||||
|
|
||||||
|
/// \brief Return a uniquified Attribute object that has the specific
|
||||||
|
/// alignment set.
|
||||||
|
static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align);
|
||||||
|
static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align);
|
||||||
|
|
||||||
/// \brief Return true if the attribute is present.
|
/// \brief Return true if the attribute is present.
|
||||||
bool hasAttribute(AttrKind Val) const;
|
bool hasAttribute(AttrKind Val) const;
|
||||||
|
|
||||||
@ -130,25 +134,18 @@ public:
|
|||||||
bool operator==(AttrKind K) const;
|
bool operator==(AttrKind K) const;
|
||||||
bool operator!=(AttrKind K) const;
|
bool operator!=(AttrKind K) const;
|
||||||
|
|
||||||
|
/// \brief Less-than operator. Useful for sorting the attributes list.
|
||||||
bool operator<(Attribute A) const;
|
bool operator<(Attribute A) const;
|
||||||
|
|
||||||
|
/// \brief The Attribute is converted to a string of equivalent mnemonic. This
|
||||||
|
/// is, presumably, for writing out the mnemonics for the assembly writer.
|
||||||
|
std::string getAsString() const;
|
||||||
|
|
||||||
void Profile(FoldingSetNodeID &ID) const {
|
void Profile(FoldingSetNodeID &ID) const {
|
||||||
ID.AddPointer(pImpl);
|
ID.AddPointer(pImpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Remove these 'operator' methods.
|
|
||||||
bool operator==(const Attribute &A) const {
|
|
||||||
return pImpl == A.pImpl;
|
|
||||||
}
|
|
||||||
bool operator!=(const Attribute &A) const {
|
|
||||||
return pImpl != A.pImpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t Raw() const;
|
uint64_t Raw() const;
|
||||||
|
|
||||||
/// \brief The Attribute is converted to a string of equivalent mnemonic. This
|
|
||||||
/// is, presumably, for writing out the mnemonics for the assembly writer.
|
|
||||||
std::string getAsString() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -62,6 +62,17 @@ Attribute Attribute::get(LLVMContext &Context, AttrBuilder &B) {
|
|||||||
return Attribute(PA);
|
return Attribute(PA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Attribute Attribute::getWithAlignment(LLVMContext &Context, uint64_t Align) {
|
||||||
|
AttrBuilder B;
|
||||||
|
return get(Context, B.addAlignmentAttr(Align));
|
||||||
|
}
|
||||||
|
|
||||||
|
Attribute Attribute::getWithStackAlignment(LLVMContext &Context,
|
||||||
|
uint64_t Align) {
|
||||||
|
AttrBuilder B;
|
||||||
|
return get(Context, B.addStackAlignmentAttr(Align));
|
||||||
|
}
|
||||||
|
|
||||||
bool Attribute::hasAttribute(AttrKind Val) const {
|
bool Attribute::hasAttribute(AttrKind Val) const {
|
||||||
return pImpl && pImpl->hasAttribute(Val);
|
return pImpl && pImpl->hasAttribute(Val);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user