LLVM: include/llvm/IR/Attributes.h Source File (original) (raw)

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

22#include "llvm/Config/llvm-config.h"

27#include

28#include

29#include

30#include

31#include

32

33namespace llvm {

34

35class AttrBuilder;

36class AttributeMask;

37class AttributeImpl;

38class AttributeListImpl;

39class AttributeSetNode;

40class ConstantRange;

41class ConstantRangeList;

42class FoldingSetNodeID;

44class LLVMContext;

46class raw_ostream;

48

51 Alloc = 1 << 0,

52 Realloc = 1 << 1,

53 Free = 1 << 2,

54 Uninitialized = 1 << 3,

55 Zeroed = 1 << 4,

56 Aligned = 1 << 5,

57

59};

60

61

62

63

64

65

66

68public:

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

87

88 None,

89 #define GET_ATTR_ENUM

90 #include "llvm/IR/Attributes.inc"

92 EmptyKey,

93 TombstoneKey,

94 };

95

96 static const unsigned NumIntAttrKinds = LastIntAttr - FirstIntAttr + 1;

97 static const unsigned NumTypeAttrKinds = LastTypeAttr - FirstTypeAttr + 1;

98

100 return Kind >= FirstEnumAttr && Kind <= LastEnumAttr;

101 }

103 return Kind >= FirstIntAttr && Kind <= LastIntAttr;

104 }

106 return Kind >= FirstTypeAttr && Kind <= LastTypeAttr;

107 }

109 return Kind >= FirstConstantRangeAttr && Kind <= LastConstantRangeAttr;

110 }

112 return Kind >= FirstConstantRangeListAttr &&

113 Kind <= LastConstantRangeListAttr;

114 }

115

119

124

125private:

127

129

130public:

132

133

134

135

136

137

146

147

148

156 LLVMContext &Context, unsigned ElemSizeArg,

157 const std::optional &NumElemsArg);

159 unsigned MinValue, unsigned MaxValue);

168

169

170

174 }

175

177

179

180

181

183

184

185

186

187

188

190

191

193

194

195

197

198

200

201

203

204

206

207

208 bool isValid() const { return pImpl; }

209

210

212

213

215

216

217

219

220

221

223

224

225

227

228

229

231

232

233

235

236

237

239

240

241

243

244

245

247

248

249

251

252

253

255

256

257

259

260

261

263

264

265

267

268

269 std::pair<unsigned, std::optional> getAllocSizeArgs() const;

270

271

273

274

275

277

278

280

281

283

284

286

287

289

290

292

293

295

296

298

299

300

301 std::string getAsString(bool InAttrGrp = false) const;

302

303

305

306

309

310

312

313

315

317

318

320 return pImpl;

321 }

322

323

326 }

327};

328

329

332}

333

334

337}

338

339

340

341

342

343

344

347 template <typename Ty, typename Enable> friend struct DenseMapInfo;

348

349

350

351

352

353

355

356private:

358

359public:

360

364

367

370

371

372

375

376

377

380

381

382

385

386

387

390

391

392

395

396

397

400

401

402

403

404 [[nodiscard]] std::optional

406

407

409

410

412

413

415

416

418

419

421

422

424

435 std::optional<std::pair<unsigned, std::optional>> getAllocSizeArgs()

436 const;

444 std::string getAsString(bool InAttrGrp = false) const;

445

446

448

450

453#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

454 void dump() const;

455#endif

456};

457

458

459

460

463 auto Val = static_cast<uintptr_t>(-1);

464 Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;

466 }

467

469 auto Val = static_cast<uintptr_t>(-2);

470 Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;

472 }

473

475 return (unsigned((uintptr_t)AS.SetNode) >> 4) ^

476 (unsigned((uintptr_t)AS.SetNode) >> 9);

477 }

478

480};

481

482

483

484

485

486

487

488

489

491public:

496 };

497

498private:

503 template <typename Ty, typename Enable> friend struct DenseMapInfo;

504

505

506

508

509public:

510

