diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-06-27 00:25:01 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-06-27 00:25:01 +0000 |
commit | 2253a2f52f3c46ae75cd05f5885acb987bd1d6b6 (patch) | |
tree | 483f06fa8a9b2981c441c49dde73b45eb724c03d /lib/IR/Verifier.cpp | |
parent | 9367c79e62307421f28ba92174f3792a6360f37b (diff) | |
download | external_llvm-2253a2f52f3c46ae75cd05f5885acb987bd1d6b6.zip external_llvm-2253a2f52f3c46ae75cd05f5885acb987bd1d6b6.tar.gz external_llvm-2253a2f52f3c46ae75cd05f5885acb987bd1d6b6.tar.bz2 |
Added support for the Builtin attribute.
The Builtin attribute is an attribute that can be placed on function call site that signal that even though a function is declared as being a builtin,
rdar://problem/13727199
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/Verifier.cpp')
-rw-r--r-- | lib/IR/Verifier.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 1b1b3b8..7123eaf 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -692,6 +692,7 @@ void Verifier::VerifyAttributeTypes(AttributeSet Attrs, unsigned Idx, I->getKindAsEnum() == Attribute::SanitizeMemory || I->getKindAsEnum() == Attribute::MinSize || I->getKindAsEnum() == Attribute::NoDuplicate || + I->getKindAsEnum() == Attribute::Builtin || I->getKindAsEnum() == Attribute::NoBuiltin || I->getKindAsEnum() == Attribute::Cold) { if (!isFunction) @@ -877,6 +878,13 @@ void Verifier::visitFunction(Function &F) { // Check function attributes. VerifyFunctionAttrs(FT, Attrs, &F); + // On function declarations/definitions, we do not support the builtin + // attribute. We do not check this in VerifyFunctionAttrs since that is + // checking for Attributes that can/can not ever be on functions. + Assert1(!Attrs.hasAttribute(AttributeSet::FunctionIndex, + Attribute::Builtin), + "Attribute 'builtin' can only be applied to a callsite.", &F); + // Check that this function meets the restrictions on this calling convention. switch (F.getCallingConv()) { default: @@ -1435,6 +1443,14 @@ void Verifier::VerifyCallSite(CallSite CS) { "Function has metadata parameter but isn't an intrinsic", I); } + // If the call site has the 'builtin' attribute, verify that it's applied to a + // direct call to a function with the 'nobuiltin' attribute. + if (CS.hasFnAttr(Attribute::Builtin)) + Assert1(CS.getCalledFunction() && + CS.getCalledFunction()->hasFnAttribute(Attribute::NoBuiltin), + "Attribute 'builtin' can only be used in a call to a function with " + "the 'nobuiltin' attribute.", I); + visitInstruction(*I); } |