|
22 | 22 | #include "llvm/ADT/StringRef.h" |
23 | 23 | #include "llvm/Config/llvm-config.h" |
24 | 24 | #include "llvm/Support/Alignment.h" |
| 25 | +#include "llvm/Support/CodeGen.h" |
25 | 26 | #include "llvm/Support/PointerLikeTypeTraits.h" |
26 | 27 | #include <bitset> |
27 | 28 | #include <cassert> |
@@ -130,6 +131,7 @@ class Attribute { |
130 | 131 | static Attribute getWithByRefType(LLVMContext &Context, Type *Ty); |
131 | 132 | static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty); |
132 | 133 | static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty); |
| 134 | + static Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind); |
133 | 135 |
|
134 | 136 | /// For a typed attribute, return the equivalent attribute with the type |
135 | 137 | /// changed to \p ReplacementTy. |
@@ -223,6 +225,9 @@ class Attribute { |
223 | 225 | /// unknown. |
224 | 226 | Optional<unsigned> getVScaleRangeMax() const; |
225 | 227 |
|
| 228 | + // Returns the unwind table kind. |
| 229 | + UWTableKind getUWTableKind() const; |
| 230 | + |
226 | 231 | /// The Attribute is converted to a string of equivalent mnemonic. This |
227 | 232 | /// is, presumably, for writing out the mnemonics for the assembly writer. |
228 | 233 | std::string getAsString(bool InAttrGrp = false) const; |
@@ -353,6 +358,7 @@ class AttributeSet { |
353 | 358 | std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const; |
354 | 359 | unsigned getVScaleRangeMin() const; |
355 | 360 | Optional<unsigned> getVScaleRangeMax() const; |
| 361 | + UWTableKind getUWTableKind() const; |
356 | 362 | std::string getAsString(bool InAttrGrp = false) const; |
357 | 363 |
|
358 | 364 | /// Return true if this attribute set belongs to the LLVMContext. |
@@ -841,6 +847,9 @@ class AttributeList { |
841 | 847 | /// arg. |
842 | 848 | uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const; |
843 | 849 |
|
| 850 | + /// Get the unwind table kind requested for the function. |
| 851 | + UWTableKind getUWTableKind() const; |
| 852 | + |
844 | 853 | /// Return the attributes at the index as a string. |
845 | 854 | std::string getAsString(unsigned Index, bool InAttrGrp = false) const; |
846 | 855 |
|
@@ -1190,6 +1199,10 @@ class AttrBuilder { |
1190 | 1199 | /// Attribute.getIntValue(). |
1191 | 1200 | AttrBuilder &addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr); |
1192 | 1201 |
|
| 1202 | + /// This turns the unwind table kind into the form used internally in |
| 1203 | + /// Attribute. |
| 1204 | + AttrBuilder &addUWTableAttr(UWTableKind Kind); |
| 1205 | + |
1193 | 1206 | ArrayRef<Attribute> attrs() const { return Attrs; } |
1194 | 1207 |
|
1195 | 1208 | bool operator==(const AttrBuilder &B) const; |
|
0 commit comments