512 ArrayRef<std::pair<unsigned, Attribute>> Attrs);

514 ArrayRef<std::pair<unsigned, AttributeSet>> Attrs);

515

516

517

521

522private:

524

526

529

530public:

532

533

534

535

536

537

550

551

552

553

557

558

559

563

564

565

568

569

570

574

575

576

580 }

581

582

583

587 }

588

589

590

595 }

596

597

598

602 }

603

604

605

609 }

610

611

612

616 }

617

618

619

623 }

624

625

626

631 }

632

633

634

639 }

640

641

642

646

647

648

652 }

653

654

655

659

660

661

667 }

668

669

670

674

675

676

678 unsigned Index) const;

679

680

681

685 }

686

687

688

692 }

693

694

695

699 }

700

701

702

705 }

706

707

708

712 }

713

714

715

719 }

720

721

722

727 }

728

729

730

735 }

736

737

738

742 }

743

744

745

750 }

751

752

753

755 unsigned ArgNo) const {

757 }

758

759

760

764 Type *ReplacementTy) const {

767 return Attrs.addAttributeAtIndex(C, ArgNo,

769 }

770

771

772

775

776

777

779 unsigned ArgNo,

781

782

783

784

788

789

790

793

794

795

798 const std::optional &NumElemsArg) const;

799

800

801

802

803 [[nodiscard]] std::optional

805

806

807

808

809

810

812

813

814

816

817

819

820

822

823

825

826

828

829

831

832

835 }

836

837

840 }

841

842

845 }

846

847

850 }

851

852

855 }

856

857

859

860

862

863

865

866

868

869

870

871

873 unsigned *Index = nullptr) const;

874

875

877

878

880

881

884 }

885

886

889 }

890

891

894 }

895

896

899 }

900

901

904 }

905

906

908

909

911

912

914

915

917

918

920

921

923

924

926

927

929

930

932

933

935

936

938

939

940

942

943

945

946

947

949

950

951

953

954

955 std::optional getParamRange(unsigned ArgNo) const;

956

957

959

960

962

963

965

967

968

970

971

972 std::string getAsString(unsigned Index, bool InAttrGrp = false) const;

973

974

976

977

978

979

980

982

985

987

988

989

990

1000

1001

1002 ++i;

1003 return *this;

1004 }

1005 };

1006

1008

1010 };

1011

1012

1014

1015

1018

1019

1021 return pImpl;

1022 }

1023

1024

1025 bool isEmpty() const { return pImpl == nullptr; }

1026

1028

1029 void dump() const;

1030};

1031

1032

1033

1034

1037 auto Val = static_cast<uintptr_t>(-1);

1038 Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;

1040 }

1041

1043 auto Val = static_cast<uintptr_t>(-2);

1044 Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;

1046 }

1047

1049 return (unsigned((uintptr_t)AS.pImpl) >> 4) ^

1050 (unsigned((uintptr_t)AS.pImpl) >> 9);

1051 }

1052

1055 }

1056};

1057

1058

1059

1060

1061

1062

1063

1067

1068public:

1072

1075 }

1076

1078

1080

1081

1083

1084

1086

1087

1089

1090

1092

1093

1095

1096

1098 if (A.isStringAttribute())

1100 else

1102 }

1103

1104

1105

1107

1108

1110

1111

1112

1114

1115

1117

1118

1119

1121

1122

1124

1125

1126

1128

1129

1130

1132

1133

1134

1135 std::optional getRange() const;

1136

1137

1138

1140

1141

1144 }

1145

1146

1149 }

1150

1151

1152

1154 return getRawIntAttr(Attribute::Dereferenceable).value_or(0);

1155 }

1156

1157

1158

1160 return getRawIntAttr(Attribute::DereferenceableOrNull).value_or(0);

1161 }

1162

1163

1165

1166

1168

1169

1171

1172

1174

1175

1177 return getTypeAttr(Attribute::Preallocated);

1178 }

1179

1180

1182

1183

1184

1185 std::optional<std::pair<unsigned, std::optional>> getAllocSizeArgs()

