| 1 | //===--- DXILAttributes.cpp - attribute helper function -------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "DXILAttributes.h" |
| 10 | #include "llvm/IR/AttributeMask.h" |
| 11 | |
| 12 | using namespace llvm; |
| 13 | using namespace llvm::dxil; |
| 14 | |
| 15 | namespace llvm { |
| 16 | namespace dxil { |
| 17 | const AttributeMask &getNonDXILAttributeMask() { |
| 18 | static const AttributeMask Result = [] { |
| 19 | AttributeMask DXILAttributeMask; |
| 20 | for (Attribute::AttrKind Kind : {Attribute::Alignment, |
| 21 | Attribute::AlwaysInline, |
| 22 | Attribute::Builtin, |
| 23 | Attribute::ByVal, |
| 24 | Attribute::InAlloca, |
| 25 | Attribute::Cold, |
| 26 | Attribute::Convergent, |
| 27 | Attribute::InlineHint, |
| 28 | Attribute::InReg, |
| 29 | Attribute::JumpTable, |
| 30 | Attribute::MinSize, |
| 31 | Attribute::Naked, |
| 32 | Attribute::Nest, |
| 33 | Attribute::NoAlias, |
| 34 | Attribute::NoBuiltin, |
| 35 | Attribute::NoDuplicate, |
| 36 | Attribute::NoImplicitFloat, |
| 37 | Attribute::NoInline, |
| 38 | Attribute::NonLazyBind, |
| 39 | Attribute::NonNull, |
| 40 | Attribute::Dereferenceable, |
| 41 | Attribute::DereferenceableOrNull, |
| 42 | Attribute::Memory, |
| 43 | Attribute::NoRedZone, |
| 44 | Attribute::NoReturn, |
| 45 | Attribute::NoUnwind, |
| 46 | Attribute::OptimizeForSize, |
| 47 | Attribute::OptimizeNone, |
| 48 | Attribute::ReadNone, |
| 49 | Attribute::ReadOnly, |
| 50 | Attribute::Returned, |
| 51 | Attribute::ReturnsTwice, |
| 52 | Attribute::SExt, |
| 53 | Attribute::StackAlignment, |
| 54 | Attribute::StackProtect, |
| 55 | Attribute::StackProtectReq, |
| 56 | Attribute::StackProtectStrong, |
| 57 | Attribute::SafeStack, |
| 58 | Attribute::StructRet, |
| 59 | Attribute::SanitizeAddress, |
| 60 | Attribute::SanitizeThread, |
| 61 | Attribute::SanitizeMemory, |
| 62 | Attribute::UWTable, |
| 63 | Attribute::ZExt}) |
| 64 | DXILAttributeMask.addAttribute(Val: Kind); |
| 65 | AttributeMask Result; |
| 66 | for (Attribute::AttrKind Kind = Attribute::None; |
| 67 | Kind != Attribute::EndAttrKinds; |
| 68 | Kind = Attribute::AttrKind(Kind + 1)) { |
| 69 | if (!DXILAttributeMask.contains(A: Kind)) |
| 70 | Result.addAttribute(Val: Kind); |
| 71 | } |
| 72 | return Result; |
| 73 | }(); |
| 74 | return Result; |
| 75 | } |
| 76 | } // namespace dxil |
| 77 | } // namespace llvm |
| 78 | |