LLVM 23.0.0git
DXILAttributes.cpp
Go to the documentation of this file.
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"
11
12using namespace llvm;
13using namespace llvm::dxil;
14
15namespace llvm {
16namespace dxil {
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(Kind);
65 AttributeMask Result;
68 Kind = Attribute::AttrKind(Kind + 1)) {
69 if (!DXILAttributeMask.contains(Kind))
70 Result.addAttribute(Kind);
71 }
72 return Result;
73 }();
74 return Result;
75}
76} // namespace dxil
77} // namespace llvm
This class stores enough information to efficiently remove some attributes from an existing AttrBuild...
AttributeMask & addAttribute(Attribute::AttrKind Val)
Add an attribute to the mask.
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition Attributes.h:124
@ None
No attributes have been set.
Definition Attributes.h:126
@ EndAttrKinds
Sentinel value useful for loops.
Definition Attributes.h:129
const AttributeMask & getNonDXILAttributeMask()
This is an optimization pass for GlobalISel generic memory operations.