1186 const;

1187

1188

1190

1191

1192

1194

1195

1196

1197

1198

1201 }

1202

1203

1204

1206

1207

1208

1209

1210

1213 }

1214

1215

1216

1218

1219

1220

1222

1223

1225 const std::optional &NumElemsArg);

1226

1227

1229 std::optional MaxValue);

1230

1231

1233

1234

1236

1237

1239

1240

1242

1243

1245

1246

1248

1249

1250

1252

1253

1254

1256

1257

1258

1260

1261

1263

1264

1266

1267

1269

1270

1272

1273

1276

1277

1279

1280

1283

1284

1286

1288

1289 bool operator==(const AttrBuilder &B) const;

1291};

1292

1293namespace AttributeFuncs {

1294

1299};

1300

1301

1302

1304

1305

1306

1307

1308

1309

1310

1311

1312

1313

1316

1317

1318

1319

1320

1321

1323

1324

1325

1327

1328

1329

1330

1331

1332

1333

1334

1336

1337

1339

1340

1341

1342

1343

1345

1346

1348

1349}

1350

1351}

1352

1353#endif

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

AttrBuilder & addStructRetAttr(Type *Ty)

This turns a sret type into the form used internally in Attribute.

AttrBuilder & addAlignmentAttr(MaybeAlign Align)

This turns an alignment into the form used internally in Attribute.

Type * getByValType() const

Retrieve the byval type.

AttrBuilder(AttrBuilder &&)=default

AttrBuilder & addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr)

Add a vscale_range attribute, using the representation returned by Attribute.getIntValue().

AttrBuilder(const AttrBuilder &)=delete

std::optional< uint64_t > getRawIntAttr(Attribute::AttrKind Kind) const

Return raw (possibly packed/encoded) value of integer attribute or std::nullopt if not set.

AttrBuilder & addStackAlignmentAttr(unsigned Align)

This turns an int stack alignment (which must be a power of 2) into the form used internally in Attri...

AttrBuilder & addAllocKindAttr(AllocFnKind Kind)

Attribute getAttribute(Attribute::AttrKind Kind) const

Return Attribute with the given Kind.

AttrBuilder & addByRefAttr(Type *Ty)

This turns a byref type into the form used internally in Attribute.

AttrBuilder & addNoFPClassAttr(FPClassTest NoFPClassMask)

AttrBuilder & addCapturesAttr(CaptureInfo CI)

Add captures attribute.

bool overlaps(const AttributeMask &AM) const

Return true if the builder has any attribute that's in the specified builder.

AttrBuilder & merge(const AttrBuilder &B)

Add the attributes from the builder.

MaybeAlign getStackAlignment() const

Retrieve the stack alignment attribute, if it exists.

Type * getByRefType() const

Retrieve the byref type.

AttrBuilder & addVScaleRangeAttr(unsigned MinValue, std::optional< unsigned > MaxValue)

This turns two ints into the form used internally in Attribute.

AttrBuilder(LLVMContext &Ctx)

uint64_t getDereferenceableBytes() const

Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is return...

bool hasAttributes() const

Return true if the builder has IR-level attributes.

AttrBuilder & addRawIntAttr(Attribute::AttrKind Kind, uint64_t Value)

Add integer attribute with raw value (packed/encoded if necessary).

AttrBuilder & addAttribute(Attribute::AttrKind Val)

Add an attribute to the builder.

MaybeAlign getAlignment() const

Retrieve the alignment attribute, if it exists.

AttrBuilder & addByValAttr(Type *Ty)

This turns a byval type into the form used internally in Attribute.

AttrBuilder & addDereferenceableAttr(uint64_t Bytes)

This turns the number of dereferenceable bytes into the form used internally in Attribute.

Type * getPreallocatedType() const

Retrieve the preallocated type.

AttrBuilder & addInitializesAttr(const ConstantRangeList &CRL)

Add initializes attribute.

bool contains(Attribute::AttrKind A) const

Return true if the builder has the specified attribute.

