mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 00:39:36 +00:00
Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
85022561f9
commit
034b94b170
@ -73,10 +73,10 @@ public:
|
||||
bool hasStructRetAttr() const;
|
||||
|
||||
/// addAttr - Add a Attribute to an argument
|
||||
void addAttr(Attributes);
|
||||
void addAttr(Attribute);
|
||||
|
||||
/// removeAttr - Remove a Attribute from an argument
|
||||
void removeAttr(Attributes);
|
||||
void removeAttr(Attribute);
|
||||
|
||||
/// classof - Methods for support type inquiry through isa, cast, and
|
||||
/// dyn_cast:
|
||||
|
@ -27,8 +27,8 @@ class AttributesImpl;
|
||||
class LLVMContext;
|
||||
class Type;
|
||||
|
||||
/// Attributes - A bitset of attributes.
|
||||
class Attributes {
|
||||
/// Attribute - A bitset of attributes.
|
||||
class Attribute {
|
||||
public:
|
||||
/// Function parameters and results can have attributes to indicate how they
|
||||
/// should be treated by optimizations and code generation. This enumeration
|
||||
@ -89,14 +89,14 @@ public:
|
||||
};
|
||||
private:
|
||||
AttributesImpl *Attrs;
|
||||
Attributes(AttributesImpl *A) : Attrs(A) {}
|
||||
Attribute(AttributesImpl *A) : Attrs(A) {}
|
||||
public:
|
||||
Attributes() : Attrs(0) {}
|
||||
Attribute() : Attrs(0) {}
|
||||
|
||||
/// get - Return a uniquified Attributes object. This takes the uniquified
|
||||
/// value from the Builder and wraps it in the Attributes class.
|
||||
static Attributes get(LLVMContext &Context, ArrayRef<AttrVal> Vals);
|
||||
static Attributes get(LLVMContext &Context, AttrBuilder &B);
|
||||
/// get - Return a uniquified Attribute object. This takes the uniquified
|
||||
/// value from the Builder and wraps it in the Attribute class.
|
||||
static Attribute get(LLVMContext &Context, ArrayRef<AttrVal> Vals);
|
||||
static Attribute get(LLVMContext &Context, AttrBuilder &B);
|
||||
|
||||
/// @brief Return true if the attribute is present.
|
||||
bool hasAttribute(AttrVal Val) const;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
bool hasAttributes() const;
|
||||
|
||||
/// @brief Return true if the attributes are a non-null intersection.
|
||||
bool hasAttributes(const Attributes &A) const;
|
||||
bool hasAttributes(const Attribute &A) const;
|
||||
|
||||
/// @brief Returns the alignment field of an attribute as a byte alignment
|
||||
/// value.
|
||||
@ -117,66 +117,66 @@ public:
|
||||
|
||||
/// @brief Parameter attributes that do not apply to vararg call arguments.
|
||||
bool hasIncompatibleWithVarArgsAttrs() const {
|
||||
return hasAttribute(Attributes::StructRet);
|
||||
return hasAttribute(Attribute::StructRet);
|
||||
}
|
||||
|
||||
/// @brief Attributes that only apply to function parameters.
|
||||
/// @brief Attribute that only apply to function parameters.
|
||||
bool hasParameterOnlyAttrs() const {
|
||||
return hasAttribute(Attributes::ByVal) ||
|
||||
hasAttribute(Attributes::Nest) ||
|
||||
hasAttribute(Attributes::StructRet) ||
|
||||
hasAttribute(Attributes::NoCapture);
|
||||
return hasAttribute(Attribute::ByVal) ||
|
||||
hasAttribute(Attribute::Nest) ||
|
||||
hasAttribute(Attribute::StructRet) ||
|
||||
hasAttribute(Attribute::NoCapture);
|
||||
}
|
||||
|
||||
/// @brief Attributes 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.
|
||||
bool hasFunctionOnlyAttrs() const {
|
||||
return hasAttribute(Attributes::NoReturn) ||
|
||||
hasAttribute(Attributes::NoUnwind) ||
|
||||
hasAttribute(Attributes::ReadNone) ||
|
||||
hasAttribute(Attributes::ReadOnly) ||
|
||||
hasAttribute(Attributes::NoInline) ||
|
||||
hasAttribute(Attributes::AlwaysInline) ||
|
||||
hasAttribute(Attributes::OptimizeForSize) ||
|
||||
hasAttribute(Attributes::StackProtect) ||
|
||||
hasAttribute(Attributes::StackProtectReq) ||
|
||||
hasAttribute(Attributes::NoRedZone) ||
|
||||
hasAttribute(Attributes::NoImplicitFloat) ||
|
||||
hasAttribute(Attributes::Naked) ||
|
||||
hasAttribute(Attributes::InlineHint) ||
|
||||
hasAttribute(Attributes::StackAlignment) ||
|
||||
hasAttribute(Attributes::UWTable) ||
|
||||
hasAttribute(Attributes::NonLazyBind) ||
|
||||
hasAttribute(Attributes::ReturnsTwice) ||
|
||||
hasAttribute(Attributes::AddressSafety) ||
|
||||
hasAttribute(Attributes::MinSize);
|
||||
return hasAttribute(Attribute::NoReturn) ||
|
||||
hasAttribute(Attribute::NoUnwind) ||
|
||||
hasAttribute(Attribute::ReadNone) ||
|
||||
hasAttribute(Attribute::ReadOnly) ||
|
||||
hasAttribute(Attribute::NoInline) ||
|
||||
hasAttribute(Attribute::AlwaysInline) ||
|
||||
hasAttribute(Attribute::OptimizeForSize) ||
|
||||
hasAttribute(Attribute::StackProtect) ||
|
||||
hasAttribute(Attribute::StackProtectReq) ||
|
||||
hasAttribute(Attribute::NoRedZone) ||
|
||||
hasAttribute(Attribute::NoImplicitFloat) ||
|
||||
hasAttribute(Attribute::Naked) ||
|
||||
hasAttribute(Attribute::InlineHint) ||
|
||||
hasAttribute(Attribute::StackAlignment) ||
|
||||
hasAttribute(Attribute::UWTable) ||
|
||||
hasAttribute(Attribute::NonLazyBind) ||
|
||||
hasAttribute(Attribute::ReturnsTwice) ||
|
||||
hasAttribute(Attribute::AddressSafety) ||
|
||||
hasAttribute(Attribute::MinSize);
|
||||
}
|
||||
|
||||
bool operator==(const Attributes &A) const {
|
||||
bool operator==(const Attribute &A) const {
|
||||
return Attrs == A.Attrs;
|
||||
}
|
||||
bool operator!=(const Attributes &A) const {
|
||||
bool operator!=(const Attribute &A) const {
|
||||
return Attrs != A.Attrs;
|
||||
}
|
||||
|
||||
uint64_t Raw() const;
|
||||
|
||||
/// @brief Which attributes cannot be applied to a type.
|
||||
static Attributes typeIncompatible(Type *Ty);
|
||||
static Attribute typeIncompatible(Type *Ty);
|
||||
|
||||
/// encodeLLVMAttributesForBitcode - This returns an integer containing an
|
||||
/// encoding of all the LLVM attributes found in the given attribute bitset.
|
||||
/// Any change to this encoding is a breaking change to bitcode compatibility.
|
||||
static uint64_t encodeLLVMAttributesForBitcode(Attributes Attrs);
|
||||
static uint64_t encodeLLVMAttributesForBitcode(Attribute Attrs);
|
||||
|
||||
/// decodeLLVMAttributesForBitcode - This returns an attribute bitset
|
||||
/// containing the LLVM attributes that have been decoded from the given
|
||||
/// integer. This function must stay in sync with
|
||||
/// 'encodeLLVMAttributesForBitcode'.
|
||||
static Attributes decodeLLVMAttributesForBitcode(LLVMContext &C,
|
||||
static Attribute decodeLLVMAttributesForBitcode(LLVMContext &C,
|
||||
uint64_t EncodedAttrs);
|
||||
|
||||
/// getAsString - The set of Attributes set in Attributes is converted to a
|
||||
/// getAsString - The set of attributes set in Attribute is converted to a
|
||||
/// string of equivalent mnemonics. This is, presumably, for writing out the
|
||||
/// mnemonics for the assembly writer.
|
||||
/// @brief Convert attribute bits to text
|
||||
@ -184,8 +184,8 @@ public:
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// AttrBuilder - This class is used in conjunction with the Attributes::get
|
||||
/// method to create an Attributes object. The object itself is uniquified. The
|
||||
/// AttrBuilder - This class is used in conjunction with the Attribute::get
|
||||
/// method to create an Attribute object. The object itself is uniquified. The
|
||||
/// Builder's value, however, is not. So this can be used as a quick way to test
|
||||
/// for equality, presence of attributes, etc.
|
||||
class AttrBuilder {
|
||||
@ -193,31 +193,31 @@ class AttrBuilder {
|
||||
public:
|
||||
AttrBuilder() : Bits(0) {}
|
||||
explicit AttrBuilder(uint64_t B) : Bits(B) {}
|
||||
AttrBuilder(const Attributes &A) : Bits(A.Raw()) {}
|
||||
AttrBuilder(const Attribute &A) : Bits(A.Raw()) {}
|
||||
|
||||
void clear() { Bits = 0; }
|
||||
|
||||
/// addAttribute - Add an attribute to the builder.
|
||||
AttrBuilder &addAttribute(Attributes::AttrVal Val);
|
||||
AttrBuilder &addAttribute(Attribute::AttrVal Val);
|
||||
|
||||
/// removeAttribute - Remove an attribute from the builder.
|
||||
AttrBuilder &removeAttribute(Attributes::AttrVal Val);
|
||||
AttrBuilder &removeAttribute(Attribute::AttrVal Val);
|
||||
|
||||
/// addAttribute - Add the attributes from A to the builder.
|
||||
AttrBuilder &addAttributes(const Attributes &A);
|
||||
AttrBuilder &addAttributes(const Attribute &A);
|
||||
|
||||
/// removeAttribute - Remove the attributes from A from the builder.
|
||||
AttrBuilder &removeAttributes(const Attributes &A);
|
||||
AttrBuilder &removeAttributes(const Attribute &A);
|
||||
|
||||
/// hasAttribute - Return true if the builder has the specified attribute.
|
||||
bool hasAttribute(Attributes::AttrVal A) const;
|
||||
bool hasAttribute(Attribute::AttrVal A) const;
|
||||
|
||||
/// hasAttributes - Return true if the builder has IR-level attributes.
|
||||
bool hasAttributes() const;
|
||||
|
||||
/// hasAttributes - Return true if the builder has any attribute that's in the
|
||||
/// specified attribute.
|
||||
bool hasAttributes(const Attributes &A) const;
|
||||
bool hasAttributes(const Attribute &A) const;
|
||||
|
||||
/// hasAlignmentAttr - Return true if the builder has an alignment attribute.
|
||||
bool hasAlignmentAttr() const;
|
||||
@ -229,11 +229,11 @@ public:
|
||||
uint64_t getStackAlignment() const;
|
||||
|
||||
/// addAlignmentAttr - This turns an int alignment (which must be a power of
|
||||
/// 2) into the form used internally in Attributes.
|
||||
/// 2) into the form used internally in Attribute.
|
||||
AttrBuilder &addAlignmentAttr(unsigned Align);
|
||||
|
||||
/// addStackAlignmentAttr - This turns an int stack alignment (which must be a
|
||||
/// power of 2) into the form used internally in Attributes.
|
||||
/// power of 2) into the form used internally in Attribute.
|
||||
AttrBuilder &addStackAlignmentAttr(unsigned Align);
|
||||
|
||||
/// addRawValue - Add the raw value to the internal representation.
|
||||
@ -242,25 +242,25 @@ public:
|
||||
|
||||
/// @brief Remove attributes that are used on functions only.
|
||||
void removeFunctionOnlyAttrs() {
|
||||
removeAttribute(Attributes::NoReturn)
|
||||
.removeAttribute(Attributes::NoUnwind)
|
||||
.removeAttribute(Attributes::ReadNone)
|
||||
.removeAttribute(Attributes::ReadOnly)
|
||||
.removeAttribute(Attributes::NoInline)
|
||||
.removeAttribute(Attributes::AlwaysInline)
|
||||
.removeAttribute(Attributes::OptimizeForSize)
|
||||
.removeAttribute(Attributes::StackProtect)
|
||||
.removeAttribute(Attributes::StackProtectReq)
|
||||
.removeAttribute(Attributes::NoRedZone)
|
||||
.removeAttribute(Attributes::NoImplicitFloat)
|
||||
.removeAttribute(Attributes::Naked)
|
||||
.removeAttribute(Attributes::InlineHint)
|
||||
.removeAttribute(Attributes::StackAlignment)
|
||||
.removeAttribute(Attributes::UWTable)
|
||||
.removeAttribute(Attributes::NonLazyBind)
|
||||
.removeAttribute(Attributes::ReturnsTwice)
|
||||
.removeAttribute(Attributes::AddressSafety)
|
||||
.removeAttribute(Attributes::MinSize);
|
||||
removeAttribute(Attribute::NoReturn)
|
||||
.removeAttribute(Attribute::NoUnwind)
|
||||
.removeAttribute(Attribute::ReadNone)
|
||||
.removeAttribute(Attribute::ReadOnly)
|
||||
.removeAttribute(Attribute::NoInline)
|
||||
.removeAttribute(Attribute::AlwaysInline)
|
||||
.removeAttribute(Attribute::OptimizeForSize)
|
||||
.removeAttribute(Attribute::StackProtect)
|
||||
.removeAttribute(Attribute::StackProtectReq)
|
||||
.removeAttribute(Attribute::NoRedZone)
|
||||
.removeAttribute(Attribute::NoImplicitFloat)
|
||||
.removeAttribute(Attribute::Naked)
|
||||
.removeAttribute(Attribute::InlineHint)
|
||||
.removeAttribute(Attribute::StackAlignment)
|
||||
.removeAttribute(Attribute::UWTable)
|
||||
.removeAttribute(Attribute::NonLazyBind)
|
||||
.removeAttribute(Attribute::ReturnsTwice)
|
||||
.removeAttribute(Attribute::AddressSafety)
|
||||
.removeAttribute(Attribute::MinSize);
|
||||
}
|
||||
|
||||
uint64_t Raw() const { return Bits; }
|
||||
@ -280,16 +280,16 @@ public:
|
||||
/// AttributeWithIndex - This is just a pair of values to associate a set of
|
||||
/// attributes with an index.
|
||||
struct AttributeWithIndex {
|
||||
Attributes Attrs; ///< The attributes that are set, or'd together.
|
||||
Attribute Attrs; ///< The attributes that are set, or'd together.
|
||||
unsigned Index; ///< Index of the parameter for which the attributes apply.
|
||||
///< Index 0 is used for return value attributes.
|
||||
///< Index ~0U is used for function attributes.
|
||||
|
||||
static AttributeWithIndex get(LLVMContext &C, unsigned Idx,
|
||||
ArrayRef<Attributes::AttrVal> Attrs) {
|
||||
return get(Idx, Attributes::get(C, Attrs));
|
||||
ArrayRef<Attribute::AttrVal> Attrs) {
|
||||
return get(Idx, Attribute::get(C, Attrs));
|
||||
}
|
||||
static AttributeWithIndex get(unsigned Idx, Attributes Attrs) {
|
||||
static AttributeWithIndex get(unsigned Idx, Attribute Attrs) {
|
||||
AttributeWithIndex P;
|
||||
P.Index = Idx;
|
||||
P.Attrs = Attrs;
|
||||
@ -318,7 +318,7 @@ private:
|
||||
|
||||
/// @brief The attributes for the specified index are returned. Attributes
|
||||
/// for the result are denoted with Idx = 0.
|
||||
Attributes getAttributes(unsigned Idx) const;
|
||||
Attribute getAttributes(unsigned Idx) const;
|
||||
|
||||
explicit AttributeSet(AttributeListImpl *LI) : AttrList(LI) {}
|
||||
public:
|
||||
@ -330,42 +330,42 @@ public:
|
||||
// Attribute List Construction and Mutation
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// get - Return a Attributes list with the specified parameters in it.
|
||||
/// get - Return an AttributeSet with the specified parameters in it.
|
||||
static AttributeSet get(LLVMContext &C, ArrayRef<AttributeWithIndex> Attrs);
|
||||
|
||||
/// addAttr - Add the specified attribute at the specified index to this
|
||||
/// attribute list. Since attribute lists are immutable, this
|
||||
/// returns the new list.
|
||||
AttributeSet addAttr(LLVMContext &C, unsigned Idx, Attributes Attrs) const;
|
||||
AttributeSet addAttr(LLVMContext &C, unsigned Idx, Attribute Attrs) const;
|
||||
|
||||
/// removeAttr - Remove the specified attribute at the specified index from
|
||||
/// this attribute list. Since attribute lists are immutable, this
|
||||
/// returns the new list.
|
||||
AttributeSet removeAttr(LLVMContext &C, unsigned Idx, Attributes Attrs) const;
|
||||
AttributeSet removeAttr(LLVMContext &C, unsigned Idx, Attribute Attrs) const;
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Attribute List Accessors
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// getParamAttributes - The attributes for the specified index are
|
||||
/// returned.
|
||||
Attributes getParamAttributes(unsigned Idx) const {
|
||||
Attribute getParamAttributes(unsigned Idx) const {
|
||||
return getAttributes(Idx);
|
||||
}
|
||||
|
||||
/// getRetAttributes - The attributes for the ret value are
|
||||
/// returned.
|
||||
Attributes getRetAttributes() const {
|
||||
Attribute getRetAttributes() const {
|
||||
return getAttributes(ReturnIndex);
|
||||
}
|
||||
|
||||
/// getFnAttributes - The function attributes are returned.
|
||||
Attributes getFnAttributes() const {
|
||||
Attribute getFnAttributes() const {
|
||||
return getAttributes(FunctionIndex);
|
||||
}
|
||||
|
||||
/// paramHasAttr - Return true if the specified parameter index has the
|
||||
/// specified attribute set.
|
||||
bool paramHasAttr(unsigned Idx, Attributes Attr) const {
|
||||
bool paramHasAttr(unsigned Idx, Attribute Attr) const {
|
||||
return getAttributes(Idx).hasAttributes(Attr);
|
||||
}
|
||||
|
||||
@ -377,10 +377,10 @@ public:
|
||||
|
||||
/// hasAttrSomewhere - Return true if the specified attribute is set for at
|
||||
/// least one parameter or for the return value.
|
||||
bool hasAttrSomewhere(Attributes::AttrVal Attr) const;
|
||||
bool hasAttrSomewhere(Attribute::AttrVal Attr) const;
|
||||
|
||||
unsigned getNumAttrs() const;
|
||||
Attributes &getAttributesAtIndex(unsigned i) const;
|
||||
Attribute &getAttributesAtIndex(unsigned i) const;
|
||||
|
||||
/// operator==/!= - Provide equality predicates.
|
||||
bool operator==(const AttributeSet &RHS) const
|
||||
@ -398,9 +398,9 @@ public:
|
||||
return AttrList;
|
||||
}
|
||||
|
||||
// Attributes are stored as a dense set of slots, where there is one
|
||||
// slot for each argument that has an attribute. This allows walking over the
|
||||
// dense set instead of walking the sparse list of attributes.
|
||||
// Attributes are stored as a dense set of slots, where there is one slot for
|
||||
// each argument that has an attribute. This allows walking over the dense
|
||||
// set instead of walking the sparse list of attributes.
|
||||
|
||||
/// isEmpty - Return true if there are no attributes.
|
||||
///
|
||||
|
@ -86,7 +86,7 @@ ISD::CondCode getICmpCondCode(ICmpInst::Predicate Pred);
|
||||
/// between it and the return.
|
||||
///
|
||||
/// This function only tests target-independent requirements.
|
||||
bool isInTailCallPosition(ImmutableCallSite CS, Attributes CalleeRetAttr,
|
||||
bool isInTailCallPosition(ImmutableCallSite CS, Attribute CalleeRetAttr,
|
||||
const TargetLowering &TLI);
|
||||
|
||||
bool isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
|
||||
|
@ -170,21 +170,21 @@ public:
|
||||
|
||||
/// getFnAttributes - Return the function attributes for querying.
|
||||
///
|
||||
Attributes getFnAttributes() const {
|
||||
Attribute getFnAttributes() const {
|
||||
return AttributeList.getFnAttributes();
|
||||
}
|
||||
|
||||
/// addFnAttr - Add function attributes to this function.
|
||||
///
|
||||
void addFnAttr(Attributes::AttrVal N) {
|
||||
// Function Attributes are stored at ~0 index
|
||||
addAttribute(AttributeSet::FunctionIndex, Attributes::get(getContext(), N));
|
||||
void addFnAttr(Attribute::AttrVal N) {
|
||||
// Function Attribute are stored at ~0 index
|
||||
addAttribute(AttributeSet::FunctionIndex, Attribute::get(getContext(), N));
|
||||
}
|
||||
|
||||
/// removeFnAttr - Remove function attributes from this function.
|
||||
///
|
||||
void removeFnAttr(Attributes N) {
|
||||
// Function Attributes are stored at ~0 index
|
||||
void removeFnAttr(Attribute N) {
|
||||
// Function Attribute are stored at ~0 index
|
||||
removeAttribute(~0U, N);
|
||||
}
|
||||
|
||||
@ -197,20 +197,20 @@ public:
|
||||
|
||||
|
||||
/// getRetAttributes - Return the return attributes for querying.
|
||||
Attributes getRetAttributes() const {
|
||||
Attribute getRetAttributes() const {
|
||||
return AttributeList.getRetAttributes();
|
||||
}
|
||||
|
||||
/// getParamAttributes - Return the parameter attributes for querying.
|
||||
Attributes getParamAttributes(unsigned Idx) const {
|
||||
Attribute getParamAttributes(unsigned Idx) const {
|
||||
return AttributeList.getParamAttributes(Idx);
|
||||
}
|
||||
|
||||
/// addAttribute - adds the attribute to the list of attributes.
|
||||
void addAttribute(unsigned i, Attributes attr);
|
||||
void addAttribute(unsigned i, Attribute attr);
|
||||
|
||||
/// removeAttribute - removes the attribute from the list of attributes.
|
||||
void removeAttribute(unsigned i, Attributes attr);
|
||||
void removeAttribute(unsigned i, Attribute attr);
|
||||
|
||||
/// @brief Extract the alignment for a call or parameter (0=unknown).
|
||||
unsigned getParamAlignment(unsigned i) const {
|
||||
@ -219,44 +219,44 @@ public:
|
||||
|
||||
/// @brief Determine if the function does not access memory.
|
||||
bool doesNotAccessMemory() const {
|
||||
return getFnAttributes().hasAttribute(Attributes::ReadNone);
|
||||
return getFnAttributes().hasAttribute(Attribute::ReadNone);
|
||||
}
|
||||
void setDoesNotAccessMemory() {
|
||||
addFnAttr(Attributes::ReadNone);
|
||||
addFnAttr(Attribute::ReadNone);
|
||||
}
|
||||
|
||||
/// @brief Determine if the function does not access or only reads memory.
|
||||
bool onlyReadsMemory() const {
|
||||
return doesNotAccessMemory() ||
|
||||
getFnAttributes().hasAttribute(Attributes::ReadOnly);
|
||||
getFnAttributes().hasAttribute(Attribute::ReadOnly);
|
||||
}
|
||||
void setOnlyReadsMemory() {
|
||||
addFnAttr(Attributes::ReadOnly);
|
||||
addFnAttr(Attribute::ReadOnly);
|
||||
}
|
||||
|
||||
/// @brief Determine if the function cannot return.
|
||||
bool doesNotReturn() const {
|
||||
return getFnAttributes().hasAttribute(Attributes::NoReturn);
|
||||
return getFnAttributes().hasAttribute(Attribute::NoReturn);
|
||||
}
|
||||
void setDoesNotReturn() {
|
||||
addFnAttr(Attributes::NoReturn);
|
||||
addFnAttr(Attribute::NoReturn);
|
||||
}
|
||||
|
||||
/// @brief Determine if the function cannot unwind.
|
||||
bool doesNotThrow() const {
|
||||
return getFnAttributes().hasAttribute(Attributes::NoUnwind);
|
||||
return getFnAttributes().hasAttribute(Attribute::NoUnwind);
|
||||
}
|
||||
void setDoesNotThrow() {
|
||||
addFnAttr(Attributes::NoUnwind);
|
||||
addFnAttr(Attribute::NoUnwind);
|
||||
}
|
||||
|
||||
/// @brief True if the ABI mandates (or the user requested) that this
|
||||
/// function be in a unwind table.
|
||||
bool hasUWTable() const {
|
||||
return getFnAttributes().hasAttribute(Attributes::UWTable);
|
||||
return getFnAttributes().hasAttribute(Attribute::UWTable);
|
||||
}
|
||||
void setHasUWTable() {
|
||||
addFnAttr(Attributes::UWTable);
|
||||
addFnAttr(Attribute::UWTable);
|
||||
}
|
||||
|
||||
/// @brief True if this function needs an unwind table.
|
||||
@ -267,25 +267,25 @@ public:
|
||||
/// @brief Determine if the function returns a structure through first
|
||||
/// pointer argument.
|
||||
bool hasStructRetAttr() const {
|
||||
return getParamAttributes(1).hasAttribute(Attributes::StructRet);
|
||||
return getParamAttributes(1).hasAttribute(Attribute::StructRet);
|
||||
}
|
||||
|
||||
/// @brief Determine if the parameter does not alias other parameters.
|
||||
/// @param n The parameter to check. 1 is the first parameter, 0 is the return
|
||||
bool doesNotAlias(unsigned n) const {
|
||||
return getParamAttributes(n).hasAttribute(Attributes::NoAlias);
|
||||
return getParamAttributes(n).hasAttribute(Attribute::NoAlias);
|
||||
}
|
||||
void setDoesNotAlias(unsigned n) {
|
||||
addAttribute(n, Attributes::get(getContext(), Attributes::NoAlias));
|
||||
addAttribute(n, Attribute::get(getContext(), Attribute::NoAlias));
|
||||
}
|
||||
|
||||
/// @brief Determine if the parameter can be captured.
|
||||
/// @param n The parameter to check. 1 is the first parameter, 0 is the return
|
||||
bool doesNotCapture(unsigned n) const {
|
||||
return getParamAttributes(n).hasAttribute(Attributes::NoCapture);
|
||||
return getParamAttributes(n).hasAttribute(Attribute::NoCapture);
|
||||
}
|
||||
void setDoesNotCapture(unsigned n) {
|
||||
addAttribute(n, Attributes::get(getContext(), Attributes::NoCapture));
|
||||
addAttribute(n, Attribute::get(getContext(), Attribute::NoCapture));
|
||||
}
|
||||
|
||||
/// copyAttributesFrom - copy all additional attributes (those not needed to
|
||||
|
@ -1272,16 +1272,16 @@ public:
|
||||
void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; }
|
||||
|
||||
/// addAttribute - adds the attribute to the list of attributes.
|
||||
void addAttribute(unsigned i, Attributes attr);
|
||||
void addAttribute(unsigned i, Attribute attr);
|
||||
|
||||
/// removeAttribute - removes the attribute from the list of attributes.
|
||||
void removeAttribute(unsigned i, Attributes attr);
|
||||
void removeAttribute(unsigned i, Attribute attr);
|
||||
|
||||
/// \brief Determine whether this call has the given attribute.
|
||||
bool hasFnAttr(Attributes::AttrVal A) const;
|
||||
bool hasFnAttr(Attribute::AttrVal A) const;
|
||||
|
||||
/// \brief Determine whether the call or the callee has the given attributes.
|
||||
bool paramHasAttr(unsigned i, Attributes::AttrVal A) const;
|
||||
bool paramHasAttr(unsigned i, Attribute::AttrVal A) const;
|
||||
|
||||
/// \brief Extract the alignment for a call or parameter (0=unknown).
|
||||
unsigned getParamAlignment(unsigned i) const {
|
||||
@ -1289,64 +1289,64 @@ public:
|
||||
}
|
||||
|
||||
/// \brief Return true if the call should not be inlined.
|
||||
bool isNoInline() const { return hasFnAttr(Attributes::NoInline); }
|
||||
bool isNoInline() const { return hasFnAttr(Attribute::NoInline); }
|
||||
void setIsNoInline() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::NoInline));
|
||||
Attribute::get(getContext(), Attribute::NoInline));
|
||||
}
|
||||
|
||||
/// \brief Return true if the call can return twice
|
||||
bool canReturnTwice() const {
|
||||
return hasFnAttr(Attributes::ReturnsTwice);
|
||||
return hasFnAttr(Attribute::ReturnsTwice);
|
||||
}
|
||||
void setCanReturnTwice() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::ReturnsTwice));
|
||||
Attribute::get(getContext(), Attribute::ReturnsTwice));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call does not access memory.
|
||||
bool doesNotAccessMemory() const {
|
||||
return hasFnAttr(Attributes::ReadNone);
|
||||
return hasFnAttr(Attribute::ReadNone);
|
||||
}
|
||||
void setDoesNotAccessMemory() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::ReadNone));
|
||||
Attribute::get(getContext(), Attribute::ReadNone));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call does not access or only reads memory.
|
||||
bool onlyReadsMemory() const {
|
||||
return doesNotAccessMemory() || hasFnAttr(Attributes::ReadOnly);
|
||||
return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly);
|
||||
}
|
||||
void setOnlyReadsMemory() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::ReadOnly));
|
||||
Attribute::get(getContext(), Attribute::ReadOnly));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call cannot return.
|
||||
bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); }
|
||||
bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); }
|
||||
void setDoesNotReturn() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::NoReturn));
|
||||
Attribute::get(getContext(), Attribute::NoReturn));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call cannot unwind.
|
||||
bool doesNotThrow() const { return hasFnAttr(Attributes::NoUnwind); }
|
||||
bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); }
|
||||
void setDoesNotThrow() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::NoUnwind));
|
||||
Attribute::get(getContext(), Attribute::NoUnwind));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call returns a structure through first
|
||||
/// pointer argument.
|
||||
bool hasStructRetAttr() const {
|
||||
// Be friendly and also check the callee.
|
||||
return paramHasAttr(1, Attributes::StructRet);
|
||||
return paramHasAttr(1, Attribute::StructRet);
|
||||
}
|
||||
|
||||
/// \brief Determine if any call argument is an aggregate passed by value.
|
||||
bool hasByValArgument() const {
|
||||
for (unsigned I = 0, E = AttributeList.getNumAttrs(); I != E; ++I)
|
||||
if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attributes::ByVal))
|
||||
if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attribute::ByVal))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -3021,16 +3021,16 @@ public:
|
||||
void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; }
|
||||
|
||||
/// addAttribute - adds the attribute to the list of attributes.
|
||||
void addAttribute(unsigned i, Attributes attr);
|
||||
void addAttribute(unsigned i, Attribute attr);
|
||||
|
||||
/// removeAttribute - removes the attribute from the list of attributes.
|
||||
void removeAttribute(unsigned i, Attributes attr);
|
||||
void removeAttribute(unsigned i, Attribute attr);
|
||||
|
||||
/// \brief Determine whether this call has the NoAlias attribute.
|
||||
bool hasFnAttr(Attributes::AttrVal A) const;
|
||||
bool hasFnAttr(Attribute::AttrVal A) const;
|
||||
|
||||
/// \brief Determine whether the call or the callee has the given attributes.
|
||||
bool paramHasAttr(unsigned i, Attributes::AttrVal A) const;
|
||||
bool paramHasAttr(unsigned i, Attribute::AttrVal A) const;
|
||||
|
||||
/// \brief Extract the alignment for a call or parameter (0=unknown).
|
||||
unsigned getParamAlignment(unsigned i) const {
|
||||
@ -3038,55 +3038,55 @@ public:
|
||||
}
|
||||
|
||||
/// \brief Return true if the call should not be inlined.
|
||||
bool isNoInline() const { return hasFnAttr(Attributes::NoInline); }
|
||||
bool isNoInline() const { return hasFnAttr(Attribute::NoInline); }
|
||||
void setIsNoInline() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::NoInline));
|
||||
Attribute::get(getContext(), Attribute::NoInline));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call does not access memory.
|
||||
bool doesNotAccessMemory() const {
|
||||
return hasFnAttr(Attributes::ReadNone);
|
||||
return hasFnAttr(Attribute::ReadNone);
|
||||
}
|
||||
void setDoesNotAccessMemory() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::ReadNone));
|
||||
Attribute::get(getContext(), Attribute::ReadNone));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call does not access or only reads memory.
|
||||
bool onlyReadsMemory() const {
|
||||
return doesNotAccessMemory() || hasFnAttr(Attributes::ReadOnly);
|
||||
return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly);
|
||||
}
|
||||
void setOnlyReadsMemory() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::ReadOnly));
|
||||
Attribute::get(getContext(), Attribute::ReadOnly));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call cannot return.
|
||||
bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); }
|
||||
bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); }
|
||||
void setDoesNotReturn() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::NoReturn));
|
||||
Attribute::get(getContext(), Attribute::NoReturn));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call cannot unwind.
|
||||
bool doesNotThrow() const { return hasFnAttr(Attributes::NoUnwind); }
|
||||
bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); }
|
||||
void setDoesNotThrow() {
|
||||
addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(getContext(), Attributes::NoUnwind));
|
||||
Attribute::get(getContext(), Attribute::NoUnwind));
|
||||
}
|
||||
|
||||
/// \brief Determine if the call returns a structure through first
|
||||
/// pointer argument.
|
||||
bool hasStructRetAttr() const {
|
||||
// Be friendly and also check the callee.
|
||||
return paramHasAttr(1, Attributes::StructRet);
|
||||
return paramHasAttr(1, Attribute::StructRet);
|
||||
}
|
||||
|
||||
/// \brief Determine if any call argument is an aggregate passed by value.
|
||||
bool hasByValArgument() const {
|
||||
for (unsigned I = 0, E = AttributeList.getNumAttrs(); I != E; ++I)
|
||||
if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attributes::ByVal))
|
||||
if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attribute::ByVal))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -185,12 +185,12 @@ public:
|
||||
}
|
||||
|
||||
/// \brief Return true if this function has the given attribute.
|
||||
bool hasFnAttr(Attributes::AttrVal A) const {
|
||||
bool hasFnAttr(Attribute::AttrVal A) const {
|
||||
CALLSITE_DELEGATE_GETTER(hasFnAttr(A));
|
||||
}
|
||||
|
||||
/// \brief Return true if the call or the callee has the given attribute.
|
||||
bool paramHasAttr(unsigned i, Attributes::AttrVal A) const {
|
||||
bool paramHasAttr(unsigned i, Attribute::AttrVal A) const {
|
||||
CALLSITE_DELEGATE_GETTER(paramHasAttr(i, A));
|
||||
}
|
||||
|
||||
@ -244,12 +244,12 @@ public:
|
||||
|
||||
/// @brief Determine whether this argument is not captured.
|
||||
bool doesNotCapture(unsigned ArgNo) const {
|
||||
return paramHasAttr(ArgNo + 1, Attributes::NoCapture);
|
||||
return paramHasAttr(ArgNo + 1, Attribute::NoCapture);
|
||||
}
|
||||
|
||||
/// @brief Determine whether this argument is passed by value.
|
||||
bool isByValArgument(unsigned ArgNo) const {
|
||||
return paramHasAttr(ArgNo + 1, Attributes::ByVal);
|
||||
return paramHasAttr(ArgNo + 1, Attribute::ByVal);
|
||||
}
|
||||
|
||||
/// hasArgument - Returns true if this CallSite passes the given Value* as an
|
||||
|
@ -1353,9 +1353,9 @@ public:
|
||||
FunctionType *FTy, bool isTailCall, SDValue callee,
|
||||
ArgListTy &args, SelectionDAG &dag, DebugLoc dl,
|
||||
ImmutableCallSite &cs)
|
||||
: Chain(chain), RetTy(retTy), RetSExt(cs.paramHasAttr(0, Attributes::SExt)),
|
||||
RetZExt(cs.paramHasAttr(0, Attributes::ZExt)), IsVarArg(FTy->isVarArg()),
|
||||
IsInReg(cs.paramHasAttr(0, Attributes::InReg)),
|
||||
: Chain(chain), RetTy(retTy), RetSExt(cs.paramHasAttr(0, Attribute::SExt)),
|
||||
RetZExt(cs.paramHasAttr(0, Attribute::ZExt)), IsVarArg(FTy->isVarArg()),
|
||||
IsInReg(cs.paramHasAttr(0, Attribute::InReg)),
|
||||
DoesNotReturn(cs.doesNotReturn()),
|
||||
IsReturnValueUsed(!cs.getInstruction()->use_empty()),
|
||||
IsTailCall(isTailCall), NumFixedArgs(FTy->getNumParams()),
|
||||
@ -2205,7 +2205,7 @@ private:
|
||||
/// GetReturnInfo - Given an LLVM IR type and return type attributes,
|
||||
/// compute the return value EVTs and flags, and optionally also
|
||||
/// the offsets, if the return value is being lowered to memory.
|
||||
void GetReturnInfo(Type* ReturnType, Attributes attr,
|
||||
void GetReturnInfo(Type* ReturnType, Attribute attr,
|
||||
SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||
const TargetLowering &TLI);
|
||||
|
||||
|
@ -503,7 +503,7 @@ bool AliasAnalysis::canInstructionRangeModify(const Instruction &I1,
|
||||
bool llvm::isNoAliasCall(const Value *V) {
|
||||
if (isa<CallInst>(V) || isa<InvokeInst>(V))
|
||||
return ImmutableCallSite(cast<Instruction>(V))
|
||||
.paramHasAttr(0, Attributes::NoAlias);
|
||||
.paramHasAttr(0, Attribute::NoAlias);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ void CodeMetrics::analyzeFunction(Function *F, const DataLayout *TD) {
|
||||
// as volatile if they are live across a setjmp call, and they probably
|
||||
// won't do this in callers.
|
||||
exposesReturnsTwice = F->callsFunctionThatReturnsTwice() &&
|
||||
!F->getFnAttributes().hasAttribute(Attributes::ReturnsTwice);
|
||||
!F->getFnAttributes().hasAttribute(Attribute::ReturnsTwice);
|
||||
|
||||
// Look at the size of the callee.
|
||||
for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
|
||||
|
@ -610,7 +610,7 @@ bool CallAnalyzer::visitStore(StoreInst &I) {
|
||||
|
||||
bool CallAnalyzer::visitCallSite(CallSite CS) {
|
||||
if (CS.isCall() && cast<CallInst>(CS.getInstruction())->canReturnTwice() &&
|
||||
!F.getFnAttributes().hasAttribute(Attributes::ReturnsTwice)) {
|
||||
!F.getFnAttributes().hasAttribute(Attribute::ReturnsTwice)) {
|
||||
// This aborts the entire analysis.
|
||||
ExposesReturnsTwice = true;
|
||||
return false;
|
||||
@ -1041,7 +1041,7 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS, Function *Callee,
|
||||
|
||||
// Calls to functions with always-inline attributes should be inlined
|
||||
// whenever possible.
|
||||
if (Callee->getFnAttributes().hasAttribute(Attributes::AlwaysInline)) {
|
||||
if (Callee->getFnAttributes().hasAttribute(Attribute::AlwaysInline)) {
|
||||
if (isInlineViable(*Callee))
|
||||
return llvm::InlineCost::getAlways();
|
||||
return llvm::InlineCost::getNever();
|
||||
@ -1051,7 +1051,7 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS, Function *Callee,
|
||||
// something else. Don't inline functions marked noinline or call sites
|
||||
// marked noinline.
|
||||
if (Callee->mayBeOverridden() ||
|
||||
Callee->getFnAttributes().hasAttribute(Attributes::NoInline) ||
|
||||
Callee->getFnAttributes().hasAttribute(Attribute::NoInline) ||
|
||||
CS.isNoInline())
|
||||
return llvm::InlineCost::getNever();
|
||||
|
||||
@ -1073,7 +1073,7 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS, Function *Callee,
|
||||
}
|
||||
|
||||
bool InlineCostAnalyzer::isInlineViable(Function &F) {
|
||||
bool ReturnsTwice =F.getFnAttributes().hasAttribute(Attributes::ReturnsTwice);
|
||||
bool ReturnsTwice =F.getFnAttributes().hasAttribute(Attribute::ReturnsTwice);
|
||||
for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; ++BI) {
|
||||
// Disallow inlining of functions which contain an indirect branch.
|
||||
if (isa<IndirectBrInst>(BI->getTerminator()))
|
||||
|
@ -132,7 +132,7 @@ static const AllocFnsTy *getAllocationData(const Value *V, AllocType AllocTy,
|
||||
|
||||
static bool hasNoAliasAttr(const Value *V, bool LookThroughBitCast) {
|
||||
ImmutableCallSite CS(LookThroughBitCast ? V->stripPointerCasts() : V);
|
||||
return CS && CS.hasFnAttr(Attributes::NoAlias);
|
||||
return CS && CS.hasFnAttr(Attribute::NoAlias);
|
||||
}
|
||||
|
||||
|
||||
|
@ -328,7 +328,7 @@ getLoadLoadClobberFullWidthSize(const Value *MemLocBase, int64_t MemLocOffs,
|
||||
|
||||
if (LIOffs+NewLoadByteSize > MemLocEnd &&
|
||||
LI->getParent()->getParent()->getFnAttributes().
|
||||
hasAttribute(Attributes::AddressSafety))
|
||||
hasAttribute(Attribute::AddressSafety))
|
||||
// We will be reading past the location accessed by the original program.
|
||||
// While this is safe in a regular build, Address Safety analysis tools
|
||||
// may start reporting false warnings. So, don't do widening.
|
||||
|
@ -939,24 +939,24 @@ bool LLParser::ParseOptionalFuncAttrs(AttrBuilder &B) {
|
||||
B.addAlignmentAttr(Alignment);
|
||||
continue;
|
||||
}
|
||||
case lltok::kw_address_safety: B.addAttribute(Attributes::AddressSafety); break;
|
||||
case lltok::kw_alwaysinline: B.addAttribute(Attributes::AlwaysInline); break;
|
||||
case lltok::kw_inlinehint: B.addAttribute(Attributes::InlineHint); break;
|
||||
case lltok::kw_minsize: B.addAttribute(Attributes::MinSize); break;
|
||||
case lltok::kw_naked: B.addAttribute(Attributes::Naked); break;
|
||||
case lltok::kw_noinline: B.addAttribute(Attributes::NoInline); break;
|
||||
case lltok::kw_nonlazybind: B.addAttribute(Attributes::NonLazyBind); break;
|
||||
case lltok::kw_noredzone: B.addAttribute(Attributes::NoRedZone); break;
|
||||
case lltok::kw_noimplicitfloat: B.addAttribute(Attributes::NoImplicitFloat); break;
|
||||
case lltok::kw_noreturn: B.addAttribute(Attributes::NoReturn); break;
|
||||
case lltok::kw_nounwind: B.addAttribute(Attributes::NoUnwind); break;
|
||||
case lltok::kw_optsize: B.addAttribute(Attributes::OptimizeForSize); break;
|
||||
case lltok::kw_readnone: B.addAttribute(Attributes::ReadNone); break;
|
||||
case lltok::kw_readonly: B.addAttribute(Attributes::ReadOnly); break;
|
||||
case lltok::kw_returns_twice: B.addAttribute(Attributes::ReturnsTwice); break;
|
||||
case lltok::kw_ssp: B.addAttribute(Attributes::StackProtect); break;
|
||||
case lltok::kw_sspreq: B.addAttribute(Attributes::StackProtectReq); break;
|
||||
case lltok::kw_uwtable: B.addAttribute(Attributes::UWTable); break;
|
||||
case lltok::kw_address_safety: B.addAttribute(Attribute::AddressSafety); break;
|
||||
case lltok::kw_alwaysinline: B.addAttribute(Attribute::AlwaysInline); break;
|
||||
case lltok::kw_inlinehint: B.addAttribute(Attribute::InlineHint); break;
|
||||
case lltok::kw_minsize: B.addAttribute(Attribute::MinSize); break;
|
||||
case lltok::kw_naked: B.addAttribute(Attribute::Naked); break;
|
||||
case lltok::kw_noinline: B.addAttribute(Attribute::NoInline); break;
|
||||
case lltok::kw_nonlazybind: B.addAttribute(Attribute::NonLazyBind); break;
|
||||
case lltok::kw_noredzone: B.addAttribute(Attribute::NoRedZone); break;
|
||||
case lltok::kw_noimplicitfloat: B.addAttribute(Attribute::NoImplicitFloat); break;
|
||||
case lltok::kw_noreturn: B.addAttribute(Attribute::NoReturn); break;
|
||||
case lltok::kw_nounwind: B.addAttribute(Attribute::NoUnwind); break;
|
||||
case lltok::kw_optsize: B.addAttribute(Attribute::OptimizeForSize); break;
|
||||
case lltok::kw_readnone: B.addAttribute(Attribute::ReadNone); break;
|
||||
case lltok::kw_readonly: B.addAttribute(Attribute::ReadOnly); break;
|
||||
case lltok::kw_returns_twice: B.addAttribute(Attribute::ReturnsTwice); break;
|
||||
case lltok::kw_ssp: B.addAttribute(Attribute::StackProtect); break;
|
||||
case lltok::kw_sspreq: B.addAttribute(Attribute::StackProtectReq); break;
|
||||
case lltok::kw_uwtable: B.addAttribute(Attribute::UWTable); break;
|
||||
|
||||
// Error handling.
|
||||
case lltok::kw_zeroext:
|
||||
@ -994,14 +994,14 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
|
||||
B.addAlignmentAttr(Alignment);
|
||||
continue;
|
||||
}
|
||||
case lltok::kw_byval: B.addAttribute(Attributes::ByVal); break;
|
||||
case lltok::kw_inreg: B.addAttribute(Attributes::InReg); break;
|
||||
case lltok::kw_nest: B.addAttribute(Attributes::Nest); break;
|
||||
case lltok::kw_noalias: B.addAttribute(Attributes::NoAlias); break;
|
||||
case lltok::kw_nocapture: B.addAttribute(Attributes::NoCapture); break;
|
||||
case lltok::kw_signext: B.addAttribute(Attributes::SExt); break;
|
||||
case lltok::kw_sret: B.addAttribute(Attributes::StructRet); break;
|
||||
case lltok::kw_zeroext: B.addAttribute(Attributes::ZExt); break;
|
||||
case lltok::kw_byval: B.addAttribute(Attribute::ByVal); break;
|
||||
case lltok::kw_inreg: B.addAttribute(Attribute::InReg); break;
|
||||
case lltok::kw_nest: B.addAttribute(Attribute::Nest); break;
|
||||
case lltok::kw_noalias: B.addAttribute(Attribute::NoAlias); break;
|
||||
case lltok::kw_nocapture: B.addAttribute(Attribute::NoCapture); break;
|
||||
case lltok::kw_signext: B.addAttribute(Attribute::SExt); break;
|
||||
case lltok::kw_sret: B.addAttribute(Attribute::StructRet); break;
|
||||
case lltok::kw_zeroext: B.addAttribute(Attribute::ZExt); break;
|
||||
|
||||
case lltok::kw_noreturn: case lltok::kw_nounwind:
|
||||
case lltok::kw_uwtable: case lltok::kw_returns_twice:
|
||||
@ -1032,10 +1032,10 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) {
|
||||
switch (Token) {
|
||||
default: // End of attributes.
|
||||
return HaveError;
|
||||
case lltok::kw_inreg: B.addAttribute(Attributes::InReg); break;
|
||||
case lltok::kw_noalias: B.addAttribute(Attributes::NoAlias); break;
|
||||
case lltok::kw_signext: B.addAttribute(Attributes::SExt); break;
|
||||
case lltok::kw_zeroext: B.addAttribute(Attributes::ZExt); break;
|
||||
case lltok::kw_inreg: B.addAttribute(Attribute::InReg); break;
|
||||
case lltok::kw_noalias: B.addAttribute(Attribute::NoAlias); break;
|
||||
case lltok::kw_signext: B.addAttribute(Attribute::SExt); break;
|
||||
case lltok::kw_zeroext: B.addAttribute(Attribute::ZExt); break;
|
||||
|
||||
// Error handling.
|
||||
case lltok::kw_sret: case lltok::kw_nocapture:
|
||||
@ -1485,7 +1485,7 @@ bool LLParser::ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList,
|
||||
// Otherwise, handle normal operands.
|
||||
if (ParseOptionalParamAttrs(ArgAttrs) || ParseValue(ArgTy, V, PFS))
|
||||
return true;
|
||||
ArgList.push_back(ParamInfo(ArgLoc, V, Attributes::get(V->getContext(),
|
||||
ArgList.push_back(ParamInfo(ArgLoc, V, Attribute::get(V->getContext(),
|
||||
ArgAttrs)));
|
||||
}
|
||||
|
||||
@ -1536,7 +1536,7 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
|
||||
return Error(TypeLoc, "invalid type for function argument");
|
||||
|
||||
ArgList.push_back(ArgInfo(TypeLoc, ArgTy,
|
||||
Attributes::get(ArgTy->getContext(),
|
||||
Attribute::get(ArgTy->getContext(),
|
||||
Attrs), Name));
|
||||
|
||||
while (EatIfPresent(lltok::comma)) {
|
||||
@ -1564,7 +1564,7 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
|
||||
return Error(TypeLoc, "invalid type for function argument");
|
||||
|
||||
ArgList.push_back(ArgInfo(TypeLoc, ArgTy,
|
||||
Attributes::get(ArgTy->getContext(), Attrs),
|
||||
Attribute::get(ArgTy->getContext(), Attrs),
|
||||
Name));
|
||||
}
|
||||
}
|
||||
@ -2803,7 +2803,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
|
||||
// If the alignment was parsed as an attribute, move to the alignment field.
|
||||
if (FuncAttrs.hasAlignmentAttr()) {
|
||||
Alignment = FuncAttrs.getAlignment();
|
||||
FuncAttrs.removeAttribute(Attributes::Alignment);
|
||||
FuncAttrs.removeAttribute(Attribute::Alignment);
|
||||
}
|
||||
|
||||
// Okay, if we got here, the function is syntactically valid. Convert types
|
||||
@ -2814,7 +2814,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
|
||||
if (RetAttrs.hasAttributes())
|
||||
Attrs.push_back(
|
||||
AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
||||
Attributes::get(RetType->getContext(),
|
||||
Attribute::get(RetType->getContext(),
|
||||
RetAttrs)));
|
||||
|
||||
for (unsigned i = 0, e = ArgList.size(); i != e; ++i) {
|
||||
@ -2826,12 +2826,12 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
|
||||
if (FuncAttrs.hasAttributes())
|
||||
Attrs.push_back(
|
||||
AttributeWithIndex::get(AttributeSet::FunctionIndex,
|
||||
Attributes::get(RetType->getContext(),
|
||||
Attribute::get(RetType->getContext(),
|
||||
FuncAttrs)));
|
||||
|
||||
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
||||
|
||||
if (PAL.getParamAttributes(1).hasAttribute(Attributes::StructRet) &&
|
||||
if (PAL.getParamAttributes(1).hasAttribute(Attribute::StructRet) &&
|
||||
!RetType->isVoidTy())
|
||||
return Error(RetTypeLoc, "functions with 'sret' argument must return void");
|
||||
|
||||
@ -3354,12 +3354,12 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
|
||||
Value *Callee;
|
||||
if (ConvertValIDToValue(PFTy, CalleeID, Callee, &PFS)) return true;
|
||||
|
||||
// Set up the Attributes for the function.
|
||||
// Set up the Attribute for the function.
|
||||
SmallVector<AttributeWithIndex, 8> Attrs;
|
||||
if (RetAttrs.hasAttributes())
|
||||
Attrs.push_back(
|
||||
AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
||||
Attributes::get(Callee->getContext(),
|
||||
Attribute::get(Callee->getContext(),
|
||||
RetAttrs)));
|
||||
|
||||
SmallVector<Value*, 8> Args;
|
||||
@ -3390,10 +3390,10 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
|
||||
if (FnAttrs.hasAttributes())
|
||||
Attrs.push_back(
|
||||
AttributeWithIndex::get(AttributeSet::FunctionIndex,
|
||||
Attributes::get(Callee->getContext(),
|
||||
Attribute::get(Callee->getContext(),
|
||||
FnAttrs)));
|
||||
|
||||
// Finish off the Attributes and check them
|
||||
// Finish off the Attribute and check them
|
||||
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
||||
|
||||
InvokeInst *II = InvokeInst::Create(Callee, NormalBB, UnwindBB, Args);
|
||||
@ -3756,12 +3756,12 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
|
||||
Value *Callee;
|
||||
if (ConvertValIDToValue(PFTy, CalleeID, Callee, &PFS)) return true;
|
||||
|
||||
// Set up the Attributes for the function.
|
||||
// Set up the Attribute for the function.
|
||||
SmallVector<AttributeWithIndex, 8> Attrs;
|
||||
if (RetAttrs.hasAttributes())
|
||||
Attrs.push_back(
|
||||
AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
||||
Attributes::get(Callee->getContext(),
|
||||
Attribute::get(Callee->getContext(),
|
||||
RetAttrs)));
|
||||
|
||||
SmallVector<Value*, 8> Args;
|
||||
@ -3792,10 +3792,10 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
|
||||
if (FnAttrs.hasAttributes())
|
||||
Attrs.push_back(
|
||||
AttributeWithIndex::get(AttributeSet::FunctionIndex,
|
||||
Attributes::get(Callee->getContext(),
|
||||
Attribute::get(Callee->getContext(),
|
||||
FnAttrs)));
|
||||
|
||||
// Finish off the Attributes and check them
|
||||
// Finish off the Attribute and check them
|
||||
AttributeSet PAL = AttributeSet::get(Context, Attrs);
|
||||
|
||||
CallInst *CI = CallInst::Create(Callee, Args);
|
||||
|
@ -326,8 +326,8 @@ namespace llvm {
|
||||
struct ParamInfo {
|
||||
LocTy Loc;
|
||||
Value *V;
|
||||
Attributes Attrs;
|
||||
ParamInfo(LocTy loc, Value *v, Attributes attrs)
|
||||
Attribute Attrs;
|
||||
ParamInfo(LocTy loc, Value *v, Attribute attrs)
|
||||
: Loc(loc), V(v), Attrs(attrs) {}
|
||||
};
|
||||
bool ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList,
|
||||
@ -347,9 +347,9 @@ namespace llvm {
|
||||
struct ArgInfo {
|
||||
LocTy Loc;
|
||||
Type *Ty;
|
||||
Attributes Attrs;
|
||||
Attribute Attrs;
|
||||
std::string Name;
|
||||
ArgInfo(LocTy L, Type *ty, Attributes Attr, const std::string &N)
|
||||
ArgInfo(LocTy L, Type *ty, Attribute Attr, const std::string &N)
|
||||
: Loc(L), Ty(ty), Attrs(Attr), Name(N) {}
|
||||
};
|
||||
bool ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList, bool &isVarArg);
|
||||
|
@ -475,8 +475,8 @@ bool BitcodeReader::ParseAttributeBlock() {
|
||||
return Error("Invalid ENTRY record");
|
||||
|
||||
for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
|
||||
Attributes ReconstitutedAttr =
|
||||
Attributes::decodeLLVMAttributesForBitcode(Context, Record[i+1]);
|
||||
Attribute ReconstitutedAttr =
|
||||
Attribute::decodeLLVMAttributesForBitcode(Context, Record[i+1]);
|
||||
Record[i+1] = ReconstitutedAttr.Raw();
|
||||
}
|
||||
|
||||
@ -484,7 +484,7 @@ bool BitcodeReader::ParseAttributeBlock() {
|
||||
AttrBuilder B(Record[i+1]);
|
||||
if (B.hasAttributes())
|
||||
Attrs.push_back(AttributeWithIndex::get(Record[i],
|
||||
Attributes::get(Context, B)));
|
||||
Attribute::get(Context, B)));
|
||||
}
|
||||
|
||||
MAttributes.push_back(AttributeSet::get(Context, Attrs));
|
||||
|
@ -175,7 +175,7 @@ static void WriteAttributeTable(const ValueEnumerator &VE,
|
||||
for (unsigned i = 0, e = A.getNumSlots(); i != e; ++i) {
|
||||
const AttributeWithIndex &PAWI = A.getSlot(i);
|
||||
Record.push_back(PAWI.Index);
|
||||
Record.push_back(Attributes::encodeLLVMAttributesForBitcode(PAWI.Attrs));
|
||||
Record.push_back(Attribute::encodeLLVMAttributesForBitcode(PAWI.Attrs));
|
||||
}
|
||||
|
||||
Stream.EmitRecord(bitc::PARAMATTR_CODE_ENTRY, Record);
|
||||
|
@ -424,8 +424,8 @@ void ValueEnumerator::EnumerateAttributes(const AttributeSet &PAL) {
|
||||
unsigned &Entry = AttributeMap[PAL.getRawPointer()];
|
||||
if (Entry == 0) {
|
||||
// Never saw this before, add it.
|
||||
Attributes.push_back(PAL);
|
||||
Entry = Attributes.size();
|
||||
Attribute.push_back(PAL);
|
||||
Entry = Attribute.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
|
||||
typedef DenseMap<void*, unsigned> AttributeMapType;
|
||||
AttributeMapType AttributeMap;
|
||||
std::vector<AttributeSet> Attributes;
|
||||
std::vector<AttributeSet> Attribute;
|
||||
|
||||
/// GlobalBasicBlockIDs - This map memoizes the basic block ID's referenced by
|
||||
/// the "getGlobalBasicBlockID" method.
|
||||
@ -122,7 +122,7 @@ public:
|
||||
return BasicBlocks;
|
||||
}
|
||||
const std::vector<AttributeSet> &getAttributes() const {
|
||||
return Attributes;
|
||||
return Attribute;
|
||||
}
|
||||
|
||||
/// getGlobalBasicBlockID - This returns the function-specific ID for the
|
||||
|
@ -266,7 +266,7 @@ static const Value *getNoopInput(const Value *V, const TargetLowering &TLI) {
|
||||
/// between it and the return.
|
||||
///
|
||||
/// This function only tests target-independent requirements.
|
||||
bool llvm::isInTailCallPosition(ImmutableCallSite CS, Attributes CalleeRetAttr,
|
||||
bool llvm::isInTailCallPosition(ImmutableCallSite CS, Attribute CalleeRetAttr,
|
||||
const TargetLowering &TLI) {
|
||||
const Instruction *I = CS.getInstruction();
|
||||
const BasicBlock *ExitBB = I->getParent();
|
||||
@ -313,14 +313,14 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS, Attributes CalleeRetAttr,
|
||||
// Conservatively require the attributes of the call to match those of
|
||||
// the return. Ignore noalias because it doesn't affect the call sequence.
|
||||
const Function *F = ExitBB->getParent();
|
||||
Attributes CallerRetAttr = F->getAttributes().getRetAttributes();
|
||||
if (AttrBuilder(CalleeRetAttr).removeAttribute(Attributes::NoAlias) !=
|
||||
AttrBuilder(CallerRetAttr).removeAttribute(Attributes::NoAlias))
|
||||
Attribute CallerRetAttr = F->getAttributes().getRetAttributes();
|
||||
if (AttrBuilder(CalleeRetAttr).removeAttribute(Attribute::NoAlias) !=
|
||||
AttrBuilder(CallerRetAttr).removeAttribute(Attribute::NoAlias))
|
||||
return false;
|
||||
|
||||
// It's not safe to eliminate the sign / zero extension of the return value.
|
||||
if (CallerRetAttr.hasAttribute(Attributes::ZExt) ||
|
||||
CallerRetAttr.hasAttribute(Attributes::SExt))
|
||||
if (CallerRetAttr.hasAttribute(Attribute::ZExt) ||
|
||||
CallerRetAttr.hasAttribute(Attribute::SExt))
|
||||
return false;
|
||||
|
||||
// Otherwise, make sure the unmodified return value of I is the return value.
|
||||
@ -355,14 +355,14 @@ bool llvm::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
|
||||
|
||||
// Conservatively require the attributes of the call to match those of
|
||||
// the return. Ignore noalias because it doesn't affect the call sequence.
|
||||
Attributes CallerRetAttr = F->getAttributes().getRetAttributes();
|
||||
Attribute CallerRetAttr = F->getAttributes().getRetAttributes();
|
||||
if (AttrBuilder(CallerRetAttr)
|
||||
.removeAttribute(Attributes::NoAlias).hasAttributes())
|
||||
.removeAttribute(Attribute::NoAlias).hasAttributes())
|
||||
return false;
|
||||
|
||||
// It's not safe to eliminate the sign / zero extension of the return value.
|
||||
if (CallerRetAttr.hasAttribute(Attributes::ZExt) ||
|
||||
CallerRetAttr.hasAttribute(Attributes::SExt))
|
||||
if (CallerRetAttr.hasAttribute(Attribute::ZExt) ||
|
||||
CallerRetAttr.hasAttribute(Attribute::SExt))
|
||||
return false;
|
||||
|
||||
// Check if the only use is a function return node.
|
||||
|
@ -131,7 +131,7 @@ namespace llvm {
|
||||
|
||||
DIE *Parent;
|
||||
|
||||
/// Attributes values.
|
||||
/// Attribute values.
|
||||
///
|
||||
SmallVector<DIEValue*, 32> Values;
|
||||
|
||||
|
@ -239,7 +239,7 @@ class DwarfDebug {
|
||||
BumpPtrAllocator DIEValueAllocator;
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Attributes used to construct specific Dwarf sections.
|
||||
// Attribute used to construct specific Dwarf sections.
|
||||
//
|
||||
|
||||
CompileUnit *FirstCU;
|
||||
|
@ -571,7 +571,7 @@ static bool ProfitableToMerge(MachineBasicBlock *MBB1,
|
||||
MachineFunction *MF = MBB1->getParent();
|
||||
if (EffectiveTailLen >= 2 &&
|
||||
MF->getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize) &&
|
||||
hasAttribute(Attribute::OptimizeForSize) &&
|
||||
(I1 == MBB1->begin() || I2 == MBB2->begin()))
|
||||
return true;
|
||||
|
||||
|
@ -373,7 +373,7 @@ bool CodePlacementOpt::OptimizeIntraLoopEdges(MachineFunction &MF) {
|
||||
///
|
||||
bool CodePlacementOpt::AlignLoops(MachineFunction &MF) {
|
||||
const Function *F = MF.getFunction();
|
||||
if (F->getFnAttributes().hasAttribute(Attributes::OptimizeForSize))
|
||||
if (F->getFnAttributes().hasAttribute(Attribute::OptimizeForSize))
|
||||
return false;
|
||||
|
||||
unsigned Align = TLI->getPrefLoopAlignment();
|
||||
|
@ -1014,7 +1014,7 @@ void MachineBlockPlacement::buildCFGChains(MachineFunction &F) {
|
||||
// unnatural CFGs and backedges that were introduced purely because of the
|
||||
// loop rotations done during this layout pass.
|
||||
if (F.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize))
|
||||
hasAttribute(Attribute::OptimizeForSize))
|
||||
return;
|
||||
unsigned Align = TLI->getPrefLoopAlignment();
|
||||
if (!Align)
|
||||
|
@ -60,13 +60,13 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,
|
||||
MFInfo = 0;
|
||||
FrameInfo = new (Allocator) MachineFrameInfo(*TM.getFrameLowering(),
|
||||
TM.Options.RealignStack);
|
||||
if (Fn->getFnAttributes().hasAttribute(Attributes::StackAlignment))
|
||||
if (Fn->getFnAttributes().hasAttribute(Attribute::StackAlignment))
|
||||
FrameInfo->ensureMaxAlignment(Fn->getAttributes().
|
||||
getFnAttributes().getStackAlignment());
|
||||
ConstantPool = new (Allocator) MachineConstantPool(TM.getDataLayout());
|
||||
Alignment = TM.getTargetLowering()->getMinFunctionAlignment();
|
||||
// FIXME: Shouldn't use pref alignment if explicit alignment is set on Fn.
|
||||
if (!Fn->getFnAttributes().hasAttribute(Attributes::OptimizeForSize))
|
||||
if (!Fn->getFnAttributes().hasAttribute(Attribute::OptimizeForSize))
|
||||
Alignment = std::max(Alignment,
|
||||
TM.getTargetLowering()->getPrefFunctionAlignment());
|
||||
FunctionNumber = FunctionNum;
|
||||
|
@ -96,7 +96,7 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {
|
||||
placeCSRSpillsAndRestores(Fn);
|
||||
|
||||
// Add the code to save and restore the callee saved registers
|
||||
if (!F->getFnAttributes().hasAttribute(Attributes::Naked))
|
||||
if (!F->getFnAttributes().hasAttribute(Attribute::Naked))
|
||||
insertCSRSpillsAndRestores(Fn);
|
||||
|
||||
// Allow the target machine to make final modifications to the function
|
||||
@ -111,7 +111,7 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {
|
||||
// called functions. Because of this, calculateCalleeSavedRegisters()
|
||||
// must be called before this function in order to set the AdjustsStack
|
||||
// and MaxCallFrameSize variables.
|
||||
if (!F->getFnAttributes().hasAttribute(Attributes::Naked))
|
||||
if (!F->getFnAttributes().hasAttribute(Attribute::Naked))
|
||||
insertPrologEpilogCode(Fn);
|
||||
|
||||
// Replace all MO_FrameIndex operands with physical register references
|
||||
@ -208,7 +208,7 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) {
|
||||
return;
|
||||
|
||||
// In Naked functions we aren't going to save any registers.
|
||||
if (Fn.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
|
||||
if (Fn.getFunction()->getFnAttributes().hasAttribute(Attribute::Naked))
|
||||
return;
|
||||
|
||||
std::vector<CalleeSavedInfo> CSI;
|
||||
|
@ -3546,7 +3546,7 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
bool OptSize =
|
||||
MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize);
|
||||
hasAttribute(Attribute::OptimizeForSize);
|
||||
FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Dst);
|
||||
if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
|
||||
DstAlignCanChange = true;
|
||||
@ -3652,7 +3652,7 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
bool OptSize = MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize);
|
||||
hasAttribute(Attribute::OptimizeForSize);
|
||||
FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Dst);
|
||||
if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
|
||||
DstAlignCanChange = true;
|
||||
@ -3731,7 +3731,7 @@ static SDValue getMemsetStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
bool OptSize = MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize);
|
||||
hasAttribute(Attribute::OptimizeForSize);
|
||||
FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Dst);
|
||||
if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
|
||||
DstAlignCanChange = true;
|
||||
|
@ -1229,9 +1229,9 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) {
|
||||
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
|
||||
|
||||
const Function *F = I.getParent()->getParent();
|
||||
if (F->getRetAttributes().hasAttribute(Attributes::SExt))
|
||||
if (F->getRetAttributes().hasAttribute(Attribute::SExt))
|
||||
ExtendKind = ISD::SIGN_EXTEND;
|
||||
else if (F->getRetAttributes().hasAttribute(Attributes::ZExt))
|
||||
else if (F->getRetAttributes().hasAttribute(Attribute::ZExt))
|
||||
ExtendKind = ISD::ZERO_EXTEND;
|
||||
|
||||
if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger())
|
||||
@ -1246,7 +1246,7 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) {
|
||||
|
||||
// 'inreg' on function refers to return value
|
||||
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
|
||||
if (F->getRetAttributes().hasAttribute(Attributes::InReg))
|
||||
if (F->getRetAttributes().hasAttribute(Attribute::InReg))
|
||||
Flags.setInReg();
|
||||
|
||||
// Propagate extension type if any
|
||||
@ -4292,7 +4292,7 @@ static SDValue ExpandPowI(DebugLoc DL, SDValue LHS, SDValue RHS,
|
||||
return DAG.getConstantFP(1.0, LHS.getValueType());
|
||||
|
||||
const Function *F = DAG.getMachineFunction().getFunction();
|
||||
if (!F->getFnAttributes().hasAttribute(Attributes::OptimizeForSize) ||
|
||||
if (!F->getFnAttributes().hasAttribute(Attribute::OptimizeForSize) ||
|
||||
// If optimizing for size, don't insert too many multiplies. This
|
||||
// inserts up to 5 multiplies.
|
||||
CountPopulation_32(Val)+Log2_32(Val) < 7) {
|
||||
@ -5235,12 +5235,12 @@ void SelectionDAGBuilder::LowerCallTo(ImmutableCallSite CS, SDValue Callee,
|
||||
Entry.Node = ArgNode; Entry.Ty = V->getType();
|
||||
|
||||
unsigned attrInd = i - CS.arg_begin() + 1;
|
||||
Entry.isSExt = CS.paramHasAttr(attrInd, Attributes::SExt);
|
||||
Entry.isZExt = CS.paramHasAttr(attrInd, Attributes::ZExt);
|
||||
Entry.isInReg = CS.paramHasAttr(attrInd, Attributes::InReg);
|
||||
Entry.isSRet = CS.paramHasAttr(attrInd, Attributes::StructRet);
|
||||
Entry.isNest = CS.paramHasAttr(attrInd, Attributes::Nest);
|
||||
Entry.isByVal = CS.paramHasAttr(attrInd, Attributes::ByVal);
|
||||
Entry.isSExt = CS.paramHasAttr(attrInd, Attribute::SExt);
|
||||
Entry.isZExt = CS.paramHasAttr(attrInd, Attribute::ZExt);
|
||||
Entry.isInReg = CS.paramHasAttr(attrInd, Attribute::InReg);
|
||||
Entry.isSRet = CS.paramHasAttr(attrInd, Attribute::StructRet);
|
||||
Entry.isNest = CS.paramHasAttr(attrInd, Attribute::Nest);
|
||||
Entry.isByVal = CS.paramHasAttr(attrInd, Attribute::ByVal);
|
||||
Entry.Alignment = CS.getParamAlignment(attrInd);
|
||||
Args.push_back(Entry);
|
||||
}
|
||||
@ -6611,15 +6611,15 @@ void SelectionDAGISel::LowerArguments(const BasicBlock *LLVMBB) {
|
||||
unsigned OriginalAlignment =
|
||||
TD->getABITypeAlignment(ArgTy);
|
||||
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attributes::ZExt))
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attribute::ZExt))
|
||||
Flags.setZExt();
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt))
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attribute::SExt))
|
||||
Flags.setSExt();
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attributes::InReg))
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attribute::InReg))
|
||||
Flags.setInReg();
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attributes::StructRet))
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attribute::StructRet))
|
||||
Flags.setSRet();
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attributes::ByVal)) {
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attribute::ByVal)) {
|
||||
Flags.setByVal();
|
||||
PointerType *Ty = cast<PointerType>(I->getType());
|
||||
Type *ElementTy = Ty->getElementType();
|
||||
@ -6633,7 +6633,7 @@ void SelectionDAGISel::LowerArguments(const BasicBlock *LLVMBB) {
|
||||
FrameAlign = TLI.getByValTypeAlignment(ElementTy);
|
||||
Flags.setByValAlign(FrameAlign);
|
||||
}
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attributes::Nest))
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attribute::Nest))
|
||||
Flags.setNest();
|
||||
Flags.setOrigAlign(OriginalAlignment);
|
||||
|
||||
@ -6721,9 +6721,9 @@ void SelectionDAGISel::LowerArguments(const BasicBlock *LLVMBB) {
|
||||
|
||||
if (!I->use_empty()) {
|
||||
ISD::NodeType AssertOp = ISD::DELETED_NODE;
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt))
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attribute::SExt))
|
||||
AssertOp = ISD::AssertSext;
|
||||
else if (F.getParamAttributes(Idx).hasAttribute(Attributes::ZExt))
|
||||
else if (F.getParamAttributes(Idx).hasAttribute(Attribute::ZExt))
|
||||
AssertOp = ISD::AssertZext;
|
||||
|
||||
ArgValues.push_back(getCopyFromParts(DAG, dl, &InVals[i],
|
||||
|
@ -989,7 +989,7 @@ unsigned TargetLowering::getVectorTypeBreakdown(LLVMContext &Context, EVT VT,
|
||||
/// type of the given function. This does not require a DAG or a return value,
|
||||
/// and is suitable for use before any DAGs for the function are constructed.
|
||||
/// TODO: Move this out of TargetLowering.cpp.
|
||||
void llvm::GetReturnInfo(Type* ReturnType, Attributes attr,
|
||||
void llvm::GetReturnInfo(Type* ReturnType, Attribute attr,
|
||||
SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||
const TargetLowering &TLI) {
|
||||
SmallVector<EVT, 4> ValueVTs;
|
||||
@ -1001,9 +1001,9 @@ void llvm::GetReturnInfo(Type* ReturnType, Attributes attr,
|
||||
EVT VT = ValueVTs[j];
|
||||
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
|
||||
|
||||
if (attr.hasAttribute(Attributes::SExt))
|
||||
if (attr.hasAttribute(Attribute::SExt))
|
||||
ExtendKind = ISD::SIGN_EXTEND;
|
||||
else if (attr.hasAttribute(Attributes::ZExt))
|
||||
else if (attr.hasAttribute(Attribute::ZExt))
|
||||
ExtendKind = ISD::ZERO_EXTEND;
|
||||
|
||||
// FIXME: C calling convention requires the return type to be promoted to
|
||||
@ -1021,13 +1021,13 @@ void llvm::GetReturnInfo(Type* ReturnType, Attributes attr,
|
||||
|
||||
// 'inreg' on function refers to return value
|
||||
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
|
||||
if (attr.hasAttribute(Attributes::InReg))
|
||||
if (attr.hasAttribute(Attribute::InReg))
|
||||
Flags.setInReg();
|
||||
|
||||
// Propagate extension type if any
|
||||
if (attr.hasAttribute(Attributes::SExt))
|
||||
if (attr.hasAttribute(Attribute::SExt))
|
||||
Flags.setSExt();
|
||||
else if (attr.hasAttribute(Attributes::ZExt))
|
||||
else if (attr.hasAttribute(Attribute::ZExt))
|
||||
Flags.setZExt();
|
||||
|
||||
for (unsigned i = 0; i < NumParts; ++i)
|
||||
|
@ -137,10 +137,10 @@ bool StackProtector::ContainsProtectableArray(Type *Ty, bool InStruct) const {
|
||||
/// add a guard variable to functions that call alloca, and functions with
|
||||
/// buffers larger than SSPBufferSize bytes.
|
||||
bool StackProtector::RequiresStackProtector() const {
|
||||
if (F->getFnAttributes().hasAttribute(Attributes::StackProtectReq))
|
||||
if (F->getFnAttributes().hasAttribute(Attribute::StackProtectReq))
|
||||
return true;
|
||||
|
||||
if (!F->getFnAttributes().hasAttribute(Attributes::StackProtect))
|
||||
if (!F->getFnAttributes().hasAttribute(Attribute::StackProtect))
|
||||
return false;
|
||||
|
||||
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
|
||||
|
@ -553,7 +553,7 @@ TailDuplicatePass::shouldTailDuplicate(const MachineFunction &MF,
|
||||
unsigned MaxDuplicateCount;
|
||||
if (TailDuplicateSize.getNumOccurrences() == 0 &&
|
||||
MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize))
|
||||
hasAttribute(Attribute::OptimizeForSize))
|
||||
MaxDuplicateCount = 1;
|
||||
else
|
||||
MaxDuplicateCount = TailDuplicateSize;
|
||||
|
@ -23,7 +23,7 @@ bool
|
||||
DWARFAbbreviationDeclaration::extract(DataExtractor data, uint32_t* offset_ptr,
|
||||
uint32_t code) {
|
||||
Code = code;
|
||||
Attributes.clear();
|
||||
Attribute.clear();
|
||||
if (Code) {
|
||||
Tag = data.getULEB128(offset_ptr);
|
||||
HasChildren = data.getU8(offset_ptr);
|
||||
@ -33,7 +33,7 @@ DWARFAbbreviationDeclaration::extract(DataExtractor data, uint32_t* offset_ptr,
|
||||
uint16_t form = data.getULEB128(offset_ptr);
|
||||
|
||||
if (attr && form)
|
||||
Attributes.push_back(DWARFAttribute(attr, form));
|
||||
Attribute.push_back(DWARFAttribute(attr, form));
|
||||
else
|
||||
break;
|
||||
}
|
||||
@ -55,19 +55,19 @@ void DWARFAbbreviationDeclaration::dump(raw_ostream &OS) const {
|
||||
else
|
||||
OS << format("DW_TAG_Unknown_%x", getTag());
|
||||
OS << "\tDW_CHILDREN_" << (hasChildren() ? "yes" : "no") << '\n';
|
||||
for (unsigned i = 0, e = Attributes.size(); i != e; ++i) {
|
||||
for (unsigned i = 0, e = Attribute.size(); i != e; ++i) {
|
||||
OS << '\t';
|
||||
const char *attrString = AttributeString(Attributes[i].getAttribute());
|
||||
const char *attrString = AttributeString(Attribute[i].getAttribute());
|
||||
if (attrString)
|
||||
OS << attrString;
|
||||
else
|
||||
OS << format("DW_AT_Unknown_%x", Attributes[i].getAttribute());
|
||||
OS << format("DW_AT_Unknown_%x", Attribute[i].getAttribute());
|
||||
OS << '\t';
|
||||
const char *formString = FormEncodingString(Attributes[i].getForm());
|
||||
const char *formString = FormEncodingString(Attribute[i].getForm());
|
||||
if (formString)
|
||||
OS << formString;
|
||||
else
|
||||
OS << format("DW_FORM_Unknown_%x", Attributes[i].getForm());
|
||||
OS << format("DW_FORM_Unknown_%x", Attribute[i].getForm());
|
||||
OS << '\n';
|
||||
}
|
||||
OS << '\n';
|
||||
@ -75,8 +75,8 @@ void DWARFAbbreviationDeclaration::dump(raw_ostream &OS) const {
|
||||
|
||||
uint32_t
|
||||
DWARFAbbreviationDeclaration::findAttributeIndex(uint16_t attr) const {
|
||||
for (uint32_t i = 0, e = Attributes.size(); i != e; ++i) {
|
||||
if (Attributes[i].getAttribute() == attr)
|
||||
for (uint32_t i = 0, e = Attribute.size(); i != e; ++i) {
|
||||
if (Attribute[i].getAttribute() == attr)
|
||||
return i;
|
||||
}
|
||||
return -1U;
|
||||
|
@ -22,7 +22,7 @@ class DWARFAbbreviationDeclaration {
|
||||
uint32_t Code;
|
||||
uint32_t Tag;
|
||||
bool HasChildren;
|
||||
SmallVector<DWARFAttribute, 8> Attributes;
|
||||
SmallVector<DWARFAttribute, 8> Attribute;
|
||||
public:
|
||||
enum { InvalidCode = 0 };
|
||||
DWARFAbbreviationDeclaration()
|
||||
@ -31,12 +31,12 @@ public:
|
||||
uint32_t getCode() const { return Code; }
|
||||
uint32_t getTag() const { return Tag; }
|
||||
bool hasChildren() const { return HasChildren; }
|
||||
uint32_t getNumAttributes() const { return Attributes.size(); }
|
||||
uint32_t getNumAttributes() const { return Attribute.size(); }
|
||||
uint16_t getAttrByIndex(uint32_t idx) const {
|
||||
return Attributes.size() > idx ? Attributes[idx].getAttribute() : 0;
|
||||
return Attribute.size() > idx ? Attribute[idx].getAttribute() : 0;
|
||||
}
|
||||
uint16_t getFormByIndex(uint32_t idx) const {
|
||||
return Attributes.size() > idx ? Attributes[idx].getForm() : 0;
|
||||
return Attribute.size() > idx ? Attribute[idx].getForm() : 0;
|
||||
}
|
||||
|
||||
uint32_t findAttributeIndex(uint16_t attr) const;
|
||||
@ -45,7 +45,7 @@ public:
|
||||
bool isValid() const { return Code != 0 && Tag != 0; }
|
||||
void dump(raw_ostream &OS) const;
|
||||
const SmallVectorImpl<DWARFAttribute> &getAttributes() const {
|
||||
return Attributes;
|
||||
return Attribute;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -249,7 +249,7 @@ const char *llvm::dwarf::AttributeString(unsigned Attribute) {
|
||||
case DW_AT_APPLE_property: return "DW_AT_APPLE_property";
|
||||
case DW_AT_APPLE_objc_complete_type: return "DW_AT_APPLE_objc_complete_type";
|
||||
|
||||
// DWARF5 Fission Extension Attributes
|
||||
// DWARF5 Fission Extension Attribute
|
||||
case DW_AT_GNU_dwo_name: return "DW_AT_GNU_dwo_name";
|
||||
case DW_AT_GNU_dwo_id: return "DW_AT_GNU_dwo_id";
|
||||
case DW_AT_GNU_ranges_base: return "DW_AT_GNU_ranges_base";
|
||||
|
@ -3328,7 +3328,7 @@ ARMBaseInstrInfo::getOperandLatency(const InstrItineraryData *ItinData,
|
||||
if (Latency > 0 && Subtarget.isThumb2()) {
|
||||
const MachineFunction *MF = DefMI->getParent()->getParent();
|
||||
if (MF->getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize))
|
||||
hasAttribute(Attribute::OptimizeForSize))
|
||||
--Latency;
|
||||
}
|
||||
return Latency;
|
||||
|
@ -326,7 +326,7 @@ needsStackRealignment(const MachineFunction &MF) const {
|
||||
unsigned StackAlign = MF.getTarget().getFrameLowering()->getStackAlignment();
|
||||
bool requiresRealignment =
|
||||
((MFI->getMaxAlignment() > StackAlign) ||
|
||||
F->getFnAttributes().hasAttribute(Attributes::StackAlignment));
|
||||
F->getFnAttributes().hasAttribute(Attribute::StackAlignment));
|
||||
|
||||
return requiresRealignment && canRealignStack(MF);
|
||||
}
|
||||
|
@ -2340,16 +2340,16 @@ bool ARMFastISel::SelectCall(const Instruction *I,
|
||||
|
||||
ISD::ArgFlagsTy Flags;
|
||||
unsigned AttrInd = i - CS.arg_begin() + 1;
|
||||
if (CS.paramHasAttr(AttrInd, Attributes::SExt))
|
||||
if (CS.paramHasAttr(AttrInd, Attribute::SExt))
|
||||
Flags.setSExt();
|
||||
if (CS.paramHasAttr(AttrInd, Attributes::ZExt))
|
||||
if (CS.paramHasAttr(AttrInd, Attribute::ZExt))
|
||||
Flags.setZExt();
|
||||
|
||||
// FIXME: Only handle *easy* calls for now.
|
||||
if (CS.paramHasAttr(AttrInd, Attributes::InReg) ||
|
||||
CS.paramHasAttr(AttrInd, Attributes::StructRet) ||
|
||||
CS.paramHasAttr(AttrInd, Attributes::Nest) ||
|
||||
CS.paramHasAttr(AttrInd, Attributes::ByVal))
|
||||
if (CS.paramHasAttr(AttrInd, Attribute::InReg) ||
|
||||
CS.paramHasAttr(AttrInd, Attribute::StructRet) ||
|
||||
CS.paramHasAttr(AttrInd, Attribute::Nest) ||
|
||||
CS.paramHasAttr(AttrInd, Attribute::ByVal))
|
||||
return false;
|
||||
|
||||
Type *ArgTy = (*i)->getType();
|
||||
|
@ -1153,7 +1153,7 @@ static void checkNumAlignedDPRCS2Regs(MachineFunction &MF) {
|
||||
return;
|
||||
|
||||
// Naked functions don't spill callee-saved registers.
|
||||
if (MF.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
|
||||
if (MF.getFunction()->getFnAttributes().hasAttribute(Attribute::Naked))
|
||||
return;
|
||||
|
||||
// We are planning to use NEON instructions vst1 / vld1.
|
||||
|
@ -1617,7 +1617,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
// FIXME: handle tail calls differently.
|
||||
unsigned CallOpc;
|
||||
bool HasMinSizeAttr = MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::MinSize);
|
||||
hasAttribute(Attribute::MinSize);
|
||||
if (Subtarget->isThumb()) {
|
||||
if ((!isDirect || isARMFunc) && !Subtarget->hasV5TOps())
|
||||
CallOpc = ARMISD::CALL_NOLINK;
|
||||
@ -6690,7 +6690,7 @@ EmitStructByval(MachineInstr *MI, MachineBasicBlock *BB) const {
|
||||
} else {
|
||||
// Check whether we can use NEON instructions.
|
||||
if (!MF->getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::NoImplicitFloat) &&
|
||||
hasAttribute(Attribute::NoImplicitFloat) &&
|
||||
Subtarget->hasNEON()) {
|
||||
if ((Align % 16 == 0) && SizeVal >= 16) {
|
||||
ldrOpc = ARM::VLD1q32wb_fixed;
|
||||
@ -9458,7 +9458,7 @@ EVT ARMTargetLowering::getOptimalMemOpType(uint64_t Size,
|
||||
// See if we can use NEON instructions for this...
|
||||
if ((!IsMemset || ZeroMemset) &&
|
||||
Subtarget->hasNEON() &&
|
||||
!F->getFnAttributes().hasAttribute(Attributes::NoImplicitFloat)) {
|
||||
!F->getFnAttributes().hasAttribute(Attribute::NoImplicitFloat)) {
|
||||
bool Fast;
|
||||
if (Size >= 16 &&
|
||||
(memOpAlign(SrcAlign, DstAlign, 16) ||
|
||||
|
@ -948,7 +948,7 @@ bool Thumb2SizeReduce::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
||||
// When -Oz is set, the function carries MinSize attribute.
|
||||
MinimizeSize =
|
||||
MF.getFunction()->getFnAttributes().hasAttribute(Attributes::MinSize);
|
||||
MF.getFunction()->getFnAttributes().hasAttribute(Attribute::MinSize);
|
||||
|
||||
bool Modified = false;
|
||||
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
|
||||
|
@ -479,9 +479,9 @@ void CppWriter::printAttributes(const AttributeSet &PAL,
|
||||
Out << " {\n AttrBuilder B;\n";
|
||||
|
||||
#define HANDLE_ATTR(X) \
|
||||
if (attrs.hasAttribute(Attributes::X)) \
|
||||
Out << " B.addAttribute(Attributes::" #X ");\n"; \
|
||||
attrs.removeAttribute(Attributes::X);
|
||||
if (attrs.hasAttribute(Attribute::X)) \
|
||||
Out << " B.addAttribute(Attribute::" #X ");\n"; \
|
||||
attrs.removeAttribute(Attribute::X);
|
||||
|
||||
HANDLE_ATTR(SExt);
|
||||
HANDLE_ATTR(ZExt);
|
||||
@ -509,11 +509,11 @@ void CppWriter::printAttributes(const AttributeSet &PAL,
|
||||
HANDLE_ATTR(NonLazyBind);
|
||||
HANDLE_ATTR(MinSize);
|
||||
#undef HANDLE_ATTR
|
||||
if (attrs.hasAttribute(Attributes::StackAlignment))
|
||||
if (attrs.hasAttribute(Attribute::StackAlignment))
|
||||
Out << " B.addStackAlignmentAttr(" << attrs.getStackAlignment() << ")\n";
|
||||
attrs.removeAttribute(Attributes::StackAlignment);
|
||||
attrs.removeAttribute(Attribute::StackAlignment);
|
||||
assert(!attrs.hasAttributes() && "Unhandled attribute!");
|
||||
Out << " PAWI.Attrs = Attributes::get(mod->getContext(), B);\n }";
|
||||
Out << " PAWI.Attrs = Attribute::get(mod->getContext(), B);\n }";
|
||||
nl(Out);
|
||||
Out << "Attrs.push_back(PAWI);";
|
||||
nl(Out);
|
||||
|
@ -51,7 +51,7 @@ bool HexagonRemoveExtendArgs::runOnFunction(Function &F) {
|
||||
unsigned Idx = 1;
|
||||
for (Function::arg_iterator AI = F.arg_begin(), AE = F.arg_end(); AI != AE;
|
||||
++AI, ++Idx) {
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt)) {
|
||||
if (F.getParamAttributes(Idx).hasAttribute(Attribute::SExt)) {
|
||||
Argument* Arg = AI;
|
||||
if (!isa<PointerType>(Arg->getType())) {
|
||||
for (Instruction::use_iterator UI = Arg->use_begin();
|
||||
|
@ -1522,7 +1522,7 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F,
|
||||
}
|
||||
|
||||
if (PAL.getParamAttributes(paramIndex+1).
|
||||
hasAttribute(Attributes::ByVal) == false) {
|
||||
hasAttribute(Attribute::ByVal) == false) {
|
||||
// Just a scalar
|
||||
const PointerType *PTy = dyn_cast<PointerType>(Ty);
|
||||
if (isKernelFunc) {
|
||||
|
@ -1022,7 +1022,7 @@ NVPTXTargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
// to newly created nodes. The SDNOdes for params have to
|
||||
// appear in the same order as their order of appearance
|
||||
// in the original function. "idx+1" holds that order.
|
||||
if (PAL.getParamAttributes(i+1).hasAttribute(Attributes::ByVal) == false) {
|
||||
if (PAL.getParamAttributes(i+1).hasAttribute(Attribute::ByVal) == false) {
|
||||
// A plain scalar.
|
||||
if (isABI || isKernel) {
|
||||
// If ABI, load from the param symbol
|
||||
|
@ -199,7 +199,7 @@ void PPCFrameLowering::determineFrameLayout(MachineFunction &MF) const {
|
||||
// SVR4, we also require a stack frame if we need to spill the CR,
|
||||
// since this spill area is addressed relative to the stack pointer.
|
||||
bool DisableRedZone = MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::NoRedZone);
|
||||
hasAttribute(Attribute::NoRedZone);
|
||||
// FIXME SVR4 The 32-bit SVR4 ABI has no red zone. However, it can
|
||||
// still generate stackless code if all local vars are reg-allocated.
|
||||
// Try: (FrameSize <= 224
|
||||
@ -261,7 +261,7 @@ bool PPCFrameLowering::needsFP(const MachineFunction &MF) const {
|
||||
|
||||
// Naked functions have no stack frame pushed, so we don't have a frame
|
||||
// pointer.
|
||||
if (MF.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
|
||||
if (MF.getFunction()->getFnAttributes().hasAttribute(Attribute::Naked))
|
||||
return false;
|
||||
|
||||
return MF.getTarget().Options.DisableFramePointerElim(MF) ||
|
||||
|
@ -6820,7 +6820,7 @@ SDValue PPCTargetLowering::LowerFRAMEADDR(SDValue Op,
|
||||
MFI->hasVarSizedObjects()) &&
|
||||
MFI->getStackSize() &&
|
||||
!MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::Naked);
|
||||
hasAttribute(Attribute::Naked);
|
||||
unsigned FrameReg = isPPC64 ? (is31 ? PPC::X31 : PPC::X1) :
|
||||
(is31 ? PPC::R31 : PPC::R1);
|
||||
SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg,
|
||||
|
@ -597,7 +597,7 @@ PPCRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
// to Offset to get the correct offset.
|
||||
// Naked functions have stack size 0, although getStackSize may not reflect that
|
||||
// because we didn't call all the pieces that compute it for naked functions.
|
||||
if (!MF.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
|
||||
if (!MF.getFunction()->getFnAttributes().hasAttribute(Attribute::Naked))
|
||||
Offset += MFI->getStackSize();
|
||||
|
||||
// If we can, encode the offset directly into the instruction. If this is a
|
||||
|
@ -1545,9 +1545,9 @@ static unsigned computeBytesPoppedByCallee(const X86Subtarget &Subtarget,
|
||||
CallingConv::ID CC = CS.getCallingConv();
|
||||
if (CC == CallingConv::Fast || CC == CallingConv::GHC)
|
||||
return 0;
|
||||
if (!CS.paramHasAttr(1, Attributes::StructRet))
|
||||
if (!CS.paramHasAttr(1, Attribute::StructRet))
|
||||
return 0;
|
||||
if (CS.paramHasAttr(1, Attributes::InReg))
|
||||
if (CS.paramHasAttr(1, Attribute::InReg))
|
||||
return 0;
|
||||
return 4;
|
||||
}
|
||||
@ -1626,12 +1626,12 @@ bool X86FastISel::DoSelectCall(const Instruction *I, const char *MemIntName) {
|
||||
Value *ArgVal = *i;
|
||||
ISD::ArgFlagsTy Flags;
|
||||
unsigned AttrInd = i - CS.arg_begin() + 1;
|
||||
if (CS.paramHasAttr(AttrInd, Attributes::SExt))
|
||||
if (CS.paramHasAttr(AttrInd, Attribute::SExt))
|
||||
Flags.setSExt();
|
||||
if (CS.paramHasAttr(AttrInd, Attributes::ZExt))
|
||||
if (CS.paramHasAttr(AttrInd, Attribute::ZExt))
|
||||
Flags.setZExt();
|
||||
|
||||
if (CS.paramHasAttr(AttrInd, Attributes::ByVal)) {
|
||||
if (CS.paramHasAttr(AttrInd, Attribute::ByVal)) {
|
||||
PointerType *Ty = cast<PointerType>(ArgVal->getType());
|
||||
Type *ElementTy = Ty->getElementType();
|
||||
unsigned FrameSize = TD.getTypeAllocSize(ElementTy);
|
||||
@ -1645,9 +1645,9 @@ bool X86FastISel::DoSelectCall(const Instruction *I, const char *MemIntName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CS.paramHasAttr(AttrInd, Attributes::InReg))
|
||||
if (CS.paramHasAttr(AttrInd, Attribute::InReg))
|
||||
Flags.setInReg();
|
||||
if (CS.paramHasAttr(AttrInd, Attributes::Nest))
|
||||
if (CS.paramHasAttr(AttrInd, Attribute::Nest))
|
||||
Flags.setNest();
|
||||
|
||||
// If this is an i1/i8/i16 argument, promote to i32 to avoid an extra
|
||||
@ -1915,11 +1915,11 @@ bool X86FastISel::DoSelectCall(const Instruction *I, const char *MemIntName) {
|
||||
ISD::InputArg MyFlags;
|
||||
MyFlags.VT = RegisterVT.getSimpleVT();
|
||||
MyFlags.Used = !CS.getInstruction()->use_empty();
|
||||
if (CS.paramHasAttr(0, Attributes::SExt))
|
||||
if (CS.paramHasAttr(0, Attribute::SExt))
|
||||
MyFlags.Flags.setSExt();
|
||||
if (CS.paramHasAttr(0, Attributes::ZExt))
|
||||
if (CS.paramHasAttr(0, Attribute::ZExt))
|
||||
MyFlags.Flags.setZExt();
|
||||
if (CS.paramHasAttr(0, Attributes::InReg))
|
||||
if (CS.paramHasAttr(0, Attribute::InReg))
|
||||
MyFlags.Flags.setInReg();
|
||||
Ins.push_back(MyFlags);
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
// function, and use up to 128 bytes of stack space, don't have a frame
|
||||
// pointer, calls, or dynamic alloca then we do not need to adjust the
|
||||
// stack pointer (we fit in the Red Zone).
|
||||
if (Is64Bit && !Fn->getFnAttributes().hasAttribute(Attributes::NoRedZone) &&
|
||||
if (Is64Bit && !Fn->getFnAttributes().hasAttribute(Attribute::NoRedZone) &&
|
||||
!RegInfo->needsStackRealignment(MF) &&
|
||||
!MFI->hasVarSizedObjects() && // No dynamic alloca.
|
||||
!MFI->adjustsStack() && // No calls.
|
||||
|
@ -432,7 +432,7 @@ static bool isCalleeLoad(SDValue Callee, SDValue &Chain, bool HasCallSeq) {
|
||||
void X86DAGToDAGISel::PreprocessISelDAG() {
|
||||
// OptForSize is used in pattern predicates that isel is matching.
|
||||
OptForSize = MF->getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize);
|
||||
hasAttribute(Attribute::OptimizeForSize);
|
||||
|
||||
for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
|
||||
E = CurDAG->allnodes_end(); I != E; ) {
|
||||
|
@ -1383,7 +1383,7 @@ X86TargetLowering::getOptimalMemOpType(uint64_t Size,
|
||||
MachineFunction &MF) const {
|
||||
const Function *F = MF.getFunction();
|
||||
if ((!IsMemset || ZeroMemset) &&
|
||||
!F->getFnAttributes().hasAttribute(Attributes::NoImplicitFloat)) {
|
||||
!F->getFnAttributes().hasAttribute(Attribute::NoImplicitFloat)) {
|
||||
if (Size >= 16 &&
|
||||
(Subtarget->isUnalignedMemAccessFast() ||
|
||||
((DstAlign == 0 || DstAlign >= 16) &&
|
||||
@ -2066,7 +2066,7 @@ X86TargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
TotalNumIntRegs);
|
||||
|
||||
bool NoImplicitFloatOps = Fn->getFnAttributes().
|
||||
hasAttribute(Attributes::NoImplicitFloat);
|
||||
hasAttribute(Attribute::NoImplicitFloat);
|
||||
assert(!(NumXMMRegs && !Subtarget->hasSSE1()) &&
|
||||
"SSE register cannot be used when SSE is disabled!");
|
||||
assert(!(NumXMMRegs && MF.getTarget().Options.UseSoftFloat &&
|
||||
@ -2545,7 +2545,7 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
} else if (Subtarget->isPICStyleRIPRel() &&
|
||||
isa<Function>(GV) &&
|
||||
cast<Function>(GV)->getFnAttributes().
|
||||
hasAttribute(Attributes::NonLazyBind)) {
|
||||
hasAttribute(Attribute::NonLazyBind)) {
|
||||
// If the function is marked as non-lazy, generate an indirect call
|
||||
// which loads from the GOT directly. This avoids runtime overhead
|
||||
// at the cost of eager binding (and one extra byte of encoding).
|
||||
@ -6735,7 +6735,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const {
|
||||
bool HasInt256 = Subtarget->hasInt256();
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
bool OptForSize = MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize);
|
||||
hasAttribute(Attribute::OptimizeForSize);
|
||||
|
||||
assert(VT.getSizeInBits() != 64 && "Can't lower MMX shuffles");
|
||||
|
||||
@ -9892,7 +9892,7 @@ SDValue X86TargetLowering::LowerVAARG(SDValue Op, SelectionDAG &DAG) const {
|
||||
assert(!getTargetMachine().Options.UseSoftFloat &&
|
||||
!(DAG.getMachineFunction()
|
||||
.getFunction()->getFnAttributes()
|
||||
.hasAttribute(Attributes::NoImplicitFloat)) &&
|
||||
.hasAttribute(Attribute::NoImplicitFloat)) &&
|
||||
Subtarget->hasSSE1());
|
||||
}
|
||||
|
||||
@ -10741,7 +10741,7 @@ SDValue X86TargetLowering::LowerINIT_TRAMPOLINE(SDValue Op,
|
||||
|
||||
for (FunctionType::param_iterator I = FTy->param_begin(),
|
||||
E = FTy->param_end(); I != E; ++I, ++Idx)
|
||||
if (Attrs.getParamAttributes(Idx).hasAttribute(Attributes::InReg))
|
||||
if (Attrs.getParamAttributes(Idx).hasAttribute(Attribute::InReg))
|
||||
// FIXME: should only count parameters that are lowered to integers.
|
||||
InRegCount += (TD->getTypeSizeInBits(*I) + 31) / 32;
|
||||
|
||||
@ -16159,7 +16159,7 @@ static SDValue PerformSTORECombine(SDNode *N, SelectionDAG &DAG,
|
||||
|
||||
const Function *F = DAG.getMachineFunction().getFunction();
|
||||
bool NoImplicitFloatOps = F->getFnAttributes().
|
||||
hasAttribute(Attributes::NoImplicitFloat);
|
||||
hasAttribute(Attribute::NoImplicitFloat);
|
||||
bool F64IsLegal = !DAG.getTarget().Options.UseSoftFloat && !NoImplicitFloatOps
|
||||
&& Subtarget->hasSSE2();
|
||||
if ((VT.isVector() ||
|
||||
|
@ -3863,7 +3863,7 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
|
||||
// Unless optimizing for size, don't fold to avoid partial
|
||||
// register update stalls
|
||||
if (!MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize) &&
|
||||
hasAttribute(Attribute::OptimizeForSize) &&
|
||||
hasPartialRegUpdate(MI->getOpcode()))
|
||||
return 0;
|
||||
|
||||
@ -3905,7 +3905,7 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
|
||||
// Unless optimizing for size, don't fold to avoid partial
|
||||
// register update stalls
|
||||
if (!MF.getFunction()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize) &&
|
||||
hasAttribute(Attribute::OptimizeForSize) &&
|
||||
hasPartialRegUpdate(MI->getOpcode()))
|
||||
return 0;
|
||||
|
||||
|
@ -417,7 +417,7 @@ bool X86RegisterInfo::needsStackRealignment(const MachineFunction &MF) const {
|
||||
unsigned StackAlign = TM.getFrameLowering()->getStackAlignment();
|
||||
bool requiresRealignment =
|
||||
((MFI->getMaxAlignment() > StackAlign) ||
|
||||
F->getFnAttributes().hasAttribute(Attributes::StackAlignment));
|
||||
F->getFnAttributes().hasAttribute(Attribute::StackAlignment));
|
||||
|
||||
// If we've requested that we force align the stack do so now.
|
||||
if (ForceStackAlign)
|
||||
|
@ -101,7 +101,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
const AttributeSet &PAL = MF.getFunction()->getAttributes();
|
||||
|
||||
for (unsigned I = 0, E = PAL.getNumAttrs(); I != E; ++I)
|
||||
if (PAL.getAttributesAtIndex(I).hasAttribute(Attributes::Nest)) {
|
||||
if (PAL.getAttributesAtIndex(I).hasAttribute(Attribute::Nest)) {
|
||||
loadFromStack(MBB, MBBI, XCore::R11, 0, dl, TII);
|
||||
break;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ CallGraphNode *ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
|
||||
SmallPtrSet<Argument*, 8> ByValArgsToTransform;
|
||||
for (unsigned i = 0; i != PointerArgs.size(); ++i) {
|
||||
bool isByVal=F->getParamAttributes(PointerArgs[i].second+1).
|
||||
hasAttribute(Attributes::ByVal);
|
||||
hasAttribute(Attribute::ByVal);
|
||||
Argument *PtrArg = PointerArgs[i].first;
|
||||
Type *AgTy = cast<PointerType>(PtrArg->getType())->getElementType();
|
||||
|
||||
@ -511,14 +511,14 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
// what the new GEP/Load instructions we are inserting look like.
|
||||
std::map<IndicesVector, LoadInst*> OriginalLoads;
|
||||
|
||||
// Attributes - Keep track of the parameter attributes for the arguments
|
||||
// Attribute - Keep track of the parameter attributes for the arguments
|
||||
// that we are *not* promoting. For the ones that we do promote, the parameter
|
||||
// attributes are lost
|
||||
SmallVector<AttributeWithIndex, 8> AttributesVec;
|
||||
const AttributeSet &PAL = F->getAttributes();
|
||||
|
||||
// Add any return attributes.
|
||||
Attributes attrs = PAL.getRetAttributes();
|
||||
Attribute attrs = PAL.getRetAttributes();
|
||||
if (attrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
||||
attrs));
|
||||
@ -537,7 +537,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
} else if (!ArgsToPromote.count(I)) {
|
||||
// Unchanged argument
|
||||
Params.push_back(I->getType());
|
||||
Attributes attrs = PAL.getParamAttributes(ArgIndex);
|
||||
Attribute attrs = PAL.getParamAttributes(ArgIndex);
|
||||
if (attrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(Params.size(), attrs));
|
||||
} else if (I->use_empty()) {
|
||||
@ -639,7 +639,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
const AttributeSet &CallPAL = CS.getAttributes();
|
||||
|
||||
// Add any return attributes.
|
||||
Attributes attrs = CallPAL.getRetAttributes();
|
||||
Attribute attrs = CallPAL.getRetAttributes();
|
||||
if (attrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
||||
attrs));
|
||||
@ -653,7 +653,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) {
|
||||
Args.push_back(*AI); // Unmodified argument
|
||||
|
||||
Attributes Attrs = CallPAL.getParamAttributes(ArgIndex);
|
||||
Attribute Attrs = CallPAL.getParamAttributes(ArgIndex);
|
||||
if (Attrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
|
||||
|
||||
@ -715,7 +715,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
// Push any varargs arguments on the list.
|
||||
for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
|
||||
Args.push_back(*AI);
|
||||
Attributes Attrs = CallPAL.getParamAttributes(ArgIndex);
|
||||
Attribute Attrs = CallPAL.getParamAttributes(ArgIndex);
|
||||
if (Attrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
|
||||
SmallVector<AttributeWithIndex, 8> AttributesVec;
|
||||
for (unsigned i = 0; PAL.getSlot(i).Index <= NumArgs; ++i)
|
||||
AttributesVec.push_back(PAL.getSlot(i));
|
||||
Attributes FnAttrs = PAL.getFnAttributes();
|
||||
Attribute FnAttrs = PAL.getFnAttributes();
|
||||
if (FnAttrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::FunctionIndex,
|
||||
FnAttrs));
|
||||
@ -701,8 +701,8 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
||||
const AttributeSet &PAL = F->getAttributes();
|
||||
|
||||
// The existing function return attributes.
|
||||
Attributes RAttrs = PAL.getRetAttributes();
|
||||
Attributes FnAttrs = PAL.getFnAttributes();
|
||||
Attribute RAttrs = PAL.getRetAttributes();
|
||||
Attribute FnAttrs = PAL.getFnAttributes();
|
||||
|
||||
// Find out the new return value.
|
||||
|
||||
@ -765,11 +765,11 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
||||
// required when new return value attributes are added.
|
||||
if (NRetTy->isVoidTy())
|
||||
RAttrs =
|
||||
Attributes::get(NRetTy->getContext(), AttrBuilder(RAttrs).
|
||||
removeAttributes(Attributes::typeIncompatible(NRetTy)));
|
||||
Attribute::get(NRetTy->getContext(), AttrBuilder(RAttrs).
|
||||
removeAttributes(Attribute::typeIncompatible(NRetTy)));
|
||||
else
|
||||
assert(!AttrBuilder(RAttrs).
|
||||
hasAttributes(Attributes::typeIncompatible(NRetTy)) &&
|
||||
hasAttributes(Attribute::typeIncompatible(NRetTy)) &&
|
||||
"Return attributes no longer compatible?");
|
||||
|
||||
if (RAttrs.hasAttributes())
|
||||
@ -791,7 +791,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
||||
|
||||
// Get the original parameter attributes (skipping the first one, that is
|
||||
// for the return value.
|
||||
Attributes Attrs = PAL.getParamAttributes(i + 1);
|
||||
Attribute Attrs = PAL.getParamAttributes(i + 1);
|
||||
if (Attrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(Params.size(), Attrs));
|
||||
} else {
|
||||
@ -836,12 +836,12 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
||||
const AttributeSet &CallPAL = CS.getAttributes();
|
||||
|
||||
// The call return attributes.
|
||||
Attributes RAttrs = CallPAL.getRetAttributes();
|
||||
Attributes FnAttrs = CallPAL.getFnAttributes();
|
||||
Attribute RAttrs = CallPAL.getRetAttributes();
|
||||
Attribute FnAttrs = CallPAL.getFnAttributes();
|
||||
// Adjust in case the function was changed to return void.
|
||||
RAttrs =
|
||||
Attributes::get(NF->getContext(), AttrBuilder(RAttrs).
|
||||
removeAttributes(Attributes::typeIncompatible(NF->getReturnType())));
|
||||
Attribute::get(NF->getContext(), AttrBuilder(RAttrs).
|
||||
removeAttributes(Attribute::typeIncompatible(NF->getReturnType())));
|
||||
if (RAttrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
||||
RAttrs));
|
||||
@ -856,7 +856,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
||||
if (ArgAlive[i]) {
|
||||
Args.push_back(*I);
|
||||
// Get original parameter attributes, but skip return attributes.
|
||||
Attributes Attrs = CallPAL.getParamAttributes(i + 1);
|
||||
Attribute Attrs = CallPAL.getParamAttributes(i + 1);
|
||||
if (Attrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
|
||||
}
|
||||
@ -864,7 +864,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
|
||||
// Push any varargs arguments on the list. Don't forget their attributes.
|
||||
for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) {
|
||||
Args.push_back(*I);
|
||||
Attributes Attrs = CallPAL.getParamAttributes(i + 1);
|
||||
Attribute Attrs = CallPAL.getParamAttributes(i + 1);
|
||||
if (Attrs.hasAttributes())
|
||||
AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
|
||||
}
|
||||
|
@ -213,16 +213,16 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
|
||||
|
||||
// Clear out any existing attributes.
|
||||
AttrBuilder B;
|
||||
B.addAttribute(Attributes::ReadOnly)
|
||||
.addAttribute(Attributes::ReadNone);
|
||||
B.addAttribute(Attribute::ReadOnly)
|
||||
.addAttribute(Attribute::ReadNone);
|
||||
F->removeAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(F->getContext(), B));
|
||||
Attribute::get(F->getContext(), B));
|
||||
|
||||
// Add in the new attribute.
|
||||
B.clear();
|
||||
B.addAttribute(ReadsMemory ? Attributes::ReadOnly : Attributes::ReadNone);
|
||||
B.addAttribute(ReadsMemory ? Attribute::ReadOnly : Attribute::ReadNone);
|
||||
F->addAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(F->getContext(), B));
|
||||
Attribute::get(F->getContext(), B));
|
||||
|
||||
if (ReadsMemory)
|
||||
++NumReadOnly;
|
||||
@ -358,7 +358,7 @@ bool FunctionAttrs::AddNoCaptureAttrs(const CallGraphSCC &SCC) {
|
||||
ArgumentGraph AG;
|
||||
|
||||
AttrBuilder B;
|
||||
B.addAttribute(Attributes::NoCapture);
|
||||
B.addAttribute(Attribute::NoCapture);
|
||||
|
||||
// Check each function in turn, determining which pointer arguments are not
|
||||
// captured.
|
||||
@ -381,7 +381,7 @@ bool FunctionAttrs::AddNoCaptureAttrs(const CallGraphSCC &SCC) {
|
||||
for (Function::arg_iterator A = F->arg_begin(), E = F->arg_end();
|
||||
A != E; ++A) {
|
||||
if (A->getType()->isPointerTy() && !A->hasNoCaptureAttr()) {
|
||||
A->addAttr(Attributes::get(F->getContext(), B));
|
||||
A->addAttr(Attribute::get(F->getContext(), B));
|
||||
++NumNoCapture;
|
||||
Changed = true;
|
||||
}
|
||||
@ -396,7 +396,7 @@ bool FunctionAttrs::AddNoCaptureAttrs(const CallGraphSCC &SCC) {
|
||||
if (!Tracker.Captured) {
|
||||
if (Tracker.Uses.empty()) {
|
||||
// If it's trivially not captured, mark it nocapture now.
|
||||
A->addAttr(Attributes::get(F->getContext(), B));
|
||||
A->addAttr(Attribute::get(F->getContext(), B));
|
||||
++NumNoCapture;
|
||||
Changed = true;
|
||||
} else {
|
||||
@ -431,7 +431,7 @@ bool FunctionAttrs::AddNoCaptureAttrs(const CallGraphSCC &SCC) {
|
||||
ArgumentSCC[0]->Uses[0] == ArgumentSCC[0]) {
|
||||
ArgumentSCC[0]->
|
||||
Definition->
|
||||
addAttr(Attributes::get(ArgumentSCC[0]->Definition->getContext(), B));
|
||||
addAttr(Attribute::get(ArgumentSCC[0]->Definition->getContext(), B));
|
||||
++NumNoCapture;
|
||||
Changed = true;
|
||||
}
|
||||
@ -473,7 +473,7 @@ bool FunctionAttrs::AddNoCaptureAttrs(const CallGraphSCC &SCC) {
|
||||
|
||||
for (unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) {
|
||||
Argument *A = ArgumentSCC[i]->Definition;
|
||||
A->addAttr(Attributes::get(A->getContext(), B));
|
||||
A->addAttr(Attribute::get(A->getContext(), B));
|
||||
++NumNoCapture;
|
||||
Changed = true;
|
||||
}
|
||||
@ -530,7 +530,7 @@ bool FunctionAttrs::IsFunctionMallocLike(Function *F,
|
||||
case Instruction::Call:
|
||||
case Instruction::Invoke: {
|
||||
CallSite CS(RVI);
|
||||
if (CS.paramHasAttr(0, Attributes::NoAlias))
|
||||
if (CS.paramHasAttr(0, Attribute::NoAlias))
|
||||
break;
|
||||
if (CS.getCalledFunction() &&
|
||||
SCCNodes.count(CS.getCalledFunction()))
|
||||
|
@ -2067,12 +2067,12 @@ static void ChangeCalleesToFastCall(Function *F) {
|
||||
|
||||
static AttributeSet StripNest(LLVMContext &C, const AttributeSet &Attrs) {
|
||||
for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) {
|
||||
if (!Attrs.getSlot(i).Attrs.hasAttribute(Attributes::Nest))
|
||||
if (!Attrs.getSlot(i).Attrs.hasAttribute(Attribute::Nest))
|
||||
continue;
|
||||
|
||||
// There can be only one.
|
||||
return Attrs.removeAttr(C, Attrs.getSlot(i).Index,
|
||||
Attributes::get(C, Attributes::Nest));
|
||||
Attribute::get(C, Attribute::Nest));
|
||||
}
|
||||
|
||||
return Attrs;
|
||||
@ -2113,7 +2113,7 @@ bool GlobalOpt::OptimizeFunctions(Module &M) {
|
||||
Changed = true;
|
||||
}
|
||||
|
||||
if (F->getAttributes().hasAttrSomewhere(Attributes::Nest) &&
|
||||
if (F->getAttributes().hasAttrSomewhere(Attribute::Nest) &&
|
||||
!F->hasAddressTaken()) {
|
||||
// The function is not used by a trampoline intrinsic, so it is safe
|
||||
// to remove the 'nest' attribute.
|
||||
|
@ -87,7 +87,7 @@ InlineCost AlwaysInliner::getInlineCost(CallSite CS) {
|
||||
// that are viable for inlining. FIXME: We shouldn't even get here for
|
||||
// declarations.
|
||||
if (Callee && !Callee->isDeclaration() &&
|
||||
Callee->getFnAttributes().hasAttribute(Attributes::AlwaysInline) &&
|
||||
Callee->getFnAttributes().hasAttribute(Attribute::AlwaysInline) &&
|
||||
CA.isInlineViable(*Callee))
|
||||
return InlineCost::getAlways();
|
||||
|
||||
|
@ -93,11 +93,11 @@ static bool InlineCallIfPossible(CallSite CS, InlineFunctionInfo &IFI,
|
||||
|
||||
// If the inlined function had a higher stack protection level than the
|
||||
// calling function, then bump up the caller's stack protection level.
|
||||
if (Callee->getFnAttributes().hasAttribute(Attributes::StackProtectReq))
|
||||
Caller->addFnAttr(Attributes::StackProtectReq);
|
||||
else if (Callee->getFnAttributes().hasAttribute(Attributes::StackProtect) &&
|
||||
!Caller->getFnAttributes().hasAttribute(Attributes::StackProtectReq))
|
||||
Caller->addFnAttr(Attributes::StackProtect);
|
||||
if (Callee->getFnAttributes().hasAttribute(Attribute::StackProtectReq))
|
||||
Caller->addFnAttr(Attribute::StackProtectReq);
|
||||
else if (Callee->getFnAttributes().hasAttribute(Attribute::StackProtect) &&
|
||||
!Caller->getFnAttributes().hasAttribute(Attribute::StackProtectReq))
|
||||
Caller->addFnAttr(Attribute::StackProtect);
|
||||
|
||||
// Look at all of the allocas that we inlined through this call site. If we
|
||||
// have already inlined other allocas through other calls into this function,
|
||||
@ -209,7 +209,7 @@ unsigned Inliner::getInlineThreshold(CallSite CS) const {
|
||||
// would decrease the threshold.
|
||||
Function *Caller = CS.getCaller();
|
||||
bool OptSize = Caller && !Caller->isDeclaration() &&
|
||||
Caller->getFnAttributes().hasAttribute(Attributes::OptimizeForSize);
|
||||
Caller->getFnAttributes().hasAttribute(Attribute::OptimizeForSize);
|
||||
if (!(InlineLimit.getNumOccurrences() > 0) && OptSize &&
|
||||
OptSizeThreshold < thres)
|
||||
thres = OptSizeThreshold;
|
||||
@ -218,9 +218,9 @@ unsigned Inliner::getInlineThreshold(CallSite CS) const {
|
||||
// and the caller does not need to minimize its size.
|
||||
Function *Callee = CS.getCalledFunction();
|
||||
bool InlineHint = Callee && !Callee->isDeclaration() &&
|
||||
Callee->getFnAttributes().hasAttribute(Attributes::InlineHint);
|
||||
Callee->getFnAttributes().hasAttribute(Attribute::InlineHint);
|
||||
if (InlineHint && HintThreshold > thres
|
||||
&& !Caller->getFnAttributes().hasAttribute(Attributes::MinSize))
|
||||
&& !Caller->getFnAttributes().hasAttribute(Attribute::MinSize))
|
||||
thres = HintThreshold;
|
||||
|
||||
return thres;
|
||||
@ -536,7 +536,7 @@ bool Inliner::removeDeadFunctions(CallGraph &CG, bool AlwaysInlineOnly) {
|
||||
// about always-inline functions. This is a bit of a hack to share code
|
||||
// between here and the InlineAlways pass.
|
||||
if (AlwaysInlineOnly &&
|
||||
!F->getFnAttributes().hasAttribute(Attributes::AlwaysInline))
|
||||
!F->getFnAttributes().hasAttribute(Attribute::AlwaysInline))
|
||||
continue;
|
||||
|
||||
// If the only remaining users of the function are dead constants, remove
|
||||
|
@ -140,14 +140,14 @@ bool PruneEH::runOnSCC(CallGraphSCC &SCC) {
|
||||
AttrBuilder NewAttributes;
|
||||
|
||||
if (!SCCMightUnwind)
|
||||
NewAttributes.addAttribute(Attributes::NoUnwind);
|
||||
NewAttributes.addAttribute(Attribute::NoUnwind);
|
||||
if (!SCCMightReturn)
|
||||
NewAttributes.addAttribute(Attributes::NoReturn);
|
||||
NewAttributes.addAttribute(Attribute::NoReturn);
|
||||
|
||||
Function *F = (*I)->getFunction();
|
||||
const AttributeSet &PAL = F->getAttributes();
|
||||
const AttributeSet &NPAL = PAL.addAttr(F->getContext(), ~0,
|
||||
Attributes::get(F->getContext(),
|
||||
Attribute::get(F->getContext(),
|
||||
NewAttributes));
|
||||
if (PAL != NPAL) {
|
||||
MadeChange = true;
|
||||
|
@ -1015,7 +1015,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
|
||||
if (!CallerPAL.isEmpty() && !Caller->use_empty()) {
|
||||
AttrBuilder RAttrs = CallerPAL.getRetAttributes();
|
||||
if (RAttrs.hasAttributes(Attributes::typeIncompatible(NewRetTy)))
|
||||
if (RAttrs.hasAttributes(Attribute::typeIncompatible(NewRetTy)))
|
||||
return false; // Attribute not compatible with transformed value.
|
||||
}
|
||||
|
||||
@ -1044,14 +1044,14 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
if (!CastInst::isCastable(ActTy, ParamTy))
|
||||
return false; // Cannot transform this parameter value.
|
||||
|
||||
Attributes Attrs = CallerPAL.getParamAttributes(i + 1);
|
||||
Attribute Attrs = CallerPAL.getParamAttributes(i + 1);
|
||||
if (AttrBuilder(Attrs).
|
||||
hasAttributes(Attributes::typeIncompatible(ParamTy)))
|
||||
hasAttributes(Attribute::typeIncompatible(ParamTy)))
|
||||
return false; // Attribute not compatible with transformed value.
|
||||
|
||||
// If the parameter is passed as a byval argument, then we have to have a
|
||||
// sized type and the sized type has to have the same size as the old type.
|
||||
if (ParamTy != ActTy && Attrs.hasAttribute(Attributes::ByVal)) {
|
||||
if (ParamTy != ActTy && Attrs.hasAttribute(Attribute::ByVal)) {
|
||||
PointerType *ParamPTy = dyn_cast<PointerType>(ParamTy);
|
||||
if (ParamPTy == 0 || !ParamPTy->getElementType()->isSized() || TD == 0)
|
||||
return false;
|
||||
@ -1102,7 +1102,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
for (unsigned i = CallerPAL.getNumSlots(); i; --i) {
|
||||
if (CallerPAL.getSlot(i - 1).Index <= FT->getNumParams())
|
||||
break;
|
||||
Attributes PAttrs = CallerPAL.getSlot(i - 1).Attrs;
|
||||
Attribute PAttrs = CallerPAL.getSlot(i - 1).Attrs;
|
||||
if (PAttrs.hasIncompatibleWithVarArgsAttrs())
|
||||
return false;
|
||||
}
|
||||
@ -1120,13 +1120,13 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
|
||||
// If the return value is not being used, the type may not be compatible
|
||||
// with the existing attributes. Wipe out any problematic attributes.
|
||||
RAttrs.removeAttributes(Attributes::typeIncompatible(NewRetTy));
|
||||
RAttrs.removeAttributes(Attribute::typeIncompatible(NewRetTy));
|
||||
|
||||
// Add the new return attributes.
|
||||
if (RAttrs.hasAttributes())
|
||||
attrVec.push_back(
|
||||
AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
||||
Attributes::get(FT->getContext(), RAttrs)));
|
||||
Attribute::get(FT->getContext(), RAttrs)));
|
||||
|
||||
AI = CS.arg_begin();
|
||||
for (unsigned i = 0; i != NumCommonArgs; ++i, ++AI) {
|
||||
@ -1140,7 +1140,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
}
|
||||
|
||||
// Add any parameter attributes.
|
||||
Attributes PAttrs = CallerPAL.getParamAttributes(i + 1);
|
||||
Attribute PAttrs = CallerPAL.getParamAttributes(i + 1);
|
||||
if (PAttrs.hasAttributes())
|
||||
attrVec.push_back(AttributeWithIndex::get(i + 1, PAttrs));
|
||||
}
|
||||
@ -1169,14 +1169,14 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
}
|
||||
|
||||
// Add any parameter attributes.
|
||||
Attributes PAttrs = CallerPAL.getParamAttributes(i + 1);
|
||||
Attribute PAttrs = CallerPAL.getParamAttributes(i + 1);
|
||||
if (PAttrs.hasAttributes())
|
||||
attrVec.push_back(AttributeWithIndex::get(i + 1, PAttrs));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Attributes FnAttrs = CallerPAL.getFnAttributes();
|
||||
Attribute FnAttrs = CallerPAL.getFnAttributes();
|
||||
if (FnAttrs.hasAttributes())
|
||||
attrVec.push_back(AttributeWithIndex::get(AttributeSet::FunctionIndex,
|
||||
FnAttrs));
|
||||
@ -1250,7 +1250,7 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
|
||||
// If the call already has the 'nest' attribute somewhere then give up -
|
||||
// otherwise 'nest' would occur twice after splicing in the chain.
|
||||
for (unsigned I = 0, E = Attrs.getNumAttrs(); I != E; ++I)
|
||||
if (Attrs.getAttributesAtIndex(I).hasAttribute(Attributes::Nest))
|
||||
if (Attrs.getAttributesAtIndex(I).hasAttribute(Attribute::Nest))
|
||||
return 0;
|
||||
|
||||
assert(Tramp &&
|
||||
@ -1264,12 +1264,12 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
|
||||
if (!NestAttrs.isEmpty()) {
|
||||
unsigned NestIdx = 1;
|
||||
Type *NestTy = 0;
|
||||
Attributes NestAttr;
|
||||
Attribute NestAttr;
|
||||
|
||||
// Look for a parameter marked with the 'nest' attribute.
|
||||
for (FunctionType::param_iterator I = NestFTy->param_begin(),
|
||||
E = NestFTy->param_end(); I != E; ++NestIdx, ++I)
|
||||
if (NestAttrs.getParamAttributes(NestIdx).hasAttribute(Attributes::Nest)){
|
||||
if (NestAttrs.getParamAttributes(NestIdx).hasAttribute(Attribute::Nest)){
|
||||
// Record the parameter type and any other attributes.
|
||||
NestTy = *I;
|
||||
NestAttr = NestAttrs.getParamAttributes(NestIdx);
|
||||
@ -1288,7 +1288,7 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
|
||||
// mean appending it. Likewise for attributes.
|
||||
|
||||
// Add any result attributes.
|
||||
Attributes Attr = Attrs.getRetAttributes();
|
||||
Attribute Attr = Attrs.getRetAttributes();
|
||||
if (Attr.hasAttributes())
|
||||
NewAttrs.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
|
||||
Attr));
|
||||
|
@ -905,7 +905,7 @@ bool AddressSanitizer::runOnFunction(Function &F) {
|
||||
// If needed, insert __asan_init before checking for AddressSafety attr.
|
||||
maybeInsertAsanInitAtFunctionEntry(F);
|
||||
|
||||
if (!F.getFnAttributes().hasAttribute(Attributes::AddressSafety))
|
||||
if (!F.getFnAttributes().hasAttribute(Attribute::AddressSafety))
|
||||
return false;
|
||||
|
||||
if (!ClDebugFunc.empty() && ClDebugFunc != F.getName())
|
||||
|
@ -642,9 +642,9 @@ void GCOVProfiler::insertCounterWriteout(
|
||||
WriteoutF = Function::Create(WriteoutFTy, GlobalValue::InternalLinkage,
|
||||
"__llvm_gcov_writeout", M);
|
||||
WriteoutF->setUnnamedAddr(true);
|
||||
WriteoutF->addFnAttr(Attributes::NoInline);
|
||||
WriteoutF->addFnAttr(Attribute::NoInline);
|
||||
if (NoRedZone)
|
||||
WriteoutF->addFnAttr(Attributes::NoRedZone);
|
||||
WriteoutF->addFnAttr(Attribute::NoRedZone);
|
||||
|
||||
BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", WriteoutF);
|
||||
IRBuilder<> Builder(BB);
|
||||
@ -689,9 +689,9 @@ void GCOVProfiler::insertCounterWriteout(
|
||||
"__llvm_gcov_init", M);
|
||||
F->setUnnamedAddr(true);
|
||||
F->setLinkage(GlobalValue::InternalLinkage);
|
||||
F->addFnAttr(Attributes::NoInline);
|
||||
F->addFnAttr(Attribute::NoInline);
|
||||
if (NoRedZone)
|
||||
F->addFnAttr(Attributes::NoRedZone);
|
||||
F->addFnAttr(Attribute::NoRedZone);
|
||||
|
||||
BB = BasicBlock::Create(*Ctx, "entry", F);
|
||||
Builder.SetInsertPoint(BB);
|
||||
@ -710,9 +710,9 @@ void GCOVProfiler::insertIndirectCounterIncrement() {
|
||||
cast<Function>(GCOVProfiler::getIncrementIndirectCounterFunc());
|
||||
Fn->setUnnamedAddr(true);
|
||||
Fn->setLinkage(GlobalValue::InternalLinkage);
|
||||
Fn->addFnAttr(Attributes::NoInline);
|
||||
Fn->addFnAttr(Attribute::NoInline);
|
||||
if (NoRedZone)
|
||||
Fn->addFnAttr(Attributes::NoRedZone);
|
||||
Fn->addFnAttr(Attribute::NoRedZone);
|
||||
|
||||
Type *Int32Ty = Type::getInt32Ty(*Ctx);
|
||||
Type *Int64Ty = Type::getInt64Ty(*Ctx);
|
||||
@ -769,9 +769,9 @@ insertFlush(ArrayRef<std::pair<GlobalVariable*, MDNode*> > CountersBySP) {
|
||||
else
|
||||
FlushF->setLinkage(GlobalValue::InternalLinkage);
|
||||
FlushF->setUnnamedAddr(true);
|
||||
FlushF->addFnAttr(Attributes::NoInline);
|
||||
FlushF->addFnAttr(Attribute::NoInline);
|
||||
if (NoRedZone)
|
||||
FlushF->addFnAttr(Attributes::NoRedZone);
|
||||
FlushF->addFnAttr(Attribute::NoRedZone);
|
||||
|
||||
BasicBlock *Entry = BasicBlock::Create(*Ctx, "entry", FlushF);
|
||||
|
||||
|
@ -1260,10 +1260,10 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
if (Function *Func = Call->getCalledFunction()) {
|
||||
// Clear out readonly/readnone attributes.
|
||||
AttrBuilder B;
|
||||
B.addAttribute(Attributes::ReadOnly)
|
||||
.addAttribute(Attributes::ReadNone);
|
||||
B.addAttribute(Attribute::ReadOnly)
|
||||
.addAttribute(Attribute::ReadNone);
|
||||
Func->removeAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(Func->getContext(), B));
|
||||
Attribute::get(Func->getContext(), B));
|
||||
}
|
||||
}
|
||||
IRBuilder<> IRB(&I);
|
||||
@ -1286,7 +1286,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
Value *ArgShadowBase = getShadowPtrForArgument(A, IRB, ArgOffset);
|
||||
DEBUG(dbgs() << " Arg#" << i << ": " << *A <<
|
||||
" Shadow: " << *ArgShadow << "\n");
|
||||
if (CS.paramHasAttr(i + 1, Attributes::ByVal)) {
|
||||
if (CS.paramHasAttr(i + 1, Attribute::ByVal)) {
|
||||
assert(A->getType()->isPointerTy() &&
|
||||
"ByVal argument is not a pointer!");
|
||||
Size = MS.TD->getTypeAllocSize(A->getType()->getPointerElementType());
|
||||
@ -1643,10 +1643,10 @@ bool MemorySanitizer::runOnFunction(Function &F) {
|
||||
|
||||
// Clear out readonly/readnone attributes.
|
||||
AttrBuilder B;
|
||||
B.addAttribute(Attributes::ReadOnly)
|
||||
.addAttribute(Attributes::ReadNone);
|
||||
B.addAttribute(Attribute::ReadOnly)
|
||||
.addAttribute(Attribute::ReadNone);
|
||||
F.removeAttribute(AttributeSet::FunctionIndex,
|
||||
Attributes::get(F.getContext(), B));
|
||||
Attribute::get(F.getContext(), B));
|
||||
|
||||
return Visitor.runOnFunction();
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
|
||||
TLInfo = &getAnalysis<TargetLibraryInfo>();
|
||||
DT = getAnalysisIfAvailable<DominatorTree>();
|
||||
PFI = getAnalysisIfAvailable<ProfileInfo>();
|
||||
OptSize = F.getFnAttributes().hasAttribute(Attributes::OptimizeForSize);
|
||||
OptSize = F.getFnAttributes().hasAttribute(Attribute::OptimizeForSize);
|
||||
|
||||
/// This optimization identifies DIV instructions that can be
|
||||
/// profitably bypassed and carried out with a shorter, faster divide.
|
||||
@ -727,9 +727,9 @@ bool CodeGenPrepare::DupRetToEnableTailCallOpts(BasicBlock *BB) {
|
||||
// It's not safe to eliminate the sign / zero extension of the return value.
|
||||
// See llvm::isInTailCallPosition().
|
||||
const Function *F = BB->getParent();
|
||||
Attributes CallerRetAttr = F->getAttributes().getRetAttributes();
|
||||
if (CallerRetAttr.hasAttribute(Attributes::ZExt) ||
|
||||
CallerRetAttr.hasAttribute(Attributes::SExt))
|
||||
Attribute CallerRetAttr = F->getAttributes().getRetAttributes();
|
||||
if (CallerRetAttr.hasAttribute(Attribute::ZExt) ||
|
||||
CallerRetAttr.hasAttribute(Attribute::SExt))
|
||||
return false;
|
||||
|
||||
// Make sure there are no instructions between the PHI and return, or that the
|
||||
@ -786,11 +786,11 @@ bool CodeGenPrepare::DupRetToEnableTailCallOpts(BasicBlock *BB) {
|
||||
|
||||
// Conservatively require the attributes of the call to match those of the
|
||||
// return. Ignore noalias because it doesn't affect the call sequence.
|
||||
Attributes CalleeRetAttr = CS.getAttributes().getRetAttributes();
|
||||
Attribute CalleeRetAttr = CS.getAttributes().getRetAttributes();
|
||||
if (AttrBuilder(CalleeRetAttr).
|
||||
removeAttribute(Attributes::NoAlias) !=
|
||||
removeAttribute(Attribute::NoAlias) !=
|
||||
AttrBuilder(CallerRetAttr).
|
||||
removeAttribute(Attributes::NoAlias))
|
||||
removeAttribute(Attribute::NoAlias))
|
||||
continue;
|
||||
|
||||
// Make sure the call instruction is followed by an unconditional branch to
|
||||
|
@ -146,7 +146,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
unsigned Threshold = CurrentThreshold;
|
||||
if (!UserThreshold &&
|
||||
Header->getParent()->getFnAttributes().
|
||||
hasAttribute(Attributes::OptimizeForSize))
|
||||
hasAttribute(Attribute::OptimizeForSize))
|
||||
Threshold = OptSizeUnrollThreshold;
|
||||
|
||||
// Find trip count and trip multiple if count is not available
|
||||
|
@ -639,7 +639,7 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val) {
|
||||
|
||||
// Do not do non-trivial unswitch while optimizing for size.
|
||||
if (OptimizeForSize ||
|
||||
F->getFnAttributes().hasAttribute(Attributes::OptimizeForSize))
|
||||
F->getFnAttributes().hasAttribute(Attribute::OptimizeForSize))
|
||||
return false;
|
||||
|
||||
UnswitchNontrivialCondition(LoopCond, Val, currentLoop);
|
||||
|
@ -1788,12 +1788,12 @@ Constant *ObjCARCOpt::getRetainRVCallee(Module *M) {
|
||||
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
|
||||
Type *Params[] = { I8X };
|
||||
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
|
||||
AttributeSet Attributes =
|
||||
AttributeSet Attribute =
|
||||
AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(C, Attributes::NoUnwind));
|
||||
Attribute::get(C, Attribute::NoUnwind));
|
||||
RetainRVCallee =
|
||||
M->getOrInsertFunction("objc_retainAutoreleasedReturnValue", FTy,
|
||||
Attributes);
|
||||
Attribute);
|
||||
}
|
||||
return RetainRVCallee;
|
||||
}
|
||||
@ -1804,12 +1804,12 @@ Constant *ObjCARCOpt::getAutoreleaseRVCallee(Module *M) {
|
||||
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
|
||||
Type *Params[] = { I8X };
|
||||
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
|
||||
AttributeSet Attributes =
|
||||
AttributeSet Attribute =
|
||||
AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(C, Attributes::NoUnwind));
|
||||
Attribute::get(C, Attribute::NoUnwind));
|
||||
AutoreleaseRVCallee =
|
||||
M->getOrInsertFunction("objc_autoreleaseReturnValue", FTy,
|
||||
Attributes);
|
||||
Attribute);
|
||||
}
|
||||
return AutoreleaseRVCallee;
|
||||
}
|
||||
@ -1818,14 +1818,14 @@ Constant *ObjCARCOpt::getReleaseCallee(Module *M) {
|
||||
if (!ReleaseCallee) {
|
||||
LLVMContext &C = M->getContext();
|
||||
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
|
||||
AttributeSet Attributes =
|
||||
AttributeSet Attribute =
|
||||
AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(C, Attributes::NoUnwind));
|
||||
Attribute::get(C, Attribute::NoUnwind));
|
||||
ReleaseCallee =
|
||||
M->getOrInsertFunction(
|
||||
"objc_release",
|
||||
FunctionType::get(Type::getVoidTy(C), Params, /*isVarArg=*/false),
|
||||
Attributes);
|
||||
Attribute);
|
||||
}
|
||||
return ReleaseCallee;
|
||||
}
|
||||
@ -1834,14 +1834,14 @@ Constant *ObjCARCOpt::getRetainCallee(Module *M) {
|
||||
if (!RetainCallee) {
|
||||
LLVMContext &C = M->getContext();
|
||||
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
|
||||
AttributeSet Attributes =
|
||||
AttributeSet Attribute =
|
||||
AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(C, Attributes::NoUnwind));
|
||||
Attribute::get(C, Attribute::NoUnwind));
|
||||
RetainCallee =
|
||||
M->getOrInsertFunction(
|
||||
"objc_retain",
|
||||
FunctionType::get(Params[0], Params, /*isVarArg=*/false),
|
||||
Attributes);
|
||||
Attribute);
|
||||
}
|
||||
return RetainCallee;
|
||||
}
|
||||
@ -1865,14 +1865,14 @@ Constant *ObjCARCOpt::getAutoreleaseCallee(Module *M) {
|
||||
if (!AutoreleaseCallee) {
|
||||
LLVMContext &C = M->getContext();
|
||||
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
|
||||
AttributeSet Attributes =
|
||||
AttributeSet Attribute =
|
||||
AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(C, Attributes::NoUnwind));
|
||||
Attribute::get(C, Attribute::NoUnwind));
|
||||
AutoreleaseCallee =
|
||||
M->getOrInsertFunction(
|
||||
"objc_autorelease",
|
||||
FunctionType::get(Params[0], Params, /*isVarArg=*/false),
|
||||
Attributes);
|
||||
Attribute);
|
||||
}
|
||||
return AutoreleaseCallee;
|
||||
}
|
||||
@ -3840,16 +3840,16 @@ Constant *ObjCARCContract::getStoreStrongCallee(Module *M) {
|
||||
Type *I8XX = PointerType::getUnqual(I8X);
|
||||
Type *Params[] = { I8XX, I8X };
|
||||
|
||||
AttributeSet Attributes = AttributeSet()
|
||||
AttributeSet Attribute = AttributeSet()
|
||||
.addAttr(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(C, Attributes::NoUnwind))
|
||||
.addAttr(M->getContext(), 1, Attributes::get(C, Attributes::NoCapture));
|
||||
Attribute::get(C, Attribute::NoUnwind))
|
||||
.addAttr(M->getContext(), 1, Attribute::get(C, Attribute::NoCapture));
|
||||
|
||||
StoreStrongCallee =
|
||||
M->getOrInsertFunction(
|
||||
"objc_storeStrong",
|
||||
FunctionType::get(Type::getVoidTy(C), Params, /*isVarArg=*/false),
|
||||
Attributes);
|
||||
Attribute);
|
||||
}
|
||||
return StoreStrongCallee;
|
||||
}
|
||||
@ -3860,11 +3860,11 @@ Constant *ObjCARCContract::getRetainAutoreleaseCallee(Module *M) {
|
||||
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
|
||||
Type *Params[] = { I8X };
|
||||
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
|
||||
AttributeSet Attributes =
|
||||
AttributeSet Attribute =
|
||||
AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(C, Attributes::NoUnwind));
|
||||
Attribute::get(C, Attribute::NoUnwind));
|
||||
RetainAutoreleaseCallee =
|
||||
M->getOrInsertFunction("objc_retainAutorelease", FTy, Attributes);
|
||||
M->getOrInsertFunction("objc_retainAutorelease", FTy, Attribute);
|
||||
}
|
||||
return RetainAutoreleaseCallee;
|
||||
}
|
||||
@ -3875,12 +3875,12 @@ Constant *ObjCARCContract::getRetainAutoreleaseRVCallee(Module *M) {
|
||||
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
|
||||
Type *Params[] = { I8X };
|
||||
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
|
||||
AttributeSet Attributes =
|
||||
AttributeSet Attribute =
|
||||
AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(C, Attributes::NoUnwind));
|
||||
Attribute::get(C, Attribute::NoUnwind));
|
||||
RetainAutoreleaseRVCallee =
|
||||
M->getOrInsertFunction("objc_retainAutoreleaseReturnValue", FTy,
|
||||
Attributes);
|
||||
Attribute);
|
||||
}
|
||||
return RetainAutoreleaseRVCallee;
|
||||
}
|
||||
|
@ -41,10 +41,10 @@ Value *llvm::EmitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout *TD,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[2];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attributes::NoCapture);
|
||||
Attributes::AttrVal AVs[2] = { Attributes::ReadOnly, Attributes::NoUnwind };
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attribute::NoCapture);
|
||||
Attribute::AttrVal AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
ArrayRef<Attributes::AttrVal>(AVs, 2));
|
||||
ArrayRef<Attribute::AttrVal>(AVs, 2));
|
||||
|
||||
LLVMContext &Context = B.GetInsertBlock()->getContext();
|
||||
Constant *StrLen = M->getOrInsertFunction("strlen",
|
||||
@ -70,10 +70,10 @@ Value *llvm::EmitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[2];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attributes::NoCapture);
|
||||
Attributes::AttrVal AVs[2] = { Attributes::ReadOnly, Attributes::NoUnwind };
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attribute::NoCapture);
|
||||
Attribute::AttrVal AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
ArrayRef<Attributes::AttrVal>(AVs, 2));
|
||||
ArrayRef<Attribute::AttrVal>(AVs, 2));
|
||||
|
||||
LLVMContext &Context = B.GetInsertBlock()->getContext();
|
||||
Constant *StrNLen = M->getOrInsertFunction("strnlen",
|
||||
@ -99,10 +99,10 @@ Value *llvm::EmitStrChr(Value *Ptr, char C, IRBuilder<> &B,
|
||||
return 0;
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
Attributes::AttrVal AVs[2] = { Attributes::ReadOnly, Attributes::NoUnwind };
|
||||
Attribute::AttrVal AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
|
||||
AttributeWithIndex AWI =
|
||||
AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
ArrayRef<Attributes::AttrVal>(AVs, 2));
|
||||
ArrayRef<Attribute::AttrVal>(AVs, 2));
|
||||
|
||||
Type *I8Ptr = B.getInt8PtrTy();
|
||||
Type *I32Ty = B.getInt32Ty();
|
||||
@ -126,11 +126,11 @@ Value *llvm::EmitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[3];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attributes::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), 2, Attributes::NoCapture);
|
||||
Attributes::AttrVal AVs[2] = { Attributes::ReadOnly, Attributes::NoUnwind };
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), 2, Attribute::NoCapture);
|
||||
Attribute::AttrVal AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
|
||||
AWI[2] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
ArrayRef<Attributes::AttrVal>(AVs, 2));
|
||||
ArrayRef<Attribute::AttrVal>(AVs, 2));
|
||||
|
||||
LLVMContext &Context = B.GetInsertBlock()->getContext();
|
||||
Value *StrNCmp = M->getOrInsertFunction("strncmp",
|
||||
@ -159,9 +159,9 @@ Value *llvm::EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[2];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 2, Attributes::NoCapture);
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 2, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::NoUnwind);
|
||||
Attribute::NoUnwind);
|
||||
Type *I8Ptr = B.getInt8PtrTy();
|
||||
Value *StrCpy = M->getOrInsertFunction(Name,
|
||||
AttributeSet::get(M->getContext(), AWI),
|
||||
@ -183,9 +183,9 @@ Value *llvm::EmitStrNCpy(Value *Dst, Value *Src, Value *Len,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[2];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 2, Attributes::NoCapture);
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 2, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::NoUnwind);
|
||||
Attribute::NoUnwind);
|
||||
Type *I8Ptr = B.getInt8PtrTy();
|
||||
Value *StrNCpy = M->getOrInsertFunction(Name,
|
||||
AttributeSet::get(M->getContext(),
|
||||
@ -211,7 +211,7 @@ Value *llvm::EmitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI;
|
||||
AWI = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::NoUnwind);
|
||||
Attribute::NoUnwind);
|
||||
LLVMContext &Context = B.GetInsertBlock()->getContext();
|
||||
Value *MemCpy = M->getOrInsertFunction("__memcpy_chk",
|
||||
AttributeSet::get(M->getContext(), AWI),
|
||||
@ -238,9 +238,9 @@ Value *llvm::EmitMemChr(Value *Ptr, Value *Val,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI;
|
||||
Attributes::AttrVal AVs[2] = { Attributes::ReadOnly, Attributes::NoUnwind };
|
||||
Attribute::AttrVal AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
|
||||
AWI = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
ArrayRef<Attributes::AttrVal>(AVs, 2));
|
||||
ArrayRef<Attribute::AttrVal>(AVs, 2));
|
||||
LLVMContext &Context = B.GetInsertBlock()->getContext();
|
||||
Value *MemChr = M->getOrInsertFunction("memchr",
|
||||
AttributeSet::get(M->getContext(), AWI),
|
||||
@ -266,11 +266,11 @@ Value *llvm::EmitMemCmp(Value *Ptr1, Value *Ptr2,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[3];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attributes::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), 2, Attributes::NoCapture);
|
||||
Attributes::AttrVal AVs[2] = { Attributes::ReadOnly, Attributes::NoUnwind };
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), 2, Attribute::NoCapture);
|
||||
Attribute::AttrVal AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
|
||||
AWI[2] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
ArrayRef<Attributes::AttrVal>(AVs, 2));
|
||||
ArrayRef<Attribute::AttrVal>(AVs, 2));
|
||||
|
||||
LLVMContext &Context = B.GetInsertBlock()->getContext();
|
||||
Value *MemCmp = M->getOrInsertFunction("memcmp",
|
||||
@ -347,9 +347,9 @@ Value *llvm::EmitPutS(Value *Str, IRBuilder<> &B, const DataLayout *TD,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[2];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attributes::NoCapture);
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::NoUnwind);
|
||||
Attribute::NoUnwind);
|
||||
|
||||
Value *PutS = M->getOrInsertFunction("puts",
|
||||
AttributeSet::get(M->getContext(), AWI),
|
||||
@ -371,9 +371,9 @@ Value *llvm::EmitFPutC(Value *Char, Value *File, IRBuilder<> &B,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[2];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 2, Attributes::NoCapture);
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 2, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::NoUnwind);
|
||||
Attribute::NoUnwind);
|
||||
Constant *F;
|
||||
if (File->getType()->isPointerTy())
|
||||
F = M->getOrInsertFunction("fputc",
|
||||
@ -404,10 +404,10 @@ Value *llvm::EmitFPutS(Value *Str, Value *File, IRBuilder<> &B,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[3];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attributes::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), 2, Attributes::NoCapture);
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), 2, Attribute::NoCapture);
|
||||
AWI[2] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::NoUnwind);
|
||||
Attribute::NoUnwind);
|
||||
StringRef FPutsName = TLI->getName(LibFunc::fputs);
|
||||
Constant *F;
|
||||
if (File->getType()->isPointerTy())
|
||||
@ -437,10 +437,10 @@ Value *llvm::EmitFWrite(Value *Ptr, Value *Size, Value *File,
|
||||
|
||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
||||
AttributeWithIndex AWI[3];
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attributes::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), 4, Attributes::NoCapture);
|
||||
AWI[0] = AttributeWithIndex::get(M->getContext(), 1, Attribute::NoCapture);
|
||||
AWI[1] = AttributeWithIndex::get(M->getContext(), 4, Attribute::NoCapture);
|
||||
AWI[2] = AttributeWithIndex::get(M->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::NoUnwind);
|
||||
Attribute::NoUnwind);
|
||||
LLVMContext &Context = B.GetInsertBlock()->getContext();
|
||||
StringRef FWriteName = TLI->getName(LibFunc::fwrite);
|
||||
Constant *F;
|
||||
|
@ -792,8 +792,8 @@ struct StrToOpt : public LibCallOptimization {
|
||||
if (isa<ConstantPointerNull>(EndPtr)) {
|
||||
// With a null EndPtr, this function won't capture the main argument.
|
||||
// It would be readonly too, except that it still may write to errno.
|
||||
CI->addAttribute(1, Attributes::get(Callee->getContext(),
|
||||
Attributes::NoCapture));
|
||||
CI->addAttribute(1, Attribute::get(Callee->getContext(),
|
||||
Attribute::NoCapture));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -95,7 +95,7 @@ struct LoopVectorize : public LoopPass {
|
||||
// Check the function attribues to find out if this function should be
|
||||
// optimized for size.
|
||||
Function *F = L->getHeader()->getParent();
|
||||
Attributes::AttrVal SzAttr= Attributes::OptimizeForSize;
|
||||
Attribute::AttrVal SzAttr= Attribute::OptimizeForSize;
|
||||
bool OptForSize = F->getFnAttributes().hasAttribute(SzAttr);
|
||||
|
||||
unsigned VF = CM.selectVectorizationFactor(OptForSize, VectorizationFactor);
|
||||
|
@ -1197,7 +1197,7 @@ public:
|
||||
void printModule(const Module *M);
|
||||
|
||||
void writeOperand(const Value *Op, bool PrintType);
|
||||
void writeParamOperand(const Value *Operand, Attributes Attrs);
|
||||
void writeParamOperand(const Value *Operand, Attribute Attrs);
|
||||
void writeAtomic(AtomicOrdering Ordering, SynchronizationScope SynchScope);
|
||||
|
||||
void writeAllMDNodes();
|
||||
@ -1206,7 +1206,7 @@ public:
|
||||
void printGlobal(const GlobalVariable *GV);
|
||||
void printAlias(const GlobalAlias *GV);
|
||||
void printFunction(const Function *F);
|
||||
void printArgument(const Argument *FA, Attributes Attrs);
|
||||
void printArgument(const Argument *FA, Attribute Attrs);
|
||||
void printBasicBlock(const BasicBlock *BB);
|
||||
void printInstruction(const Instruction &I);
|
||||
|
||||
@ -1251,7 +1251,7 @@ void AssemblyWriter::writeAtomic(AtomicOrdering Ordering,
|
||||
}
|
||||
|
||||
void AssemblyWriter::writeParamOperand(const Value *Operand,
|
||||
Attributes Attrs) {
|
||||
Attribute Attrs) {
|
||||
if (Operand == 0) {
|
||||
Out << "<null operand!>";
|
||||
return;
|
||||
@ -1557,7 +1557,7 @@ void AssemblyWriter::printFunction(const Function *F) {
|
||||
|
||||
FunctionType *FT = F->getFunctionType();
|
||||
const AttributeSet &Attrs = F->getAttributes();
|
||||
Attributes RetAttrs = Attrs.getRetAttributes();
|
||||
Attribute RetAttrs = Attrs.getRetAttributes();
|
||||
if (RetAttrs.hasAttributes())
|
||||
Out << Attrs.getRetAttributes().getAsString() << ' ';
|
||||
TypePrinter.print(F->getReturnType(), Out);
|
||||
@ -1587,7 +1587,7 @@ void AssemblyWriter::printFunction(const Function *F) {
|
||||
// Output type...
|
||||
TypePrinter.print(FT->getParamType(i), Out);
|
||||
|
||||
Attributes ArgAttrs = Attrs.getParamAttributes(i+1);
|
||||
Attribute ArgAttrs = Attrs.getParamAttributes(i+1);
|
||||
if (ArgAttrs.hasAttributes())
|
||||
Out << ' ' << ArgAttrs.getAsString();
|
||||
}
|
||||
@ -1601,7 +1601,7 @@ void AssemblyWriter::printFunction(const Function *F) {
|
||||
Out << ')';
|
||||
if (F->hasUnnamedAddr())
|
||||
Out << " unnamed_addr";
|
||||
Attributes FnAttrs = Attrs.getFnAttributes();
|
||||
Attribute FnAttrs = Attrs.getFnAttributes();
|
||||
if (FnAttrs.hasAttributes())
|
||||
Out << ' ' << Attrs.getFnAttributes().getAsString();
|
||||
if (F->hasSection()) {
|
||||
@ -1631,7 +1631,7 @@ void AssemblyWriter::printFunction(const Function *F) {
|
||||
/// the function. Simply print it out
|
||||
///
|
||||
void AssemblyWriter::printArgument(const Argument *Arg,
|
||||
Attributes Attrs) {
|
||||
Attribute Attrs) {
|
||||
// Output type...
|
||||
TypePrinter.print(Arg->getType(), Out);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- Attributes.cpp - Implement AttributesList -------------------------===//
|
||||
//===-- Attribute.cpp - Implement AttributesList -------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -7,7 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the Attributes, AttributeImpl, AttrBuilder,
|
||||
// This file implements the Attribute, AttributeImpl, AttrBuilder,
|
||||
// AttributeListImpl, and AttributeSet classes.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -26,21 +26,21 @@
|
||||
using namespace llvm;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Attributes Implementation
|
||||
// Attribute Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Attributes Attributes::get(LLVMContext &Context, ArrayRef<AttrVal> Vals) {
|
||||
Attribute Attribute::get(LLVMContext &Context, ArrayRef<AttrVal> Vals) {
|
||||
AttrBuilder B;
|
||||
for (ArrayRef<AttrVal>::iterator I = Vals.begin(), E = Vals.end();
|
||||
I != E; ++I)
|
||||
B.addAttribute(*I);
|
||||
return Attributes::get(Context, B);
|
||||
return Attribute::get(Context, B);
|
||||
}
|
||||
|
||||
Attributes Attributes::get(LLVMContext &Context, AttrBuilder &B) {
|
||||
// If there are no attributes, return an empty Attributes class.
|
||||
Attribute Attribute::get(LLVMContext &Context, AttrBuilder &B) {
|
||||
// If there are no attributes, return an empty Attribute class.
|
||||
if (!B.hasAttributes())
|
||||
return Attributes();
|
||||
return Attribute();
|
||||
|
||||
// Otherwise, build a key to look up the existing attributes.
|
||||
LLVMContextImpl *pImpl = Context.pImpl;
|
||||
@ -58,63 +58,63 @@ Attributes Attributes::get(LLVMContext &Context, AttrBuilder &B) {
|
||||
}
|
||||
|
||||
// Return the AttributesList that we found or created.
|
||||
return Attributes(PA);
|
||||
return Attribute(PA);
|
||||
}
|
||||
|
||||
bool Attributes::hasAttribute(AttrVal Val) const {
|
||||
bool Attribute::hasAttribute(AttrVal Val) const {
|
||||
return Attrs && Attrs->hasAttribute(Val);
|
||||
}
|
||||
|
||||
bool Attributes::hasAttributes() const {
|
||||
bool Attribute::hasAttributes() const {
|
||||
return Attrs && Attrs->hasAttributes();
|
||||
}
|
||||
|
||||
bool Attributes::hasAttributes(const Attributes &A) const {
|
||||
bool Attribute::hasAttributes(const Attribute &A) const {
|
||||
return Attrs && Attrs->hasAttributes(A);
|
||||
}
|
||||
|
||||
/// This returns the alignment field of an attribute as a byte alignment value.
|
||||
unsigned Attributes::getAlignment() const {
|
||||
if (!hasAttribute(Attributes::Alignment))
|
||||
unsigned Attribute::getAlignment() const {
|
||||
if (!hasAttribute(Attribute::Alignment))
|
||||
return 0;
|
||||
return 1U << ((Attrs->getAlignment() >> 16) - 1);
|
||||
}
|
||||
|
||||
/// This returns the stack alignment field of an attribute as a byte alignment
|
||||
/// value.
|
||||
unsigned Attributes::getStackAlignment() const {
|
||||
if (!hasAttribute(Attributes::StackAlignment))
|
||||
unsigned Attribute::getStackAlignment() const {
|
||||
if (!hasAttribute(Attribute::StackAlignment))
|
||||
return 0;
|
||||
return 1U << ((Attrs->getStackAlignment() >> 26) - 1);
|
||||
}
|
||||
|
||||
uint64_t Attributes::Raw() const {
|
||||
uint64_t Attribute::Raw() const {
|
||||
return Attrs ? Attrs->Raw() : 0;
|
||||
}
|
||||
|
||||
Attributes Attributes::typeIncompatible(Type *Ty) {
|
||||
Attribute Attribute::typeIncompatible(Type *Ty) {
|
||||
AttrBuilder Incompatible;
|
||||
|
||||
if (!Ty->isIntegerTy())
|
||||
// Attributes that only apply to integers.
|
||||
Incompatible.addAttribute(Attributes::SExt)
|
||||
.addAttribute(Attributes::ZExt);
|
||||
// Attribute that only apply to integers.
|
||||
Incompatible.addAttribute(Attribute::SExt)
|
||||
.addAttribute(Attribute::ZExt);
|
||||
|
||||
if (!Ty->isPointerTy())
|
||||
// Attributes that only apply to pointers.
|
||||
Incompatible.addAttribute(Attributes::ByVal)
|
||||
.addAttribute(Attributes::Nest)
|
||||
.addAttribute(Attributes::NoAlias)
|
||||
.addAttribute(Attributes::NoCapture)
|
||||
.addAttribute(Attributes::StructRet);
|
||||
// Attribute that only apply to pointers.
|
||||
Incompatible.addAttribute(Attribute::ByVal)
|
||||
.addAttribute(Attribute::Nest)
|
||||
.addAttribute(Attribute::NoAlias)
|
||||
.addAttribute(Attribute::NoCapture)
|
||||
.addAttribute(Attribute::StructRet);
|
||||
|
||||
return Attributes::get(Ty->getContext(), Incompatible);
|
||||
return Attribute::get(Ty->getContext(), Incompatible);
|
||||
}
|
||||
|
||||
/// encodeLLVMAttributesForBitcode - This returns an integer containing an
|
||||
/// encoding of all the LLVM attributes found in the given attribute bitset.
|
||||
/// Any change to this encoding is a breaking change to bitcode compatibility.
|
||||
uint64_t Attributes::encodeLLVMAttributesForBitcode(Attributes Attrs) {
|
||||
uint64_t Attribute::encodeLLVMAttributesForBitcode(Attribute Attrs) {
|
||||
// FIXME: It doesn't make sense to store the alignment information as an
|
||||
// expanded out value, we should store it as a log2 value. However, we can't
|
||||
// just change that here without breaking bitcode compatibility. If this ever
|
||||
@ -125,7 +125,7 @@ uint64_t Attributes::encodeLLVMAttributesForBitcode(Attributes Attrs) {
|
||||
// Store the alignment in the bitcode as a 16-bit raw value instead of a 5-bit
|
||||
// log2 encoded value. Shift the bits above the alignment up by 11 bits.
|
||||
uint64_t EncodedAttrs = Attrs.Raw() & 0xffff;
|
||||
if (Attrs.hasAttribute(Attributes::Alignment))
|
||||
if (Attrs.hasAttribute(Attribute::Alignment))
|
||||
EncodedAttrs |= Attrs.getAlignment() << 16;
|
||||
EncodedAttrs |= (Attrs.Raw() & (0xffffULL << 21)) << 11;
|
||||
return EncodedAttrs;
|
||||
@ -134,7 +134,7 @@ uint64_t Attributes::encodeLLVMAttributesForBitcode(Attributes Attrs) {
|
||||
/// decodeLLVMAttributesForBitcode - This returns an attribute bitset containing
|
||||
/// the LLVM attributes that have been decoded from the given integer. This
|
||||
/// function must stay in sync with 'encodeLLVMAttributesForBitcode'.
|
||||
Attributes Attributes::decodeLLVMAttributesForBitcode(LLVMContext &C,
|
||||
Attribute Attribute::decodeLLVMAttributesForBitcode(LLVMContext &C,
|
||||
uint64_t EncodedAttrs) {
|
||||
// The alignment is stored as a 16-bit raw value from bits 31--16. We shift
|
||||
// the bits above 31 down by 11 bits.
|
||||
@ -146,69 +146,69 @@ Attributes Attributes::decodeLLVMAttributesForBitcode(LLVMContext &C,
|
||||
if (Alignment)
|
||||
B.addAlignmentAttr(Alignment);
|
||||
B.addRawValue((EncodedAttrs & (0xffffULL << 32)) >> 11);
|
||||
return Attributes::get(C, B);
|
||||
return Attribute::get(C, B);
|
||||
}
|
||||
|
||||
std::string Attributes::getAsString() const {
|
||||
std::string Attribute::getAsString() const {
|
||||
std::string Result;
|
||||
if (hasAttribute(Attributes::ZExt))
|
||||
if (hasAttribute(Attribute::ZExt))
|
||||
Result += "zeroext ";
|
||||
if (hasAttribute(Attributes::SExt))
|
||||
if (hasAttribute(Attribute::SExt))
|
||||
Result += "signext ";
|
||||
if (hasAttribute(Attributes::NoReturn))
|
||||
if (hasAttribute(Attribute::NoReturn))
|
||||
Result += "noreturn ";
|
||||
if (hasAttribute(Attributes::NoUnwind))
|
||||
if (hasAttribute(Attribute::NoUnwind))
|
||||
Result += "nounwind ";
|
||||
if (hasAttribute(Attributes::UWTable))
|
||||
if (hasAttribute(Attribute::UWTable))
|
||||
Result += "uwtable ";
|
||||
if (hasAttribute(Attributes::ReturnsTwice))
|
||||
if (hasAttribute(Attribute::ReturnsTwice))
|
||||
Result += "returns_twice ";
|
||||
if (hasAttribute(Attributes::InReg))
|
||||
if (hasAttribute(Attribute::InReg))
|
||||
Result += "inreg ";
|
||||
if (hasAttribute(Attributes::NoAlias))
|
||||
if (hasAttribute(Attribute::NoAlias))
|
||||
Result += "noalias ";
|
||||
if (hasAttribute(Attributes::NoCapture))
|
||||
if (hasAttribute(Attribute::NoCapture))
|
||||
Result += "nocapture ";
|
||||
if (hasAttribute(Attributes::StructRet))
|
||||
if (hasAttribute(Attribute::StructRet))
|
||||
Result += "sret ";
|
||||
if (hasAttribute(Attributes::ByVal))
|
||||
if (hasAttribute(Attribute::ByVal))
|
||||
Result += "byval ";
|
||||
if (hasAttribute(Attributes::Nest))
|
||||
if (hasAttribute(Attribute::Nest))
|
||||
Result += "nest ";
|
||||
if (hasAttribute(Attributes::ReadNone))
|
||||
if (hasAttribute(Attribute::ReadNone))
|
||||
Result += "readnone ";
|
||||
if (hasAttribute(Attributes::ReadOnly))
|
||||
if (hasAttribute(Attribute::ReadOnly))
|
||||
Result += "readonly ";
|
||||
if (hasAttribute(Attributes::OptimizeForSize))
|
||||
if (hasAttribute(Attribute::OptimizeForSize))
|
||||
Result += "optsize ";
|
||||
if (hasAttribute(Attributes::NoInline))
|
||||
if (hasAttribute(Attribute::NoInline))
|
||||
Result += "noinline ";
|
||||
if (hasAttribute(Attributes::InlineHint))
|
||||
if (hasAttribute(Attribute::InlineHint))
|
||||
Result += "inlinehint ";
|
||||
if (hasAttribute(Attributes::AlwaysInline))
|
||||
if (hasAttribute(Attribute::AlwaysInline))
|
||||
Result += "alwaysinline ";
|
||||
if (hasAttribute(Attributes::StackProtect))
|
||||
if (hasAttribute(Attribute::StackProtect))
|
||||
Result += "ssp ";
|
||||
if (hasAttribute(Attributes::StackProtectReq))
|
||||
if (hasAttribute(Attribute::StackProtectReq))
|
||||
Result += "sspreq ";
|
||||
if (hasAttribute(Attributes::NoRedZone))
|
||||
if (hasAttribute(Attribute::NoRedZone))
|
||||
Result += "noredzone ";
|
||||
if (hasAttribute(Attributes::NoImplicitFloat))
|
||||
if (hasAttribute(Attribute::NoImplicitFloat))
|
||||
Result += "noimplicitfloat ";
|
||||
if (hasAttribute(Attributes::Naked))
|
||||
if (hasAttribute(Attribute::Naked))
|
||||
Result += "naked ";
|
||||
if (hasAttribute(Attributes::NonLazyBind))
|
||||
if (hasAttribute(Attribute::NonLazyBind))
|
||||
Result += "nonlazybind ";
|
||||
if (hasAttribute(Attributes::AddressSafety))
|
||||
if (hasAttribute(Attribute::AddressSafety))
|
||||
Result += "address_safety ";
|
||||
if (hasAttribute(Attributes::MinSize))
|
||||
if (hasAttribute(Attribute::MinSize))
|
||||
Result += "minsize ";
|
||||
if (hasAttribute(Attributes::StackAlignment)) {
|
||||
if (hasAttribute(Attribute::StackAlignment)) {
|
||||
Result += "alignstack(";
|
||||
Result += utostr(getStackAlignment());
|
||||
Result += ") ";
|
||||
}
|
||||
if (hasAttribute(Attributes::Alignment)) {
|
||||
if (hasAttribute(Attribute::Alignment)) {
|
||||
Result += "align ";
|
||||
Result += utostr(getAlignment());
|
||||
Result += " ";
|
||||
@ -223,7 +223,7 @@ std::string Attributes::getAsString() const {
|
||||
// AttrBuilder Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
AttrBuilder &AttrBuilder::addAttribute(Attributes::AttrVal Val){
|
||||
AttrBuilder &AttrBuilder::addAttribute(Attribute::AttrVal Val){
|
||||
Bits |= AttributesImpl::getAttrMask(Val);
|
||||
return *this;
|
||||
}
|
||||
@ -249,47 +249,47 @@ AttrBuilder &AttrBuilder::addStackAlignmentAttr(unsigned Align){
|
||||
return *this;
|
||||
}
|
||||
|
||||
AttrBuilder &AttrBuilder::removeAttribute(Attributes::AttrVal Val) {
|
||||
AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrVal Val) {
|
||||
Bits &= ~AttributesImpl::getAttrMask(Val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
AttrBuilder &AttrBuilder::addAttributes(const Attributes &A) {
|
||||
AttrBuilder &AttrBuilder::addAttributes(const Attribute &A) {
|
||||
Bits |= A.Raw();
|
||||
return *this;
|
||||
}
|
||||
|
||||
AttrBuilder &AttrBuilder::removeAttributes(const Attributes &A){
|
||||
AttrBuilder &AttrBuilder::removeAttributes(const Attribute &A){
|
||||
Bits &= ~A.Raw();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool AttrBuilder::hasAttribute(Attributes::AttrVal A) const {
|
||||
bool AttrBuilder::hasAttribute(Attribute::AttrVal A) const {
|
||||
return Bits & AttributesImpl::getAttrMask(A);
|
||||
}
|
||||
|
||||
bool AttrBuilder::hasAttributes() const {
|
||||
return Bits != 0;
|
||||
}
|
||||
bool AttrBuilder::hasAttributes(const Attributes &A) const {
|
||||
bool AttrBuilder::hasAttributes(const Attribute &A) const {
|
||||
return Bits & A.Raw();
|
||||
}
|
||||
bool AttrBuilder::hasAlignmentAttr() const {
|
||||
return Bits & AttributesImpl::getAttrMask(Attributes::Alignment);
|
||||
return Bits & AttributesImpl::getAttrMask(Attribute::Alignment);
|
||||
}
|
||||
|
||||
uint64_t AttrBuilder::getAlignment() const {
|
||||
if (!hasAlignmentAttr())
|
||||
return 0;
|
||||
return 1ULL <<
|
||||
(((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1);
|
||||
(((Bits & AttributesImpl::getAttrMask(Attribute::Alignment)) >> 16) - 1);
|
||||
}
|
||||
|
||||
uint64_t AttrBuilder::getStackAlignment() const {
|
||||
if (!hasAlignmentAttr())
|
||||
return 0;
|
||||
return 1ULL <<
|
||||
(((Bits & AttributesImpl::getAttrMask(Attributes::StackAlignment))>>26)-1);
|
||||
(((Bits & AttributesImpl::getAttrMask(Attribute::StackAlignment))>>26)-1);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -298,35 +298,35 @@ uint64_t AttrBuilder::getStackAlignment() const {
|
||||
|
||||
uint64_t AttributesImpl::getAttrMask(uint64_t Val) {
|
||||
switch (Val) {
|
||||
case Attributes::None: return 0;
|
||||
case Attributes::ZExt: return 1 << 0;
|
||||
case Attributes::SExt: return 1 << 1;
|
||||
case Attributes::NoReturn: return 1 << 2;
|
||||
case Attributes::InReg: return 1 << 3;
|
||||
case Attributes::StructRet: return 1 << 4;
|
||||
case Attributes::NoUnwind: return 1 << 5;
|
||||
case Attributes::NoAlias: return 1 << 6;
|
||||
case Attributes::ByVal: return 1 << 7;
|
||||
case Attributes::Nest: return 1 << 8;
|
||||
case Attributes::ReadNone: return 1 << 9;
|
||||
case Attributes::ReadOnly: return 1 << 10;
|
||||
case Attributes::NoInline: return 1 << 11;
|
||||
case Attributes::AlwaysInline: return 1 << 12;
|
||||
case Attributes::OptimizeForSize: return 1 << 13;
|
||||
case Attributes::StackProtect: return 1 << 14;
|
||||
case Attributes::StackProtectReq: return 1 << 15;
|
||||
case Attributes::Alignment: return 31 << 16;
|
||||
case Attributes::NoCapture: return 1 << 21;
|
||||
case Attributes::NoRedZone: return 1 << 22;
|
||||
case Attributes::NoImplicitFloat: return 1 << 23;
|
||||
case Attributes::Naked: return 1 << 24;
|
||||
case Attributes::InlineHint: return 1 << 25;
|
||||
case Attributes::StackAlignment: return 7 << 26;
|
||||
case Attributes::ReturnsTwice: return 1 << 29;
|
||||
case Attributes::UWTable: return 1 << 30;
|
||||
case Attributes::NonLazyBind: return 1U << 31;
|
||||
case Attributes::AddressSafety: return 1ULL << 32;
|
||||
case Attributes::MinSize: return 1ULL << 33;
|
||||
case Attribute::None: return 0;
|
||||
case Attribute::ZExt: return 1 << 0;
|
||||
case Attribute::SExt: return 1 << 1;
|
||||
case Attribute::NoReturn: return 1 << 2;
|
||||
case Attribute::InReg: return 1 << 3;
|
||||
case Attribute::StructRet: return 1 << 4;
|
||||
case Attribute::NoUnwind: return 1 << 5;
|
||||
case Attribute::NoAlias: return 1 << 6;
|
||||
case Attribute::ByVal: return 1 << 7;
|
||||
case Attribute::Nest: return 1 << 8;
|
||||
case Attribute::ReadNone: return 1 << 9;
|
||||
case Attribute::ReadOnly: return 1 << 10;
|
||||
case Attribute::NoInline: return 1 << 11;
|
||||
case Attribute::AlwaysInline: return 1 << 12;
|
||||
case Attribute::OptimizeForSize: return 1 << 13;
|
||||
case Attribute::StackProtect: return 1 << 14;
|
||||
case Attribute::StackProtectReq: return 1 << 15;
|
||||
case Attribute::Alignment: return 31 << 16;
|
||||
case Attribute::NoCapture: return 1 << 21;
|
||||
case Attribute::NoRedZone: return 1 << 22;
|
||||
case Attribute::NoImplicitFloat: return 1 << 23;
|
||||
case Attribute::Naked: return 1 << 24;
|
||||
case Attribute::InlineHint: return 1 << 25;
|
||||
case Attribute::StackAlignment: return 7 << 26;
|
||||
case Attribute::ReturnsTwice: return 1 << 29;
|
||||
case Attribute::UWTable: return 1 << 30;
|
||||
case Attribute::NonLazyBind: return 1U << 31;
|
||||
case Attribute::AddressSafety: return 1ULL << 32;
|
||||
case Attribute::MinSize: return 1ULL << 33;
|
||||
}
|
||||
llvm_unreachable("Unsupported attribute type");
|
||||
}
|
||||
@ -339,16 +339,16 @@ bool AttributesImpl::hasAttributes() const {
|
||||
return Bits != 0;
|
||||
}
|
||||
|
||||
bool AttributesImpl::hasAttributes(const Attributes &A) const {
|
||||
bool AttributesImpl::hasAttributes(const Attribute &A) const {
|
||||
return Bits & A.Raw(); // FIXME: Raw() won't work here in the future.
|
||||
}
|
||||
|
||||
uint64_t AttributesImpl::getAlignment() const {
|
||||
return Bits & getAttrMask(Attributes::Alignment);
|
||||
return Bits & getAttrMask(Attribute::Alignment);
|
||||
}
|
||||
|
||||
uint64_t AttributesImpl::getStackAlignment() const {
|
||||
return Bits & getAttrMask(Attributes::StackAlignment);
|
||||
return Bits & getAttrMask(Attribute::StackAlignment);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -416,22 +416,22 @@ const AttributeWithIndex &AttributeSet::getSlot(unsigned Slot) const {
|
||||
}
|
||||
|
||||
/// getAttributes - The attributes for the specified index are returned.
|
||||
/// Attributes for the result are denoted with Idx = 0. Function notes are
|
||||
/// Attribute for the result are denoted with Idx = 0. Function notes are
|
||||
/// denoted with idx = ~0.
|
||||
Attributes AttributeSet::getAttributes(unsigned Idx) const {
|
||||
if (AttrList == 0) return Attributes();
|
||||
Attribute AttributeSet::getAttributes(unsigned Idx) const {
|
||||
if (AttrList == 0) return Attribute();
|
||||
|
||||
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
|
||||
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
|
||||
if (Attrs[i].Index == Idx)
|
||||
return Attrs[i].Attrs;
|
||||
|
||||
return Attributes();
|
||||
return Attribute();
|
||||
}
|
||||
|
||||
/// hasAttrSomewhere - Return true if the specified attribute is set for at
|
||||
/// least one parameter or for the return value.
|
||||
bool AttributeSet::hasAttrSomewhere(Attributes::AttrVal Attr) const {
|
||||
bool AttributeSet::hasAttrSomewhere(Attribute::AttrVal Attr) const {
|
||||
if (AttrList == 0) return false;
|
||||
|
||||
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
|
||||
@ -446,15 +446,15 @@ unsigned AttributeSet::getNumAttrs() const {
|
||||
return AttrList ? AttrList->Attrs.size() : 0;
|
||||
}
|
||||
|
||||
Attributes &AttributeSet::getAttributesAtIndex(unsigned i) const {
|
||||
Attribute &AttributeSet::getAttributesAtIndex(unsigned i) const {
|
||||
assert(AttrList && "Trying to get an attribute from an empty list!");
|
||||
assert(i < AttrList->Attrs.size() && "Index out of range!");
|
||||
return AttrList->Attrs[i].Attrs;
|
||||
}
|
||||
|
||||
AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
|
||||
Attributes Attrs) const {
|
||||
Attributes OldAttrs = getAttributes(Idx);
|
||||
Attribute Attrs) const {
|
||||
Attribute OldAttrs = getAttributes(Idx);
|
||||
#ifndef NDEBUG
|
||||
// FIXME it is not obvious how this should work for alignment.
|
||||
// For now, say we can't change a known alignment.
|
||||
@ -482,7 +482,7 @@ AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
|
||||
// If there are attributes already at this index, merge them in.
|
||||
if (i != e && OldAttrList[i].Index == Idx) {
|
||||
Attrs =
|
||||
Attributes::get(C, AttrBuilder(Attrs).
|
||||
Attribute::get(C, AttrBuilder(Attrs).
|
||||
addAttributes(OldAttrList[i].Attrs));
|
||||
++i;
|
||||
}
|
||||
@ -498,16 +498,16 @@ AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
|
||||
}
|
||||
|
||||
AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
|
||||
Attributes Attrs) const {
|
||||
Attribute Attrs) const {
|
||||
#ifndef NDEBUG
|
||||
// FIXME it is not obvious how this should work for alignment.
|
||||
// For now, say we can't pass in alignment, which no current use does.
|
||||
assert(!Attrs.hasAttribute(Attributes::Alignment) &&
|
||||
assert(!Attrs.hasAttribute(Attribute::Alignment) &&
|
||||
"Attempt to exclude alignment!");
|
||||
#endif
|
||||
if (AttrList == 0) return AttributeSet();
|
||||
|
||||
Attributes OldAttrs = getAttributes(Idx);
|
||||
Attribute OldAttrs = getAttributes(Idx);
|
||||
AttrBuilder NewAttrs =
|
||||
AttrBuilder(OldAttrs).removeAttributes(Attrs);
|
||||
if (NewAttrs == AttrBuilder(OldAttrs))
|
||||
@ -523,7 +523,7 @@ AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
|
||||
|
||||
// If there are attributes already at this index, merge them in.
|
||||
assert(OldAttrList[i].Index == Idx && "Attribute isn't set?");
|
||||
Attrs = Attributes::get(C, AttrBuilder(OldAttrList[i].Attrs).
|
||||
Attrs = Attribute::get(C, AttrBuilder(OldAttrList[i].Attrs).
|
||||
removeAttributes(Attrs));
|
||||
++i;
|
||||
if (Attrs.hasAttributes()) // If any attributes left for this param, add them.
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- AttributesImpl.h - Attributes Internals -----------------*- C++ -*-===//
|
||||
//===-- AttributesImpl.h - Attribute Internals -----------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -28,7 +28,7 @@ public:
|
||||
bool hasAttribute(uint64_t A) const;
|
||||
|
||||
bool hasAttributes() const;
|
||||
bool hasAttributes(const Attributes &A) const;
|
||||
bool hasAttributes(const Attribute &A) const;
|
||||
|
||||
uint64_t getAlignment() const;
|
||||
uint64_t getStackAlignment() const;
|
||||
|
@ -1384,7 +1384,7 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
|
||||
AttrBuilder B(PA);
|
||||
const AttributeSet PALnew =
|
||||
PAL.addAttr(Func->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(Func->getContext(), B));
|
||||
Attribute::get(Func->getContext(), B));
|
||||
Func->setAttributes(PALnew);
|
||||
}
|
||||
|
||||
@ -1394,14 +1394,14 @@ void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
|
||||
AttrBuilder B(PA);
|
||||
const AttributeSet PALnew =
|
||||
PAL.removeAttr(Func->getContext(), AttributeSet::FunctionIndex,
|
||||
Attributes::get(Func->getContext(), B));
|
||||
Attribute::get(Func->getContext(), B));
|
||||
Func->setAttributes(PALnew);
|
||||
}
|
||||
|
||||
LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn) {
|
||||
Function *Func = unwrap<Function>(Fn);
|
||||
const AttributeSet PAL = Func->getAttributes();
|
||||
Attributes attr = PAL.getFnAttributes();
|
||||
Attribute attr = PAL.getFnAttributes();
|
||||
return (LLVMAttribute)attr.Raw();
|
||||
}
|
||||
|
||||
@ -1466,18 +1466,18 @@ LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg) {
|
||||
void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA) {
|
||||
Argument *A = unwrap<Argument>(Arg);
|
||||
AttrBuilder B(PA);
|
||||
A->addAttr(Attributes::get(A->getContext(), B));
|
||||
A->addAttr(Attribute::get(A->getContext(), B));
|
||||
}
|
||||
|
||||
void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA) {
|
||||
Argument *A = unwrap<Argument>(Arg);
|
||||
AttrBuilder B(PA);
|
||||
A->removeAttr(Attributes::get(A->getContext(), B));
|
||||
A->removeAttr(Attribute::get(A->getContext(), B));
|
||||
}
|
||||
|
||||
LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) {
|
||||
Argument *A = unwrap<Argument>(Arg);
|
||||
Attributes attr = A->getParent()->getAttributes().getParamAttributes(
|
||||
Attribute attr = A->getParent()->getAttributes().getParamAttributes(
|
||||
A->getArgNo()+1);
|
||||
return (LLVMAttribute)attr.Raw();
|
||||
}
|
||||
@ -1486,7 +1486,7 @@ LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg) {
|
||||
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) {
|
||||
AttrBuilder B;
|
||||
B.addAlignmentAttr(align);
|
||||
unwrap<Argument>(Arg)->addAttr(Attributes::
|
||||
unwrap<Argument>(Arg)->addAttr(Attribute::
|
||||
get(unwrap<Argument>(Arg)->getContext(), B));
|
||||
}
|
||||
|
||||
@ -1679,7 +1679,7 @@ void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index,
|
||||
AttrBuilder B(PA);
|
||||
Call.setAttributes(
|
||||
Call.getAttributes().addAttr(Call->getContext(), index,
|
||||
Attributes::get(Call->getContext(), B)));
|
||||
Attribute::get(Call->getContext(), B)));
|
||||
}
|
||||
|
||||
void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
|
||||
@ -1688,7 +1688,7 @@ void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
|
||||
AttrBuilder B(PA);
|
||||
Call.setAttributes(
|
||||
Call.getAttributes().removeAttr(Call->getContext(), index,
|
||||
Attributes::get(Call->getContext(), B)));
|
||||
Attribute::get(Call->getContext(), B)));
|
||||
}
|
||||
|
||||
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
|
||||
@ -1697,7 +1697,7 @@ void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
|
||||
AttrBuilder B;
|
||||
B.addAlignmentAttr(align);
|
||||
Call.setAttributes(Call.getAttributes().addAttr(Call->getContext(), index,
|
||||
Attributes::get(Call->getContext(), B)));
|
||||
Attribute::get(Call->getContext(), B)));
|
||||
}
|
||||
|
||||
/*--.. Operations on call instructions (only) ..............................--*/
|
||||
|
@ -80,7 +80,7 @@ unsigned Argument::getArgNo() const {
|
||||
bool Argument::hasByValAttr() const {
|
||||
if (!getType()->isPointerTy()) return false;
|
||||
return getParent()->getParamAttributes(getArgNo()+1).
|
||||
hasAttribute(Attributes::ByVal);
|
||||
hasAttribute(Attribute::ByVal);
|
||||
}
|
||||
|
||||
unsigned Argument::getParamAlignment() const {
|
||||
@ -94,7 +94,7 @@ unsigned Argument::getParamAlignment() const {
|
||||
bool Argument::hasNestAttr() const {
|
||||
if (!getType()->isPointerTy()) return false;
|
||||
return getParent()->getParamAttributes(getArgNo()+1).
|
||||
hasAttribute(Attributes::Nest);
|
||||
hasAttribute(Attribute::Nest);
|
||||
}
|
||||
|
||||
/// hasNoAliasAttr - Return true if this argument has the noalias attribute on
|
||||
@ -102,7 +102,7 @@ bool Argument::hasNestAttr() const {
|
||||
bool Argument::hasNoAliasAttr() const {
|
||||
if (!getType()->isPointerTy()) return false;
|
||||
return getParent()->getParamAttributes(getArgNo()+1).
|
||||
hasAttribute(Attributes::NoAlias);
|
||||
hasAttribute(Attribute::NoAlias);
|
||||
}
|
||||
|
||||
/// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
|
||||
@ -110,7 +110,7 @@ bool Argument::hasNoAliasAttr() const {
|
||||
bool Argument::hasNoCaptureAttr() const {
|
||||
if (!getType()->isPointerTy()) return false;
|
||||
return getParent()->getParamAttributes(getArgNo()+1).
|
||||
hasAttribute(Attributes::NoCapture);
|
||||
hasAttribute(Attribute::NoCapture);
|
||||
}
|
||||
|
||||
/// hasSRetAttr - Return true if this argument has the sret attribute on
|
||||
@ -120,16 +120,16 @@ bool Argument::hasStructRetAttr() const {
|
||||
if (this != getParent()->arg_begin())
|
||||
return false; // StructRet param must be first param
|
||||
return getParent()->getParamAttributes(1).
|
||||
hasAttribute(Attributes::StructRet);
|
||||
hasAttribute(Attribute::StructRet);
|
||||
}
|
||||
|
||||
/// addAttr - Add a Attribute to an argument
|
||||
void Argument::addAttr(Attributes attr) {
|
||||
void Argument::addAttr(Attribute attr) {
|
||||
getParent()->addAttribute(getArgNo() + 1, attr);
|
||||
}
|
||||
|
||||
/// removeAttr - Remove a Attribute from an argument
|
||||
void Argument::removeAttr(Attributes attr) {
|
||||
void Argument::removeAttr(Attribute attr) {
|
||||
getParent()->removeAttribute(getArgNo() + 1, attr);
|
||||
}
|
||||
|
||||
@ -248,13 +248,13 @@ void Function::dropAllReferences() {
|
||||
BasicBlocks.begin()->eraseFromParent();
|
||||
}
|
||||
|
||||
void Function::addAttribute(unsigned i, Attributes attr) {
|
||||
void Function::addAttribute(unsigned i, Attribute attr) {
|
||||
AttributeSet PAL = getAttributes();
|
||||
PAL = PAL.addAttr(getContext(), i, attr);
|
||||
setAttributes(PAL);
|
||||
}
|
||||
|
||||
void Function::removeAttribute(unsigned i, Attributes attr) {
|
||||
void Function::removeAttribute(unsigned i, Attribute attr) {
|
||||
AttributeSet PAL = getAttributes();
|
||||
PAL = PAL.removeAttr(getContext(), i, attr);
|
||||
setAttributes(PAL);
|
||||
|
@ -331,19 +331,19 @@ CallInst::CallInst(const CallInst &CI)
|
||||
SubclassOptionalData = CI.SubclassOptionalData;
|
||||
}
|
||||
|
||||
void CallInst::addAttribute(unsigned i, Attributes attr) {
|
||||
void CallInst::addAttribute(unsigned i, Attribute attr) {
|
||||
AttributeSet PAL = getAttributes();
|
||||
PAL = PAL.addAttr(getContext(), i, attr);
|
||||
setAttributes(PAL);
|
||||
}
|
||||
|
||||
void CallInst::removeAttribute(unsigned i, Attributes attr) {
|
||||
void CallInst::removeAttribute(unsigned i, Attribute attr) {
|
||||
AttributeSet PAL = getAttributes();
|
||||
PAL = PAL.removeAttr(getContext(), i, attr);
|
||||
setAttributes(PAL);
|
||||
}
|
||||
|
||||
bool CallInst::hasFnAttr(Attributes::AttrVal A) const {
|
||||
bool CallInst::hasFnAttr(Attribute::AttrVal A) const {
|
||||
if (AttributeList.getParamAttributes(AttributeSet::FunctionIndex)
|
||||
.hasAttribute(A))
|
||||
return true;
|
||||
@ -352,7 +352,7 @@ bool CallInst::hasFnAttr(Attributes::AttrVal A) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CallInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const {
|
||||
bool CallInst::paramHasAttr(unsigned i, Attribute::AttrVal A) const {
|
||||
if (AttributeList.getParamAttributes(i).hasAttribute(A))
|
||||
return true;
|
||||
if (const Function *F = getCalledFunction())
|
||||
@ -572,7 +572,7 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
|
||||
return setSuccessor(idx, B);
|
||||
}
|
||||
|
||||
bool InvokeInst::hasFnAttr(Attributes::AttrVal A) const {
|
||||
bool InvokeInst::hasFnAttr(Attribute::AttrVal A) const {
|
||||
if (AttributeList.getParamAttributes(AttributeSet::FunctionIndex).
|
||||
hasAttribute(A))
|
||||
return true;
|
||||
@ -581,7 +581,7 @@ bool InvokeInst::hasFnAttr(Attributes::AttrVal A) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InvokeInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const {
|
||||
bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrVal A) const {
|
||||
if (AttributeList.getParamAttributes(i).hasAttribute(A))
|
||||
return true;
|
||||
if (const Function *F = getCalledFunction())
|
||||
@ -589,13 +589,13 @@ bool InvokeInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void InvokeInst::addAttribute(unsigned i, Attributes attr) {
|
||||
void InvokeInst::addAttribute(unsigned i, Attribute attr) {
|
||||
AttributeSet PAL = getAttributes();
|
||||
PAL = PAL.addAttr(getContext(), i, attr);
|
||||
setAttributes(PAL);
|
||||
}
|
||||
|
||||
void InvokeInst::removeAttribute(unsigned i, Attributes attr) {
|
||||
void InvokeInst::removeAttribute(unsigned i, Attribute attr) {
|
||||
AttributeSet PAL = getAttributes();
|
||||
PAL = PAL.removeAttr(getContext(), i, attr);
|
||||
setAttributes(PAL);
|
||||
|
@ -297,7 +297,7 @@ namespace {
|
||||
bool VerifyIntrinsicType(Type *Ty,
|
||||
ArrayRef<Intrinsic::IITDescriptor> &Infos,
|
||||
SmallVectorImpl<Type*> &ArgTys);
|
||||
void VerifyParameterAttrs(Attributes Attrs, Type *Ty,
|
||||
void VerifyParameterAttrs(Attribute Attrs, Type *Ty,
|
||||
bool isReturnValue, const Value *V);
|
||||
void VerifyFunctionAttrs(FunctionType *FT, const AttributeSet &Attrs,
|
||||
const Value *V);
|
||||
@ -524,7 +524,7 @@ void Verifier::visitMDNode(MDNode &MD, Function *F) {
|
||||
|
||||
// VerifyParameterAttrs - Check the given attributes for an argument or return
|
||||
// value of the specified type. The value V is printed in error messages.
|
||||
void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty,
|
||||
void Verifier::VerifyParameterAttrs(Attribute Attrs, Type *Ty,
|
||||
bool isReturnValue, const Value *V) {
|
||||
if (!Attrs.hasAttributes())
|
||||
return;
|
||||
@ -535,49 +535,49 @@ void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty,
|
||||
|
||||
if (isReturnValue)
|
||||
Assert1(!Attrs.hasParameterOnlyAttrs(),
|
||||
"Attributes 'byval', 'nest', 'sret', and 'nocapture' "
|
||||
"Attribute 'byval', 'nest', 'sret', and 'nocapture' "
|
||||
"do not apply to return values!", V);
|
||||
|
||||
// Check for mutually incompatible attributes.
|
||||
Assert1(!((Attrs.hasAttribute(Attributes::ByVal) &&
|
||||
Attrs.hasAttribute(Attributes::Nest)) ||
|
||||
(Attrs.hasAttribute(Attributes::ByVal) &&
|
||||
Attrs.hasAttribute(Attributes::StructRet)) ||
|
||||
(Attrs.hasAttribute(Attributes::Nest) &&
|
||||
Attrs.hasAttribute(Attributes::StructRet))), "Attributes "
|
||||
Assert1(!((Attrs.hasAttribute(Attribute::ByVal) &&
|
||||
Attrs.hasAttribute(Attribute::Nest)) ||
|
||||
(Attrs.hasAttribute(Attribute::ByVal) &&
|
||||
Attrs.hasAttribute(Attribute::StructRet)) ||
|
||||
(Attrs.hasAttribute(Attribute::Nest) &&
|
||||
Attrs.hasAttribute(Attribute::StructRet))), "Attributes "
|
||||
"'byval, nest, and sret' are incompatible!", V);
|
||||
|
||||
Assert1(!((Attrs.hasAttribute(Attributes::ByVal) &&
|
||||
Attrs.hasAttribute(Attributes::Nest)) ||
|
||||
(Attrs.hasAttribute(Attributes::ByVal) &&
|
||||
Attrs.hasAttribute(Attributes::InReg)) ||
|
||||
(Attrs.hasAttribute(Attributes::Nest) &&
|
||||
Attrs.hasAttribute(Attributes::InReg))), "Attributes "
|
||||
Assert1(!((Attrs.hasAttribute(Attribute::ByVal) &&
|
||||
Attrs.hasAttribute(Attribute::Nest)) ||
|
||||
(Attrs.hasAttribute(Attribute::ByVal) &&
|
||||
Attrs.hasAttribute(Attribute::InReg)) ||
|
||||
(Attrs.hasAttribute(Attribute::Nest) &&
|
||||
Attrs.hasAttribute(Attribute::InReg))), "Attributes "
|
||||
"'byval, nest, and inreg' are incompatible!", V);
|
||||
|
||||
Assert1(!(Attrs.hasAttribute(Attributes::ZExt) &&
|
||||
Attrs.hasAttribute(Attributes::SExt)), "Attributes "
|
||||
Assert1(!(Attrs.hasAttribute(Attribute::ZExt) &&
|
||||
Attrs.hasAttribute(Attribute::SExt)), "Attributes "
|
||||
"'zeroext and signext' are incompatible!", V);
|
||||
|
||||
Assert1(!(Attrs.hasAttribute(Attributes::ReadNone) &&
|
||||
Attrs.hasAttribute(Attributes::ReadOnly)), "Attributes "
|
||||
Assert1(!(Attrs.hasAttribute(Attribute::ReadNone) &&
|
||||
Attrs.hasAttribute(Attribute::ReadOnly)), "Attributes "
|
||||
"'readnone and readonly' are incompatible!", V);
|
||||
|
||||
Assert1(!(Attrs.hasAttribute(Attributes::NoInline) &&
|
||||
Attrs.hasAttribute(Attributes::AlwaysInline)), "Attributes "
|
||||
Assert1(!(Attrs.hasAttribute(Attribute::NoInline) &&
|
||||
Attrs.hasAttribute(Attribute::AlwaysInline)), "Attributes "
|
||||
"'noinline and alwaysinline' are incompatible!", V);
|
||||
|
||||
Assert1(!AttrBuilder(Attrs).
|
||||
hasAttributes(Attributes::typeIncompatible(Ty)),
|
||||
hasAttributes(Attribute::typeIncompatible(Ty)),
|
||||
"Wrong types for attribute: " +
|
||||
Attributes::typeIncompatible(Ty).getAsString(), V);
|
||||
Attribute::typeIncompatible(Ty).getAsString(), V);
|
||||
|
||||
if (PointerType *PTy = dyn_cast<PointerType>(Ty))
|
||||
Assert1(!Attrs.hasAttribute(Attributes::ByVal) ||
|
||||
Assert1(!Attrs.hasAttribute(Attribute::ByVal) ||
|
||||
PTy->getElementType()->isSized(),
|
||||
"Attribute 'byval' does not support unsized types!", V);
|
||||
else
|
||||
Assert1(!Attrs.hasAttribute(Attributes::ByVal),
|
||||
Assert1(!Attrs.hasAttribute(Attribute::ByVal),
|
||||
"Attribute 'byval' only applies to parameters with pointer type!",
|
||||
V);
|
||||
}
|
||||
@ -605,49 +605,49 @@ void Verifier::VerifyFunctionAttrs(FunctionType *FT,
|
||||
|
||||
VerifyParameterAttrs(Attr.Attrs, Ty, Attr.Index == 0, V);
|
||||
|
||||
if (Attr.Attrs.hasAttribute(Attributes::Nest)) {
|
||||
if (Attr.Attrs.hasAttribute(Attribute::Nest)) {
|
||||
Assert1(!SawNest, "More than one parameter has attribute nest!", V);
|
||||
SawNest = true;
|
||||
}
|
||||
|
||||
if (Attr.Attrs.hasAttribute(Attributes::StructRet))
|
||||
Assert1(Attr.Index == 1, "Attribute sret not on first parameter!", V);
|
||||
if (Attr.Attrs.hasAttribute(Attribute::StructRet))
|
||||
Assert1(Attr.Index == 1, "Attribute sret is not on first parameter!", V);
|
||||
}
|
||||
|
||||
Attributes FAttrs = Attrs.getFnAttributes();
|
||||
Attribute FAttrs = Attrs.getFnAttributes();
|
||||
AttrBuilder NotFn(FAttrs);
|
||||
NotFn.removeFunctionOnlyAttrs();
|
||||
Assert1(!NotFn.hasAttributes(), "Attributes '" +
|
||||
Attributes::get(V->getContext(), NotFn).getAsString() +
|
||||
Assert1(!NotFn.hasAttributes(), "Attribute '" +
|
||||
Attribute::get(V->getContext(), NotFn).getAsString() +
|
||||
"' do not apply to the function!", V);
|
||||
|
||||
// Check for mutually incompatible attributes.
|
||||
Assert1(!((FAttrs.hasAttribute(Attributes::ByVal) &&
|
||||
FAttrs.hasAttribute(Attributes::Nest)) ||
|
||||
(FAttrs.hasAttribute(Attributes::ByVal) &&
|
||||
FAttrs.hasAttribute(Attributes::StructRet)) ||
|
||||
(FAttrs.hasAttribute(Attributes::Nest) &&
|
||||
FAttrs.hasAttribute(Attributes::StructRet))), "Attributes "
|
||||
Assert1(!((FAttrs.hasAttribute(Attribute::ByVal) &&
|
||||
FAttrs.hasAttribute(Attribute::Nest)) ||
|
||||
(FAttrs.hasAttribute(Attribute::ByVal) &&
|
||||
FAttrs.hasAttribute(Attribute::StructRet)) ||
|
||||
(FAttrs.hasAttribute(Attribute::Nest) &&
|
||||
FAttrs.hasAttribute(Attribute::StructRet))), "Attributes "
|
||||
"'byval, nest, and sret' are incompatible!", V);
|
||||
|
||||
Assert1(!((FAttrs.hasAttribute(Attributes::ByVal) &&
|
||||
FAttrs.hasAttribute(Attributes::Nest)) ||
|
||||
(FAttrs.hasAttribute(Attributes::ByVal) &&
|
||||
FAttrs.hasAttribute(Attributes::InReg)) ||
|
||||
(FAttrs.hasAttribute(Attributes::Nest) &&
|
||||
FAttrs.hasAttribute(Attributes::InReg))), "Attributes "
|
||||
Assert1(!((FAttrs.hasAttribute(Attribute::ByVal) &&
|
||||
FAttrs.hasAttribute(Attribute::Nest)) ||
|
||||
(FAttrs.hasAttribute(Attribute::ByVal) &&
|
||||
FAttrs.hasAttribute(Attribute::InReg)) ||
|
||||
(FAttrs.hasAttribute(Attribute::Nest) &&
|
||||
FAttrs.hasAttribute(Attribute::InReg))), "Attributes "
|
||||
"'byval, nest, and inreg' are incompatible!", V);
|
||||
|
||||
Assert1(!(FAttrs.hasAttribute(Attributes::ZExt) &&
|
||||
FAttrs.hasAttribute(Attributes::SExt)), "Attributes "
|
||||
Assert1(!(FAttrs.hasAttribute(Attribute::ZExt) &&
|
||||
FAttrs.hasAttribute(Attribute::SExt)), "Attributes "
|
||||
"'zeroext and signext' are incompatible!", V);
|
||||
|
||||
Assert1(!(FAttrs.hasAttribute(Attributes::ReadNone) &&
|
||||
FAttrs.hasAttribute(Attributes::ReadOnly)), "Attributes "
|
||||
Assert1(!(FAttrs.hasAttribute(Attribute::ReadNone) &&
|
||||
FAttrs.hasAttribute(Attribute::ReadOnly)), "Attributes "
|
||||
"'readnone and readonly' are incompatible!", V);
|
||||
|
||||
Assert1(!(FAttrs.hasAttribute(Attributes::NoInline) &&
|
||||
FAttrs.hasAttribute(Attributes::AlwaysInline)), "Attributes "
|
||||
Assert1(!(FAttrs.hasAttribute(Attribute::NoInline) &&
|
||||
FAttrs.hasAttribute(Attribute::AlwaysInline)), "Attributes "
|
||||
"'noinline and alwaysinline' are incompatible!", V);
|
||||
}
|
||||
|
||||
@ -690,7 +690,7 @@ void Verifier::visitFunction(Function &F) {
|
||||
const AttributeSet &Attrs = F.getAttributes();
|
||||
|
||||
Assert1(VerifyAttributeCount(Attrs, FT->getNumParams()),
|
||||
"Attributes after last parameter!", &F);
|
||||
"Attribute after last parameter!", &F);
|
||||
|
||||
// Check function attributes.
|
||||
VerifyFunctionAttrs(FT, Attrs, &F);
|
||||
@ -1203,7 +1203,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
|
||||
const AttributeSet &Attrs = CS.getAttributes();
|
||||
|
||||
Assert1(VerifyAttributeCount(Attrs, CS.arg_size()),
|
||||
"Attributes after last parameter!", I);
|
||||
"Attribute after last parameter!", I);
|
||||
|
||||
// Verify call attributes.
|
||||
VerifyFunctionAttrs(FTy, Attrs, I);
|
||||
@ -1211,7 +1211,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
|
||||
if (FTy->isVarArg())
|
||||
// Check attributes on the varargs part.
|
||||
for (unsigned Idx = 1 + FTy->getNumParams(); Idx <= CS.arg_size(); ++Idx) {
|
||||
Attributes Attr = Attrs.getParamAttributes(Idx);
|
||||
Attribute Attr = Attrs.getParamAttributes(Idx);
|
||||
|
||||
VerifyParameterAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I);
|
||||
|
||||
|
@ -548,7 +548,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
|
||||
OS << " AttributeWithIndex AWI[" << maxArgAttrs+1 << "];\n";
|
||||
OS << " unsigned NumAttrs = 0;\n";
|
||||
OS << " if (id != 0) {\n";
|
||||
OS << " SmallVector<Attributes::AttrVal, 8> AttrVec;\n";
|
||||
OS << " SmallVector<Attribute::AttrVal, 8> AttrVec;\n";
|
||||
OS << " switch(IntrinsicsToAttributesMap[id - ";
|
||||
if (TargetOnly)
|
||||
OS << "Intrinsic::num_intrinsics";
|
||||
@ -576,7 +576,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
|
||||
do {
|
||||
switch (intrinsic.ArgumentAttributes[ai].second) {
|
||||
case CodeGenIntrinsic::NoCapture:
|
||||
OS << " AttrVec.push_back(Attributes::NoCapture);\n";
|
||||
OS << " AttrVec.push_back(Attribute::NoCapture);\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -594,17 +594,17 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
|
||||
OS << " AttrVec.clear();\n";
|
||||
|
||||
if (!intrinsic.canThrow)
|
||||
OS << " AttrVec.push_back(Attributes::NoUnwind);\n";
|
||||
OS << " AttrVec.push_back(Attribute::NoUnwind);\n";
|
||||
if (intrinsic.isNoReturn)
|
||||
OS << " AttrVec.push_back(Attributes::NoReturn);\n";
|
||||
OS << " AttrVec.push_back(Attribute::NoReturn);\n";
|
||||
|
||||
switch (modRef) {
|
||||
case MRK_none: break;
|
||||
case MRK_readonly:
|
||||
OS << " AttrVec.push_back(Attributes::ReadOnly);\n";
|
||||
OS << " AttrVec.push_back(Attribute::ReadOnly);\n";
|
||||
break;
|
||||
case MRK_readnone:
|
||||
OS << " AttrVec.push_back(Attributes::ReadNone);\n";
|
||||
OS << " AttrVec.push_back(Attribute::ReadNone);\n";
|
||||
break;
|
||||
}
|
||||
OS << " AWI[" << numAttrs++ << "] = AttributeWithIndex::get(C, "
|
||||
|
Loading…
x
Reference in New Issue
Block a user