mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Move the 'ParameterOnly' variable inside of the Attributes class and make it a method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165497 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -110,10 +110,6 @@ DECLARE_LLVM_ATTRIBUTE(AddressSafety,1ULL<<32) ///< Address safety checking is o
|
|||||||
/// an exception might pass by.
|
/// an exception might pass by.
|
||||||
/// uwtable + nounwind = Needs an entry because the ABI says so.
|
/// uwtable + nounwind = Needs an entry because the ABI says so.
|
||||||
|
|
||||||
/// @brief Attributes that only apply to function parameters.
|
|
||||||
const AttrConst ParameterOnly = {ByVal_i | Nest_i |
|
|
||||||
StructRet_i | NoCapture_i};
|
|
||||||
|
|
||||||
/// @brief Attributes that may be applied to the function itself. These cannot
|
/// @brief Attributes that may be applied to the function itself. These cannot
|
||||||
/// be used on return values or function parameters.
|
/// be used on return values or function parameters.
|
||||||
const AttrConst FunctionOnly = {NoReturn_i | NoUnwind_i | ReadNone_i |
|
const AttrConst FunctionOnly = {NoReturn_i | NoUnwind_i | ReadNone_i |
|
||||||
@@ -215,11 +211,6 @@ public:
|
|||||||
static Attributes get(Builder &B);
|
static Attributes get(Builder &B);
|
||||||
static Attributes get(LLVMContext &Context, Builder &B);
|
static Attributes get(LLVMContext &Context, Builder &B);
|
||||||
|
|
||||||
/// @brief Parameter attributes that do not apply to vararg call arguments.
|
|
||||||
bool hasIncompatibleWithVarArgsAttrs() const {
|
|
||||||
return hasAttribute(Attributes::StructRet);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Return true if the attribute is present.
|
/// @brief Return true if the attribute is present.
|
||||||
bool hasAttribute(AttrVal Val) const;
|
bool hasAttribute(AttrVal Val) const;
|
||||||
|
|
||||||
@@ -231,14 +222,27 @@ public:
|
|||||||
/// @brief Return true if the attributes are a non-null intersection.
|
/// @brief Return true if the attributes are a non-null intersection.
|
||||||
bool hasAttributes(const Attributes &A) const;
|
bool hasAttributes(const Attributes &A) const;
|
||||||
|
|
||||||
/// This returns the alignment field of an attribute as a byte alignment
|
/// @brief Returns the alignment field of an attribute as a byte alignment
|
||||||
/// value.
|
/// value.
|
||||||
unsigned getAlignment() const;
|
unsigned getAlignment() const;
|
||||||
|
|
||||||
/// This returns the stack alignment field of an attribute as a byte alignment
|
/// @brief Returns the stack alignment field of an attribute as a byte
|
||||||
/// value.
|
/// alignment value.
|
||||||
unsigned getStackAlignment() const;
|
unsigned getStackAlignment() const;
|
||||||
|
|
||||||
|
/// @brief Parameter attributes that do not apply to vararg call arguments.
|
||||||
|
bool hasIncompatibleWithVarArgsAttrs() const {
|
||||||
|
return hasAttribute(Attributes::StructRet);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @brief Attributes that only apply to function parameters.
|
||||||
|
bool hasParameterOnlyAttrs() const {
|
||||||
|
return hasAttribute(Attributes::ByVal) ||
|
||||||
|
hasAttribute(Attributes::Nest) ||
|
||||||
|
hasAttribute(Attributes::StructRet) ||
|
||||||
|
hasAttribute(Attributes::NoCapture);
|
||||||
|
}
|
||||||
|
|
||||||
bool isEmptyOrSingleton() const;
|
bool isEmptyOrSingleton() const;
|
||||||
|
|
||||||
// This is a "safe bool() operator".
|
// This is a "safe bool() operator".
|
||||||
|
@@ -533,11 +533,10 @@ void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty,
|
|||||||
Assert1(!FnCheckAttr, "Attribute " + FnCheckAttr.getAsString() +
|
Assert1(!FnCheckAttr, "Attribute " + FnCheckAttr.getAsString() +
|
||||||
" only applies to the function!", V);
|
" only applies to the function!", V);
|
||||||
|
|
||||||
if (isReturnValue) {
|
if (isReturnValue)
|
||||||
Attributes RetI = Attrs & Attribute::ParameterOnly;
|
Assert1(!Attrs.hasParameterOnlyAttrs(),
|
||||||
Assert1(!RetI, "Attribute " + RetI.getAsString() +
|
"Attributes 'byval', 'nest', 'sret', and 'nocapture' "
|
||||||
" does not apply to return values!", V);
|
"do not apply to return values!", V);
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned i = 0;
|
for (unsigned i = 0;
|
||||||
i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
|
i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
|
||||||
@@ -550,16 +549,14 @@ void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty,
|
|||||||
Assert1(!TypeI, "Wrong type for attribute " +
|
Assert1(!TypeI, "Wrong type for attribute " +
|
||||||
TypeI.getAsString(), V);
|
TypeI.getAsString(), V);
|
||||||
|
|
||||||
Attributes ByValI = Attrs & Attribute::ByVal;
|
if (PointerType *PTy = dyn_cast<PointerType>(Ty))
|
||||||
if (PointerType *PTy = dyn_cast<PointerType>(Ty)) {
|
Assert1(!Attrs.hasAttribute(Attributes::ByVal) ||
|
||||||
Assert1(!ByValI || PTy->getElementType()->isSized(),
|
PTy->getElementType()->isSized(),
|
||||||
"Attribute " + ByValI.getAsString() +
|
"Attribute 'byval' does not support unsized types!", V);
|
||||||
" does not support unsized types!", V);
|
else
|
||||||
} else {
|
Assert1(!Attrs.hasAttribute(Attributes::ByVal),
|
||||||
Assert1(!ByValI,
|
"Attribute 'byval' only applies to parameters with pointer type!",
|
||||||
"Attribute " + ByValI.getAsString() +
|
V);
|
||||||
" only applies to parameters with pointer type!", V);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyFunctionAttrs - Check parameter attributes against a function type.
|
// VerifyFunctionAttrs - Check parameter attributes against a function type.
|
||||||
|
Reference in New Issue
Block a user