AttrBuilder & addMemoryAttr(MemoryEffects ME)

Add memory effect attribute.

AttrBuilder & addConstantRangeListAttr(Attribute::AttrKind Kind, ArrayRef< ConstantRange > Val)

Add a ConstantRangeList attribute with the given ranges.

AttrBuilder & addConstantRangeAttr(Attribute::AttrKind Kind, const ConstantRange &CR)

Add a ConstantRange attribute with the given range.

AttrBuilder & addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr)

Add an allocsize attribute, using the representation returned by Attribute.getIntValue().

AttrBuilder & addPreallocatedAttr(Type *Ty)

This turns a preallocated type into the form used internally in Attribute.

Type * getInAllocaType() const

Retrieve the inalloca type.

AttrBuilder & addStackAlignmentAttr(MaybeAlign Align)

This turns a stack alignment into the form used internally in Attribute.

AttrBuilder & removeAttribute(Attribute A)

Remove the target-dependent attribute from the builder.

uint64_t getDereferenceableOrNullBytes() const

Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists...

ArrayRef< Attribute > attrs() const

AttrBuilder & addInAllocaAttr(Type *Ty)

This turns an inalloca type into the form used internally in Attribute.

AttrBuilder & removeAttribute(Attribute::AttrKind Val)

Remove an attribute from the builder.

Type * getTypeAttr(Attribute::AttrKind Kind) const

Retrieve type for the given type attribute.

AttrBuilder & remove(const AttributeMask &AM)

Remove the attributes from the builder.

std::optional< ConstantRange > getRange() const

Retrieve the range if the attribute exists (std::nullopt is returned otherwise).

AttrBuilder & addDereferenceableOrNullAttr(uint64_t Bytes)

This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute.

AttrBuilder & addAlignmentAttr(unsigned Align)

This turns an int alignment (which must be a power of 2) into the form used internally in Attribute.

AttrBuilder & addTypeAttr(Attribute::AttrKind Kind, Type *Ty)

Add a type attribute with the given type.

std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const

Retrieve the allocsize args, or std::nullopt if the attribute does not exist.

AttrBuilder & addAllocSizeAttr(unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)

This turns one (or two) ints into the form used internally in Attribute.

bool operator!=(const AttrBuilder &B) const

Type * getStructRetType() const

Retrieve the sret type.

AttrBuilder & addRangeAttr(const ConstantRange &CR)

Add range attribute.

AttrBuilder(LLVMContext &Ctx, const Attribute &A)

AttrBuilder & addUWTableAttr(UWTableKind Kind)

This turns the unwind table kind into the form used internally in Attribute.

Attribute getFnAttr(StringRef Kind) const

Return the attribute object that exists for the function.

bool operator==(const AttributeList &RHS) const

operator==/!= - Provide equality predicates.

bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const

Return true if the attribute exists at the given index.

Type * getParamStructRetType(unsigned ArgNo) const

Return the sret type for the specified function parameter.

AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const

Add the dereferenceable attribute to the attribute set at the given arg index.

AttributeList removeAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const

Remove the specified attribute at the specified index from this attribute list.

AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo) const

Remove all attributes at the specified arg index from this attribute list.

AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttributeMask &AttrsToRemove) const

Remove the specified attribute at the specified arg index from this attribute list.

AttributeList addRangeRetAttr(LLVMContext &C, const ConstantRange &CR) const

Add the range attribute to the attribute set at the return value index.

bool hasAttributesAtIndex(unsigned Index) const

Return true if attribute exists at the given index.

AttributeList removeRetAttribute(LLVMContext &C, StringRef Kind) const

Remove the specified attribute at the return value index from this attribute list.

bool hasRetAttr(StringRef Kind) const

Return true if the attribute exists for the return value.

AttributeSet getFnAttrs() const

The function attributes are returned.

index_iterator indexes() const

Use this to iterate over the valid attribute indexes.

AttributeList removeAttributesAtIndex(LLVMContext &C, unsigned Index, const AttributeMask &AttrsToRemove) const

