diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Attributes.h | 6 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Attributes.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Verifier.cpp | 2 | 
5 files changed, 15 insertions, 14 deletions
diff --git a/llvm/include/llvm/Attributes.h b/llvm/include/llvm/Attributes.h index 9dc2c1aa579..493af92a566 100644 --- a/llvm/include/llvm/Attributes.h +++ b/llvm/include/llvm/Attributes.h @@ -276,6 +276,9 @@ public:    Attributes operator ~ () const { return Attributes(~Bits); }    uint64_t Raw() const { return Bits; } +  /// @brief Which attributes cannot be applied to a type. +  static Attributes typeIncompatible(Type *Ty); +    /// The set of Attributes set in Attributes is converted to a string of    /// equivalent mnemonics. This is, presumably, for writing out the mnemonics    /// for the assembly writer. @@ -321,9 +324,6 @@ const AttrConst MutuallyIncompatible[5] = {    {NoInline_i | AlwaysInline_i}  }; -/// @brief Which attributes cannot be applied to a type. -Attributes typeIncompatible(Type *Ty); -  /// 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 diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index fd23a935b90..c7429c59546 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -717,9 +717,9 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {    // here. Currently, this should not be possible, but special handling might be    // required when new return value attributes are added.    if (NRetTy->isVoidTy()) -    RAttrs &= ~Attribute::typeIncompatible(NRetTy); +    RAttrs &= ~Attributes::typeIncompatible(NRetTy);    else -    assert((RAttrs & Attribute::typeIncompatible(NRetTy)) == 0 +    assert((RAttrs & Attributes::typeIncompatible(NRetTy)) == 0             && "Return attributes no longer compatible?");    if (RAttrs) @@ -786,7 +786,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {      Attributes RAttrs = CallPAL.getRetAttributes();      Attributes FnAttrs = CallPAL.getFnAttributes();      // Adjust in case the function was changed to return void. -    RAttrs &= ~Attribute::typeIncompatible(NF->getReturnType()); +    RAttrs &= ~Attributes::typeIncompatible(NF->getReturnType());      if (RAttrs)        AttributesVec.push_back(AttributeWithIndex::get(0, RAttrs)); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 486dd1312a4..cf8375649f4 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1037,7 +1037,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {      if (!CallerPAL.isEmpty() && !Caller->use_empty()) {        Attributes RAttrs = CallerPAL.getRetAttributes(); -      if (RAttrs & Attribute::typeIncompatible(NewRetTy)) +      if (RAttrs & Attributes::typeIncompatible(NewRetTy))          return false;   // Attribute not compatible with transformed value.      } @@ -1067,7 +1067,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {        return false;   // Cannot transform this parameter value.      Attributes Attrs = CallerPAL.getParamAttributes(i + 1); -    if (Attrs & Attribute::typeIncompatible(ParamTy)) +    if (Attrs & Attributes::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 @@ -1141,7 +1141,7 @@ 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 &= ~Attribute::typeIncompatible(NewRetTy); +  RAttrs &= ~Attributes::typeIncompatible(NewRetTy);    // Add the new return attributes.    if (RAttrs) diff --git a/llvm/lib/VMCore/Attributes.cpp b/llvm/lib/VMCore/Attributes.cpp index af8163fd40e..453190bbaf8 100644 --- a/llvm/lib/VMCore/Attributes.cpp +++ b/llvm/lib/VMCore/Attributes.cpp @@ -94,16 +94,17 @@ std::string Attributes::getAsString() const {    return Result;  } -Attributes Attribute::typeIncompatible(Type *Ty) { -  Attributes Incompatible = None; +Attributes Attributes::typeIncompatible(Type *Ty) { +  Attributes Incompatible = Attribute::None;    if (!Ty->isIntegerTy())      // Attributes that only apply to integers. -    Incompatible |= SExt | ZExt; +    Incompatible |= Attribute::SExt | Attribute::ZExt;    if (!Ty->isPointerTy())      // Attributes that only apply to pointers. -    Incompatible |= ByVal | Nest | NoAlias | StructRet | NoCapture; +    Incompatible |= Attribute::ByVal | Attribute::Nest | Attribute::NoAlias | +      Attribute::StructRet | Attribute::NoCapture;    return Incompatible;  } diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 647a52fbdd2..292456ab63c 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -546,7 +546,7 @@ void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty,              MutI.getAsString() + " are incompatible!", V);    } -  Attributes TypeI = Attrs & Attribute::typeIncompatible(Ty); +  Attributes TypeI = Attrs & Attributes::typeIncompatible(Ty);    Assert1(!TypeI, "Wrong type for attribute " +            TypeI.getAsString(), V);  | 

