| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
#ifndef LLVM_IR_ATTRIBUTES_H |
| 16 |
#define LLVM_IR_ATTRIBUTES_H |
| 17 |
|
| 18 |
#include "llvm-c/Types.h" |
| 19 |
#include "llvm/ADT/ArrayRef.h" |
| 20 |
#include "llvm/ADT/Optional.h" |
| 21 |
#include "llvm/ADT/SmallString.h" |
| 22 |
#include "llvm/ADT/StringRef.h" |
| 23 |
#include "llvm/Config/llvm-config.h" |
| 24 |
#include "llvm/Support/Alignment.h" |
| 25 |
#include "llvm/Support/PointerLikeTypeTraits.h" |
| 26 |
#include <bitset> |
| 27 |
#include <cassert> |
| 28 |
#include <cstdint> |
| 29 |
#include <set> |
| 30 |
#include <string> |
| 31 |
#include <utility> |
| 32 |
|
| 33 |
namespace llvm { |
| 34 |
|
| 35 |
class AttrBuilder; |
| 36 |
class AttributeMask; |
| 37 |
class AttributeImpl; |
| 38 |
class AttributeListImpl; |
| 39 |
class AttributeSetNode; |
| 40 |
class FoldingSetNodeID; |
| 41 |
class Function; |
| 42 |
class LLVMContext; |
| 43 |
class Type; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
class Attribute { |
| 52 |
public: |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
enum AttrKind { |
| 71 |
|
| 72 |
None, |
| 73 |
#define GET_ATTR_ENUM |
| 74 |
#include "llvm/IR/Attributes.inc" |
| 75 |
EndAttrKinds, |
| 76 |
EmptyKey, |
| 77 |
TombstoneKey, |
| 78 |
}; |
| 79 |
|
| 80 |
static const unsigned NumIntAttrKinds = LastIntAttr - FirstIntAttr + 1; |
| 81 |
static const unsigned NumTypeAttrKinds = LastTypeAttr - FirstTypeAttr + 1; |
| 82 |
|
| 83 |
static bool isEnumAttrKind(AttrKind Kind) { |
| 84 |
return Kind >= FirstEnumAttr && Kind <= LastEnumAttr; |
| 85 |
} |
| 86 |
static bool isIntAttrKind(AttrKind Kind) { |
| 87 |
return Kind >= FirstIntAttr && Kind <= LastIntAttr; |
| 88 |
} |
| 89 |
static bool isTypeAttrKind(AttrKind Kind) { |
| 90 |
return Kind >= FirstTypeAttr && Kind <= LastTypeAttr; |
| 91 |
} |
| 92 |
|
| 93 |
static bool canUseAsFnAttr(AttrKind Kind); |
| 94 |
static bool canUseAsParamAttr(AttrKind Kind); |
| 95 |
static bool canUseAsRetAttr(AttrKind Kind); |
| 96 |
|
| 97 |
private: |
| 98 |
AttributeImpl *pImpl = nullptr; |
| 99 |
|
| 100 |
Attribute(AttributeImpl *A) : pImpl(A) {} |
| 101 |
|
| 102 |
public: |
| 103 |
Attribute() = default; |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0); |
| 111 |
static Attribute get(LLVMContext &Context, StringRef Kind, |
| 112 |
StringRef Val = StringRef()); |
| 113 |
static Attribute get(LLVMContext &Context, AttrKind Kind, Type *Ty); |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment); |
| 118 |
static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment); |
| 119 |
static Attribute getWithDereferenceableBytes(LLVMContext &Context, |
| 120 |
uint64_t Bytes); |
| 121 |
static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, |
| 122 |
uint64_t Bytes); |
| 123 |
static Attribute getWithAllocSizeArgs(LLVMContext &Context, |
| 124 |
unsigned ElemSizeArg, |
| 125 |
const Optional<unsigned> &NumElemsArg); |
| 126 |
static Attribute getWithVScaleRangeArgs(LLVMContext &Context, |
| 127 |
unsigned MinValue, unsigned MaxValue); |
| 128 |
static Attribute getWithByValType(LLVMContext &Context, Type *Ty); |
| 129 |
static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty); |
| 130 |
static Attribute getWithByRefType(LLVMContext &Context, Type *Ty); |
| 131 |
static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty); |
| 132 |
static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty); |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
Attribute getWithNewType(LLVMContext &Context, Type *ReplacementTy) { |
| 137 |
assert(isTypeAttribute() && "this requires a typed attribute"); |
| 138 |
return get(Context, getKindAsEnum(), ReplacementTy); |
| 139 |
} |
| 140 |
|
| 141 |
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName); |
| 142 |
|
| 143 |
static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind); |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
static bool isExistingAttribute(StringRef Name); |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
bool isEnumAttribute() const; |
| 155 |
|
| 156 |
|
| 157 |
bool isIntAttribute() const; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
bool isStringAttribute() const; |
| 162 |
|
| 163 |
|
| 164 |
bool isTypeAttribute() const; |
| 165 |
|
| 166 |
|
| 167 |
bool isValid() const { return pImpl; } |
| 168 |
|
| 169 |
|
| 170 |
bool hasAttribute(AttrKind Val) const; |
| 171 |
|
| 172 |
|
| 173 |
bool hasAttribute(StringRef Val) const; |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
Attribute::AttrKind getKindAsEnum() const; |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
uint64_t getValueAsInt() const; |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
bool getValueAsBool() const; |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
StringRef getKindAsString() const; |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
StringRef getValueAsString() const; |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
Type *getValueAsType() const; |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
MaybeAlign getAlignment() const; |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
MaybeAlign getStackAlignment() const; |
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
uint64_t getDereferenceableBytes() const; |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
uint64_t getDereferenceableOrNullBytes() const; |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const; |
| 218 |
|
| 219 |
|
| 220 |
unsigned getVScaleRangeMin() const; |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
Optional<unsigned> getVScaleRangeMax() const; |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
std::string getAsString(bool InAttrGrp = false) const; |
| 229 |
|
| 230 |
|
| 231 |
bool hasParentContext(LLVMContext &C) const; |
| 232 |
|
| 233 |
|
| 234 |
bool operator==(Attribute A) const { return pImpl == A.pImpl; } |
| 235 |
bool operator!=(Attribute A) const { return pImpl != A.pImpl; } |
| 236 |
|
| 237 |
|
| 238 |
bool operator<(Attribute A) const; |
| 239 |
|
| 240 |
void Profile(FoldingSetNodeID &ID) const; |
| 241 |
|
| 242 |
|
| 243 |
void *getRawPointer() const { |
| 244 |
return pImpl; |
| 245 |
} |
| 246 |
|
| 247 |
|
| 248 |
static Attribute fromRawPointer(void *RawPtr) { |
| 249 |
return Attribute(reinterpret_cast<AttributeImpl*>(RawPtr)); |
| 250 |
} |
| 251 |
}; |
| 252 |
|
| 253 |
|
| 254 |
inline LLVMAttributeRef wrap(Attribute Attr) { |
| 255 |
return reinterpret_cast<LLVMAttributeRef>(Attr.getRawPointer()); |
| 256 |
} |
| 257 |
|
| 258 |
|
| 259 |
inline Attribute unwrap(LLVMAttributeRef Attr) { |
| 260 |
return Attribute::fromRawPointer(Attr); |
| 261 |
} |
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
class AttributeSet { |
| 270 |
friend AttributeListImpl; |
| 271 |
template <typename Ty, typename Enable> friend struct DenseMapInfo; |
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
AttributeSetNode *SetNode = nullptr; |
| 279 |
|
| 280 |
private: |
| 281 |
explicit AttributeSet(AttributeSetNode *ASN) : SetNode(ASN) {} |
| 282 |
|
| 283 |
public: |
| 284 |
|
| 285 |
AttributeSet() = default; |
| 286 |
AttributeSet(const AttributeSet &) = default; |
| 287 |
~AttributeSet() = default; |
| 288 |
|
| 289 |
static AttributeSet get(LLVMContext &C, const AttrBuilder &B); |
| 290 |
static AttributeSet get(LLVMContext &C, ArrayRef<Attribute> Attrs); |
| 291 |
|
| 292 |
bool operator==(const AttributeSet &O) const { return SetNode == O.SetNode; } |
| 293 |
bool operator!=(const AttributeSet &O) const { return !(*this == O); } |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
LLVM_NODISCARD AttributeSet addAttribute(LLVMContext &C, |
| 298 |
Attribute::AttrKind Kind) const; |
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
LLVM_NODISCARD AttributeSet addAttribute(LLVMContext &C, StringRef Kind, |
| 303 |
StringRef Value = StringRef()) const; |
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
LLVM_NODISCARD AttributeSet addAttributes(LLVMContext &C, |
| 308 |
AttributeSet AS) const; |
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
LLVM_NODISCARD AttributeSet removeAttribute(LLVMContext &C, |
| 313 |
Attribute::AttrKind Kind) const; |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
LLVM_NODISCARD AttributeSet removeAttribute(LLVMContext &C, |
| 318 |
StringRef Kind) const; |
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
LLVM_NODISCARD AttributeSet |
| 323 |
removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const; |
| 324 |
|
| 325 |
|
| 326 |
unsigned getNumAttributes() const; |
| 327 |
|
| 328 |
|
| 329 |
bool hasAttributes() const { return SetNode != nullptr; } |
| 330 |
|
| 331 |
|
| 332 |
bool hasAttribute(Attribute::AttrKind Kind) const; |
| 333 |
|
| 334 |
|
| 335 |
bool hasAttribute(StringRef Kind) const; |
| 336 |
|
| 337 |
|
| 338 |
Attribute getAttribute(Attribute::AttrKind Kind) const; |
| 339 |
|
| 340 |
|
| 341 |
Attribute getAttribute(StringRef Kind) const; |
| 342 |
|
| 343 |
MaybeAlign getAlignment() const; |
| 344 |
MaybeAlign getStackAlignment() const; |
| 345 |
uint64_t getDereferenceableBytes() const; |
| 346 |
uint64_t getDereferenceableOrNullBytes() const; |
| 347 |
Type *getByValType() const; |
| 348 |
Type *getStructRetType() const; |
| 349 |
Type *getByRefType() const; |
| 350 |
Type *getPreallocatedType() const; |
| 351 |
Type *getInAllocaType() const; |
| 352 |
Type *getElementType() const; |
| 353 |
std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const; |
| 354 |
unsigned getVScaleRangeMin() const; |
| 355 |
Optional<unsigned> getVScaleRangeMax() const; |
| 356 |
std::string getAsString(bool InAttrGrp = false) const; |
| 357 |
|
| 358 |
|
| 359 |
bool hasParentContext(LLVMContext &C) const; |
| 360 |
|
| 361 |
using iterator = const Attribute *; |
| 362 |
|
| 363 |
iterator begin() const; |
| 364 |
iterator end() const; |
| 365 |
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) |
| 366 |
void dump() const; |
| 367 |
#endif |
| 368 |
}; |
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
template <> struct DenseMapInfo<AttributeSet, void> { |
| 374 |
static AttributeSet getEmptyKey() { |
| 375 |
auto Val = static_cast<uintptr_t>(-1); |
| 376 |
Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable; |
| 377 |
return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val)); |
| 378 |
} |
| 379 |
|
| 380 |
static AttributeSet getTombstoneKey() { |
| 381 |
auto Val = static_cast<uintptr_t>(-2); |
| 382 |
Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable; |
| 383 |
return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val)); |
| 384 |
} |
| 385 |
|
| 386 |
static unsigned getHashValue(AttributeSet AS) { |
| 387 |
return (unsigned((uintptr_t)AS.SetNode) >> 4) ^ |
| 388 |
(unsigned((uintptr_t)AS.SetNode) >> 9); |
| 389 |
} |
| 390 |
|
| 391 |
static bool isEqual(AttributeSet LHS, AttributeSet RHS) { return LHS == RHS; } |
| 392 |
}; |
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
class AttributeList { |
| 403 |
public: |
| 404 |
enum AttrIndex : unsigned { |
| 405 |
ReturnIndex = 0U, |
| 406 |
FunctionIndex = ~0U, |
| 407 |
FirstArgIndex = 1, |
| 408 |
}; |
| 409 |
|
| 410 |
private: |
| 411 |
friend class AttrBuilder; |
| 412 |
friend class AttributeListImpl; |
| 413 |
friend class AttributeSet; |
| 414 |
friend class AttributeSetNode; |
| 415 |
template <typename Ty, typename Enable> friend struct DenseMapInfo; |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
AttributeListImpl *pImpl = nullptr; |
| 420 |
|
| 421 |
public: |
| 422 |
|
| 423 |
static AttributeList get(LLVMContext &C, |
| 424 |
ArrayRef<std::pair<unsigned, Attribute>> Attrs); |
| 425 |
static AttributeList get(LLVMContext &C, |
| 426 |
ArrayRef<std::pair<unsigned, AttributeSet>> Attrs); |
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
static AttributeList get(LLVMContext &C, AttributeSet FnAttrs, |
| 431 |
AttributeSet RetAttrs, |
| 432 |
ArrayRef<AttributeSet> ArgAttrs); |
| 433 |
|
| 434 |
private: |
| 435 |
explicit AttributeList(AttributeListImpl *LI) : pImpl(LI) {} |
| 436 |
|
| 437 |
static AttributeList getImpl(LLVMContext &C, ArrayRef<AttributeSet> AttrSets); |
| 438 |
|
| 439 |
AttributeList setAttributesAtIndex(LLVMContext &C, unsigned Index, |
| 440 |
AttributeSet Attrs) const; |
| 441 |
|
| 442 |
public: |
| 443 |
AttributeList() = default; |
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
static AttributeList get(LLVMContext &C, ArrayRef<AttributeList> Attrs); |
| 451 |
static AttributeList get(LLVMContext &C, unsigned Index, |
| 452 |
ArrayRef<Attribute::AttrKind> Kinds); |
| 453 |
static AttributeList get(LLVMContext &C, unsigned Index, |
| 454 |
ArrayRef<Attribute::AttrKind> Kinds, |
| 455 |
ArrayRef<uint64_t> Values); |
| 456 |
static AttributeList get(LLVMContext &C, unsigned Index, |
| 457 |
ArrayRef<StringRef> Kind); |
| 458 |
static AttributeList get(LLVMContext &C, unsigned Index, |
| 459 |
AttributeSet Attrs); |
| 460 |
static AttributeList get(LLVMContext &C, unsigned Index, |
| 461 |
const AttrBuilder &B); |
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
LLVM_NODISCARD AttributeList addAttributeAtIndex( |
| 467 |
LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const; |
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
LLVM_NODISCARD AttributeList |
| 472 |
addAttributeAtIndex(LLVMContext &C, unsigned Index, StringRef Kind, |
| 473 |
StringRef Value = StringRef()) const; |
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
LLVM_NODISCARD AttributeList addAttributeAtIndex(LLVMContext &C, |
| 478 |
unsigned Index, |
| 479 |
Attribute A) const; |
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
LLVM_NODISCARD AttributeList addAttributesAtIndex(LLVMContext &C, |
| 484 |
unsigned Index, |
| 485 |
const AttrBuilder &B) const; |
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
LLVM_NODISCARD AttributeList addFnAttribute(LLVMContext &C, |
| 490 |
Attribute::AttrKind Kind) const { |
| 491 |
return addAttributeAtIndex(C, FunctionIndex, Kind); |
| 492 |
} |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
LLVM_NODISCARD AttributeList addFnAttribute(LLVMContext &C, |
| 497 |
Attribute Attr) const { |
| 498 |
return addAttributeAtIndex(C, FunctionIndex, Attr); |
| 499 |
} |
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
LLVM_NODISCARD AttributeList addFnAttribute( |
| 504 |
LLVMContext &C, StringRef Kind, StringRef Value = StringRef()) const { |
| 505 |
return addAttributeAtIndex(C, FunctionIndex, Kind, Value); |
| 506 |
} |
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
LLVM_NODISCARD AttributeList addFnAttributes(LLVMContext &C, |
| 511 |
const AttrBuilder &B) const { |
| 512 |
return addAttributesAtIndex(C, FunctionIndex, B); |
| 513 |
} |
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
LLVM_NODISCARD AttributeList addRetAttribute(LLVMContext &C, |
| 518 |
Attribute::AttrKind Kind) const { |
| 519 |
return addAttributeAtIndex(C, ReturnIndex, Kind); |
| 520 |
} |
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
LLVM_NODISCARD AttributeList addRetAttribute(LLVMContext &C, |
| 525 |
Attribute Attr) const { |
| 526 |
return addAttributeAtIndex(C, ReturnIndex, Attr); |
| 527 |
} |
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
LLVM_NODISCARD AttributeList addRetAttributes(LLVMContext &C, |
| 532 |
const AttrBuilder &B) const { |
| 533 |
return addAttributesAtIndex(C, ReturnIndex, B); |
| 534 |
} |
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
LLVM_NODISCARD AttributeList addParamAttribute( |
| 539 |
LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const { |
| 540 |
return addAttributeAtIndex(C, ArgNo + FirstArgIndex, Kind); |
| 541 |
} |
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
LLVM_NODISCARD AttributeList |
| 546 |
addParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind, |
| 547 |
StringRef Value = StringRef()) const { |
| 548 |
return addAttributeAtIndex(C, ArgNo + FirstArgIndex, Kind, Value); |
| 549 |
} |
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
LLVM_NODISCARD AttributeList addParamAttribute(LLVMContext &C, |
| 554 |
ArrayRef<unsigned> ArgNos, |
| 555 |
Attribute A) const; |
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
LLVM_NODISCARD AttributeList addParamAttributes(LLVMContext &C, |
| 560 |
unsigned ArgNo, |
| 561 |
const AttrBuilder &B) const { |
| 562 |
return addAttributesAtIndex(C, ArgNo + FirstArgIndex, B); |
| 563 |
} |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
LLVM_NODISCARD AttributeList removeAttributeAtIndex( |
| 568 |
LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const; |
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
LLVM_NODISCARD AttributeList removeAttributeAtIndex(LLVMContext &C, |
| 573 |
unsigned Index, |
| 574 |
StringRef Kind) const; |
| 575 |
LLVM_NODISCARD AttributeList removeAttribute(LLVMContext &C, unsigned Index, |
| 576 |
StringRef Kind) const { |
| 577 |
return removeAttributeAtIndex(C, Index, Kind); |
| 578 |
} |
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
LLVM_NODISCARD AttributeList removeAttributesAtIndex( |
| 583 |
LLVMContext &C, unsigned Index, const AttributeMask &AttrsToRemove) const; |
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
LLVM_NODISCARD AttributeList removeAttributesAtIndex(LLVMContext &C, |
| 588 |
unsigned Index) const; |
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
LLVM_NODISCARD AttributeList |
| 593 |
removeFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const { |
| 594 |
return removeAttributeAtIndex(C, FunctionIndex, Kind); |
| 595 |
} |
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
LLVM_NODISCARD AttributeList removeFnAttribute(LLVMContext &C, |
| 600 |
StringRef Kind) const { |
| 601 |
return removeAttributeAtIndex(C, FunctionIndex, Kind); |
| 602 |
} |
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
LLVM_NODISCARD AttributeList |
| 607 |
removeFnAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const { |
| 608 |
return removeAttributesAtIndex(C, FunctionIndex, AttrsToRemove); |
| 609 |
} |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
LLVM_NODISCARD AttributeList removeFnAttributes(LLVMContext &C) const { |
| 614 |
return removeAttributesAtIndex(C, FunctionIndex); |
| 615 |
} |
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
LLVM_NODISCARD AttributeList |
| 620 |
removeRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const { |
| 621 |
return removeAttributeAtIndex(C, ReturnIndex, Kind); |
| 622 |
} |
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
LLVM_NODISCARD AttributeList removeRetAttribute(LLVMContext &C, |
| 627 |
StringRef Kind) const { |
| 628 |
return removeAttributeAtIndex(C, ReturnIndex, Kind); |
| 629 |
} |
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
LLVM_NODISCARD AttributeList removeRetAttributes( |
| 634 |
LLVMContext &C, const AttributeMask &AttrsToRemove) const { |
| 635 |
return removeAttributesAtIndex(C, ReturnIndex, AttrsToRemove); |
| 636 |
} |
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
LLVM_NODISCARD AttributeList removeParamAttribute( |
| 641 |
LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const { |
| 642 |
return removeAttributeAtIndex(C, ArgNo + FirstArgIndex, Kind); |
| 643 |
} |
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
LLVM_NODISCARD AttributeList removeParamAttribute(LLVMContext &C, |
| 648 |
unsigned ArgNo, |
| 649 |
StringRef Kind) const { |
| 650 |
return removeAttributeAtIndex(C, ArgNo + FirstArgIndex, Kind); |
| 651 |
} |
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
LLVM_NODISCARD AttributeList |
| 656 |
removeParamAttributes(LLVMContext &C, unsigned ArgNo, |
| 657 |
const AttributeMask &AttrsToRemove) const { |
| 658 |
return removeAttributesAtIndex(C, ArgNo + FirstArgIndex, AttrsToRemove); |
| 659 |
} |
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
LLVM_NODISCARD AttributeList removeParamAttributes(LLVMContext &C, |
| 664 |
unsigned ArgNo) const { |
| 665 |
return removeAttributesAtIndex(C, ArgNo + FirstArgIndex); |
| 666 |
} |
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
LLVM_NODISCARD AttributeList replaceAttributeTypeAtIndex( |
| 671 |
LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind, |
| 672 |
Type *ReplacementTy) const { |
| 673 |
Attribute Attr = getAttributeAtIndex(ArgNo, Kind); |
| 674 |
auto Attrs = removeAttributeAtIndex(C, ArgNo, Kind); |
| 675 |
return Attrs.addAttributeAtIndex(C, ArgNo, |
| 676 |
Attr.getWithNewType(C, ReplacementTy)); |
| 677 |
} |
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
LLVM_NODISCARD AttributeList addDereferenceableRetAttr(LLVMContext &C, |
| 682 |
uint64_t Bytes) const; |
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
LLVM_NODISCARD AttributeList addDereferenceableParamAttr( |
| 687 |
LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const; |
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
LLVM_NODISCARD AttributeList addDereferenceableOrNullParamAttr( |
| 693 |
LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const; |
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
LLVM_NODISCARD AttributeList |
| 698 |
addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg, |
| 699 |
const Optional<unsigned> &NumElemsArg); |
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
AttributeSet getAttributes(unsigned Index) const; |
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
AttributeSet getParamAttrs(unsigned ArgNo) const; |
| 711 |
|
| 712 |
|
| 713 |
AttributeSet getRetAttrs() const; |
| 714 |
|
| 715 |
|
| 716 |
AttributeSet getFnAttrs() const; |
| 717 |
|
| 718 |
|
| 719 |
bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const; |
| 720 |
|
| 721 |
|
| 722 |
bool hasAttributeAtIndex(unsigned Index, StringRef Kind) const; |
| 723 |
|
| 724 |
|
| 725 |
bool hasAttributesAtIndex(unsigned Index) const; |
| 726 |
|
| 727 |
|
| 728 |
bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const { |
| 729 |
return hasAttributeAtIndex(ArgNo + FirstArgIndex, Kind); |
| 730 |
} |
| 731 |
|
| 732 |
|
| 733 |
bool hasParamAttr(unsigned ArgNo, StringRef Kind) const { |
| 734 |
return hasAttributeAtIndex(ArgNo + FirstArgIndex, Kind); |
| 735 |
} |
| 736 |
|
| 737 |
|
| 738 |
bool hasParamAttrs(unsigned ArgNo) const { |
| 739 |
return hasAttributesAtIndex(ArgNo + FirstArgIndex); |
| 740 |
} |
| 741 |
|
| 742 |
|
| 743 |
bool hasRetAttr(Attribute::AttrKind Kind) const { |
| 744 |
return hasAttributeAtIndex(ReturnIndex, Kind); |
| 745 |
} |
| 746 |
|
| 747 |
|
| 748 |
bool hasRetAttr(StringRef Kind) const { |
| 749 |
return hasAttributeAtIndex(ReturnIndex, Kind); |
| 750 |
} |
| 751 |
|
| 752 |
|
| 753 |
bool hasRetAttrs() const { return hasAttributesAtIndex(ReturnIndex); } |
| 754 |
|
| 755 |
|
| 756 |
bool hasFnAttr(Attribute::AttrKind Kind) const; |
| 757 |
|
| 758 |
|
| 759 |
bool hasFnAttr(StringRef Kind) const; |
| 760 |
|
| 761 |
|
| 762 |
bool hasFnAttrs() const { return hasAttributesAtIndex(FunctionIndex); } |
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
bool hasAttrSomewhere(Attribute::AttrKind Kind, |
| 768 |
unsigned *Index = nullptr) const; |
| 769 |
|
| 770 |
|
| 771 |
Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const; |
| 772 |
|
| 773 |
|
| 774 |
Attribute getAttributeAtIndex(unsigned Index, StringRef Kind) const; |
| 775 |
|
| 776 |
|
| 777 |
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const { |
| 778 |
return getAttributeAtIndex(ArgNo + FirstArgIndex, Kind); |
| 779 |
} |
| 780 |
|
| 781 |
|
| 782 |
Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const { |
| 783 |
return getAttributeAtIndex(ArgNo + FirstArgIndex, Kind); |
| 784 |
} |
| 785 |
|
| 786 |
|
| 787 |
Attribute getFnAttr(Attribute::AttrKind Kind) const { |
| 788 |
return getAttributeAtIndex(FunctionIndex, Kind); |
| 789 |
} |
| 790 |
|
| 791 |
|
| 792 |
Attribute getFnAttr(StringRef Kind) const { |
| 793 |
return getAttributeAtIndex(FunctionIndex, Kind); |
| 794 |
} |
| 795 |
|
| 796 |
|
| 797 |
MaybeAlign getRetAlignment() const; |
| 798 |
|
| 799 |
|
| 800 |
MaybeAlign getParamAlignment(unsigned ArgNo) const; |
| 801 |
|
| 802 |
|
| 803 |
MaybeAlign getParamStackAlignment(unsigned ArgNo) const; |
| 804 |
|
| 805 |
|
| 806 |
Type *getParamByValType(unsigned ArgNo) const; |
| 807 |
|
| 808 |
|
| 809 |
Type *getParamStructRetType(unsigned ArgNo) const; |
| 810 |
|
| 811 |
|
| 812 |
Type *getParamByRefType(unsigned ArgNo) const; |
| 813 |
|
| 814 |
|
| 815 |
Type *getParamPreallocatedType(unsigned ArgNo) const; |
| 816 |
|
| 817 |
|
| 818 |
Type *getParamInAllocaType(unsigned ArgNo) const; |
| 819 |
|
| 820 |
|
| 821 |
Type *getParamElementType(unsigned ArgNo) const; |
| 822 |
|
| 823 |
|
| 824 |
MaybeAlign getFnStackAlignment() const; |
| 825 |
|
| 826 |
|
| 827 |
MaybeAlign getRetStackAlignment() const; |
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
uint64_t getRetDereferenceableBytes() const; |
| 832 |
|
| 833 |
|
| 834 |
uint64_t getParamDereferenceableBytes(unsigned Index) const; |
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
uint64_t getRetDereferenceableOrNullBytes() const; |
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const; |
| 843 |
|
| 844 |
|
| 845 |
std::string getAsString(unsigned Index, bool InAttrGrp = false) const; |
| 846 |
|
| 847 |
|
| 848 |
bool hasParentContext(LLVMContext &C) const; |
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
|
| 854 |
using iterator = const AttributeSet *; |
| 855 |
|
| 856 |
iterator begin() const; |
| 857 |
iterator end() const; |
| 858 |
|
| 859 |
unsigned getNumAttrSets() const; |
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
struct index_iterator { |
| 865 |
unsigned NumAttrSets; |
| 866 |
index_iterator(int NumAttrSets) : NumAttrSets(NumAttrSets) {} |
| 867 |
struct int_wrapper { |
| 868 |
int_wrapper(unsigned i) : i(i) {} |
| 869 |
unsigned i; |
| 870 |
unsigned operator*() { return i; } |
| 871 |
bool operator!=(const int_wrapper &Other) { return i != Other.i; } |
| 872 |
int_wrapper &operator++() { |
| 873 |
|
| 874 |
|
| 875 |
++i; |
| 876 |
return *this; |
| 877 |
} |
| 878 |
}; |
| 879 |
|
| 880 |
int_wrapper begin() { return int_wrapper(AttributeList::FunctionIndex); } |
| 881 |
|
| 882 |
int_wrapper end() { return int_wrapper(NumAttrSets - 1); } |
| 883 |
}; |
| 884 |
|
| 885 |
|
| 886 |
index_iterator indexes() const { return index_iterator(getNumAttrSets()); } |
| 887 |
|
| 888 |
|
| 889 |
bool operator==(const AttributeList &RHS) const { return pImpl == RHS.pImpl; } |
| 890 |
bool operator!=(const AttributeList &RHS) const { return pImpl != RHS.pImpl; } |
| 891 |
|
| 892 |
|
| 893 |
void *getRawPointer() const { |
| 894 |
return pImpl; |
| 895 |
} |
| 896 |
|
| 897 |
|
| 898 |
bool isEmpty() const { return pImpl == nullptr; } |
| 899 |
|
| 900 |
void print(raw_ostream &O) const; |
| 901 |
|
| 902 |
void dump() const; |
| 903 |
}; |
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
template <> struct DenseMapInfo<AttributeList, void> { |
| 909 |
static AttributeList getEmptyKey() { |
| 910 |
auto Val = static_cast<uintptr_t>(-1); |
| 911 |
Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable; |
| 912 |
return AttributeList(reinterpret_cast<AttributeListImpl *>(Val)); |
| 913 |
} |
| 914 |
|
| 915 |
static AttributeList getTombstoneKey() { |
| 916 |
auto Val = static_cast<uintptr_t>(-2); |
| 917 |
Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable; |
| 918 |
return AttributeList(reinterpret_cast<AttributeListImpl *>(Val)); |
| 919 |
} |
| 920 |
|
| 921 |
static unsigned getHashValue(AttributeList AS) { |
| 922 |
return (unsigned((uintptr_t)AS.pImpl) >> 4) ^ |
| 923 |
(unsigned((uintptr_t)AS.pImpl) >> 9); |
| 924 |
} |
| 925 |
|
| 926 |
static bool isEqual(AttributeList LHS, AttributeList RHS) { |
| 927 |
return LHS == RHS; |
| 928 |
} |
| 929 |
}; |
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
|
| 934 |
|
| 935 |
class AttributeMask { |
| 936 |
std::bitset<Attribute::EndAttrKinds> Attrs; |
| 937 |
std::set<SmallString<32>, std::less<>> TargetDepAttrs; |
| 938 |
|
| 939 |
public: |
| 940 |
AttributeMask() = default; |
| 941 |
AttributeMask(const AttributeMask &) = delete; |
| 942 |
AttributeMask(AttributeMask &&) = default; |
| 943 |
|
| 944 |
AttributeMask(AttributeSet AS) { |
| 945 |
for (Attribute A : AS) |
| 946 |
addAttribute(A); |
| 947 |
} |
| 948 |
|
| 949 |
|
| 950 |
AttributeMask &addAttribute(Attribute::AttrKind Val) { |
| 951 |
assert((unsigned)Val < Attribute::EndAttrKinds && |
| 952 |
"Attribute out of range!"); |
| 953 |
Attrs[Val] = true; |
| 954 |
return *this; |
| 955 |
} |
| 956 |
|
| 957 |
|
| 958 |
AttributeMask &addAttribute(Attribute A) { |
| 959 |
if (A.isStringAttribute()) |
| 960 |
addAttribute(A.getKindAsString()); |
| 961 |
else |
| 962 |
addAttribute(A.getKindAsEnum()); |
| 963 |
return *this; |
| 964 |
} |
| 965 |
|
| 966 |
|
| 967 |
AttributeMask &addAttribute(StringRef A) { |
| 968 |
TargetDepAttrs.insert(A); |
| 969 |
return *this; |
| 970 |
} |
| 971 |
|
| 972 |
|
| 973 |
bool contains(Attribute::AttrKind A) const { |
| 974 |
assert((unsigned)A < Attribute::EndAttrKinds && "Attribute out of range!"); |
| 975 |
return Attrs[A]; |
| 976 |
} |
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
bool contains(StringRef A) const { return TargetDepAttrs.count(A); } |
| 981 |
|
| 982 |
|
| 983 |
bool contains(Attribute A) const { |
| 984 |
if (A.isStringAttribute()) |
| 985 |
return contains(A.getKindAsString()); |
| 986 |
return contains(A.getKindAsEnum()); |
| 987 |
} |
| 988 |
}; |
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
class AttrBuilder { |
| 997 |
LLVMContext &Ctx; |
| 998 |
SmallVector<Attribute, 8> Attrs; |
| 999 |
|
| 1000 |
public: |
| 1001 |
AttrBuilder(LLVMContext &Ctx) : Ctx(Ctx) {} |
| 1002 |
AttrBuilder(const AttrBuilder &) = delete; |
| 1003 |
AttrBuilder(AttrBuilder &&) = default; |
| 1004 |
|
| 1005 |
AttrBuilder(LLVMContext &Ctx, const Attribute &A) : Ctx(Ctx) { |
| 1006 |
addAttribute(A); |
| 1007 |
} |
| 1008 |
|
| 1009 |
AttrBuilder(LLVMContext &Ctx, AttributeSet AS); |
| 1010 |
|
| 1011 |
void clear(); |
| 1012 |
|
| 1013 |
|
| 1014 |
AttrBuilder &addAttribute(Attribute::AttrKind Val); |
| 1015 |
|
| 1016 |
|
| 1017 |
AttrBuilder &addAttribute(Attribute A); |
| 1018 |
|
| 1019 |
|
| 1020 |
AttrBuilder &addAttribute(StringRef A, StringRef V = StringRef()); |
| 1021 |
|
| 1022 |
|
| 1023 |
AttrBuilder &removeAttribute(Attribute::AttrKind Val); |
| 1024 |
|
| 1025 |
|
| 1026 |
AttrBuilder &removeAttribute(StringRef A); |
| 1027 |
|
| 1028 |
|
| 1029 |
AttrBuilder &removeAttribute(Attribute A) { |
| 1030 |
if (A.isStringAttribute()) |
| 1031 |
return removeAttribute(A.getKindAsString()); |
| 1032 |
else |
| 1033 |
return removeAttribute(A.getKindAsEnum()); |
| 1034 |
} |
| 1035 |
|
| 1036 |
|
| 1037 |
|
| 1038 |
AttrBuilder &merge(const AttrBuilder &B); |
| 1039 |
|
| 1040 |
|
| 1041 |
AttrBuilder &remove(const AttributeMask &AM); |
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
bool overlaps(const AttributeMask &AM) const; |
| 1046 |
|
| 1047 |
|
| 1048 |
bool contains(Attribute::AttrKind A) const; |
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
bool contains(StringRef A) const; |
| 1053 |
|
| 1054 |
|
| 1055 |
bool hasAttributes() const { return !Attrs.empty(); } |
| 1056 |
|
| 1057 |
|
| 1058 |
bool hasAlignmentAttr() const; |
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
Attribute getAttribute(Attribute::AttrKind Kind) const; |
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
Attribute getAttribute(StringRef Kind) const; |
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
uint64_t getRawIntAttr(Attribute::AttrKind Kind) const; |
| 1071 |
|
| 1072 |
|
| 1073 |
MaybeAlign getAlignment() const { |
| 1074 |
return MaybeAlign(getRawIntAttr(Attribute::Alignment)); |
| 1075 |
} |
| 1076 |
|
| 1077 |
|
| 1078 |
MaybeAlign getStackAlignment() const { |
| 1079 |
return MaybeAlign(getRawIntAttr(Attribute::StackAlignment)); |
| 1080 |
} |
| 1081 |
|
| 1082 |
|
| 1083 |
|
| 1084 |
uint64_t getDereferenceableBytes() const { |
| 1085 |
return getRawIntAttr(Attribute::Dereferenceable); |
| 1086 |
} |
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
uint64_t getDereferenceableOrNullBytes() const { |
| 1091 |
return getRawIntAttr(Attribute::DereferenceableOrNull); |
| 1092 |
} |
| 1093 |
|
| 1094 |
|
| 1095 |
Type *getTypeAttr(Attribute::AttrKind Kind) const; |
| 1096 |
|
| 1097 |
|
| 1098 |
Type *getByValType() const { return getTypeAttr(Attribute::ByVal); } |
| 1099 |
|
| 1100 |
|
| 1101 |
Type *getStructRetType() const { return getTypeAttr(Attribute::StructRet); } |
| 1102 |
|
| 1103 |
|
| 1104 |
Type *getByRefType() const { return getTypeAttr(Attribute::ByRef); } |
| 1105 |
|
| 1106 |
|
| 1107 |
Type *getPreallocatedType() const { |
| 1108 |
return getTypeAttr(Attribute::Preallocated); |
| 1109 |
} |
| 1110 |
|
| 1111 |
|
| 1112 |
Type *getInAllocaType() const { return getTypeAttr(Attribute::InAlloca); } |
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const; |
| 1117 |
|
| 1118 |
|
| 1119 |
unsigned getVScaleRangeMin() const; |
| 1120 |
|
| 1121 |
|
| 1122 |
Optional<unsigned> getVScaleRangeMax() const; |
| 1123 |
|
| 1124 |
|
| 1125 |
AttrBuilder &addRawIntAttr(Attribute::AttrKind Kind, uint64_t Value); |
| 1126 |
|
| 1127 |
|
| 1128 |
|
| 1129 |
AttrBuilder &addAlignmentAttr(MaybeAlign Align); |
| 1130 |
|
| 1131 |
|
| 1132 |
|
| 1133 |
|
| 1134 |
|
| 1135 |
inline AttrBuilder &addAlignmentAttr(unsigned Align) { |
| 1136 |
return addAlignmentAttr(MaybeAlign(Align)); |
| 1137 |
} |
| 1138 |
|
| 1139 |
|
| 1140 |
|
| 1141 |
AttrBuilder &addStackAlignmentAttr(MaybeAlign Align); |
| 1142 |
|
| 1143 |
|
| 1144 |
|
| 1145 |
|
| 1146 |
|
| 1147 |
inline AttrBuilder &addStackAlignmentAttr(unsigned Align) { |
| 1148 |
return addStackAlignmentAttr(MaybeAlign(Align)); |
| 1149 |
} |
| 1150 |
|
| 1151 |
|
| 1152 |
|
| 1153 |
AttrBuilder &addDereferenceableAttr(uint64_t Bytes); |
| 1154 |
|
| 1155 |
|
| 1156 |
|
| 1157 |
AttrBuilder &addDereferenceableOrNullAttr(uint64_t Bytes); |
| 1158 |
|
| 1159 |
|
| 1160 |
AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg, |
| 1161 |
const Optional<unsigned> &NumElemsArg); |
| 1162 |
|
| 1163 |
|
| 1164 |
AttrBuilder &addVScaleRangeAttr(unsigned MinValue, |
| 1165 |
Optional<unsigned> MaxValue); |
| 1166 |
|
| 1167 |
|
| 1168 |
AttrBuilder &addTypeAttr(Attribute::AttrKind Kind, Type *Ty); |
| 1169 |
|
| 1170 |
|
| 1171 |
AttrBuilder &addByValAttr(Type *Ty); |
| 1172 |
|
| 1173 |
|
| 1174 |
AttrBuilder &addStructRetAttr(Type *Ty); |
| 1175 |
|
| 1176 |
|
| 1177 |
AttrBuilder &addByRefAttr(Type *Ty); |
| 1178 |
|
| 1179 |
|
| 1180 |
AttrBuilder &addPreallocatedAttr(Type *Ty); |
| 1181 |
|
| 1182 |
|
| 1183 |
AttrBuilder &addInAllocaAttr(Type *Ty); |
| 1184 |
|
| 1185 |
|
| 1186 |
|
| 1187 |
AttrBuilder &addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr); |
| 1188 |
|
| 1189 |
|
| 1190 |
|
| 1191 |
AttrBuilder &addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr); |
| 1192 |
|
| 1193 |
ArrayRef<Attribute> attrs() const { return Attrs; } |
| 1194 |
|
| 1195 |
bool operator==(const AttrBuilder &B) const; |
| 1196 |
bool operator!=(const AttrBuilder &B) const { return !(*this == B); } |
| 1197 |
}; |
| 1198 |
|
| 1199 |
namespace AttributeFuncs { |
| 1200 |
|
| 1201 |
|
| 1202 |
AttributeMask typeIncompatible(Type *Ty); |
| 1203 |
|
| 1204 |
|
| 1205 |
|
| 1206 |
|
| 1207 |
|
| 1208 |
|
| 1209 |
AttributeMask getUBImplyingAttributes(); |
| 1210 |
|
| 1211 |
|
| 1212 |
|
| 1213 |
bool areInlineCompatible(const Function &Caller, const Function &Callee); |
| 1214 |
|
| 1215 |
|
| 1216 |
|
| 1217 |
|
| 1218 |
|
| 1219 |
|
| 1220 |
|
| 1221 |
|
| 1222 |
bool areOutlineCompatible(const Function &A, const Function &B); |
| 1223 |
|
| 1224 |
|
| 1225 |
void mergeAttributesForInlining(Function &Caller, const Function &Callee); |
| 1226 |
|
| 1227 |
|
| 1228 |
|
| 1229 |
|
| 1230 |
|
| 1231 |
void mergeAttributesForOutlining(Function &Base, const Function &ToMerge); |
| 1232 |
|
| 1233 |
} |
| 1234 |
|
| 1235 |
} |
| 1236 |
|
| 1237 |
#endif |