Remove the specified attributes at the specified index from this attribute list.

AttributeList addRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const

Add a return value attribute to the list.

bool hasParamAttrs(unsigned ArgNo) const

Return true if attributes exists for the given argument.

MaybeAlign getRetStackAlignment() const

Get the stack alignment of the return value.

AttributeList addRetAttributes(LLVMContext &C, const AttrBuilder &B) const

Add a return value attribute to the list.

void print(raw_ostream &O) const

AttributeList addDereferenceableRetAttr(LLVMContext &C, uint64_t Bytes) const

Add the dereferenceable attribute to the attribute set at the given index.

AttributeList removeRetAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const

Remove the specified attribute at the return value index from this attribute list.

static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute > > Attrs)

Create an AttributeList with the specified parameters in it.

Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const

Return the attribute object that exists at the arg index.

AttributeList removeAttribute(LLVMContext &C, unsigned Index, StringRef Kind) const

void * getRawPointer() const

Return a raw pointer that uniquely identifies this attribute list.

AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind) const

Remove the specified attribute at the specified arg index from this attribute list.

AllocFnKind getAllocKind() const

bool isEmpty() const

Return true if there are no attributes.

AttributeList addFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const

Add a function attribute to the list.

AttributeSet getRetAttrs() const

The attributes for the ret value are returned.

AttributeList addFnAttributes(LLVMContext &C, const AttrBuilder &B) const

Add function attribute to the list.

bool hasFnAttr(Attribute::AttrKind Kind) const

Return true if the attribute exists for the function.

uint64_t getParamDereferenceableBytes(unsigned Index) const

Get the number of dereferenceable bytes (or zero if unknown) of an arg.

MaybeAlign getParamAlignment(unsigned ArgNo) const

Return the alignment for the specified function parameter.

bool hasParamAttr(unsigned ArgNo, StringRef Kind) const

Return true if the attribute exists for the given argument.

AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind, StringRef Value=StringRef()) const

Add an argument attribute to the list.

bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const

Return true if the specified attribute is set for at least one parameter or for the return value.

Type * getParamInAllocaType(unsigned ArgNo) const

Return the inalloca type for the specified function parameter.

unsigned getNumAttrSets() const

bool operator!=(const AttributeList &RHS) const

FPClassTest getRetNoFPClass() const

Get the disallowed floating-point classes of the return value.

Attribute getFnAttr(Attribute::AttrKind Kind) const

Return the attribute object that exists for the function.

std::string getAsString(unsigned Index, bool InAttrGrp=false) const

Return the attributes at the index as a string.

UWTableKind getUWTableKind() const

Get the unwind table kind requested for the function.

MaybeAlign getRetAlignment() const

Return the alignment of the return value.

Type * getParamElementType(unsigned ArgNo) const

Return the elementtype type for the specified function parameter.

Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const

Return the attribute object that exists at the given index.

Type * getParamPreallocatedType(unsigned ArgNo) const

Return the preallocated type for the specified function parameter.

bool hasParentContext(LLVMContext &C) const

Return true if this attribute list belongs to the LLVMContext.

AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const

Remove the specified attribute at the specified arg index from this attribute list.

AttributeList addFnAttribute(LLVMContext &C, StringRef Kind, StringRef Value=StringRef()) const

Add a function attribute to the list.

bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const

Return true if the attribute exists for the given argument.

MaybeAlign getFnStackAlignment() const

Get the stack alignment of the function.

AttributeList addAttributesAtIndex(LLVMContext &C, unsigned Index, const AttrBuilder &B) const

Add attributes to the attribute set at the given index.

Type * getParamByValType(unsigned ArgNo) const

Return the byval type for the specified function parameter.

AttributeList removeFnAttributes(LLVMContext &C) const

Remove the attributes at the function index from this attribute list.

Attribute getRetAttr(Attribute::AttrKind Kind) const

Return the attribute for the given attribute kind for the return value.

MaybeAlign getParamStackAlignment(unsigned ArgNo) const

