diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-01-18 21:11:39 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-01-18 21:11:39 +0000 |
commit | 775438952693c261bf1b5a85143dea4f5852dcdf (patch) | |
tree | fa8e7f5c9677bc1375634402ce35a98c2c98160f /llvm/lib/IR/Verifier.cpp | |
parent | 8bee90d5f33f49d4ebcb89aac780916fe3bfc65d (diff) | |
download | bcm5719-llvm-775438952693c261bf1b5a85143dea4f5852dcdf.tar.gz bcm5719-llvm-775438952693c261bf1b5a85143dea4f5852dcdf.zip |
Push some more methods down to hide the use of the Attribute class.
Because the Attribute class is going to stop representing a collection of
attributes, limit the use of it as an aggregate in favor of using AttributeSet.
This replaces some of the uses for querying the function attributes.
llvm-svn: 172844
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 78 |
1 files changed, 49 insertions, 29 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 49821f24f23..07176fe7707 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -739,41 +739,61 @@ void Verifier::VerifyFunctionAttrs(FunctionType *FT, Assert1(Attr.Index == 1, "Attribute sret is not on first parameter!", V); } - Attribute FAttrs = Attrs.getFnAttributes(); - AttrBuilder NotFn(FAttrs); + if (!Attrs.hasAttributes(AttributeSet::FunctionIndex)) + return; + + AttrBuilder NotFn(Attrs, AttributeSet::FunctionIndex); NotFn.removeFunctionOnlyAttrs(); 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(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(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(Attribute::ZExt) && - FAttrs.hasAttribute(Attribute::SExt)), "Attributes " - "'zeroext and signext' are incompatible!", V); - - Assert1(!(FAttrs.hasAttribute(Attribute::ReadNone) && - FAttrs.hasAttribute(Attribute::ReadOnly)), "Attributes " - "'readnone and readonly' are incompatible!", V); - - Assert1(!(FAttrs.hasAttribute(Attribute::NoInline) && - FAttrs.hasAttribute(Attribute::AlwaysInline)), "Attributes " - "'noinline and alwaysinline' are incompatible!", V); + Assert1(!((Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::ByVal) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::Nest)) || + (Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::ByVal) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::StructRet)) || + (Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::Nest) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::StructRet))), + "Attributes 'byval, nest, and sret' are incompatible!", V); + + Assert1(!((Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::ByVal) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::Nest)) || + (Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::ByVal) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::InReg)) || + (Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::Nest) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::InReg))), + "Attributes 'byval, nest, and inreg' are incompatible!", V); + + Assert1(!(Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::ZExt) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::SExt)), + "Attributes 'zeroext and signext' are incompatible!", V); + + Assert1(!(Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::ReadNone) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::ReadOnly)), + "Attributes 'readnone and readonly' are incompatible!", V); + + Assert1(!(Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::NoInline) && + Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::AlwaysInline)), + "Attributes 'noinline and alwaysinline' are incompatible!", V); } static bool VerifyAttributeCount(const AttributeSet &Attrs, unsigned Params) { |