mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-21 18:29:45 +00:00
Inline the 'hasIncompatibleWithVarArgsAttrs' method into its only uses. And some minor comment reformatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170516 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0575429d14
commit
1d3dcfe424
@ -27,15 +27,17 @@ class AttributesImpl;
|
|||||||
class LLVMContext;
|
class LLVMContext;
|
||||||
class Type;
|
class Type;
|
||||||
|
|
||||||
/// Attribute - A bitset of attributes.
|
//===----------------------------------------------------------------------===//
|
||||||
|
/// \class Functions, function parameters, and return types can have attributes
|
||||||
|
/// to indicate how they should be treated by optimizations and code
|
||||||
|
/// generation. This class represents one of those attributes. It's light-weight
|
||||||
|
/// and should be passed around by-value.
|
||||||
class Attribute {
|
class Attribute {
|
||||||
public:
|
public:
|
||||||
/// Function parameters and results can have attributes to indicate how they
|
/// This enumeration lists the attributes that can be associated with
|
||||||
/// should be treated by optimizations and code generation. This enumeration
|
/// parameters, function results or the function itself.
|
||||||
/// lists the attributes that can be associated with parameters, function
|
|
||||||
/// results or the function itself.
|
|
||||||
///
|
///
|
||||||
/// Note that uwtable is about the ABI or the user mandating an entry in the
|
/// Note: uwtable is about the ABI or the user mandating an entry in the
|
||||||
/// unwind table. The nounwind attribute is about an exception passing by the
|
/// unwind table. The nounwind attribute is about an exception passing by the
|
||||||
/// function.
|
/// function.
|
||||||
///
|
///
|
||||||
@ -93,34 +95,29 @@ private:
|
|||||||
public:
|
public:
|
||||||
Attribute() : Attrs(0) {}
|
Attribute() : Attrs(0) {}
|
||||||
|
|
||||||
/// get - Return a uniquified Attribute object. This takes the uniquified
|
/// \brief Return a uniquified Attribute object. This takes the uniquified
|
||||||
/// value from the Builder and wraps it in the Attribute class.
|
/// value from the Builder and wraps it in the Attribute class.
|
||||||
static Attribute get(LLVMContext &Context, ArrayRef<AttrVal> Vals);
|
static Attribute get(LLVMContext &Context, ArrayRef<AttrVal> Vals);
|
||||||
static Attribute get(LLVMContext &Context, AttrBuilder &B);
|
static Attribute get(LLVMContext &Context, AttrBuilder &B);
|
||||||
|
|
||||||
/// @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;
|
||||||
|
|
||||||
/// @brief Return true if attributes exist
|
/// \brief Return true if attributes exist
|
||||||
bool hasAttributes() const;
|
bool hasAttributes() const;
|
||||||
|
|
||||||
/// @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 Attribute &A) const;
|
bool hasAttributes(const Attribute &A) const;
|
||||||
|
|
||||||
/// @brief 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;
|
||||||
|
|
||||||
/// @brief Returns the stack alignment field of an attribute as a byte
|
/// \brief Returns the stack alignment field of an attribute as a byte
|
||||||
/// alignment value.
|
/// alignment value.
|
||||||
unsigned getStackAlignment() const;
|
unsigned getStackAlignment() const;
|
||||||
|
|
||||||
/// @brief Parameter attributes that do not apply to vararg call arguments.
|
/// \brief Attribute that only apply to function parameters.
|
||||||
bool hasIncompatibleWithVarArgsAttrs() const {
|
|
||||||
return hasAttribute(Attribute::StructRet);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Attribute that only apply to function parameters.
|
|
||||||
bool hasParameterOnlyAttrs() const {
|
bool hasParameterOnlyAttrs() const {
|
||||||
return hasAttribute(Attribute::ByVal) ||
|
return hasAttribute(Attribute::ByVal) ||
|
||||||
hasAttribute(Attribute::Nest) ||
|
hasAttribute(Attribute::Nest) ||
|
||||||
@ -128,7 +125,7 @@ public:
|
|||||||
hasAttribute(Attribute::NoCapture);
|
hasAttribute(Attribute::NoCapture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Attribute that may be applied to the function itself. These cannot
|
/// \brief Attribute 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.
|
||||||
bool hasFunctionOnlyAttrs() const {
|
bool hasFunctionOnlyAttrs() const {
|
||||||
return hasAttribute(Attribute::NoReturn) ||
|
return hasAttribute(Attribute::NoReturn) ||
|
||||||
@ -161,25 +158,23 @@ public:
|
|||||||
|
|
||||||
uint64_t Raw() const;
|
uint64_t Raw() const;
|
||||||
|
|
||||||
/// @brief Which attributes cannot be applied to a type.
|
/// \brief Which attributes cannot be applied to a type.
|
||||||
static Attribute typeIncompatible(Type *Ty);
|
static Attribute typeIncompatible(Type *Ty);
|
||||||
|
|
||||||
/// encodeLLVMAttributesForBitcode - This returns an integer containing an
|
/// \brief This returns an integer containing an encoding of all the LLVM
|
||||||
/// encoding of all the LLVM attributes found in the given attribute bitset.
|
/// attributes found in the given attribute bitset. Any change to this
|
||||||
/// Any change to this encoding is a breaking change to bitcode compatibility.
|
/// encoding is a breaking change to bitcode compatibility.
|
||||||
static uint64_t encodeLLVMAttributesForBitcode(Attribute Attrs);
|
static uint64_t encodeLLVMAttributesForBitcode(Attribute Attrs);
|
||||||
|
|
||||||
/// decodeLLVMAttributesForBitcode - This returns an attribute bitset
|
/// \brief This returns an attribute bitset containing the LLVM attributes
|
||||||
/// containing the LLVM attributes that have been decoded from the given
|
/// that have been decoded from the given integer. This function must stay in
|
||||||
/// integer. This function must stay in sync with
|
/// sync with 'encodeLLVMAttributesForBitcode'.
|
||||||
/// 'encodeLLVMAttributesForBitcode'.
|
|
||||||
static Attribute decodeLLVMAttributesForBitcode(LLVMContext &C,
|
static Attribute decodeLLVMAttributesForBitcode(LLVMContext &C,
|
||||||
uint64_t EncodedAttrs);
|
uint64_t EncodedAttrs);
|
||||||
|
|
||||||
/// getAsString - The set of attributes set in Attribute is converted to a
|
/// \brief The set of attributes set in Attribute is converted to a string of
|
||||||
/// string of equivalent mnemonics. This is, presumably, for writing out the
|
/// equivalent mnemonics. This is, presumably, for writing out the mnemonics
|
||||||
/// mnemonics for the assembly writer.
|
/// for the assembly writer. @brief Convert attribute bits to text
|
||||||
/// @brief Convert attribute bits to text
|
|
||||||
std::string getAsString() const;
|
std::string getAsString() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1103,7 +1103,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
|||||||
if (CallerPAL.getSlot(i - 1).Index <= FT->getNumParams())
|
if (CallerPAL.getSlot(i - 1).Index <= FT->getNumParams())
|
||||||
break;
|
break;
|
||||||
Attribute PAttrs = CallerPAL.getSlot(i - 1).Attrs;
|
Attribute PAttrs = CallerPAL.getSlot(i - 1).Attrs;
|
||||||
if (PAttrs.hasIncompatibleWithVarArgsAttrs())
|
// Check if it has an attribute that's incompatible with varargs.
|
||||||
|
if (PAttrs.hasAttribute(Attribute::StructRet))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1215,7 +1215,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
|
|||||||
|
|
||||||
VerifyParameterAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I);
|
VerifyParameterAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I);
|
||||||
|
|
||||||
Assert1(!Attr.hasIncompatibleWithVarArgsAttrs(),
|
Assert1(!Attr.hasAttribute(Attribute::StructRet),
|
||||||
"Attribute 'sret' cannot be used for vararg call arguments!", I);
|
"Attribute 'sret' cannot be used for vararg call arguments!", I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user