Return the stack alignment for the specified function parameter.

uint64_t getRetDereferenceableBytes() const

Get the number of dereferenceable bytes (or zero if unknown) of the return value.

Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const

Return the attribute object that exists at the given index.

AttributeList addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg) const

Add the allocsize attribute to the attribute set at the given arg index.

AttributeList removeFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const

Remove the specified attribute at the function index from this attribute list.

uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const

Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.

bool hasRetAttrs() const

Return true if attributes exist for the return value.

AttributeList addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const

Add the dereferenceable_or_null attribute to the attribute set at the given arg index.

AttributeSet getAttributes(unsigned Index) const

The attributes for the specified index are returned.

AttributeList addRetAttribute(LLVMContext &C, Attribute Attr) const

Add a return value attribute to the list.

FPClassTest getParamNoFPClass(unsigned ArgNo) const

Get the disallowed floating-point classes of the argument value.

AttributeList removeFnAttribute(LLVMContext &C, StringRef Kind) const

Remove the specified attribute at the function index from this attribute list.

AttributeList removeFnAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const

Remove the specified attribute at the function index from this attribute list.

std::optional< AttributeList > intersectWith(LLVMContext &C, AttributeList Other) const

Try to intersect this AttributeList with Other.

bool hasFnAttrs() const

Return true the attributes exist for the function.

Type * getParamByRefType(unsigned ArgNo) const

Return the byref type for the specified function parameter.

AttributeList addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const

Add an attribute to the attribute set at the given index.

AttributeSet getParamAttrs(unsigned ArgNo) const

The attributes for the argument or parameter at the given index are returned.

AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const

Add an argument attribute to the list.

std::optional< ConstantRange > getParamRange(unsigned ArgNo) const

Get range (or std::nullopt if unknown) of an arg.

uint64_t getRetDereferenceableOrNullBytes() const

Get the number of dereferenceable_or_null bytes (or zero if unknown) of the return value.

AttributeList removeRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const

Remove the specified attribute at the return value index from this attribute list.

AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const

Add an argument attribute to the list.

AttributeList replaceAttributeTypeAtIndex(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind, Type *ReplacementTy) const

Replace the type contained by attribute AttrKind at index ArgNo wih ReplacementTy,...

AttributeList addFnAttribute(LLVMContext &C, Attribute Attr) const

Add a function attribute to the list.

MemoryEffects getMemoryEffects() const

Returns memory effects of the function.

bool hasRetAttr(Attribute::AttrKind Kind) const

Return true if the attribute exists for the return value.

AllocFnKind getAllocKind() const

bool hasAttributes() const

Return true if attributes exists in this set.

AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const

Remove the specified attribute from this set.

Type * getInAllocaType() const

Type * getByValType() const

bool operator!=(const AttributeSet &O) const

AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const

Add attributes to the attribute set.

MemoryEffects getMemoryEffects() const

bool hasAttribute(Attribute::AttrKind Kind) const

Return true if the attribute exists in this set.

bool operator==(const AttributeSet &O) const

std::optional< AttributeSet > intersectWith(LLVMContext &C, AttributeSet Other) const

Try to intersect this AttributeSet with Other.

Type * getStructRetType() const

std::string getAsString(bool InAttrGrp=false) const

unsigned getVScaleRangeMin() const

std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const

UWTableKind getUWTableKind() const

bool hasParentContext(LLVMContext &C) const

Return true if this attribute set belongs to the LLVMContext.

AttributeSet removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const

Remove the specified attributes from this set.

std::optional< unsigned > getVScaleRangeMax() const

MaybeAlign getStackAlignment() const

Attribute getAttribute(Attribute::AttrKind Kind) const

Return the attribute object.

Type * getPreallocatedType() const

uint64_t getDereferenceableBytes() const

MaybeAlign getAlignment() const

FPClassTest getNoFPClass() const

AttributeSet(const AttributeSet &)=default

Type * getElementType() const

Type * getByRefType() const

CaptureInfo getCaptureInfo() const

AttributeSet()=default

AttributeSet is a trivially copyable value type.

static AttributeSet get(LLVMContext &C, const AttrBuilder &B)

uint64_t getDereferenceableOrNullBytes() const

unsigned getNumAttributes() const

Return the number of attributes in this set.

AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const

Add an argument attribute.

static const unsigned NumTypeAttrKinds

bool isStringAttribute() const

Return true if the attribute is a string (target-dependent) attribute.

static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty)

bool operator==(Attribute A) const

Equality and non-equality operators.

static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)

bool isEnumAttribute() const

Return true if the attribute is an Attribute::AttrKind type.

static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment)

const ConstantRange & getRange() const

Returns the value of the range attribute.

static bool intersectWithCustom(AttrKind Kind)

bool isIntAttribute() const

Return true if the attribute is an integer attribute.

static Attribute getWithByRefType(LLVMContext &Context, Type *Ty)

std::optional< unsigned > getVScaleRangeMax() const

Returns the maximum value for the vscale_range attribute or std::nullopt when unknown.

uint64_t getValueAsInt() const

Return the attribute's value as an integer.

unsigned getVScaleRangeMin() const

Returns the minimum value for the vscale_range attribute.

AllocFnKind getAllocKind() const

bool isConstantRangeAttribute() const

Return true if the attribute is a ConstantRange attribute.

StringRef getKindAsString() const

Return the attribute's kind as a string.

static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty)

static bool intersectWithMin(AttrKind Kind)

static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)

Return a uniquified Attribute object.

static bool canUseAsRetAttr(AttrKind Kind)

static bool isTypeAttrKind(AttrKind Kind)

std::string getAsString(bool InAttrGrp=false) const

The Attribute is converted to a string of equivalent mnemonic.

uint64_t getDereferenceableOrNullBytes() const

Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.

static Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)

std::pair< unsigned, std::optional< unsigned > > getAllocSizeArgs() const

Returns the argument numbers for the allocsize attribute.

static Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind)

bool operator!=(Attribute A) const

FPClassTest getNoFPClass() const

Return the FPClassTest for nofpclass.

static Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)

Attribute::AttrKind getKindAsEnum() const

Return the attribute's kind as an enum (Attribute::AttrKind).

bool getValueAsBool() const

Return the attribute's value as a boolean.

ArrayRef< ConstantRange > getInitializes() const

Returns the value of the initializes attribute.

const ConstantRange & getValueAsConstantRange() const

Return the attribute's value as a ConstantRange.

uint64_t getDereferenceableBytes() const

Returns the number of dereferenceable bytes from the dereferenceable attribute.

static Attribute getWithVScaleRangeArgs(LLVMContext &Context, unsigned MinValue, unsigned MaxValue)

MemoryEffects getMemoryEffects() const

Returns memory effects.

UWTableKind getUWTableKind() const

static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes)

ArrayRef< ConstantRange > getValueAsConstantRangeList() const

Return the attribute's value as a ConstantRange array.

StringRef getValueAsString() const

Return the attribute's value as a string.

static bool isExistingAttribute(StringRef Name)

Return true if the provided string matches the IR name of an attribute.

bool hasKindAsEnum() const

Returns true if the attribute's kind can be represented as an enum (Enum, Integer,...

static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind)

static bool canUseAsFnAttr(AttrKind Kind)

static bool intersectWithAnd(AttrKind Kind)

static Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask)

AttrKind

This enumeration lists the attributes that can be associated with parameters, function results,...

@ TombstoneKey

Use as Tombstone key for DenseMap of AttrKind.

@ None

No attributes have been set.

@ EmptyKey

Use as Empty key for DenseMap of AttrKind.

@ EndAttrKinds

Sentinel value useful for loops.

static bool isConstantRangeAttrKind(AttrKind Kind)

void * getRawPointer() const

Return a raw pointer that uniquely identifies this attribute.

bool hasParentContext(LLVMContext &C) const

Return true if this attribute belongs to the LLVMContext.

bool isTypeAttribute() const

Return true if the attribute is a type attribute.

static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty)

static bool isIntAttrKind(AttrKind Kind)

static bool isConstantRangeListAttrKind(AttrKind Kind)

bool isConstantRangeListAttribute() const

Return true if the attribute is a ConstantRangeList attribute.

static Attribute getWithByValType(LLVMContext &Context, Type *Ty)

Attribute getWithNewType(LLVMContext &Context, Type *ReplacementTy)

For a typed attribute, return the equivalent attribute with the type changed to ReplacementTy.

bool hasAttribute(AttrKind Val) const

Return true if the attribute is present.

static bool isEnumAttrKind(AttrKind Kind)

static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME)

static bool canUseAsParamAttr(AttrKind Kind)

bool isValid() const

Return true if the attribute is any kind of attribute.

MaybeAlign getStackAlignment() const

Returns the stack alignment field of an attribute as a byte alignment value.

static Attribute fromRawPointer(void *RawPtr)

Get an attribute from a raw pointer created by getRawPointer.

static const unsigned NumIntAttrKinds

MaybeAlign getAlignment() const

Returns the alignment field of an attribute as a byte alignment value.

CaptureInfo getCaptureInfo() const

Returns information from captures attribute.

static bool intersectMustPreserve(AttrKind Kind)

int cmpKind(Attribute A) const

Used to sort attribute by kind.

bool operator<(Attribute A) const

Less-than operator. Useful for sorting the attributes list.

static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)

Return a uniquified Attribute object that has the specific alignment set.

Type * getValueAsType() const

Return the attribute's value as a Type.

Represents which components of the pointer may be captured in which location.

This class represents a list of constant ranges.

This class represents a range of values.

FoldingSetNodeID - This class is used to gather all the unique data bits of a node.

This is an important class for using LLVM in a threaded context.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

The instances of the Type class are immutable: once they are created, they are never changed.

LLVM Value Representation.

This class implements an extremely fast bulk output stream that can only output to a stream.

struct LLVMOpaqueAttributeRef * LLVMAttributeRef

Used to represent an attributes.

bool areInlineCompatible(const Function &Caller, const Function &Callee)

AttributeMask getUBImplyingAttributes()

Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.

bool isNoFPClassCompatibleType(Type *Ty)

Returns true if this is a type legal for the 'nofpclass' attribute.

bool areOutlineCompatible(const Function &A, const Function &B)

Checks if there are any incompatible function attributes between A and B.

void updateMinLegalVectorWidthAttr(Function &Fn, uint64_t Width)

Update min-legal-vector-width if it is in Attribute and less than Width.

void mergeAttributesForOutlining(Function &Base, const Function &ToMerge)

Merges the functions attributes from ToMerge into function Base.

AttributeMask typeIncompatible(Type *Ty, AttributeSet AS, AttributeSafetyKind ASK=ASK_ALL)

Which attributes cannot be applied to a type.

void mergeAttributesForInlining(Function &Caller, const Function &Callee)

Merge caller's and callee's attributes.

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

FPClassTest

Floating-point class tests, supported by 'is_fpclass' intrinsic.

@ LLVM_MARK_AS_BITMASK_ENUM

Attribute unwrap(LLVMAttributeRef Attr)

LLVMAttributeRef wrap(Attribute Attr)

This struct is a compact representation of a valid (non-zero power of two) alignment.

bool operator!=(const int_wrapper &Other)

int_wrapper & operator++()

index_iterator(int NumAttrSets)

static unsigned getHashValue(AttributeList AS)

static AttributeList getEmptyKey()

static AttributeList getTombstoneKey()

static bool isEqual(AttributeList LHS, AttributeList RHS)

static AttributeSet getTombstoneKey()

static bool isEqual(AttributeSet LHS, AttributeSet RHS)

static AttributeSet getEmptyKey()

static unsigned getHashValue(AttributeSet AS)

An information struct used to provide DenseMap with the various necessary components for a given valu...

This struct is a compact representation of a valid (power of two) or undefined (0) alignment.