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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20#ifndef LLVM_IR_CONSTANTS_H

21#define LLVM_IR_CONSTANTS_H

22

39#include

40#include

41#include

42#include

43

44namespace llvm {

45

47

48

49

50

51

52

53

54

55

58

60

63 }

64

65protected:

67

68 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

69

70public:

71 void operator delete(void *Ptr) { User::operator delete(Ptr); }

72

74

75

77 static_assert(Value::ConstantDataFirstVal == 0,

78 "V->getValueID() >= Value::ConstantDataFirstVal");

79 return V->getValueID() <= ConstantDataLastVal;

80 }

81};

82

83

84

85

86

90

92

93 ConstantInt(Type *Ty, const APInt &V);

94

95 void destroyConstantImpl();

96

97

98

99

102

103public:

105

112

113

114

115

116

118 bool ImplicitTrunc = true);

119

120

121

122

123

124

125

126

128 bool IsSigned = false,

129 bool ImplicitTrunc = true);

130

131

132

133

134

135

137 return get(Ty, V, true);

138 }

140 return get(Ty, V, true);

141 }

142

143

144

146

147

148

151

152

153

155

156

157

158

160

161

162 unsigned getBitWidth() const { return Val.getBitWidth(); }

163

164

165

166

167

169

170

171

172

173

174 inline int64_t getSExtValue() const { return Val.getSExtValue(); }

175

176

177

178

182

183

184

185

189

190

191

192

193

195

196

197

201

202

203

204

205

206

207

208

209

210

213

214 bool isNegative() const { return Val.isNegative(); }

215

216

217

218

219 bool isZero() const { return Val.isZero(); }

220

221

222

223

224

225 bool isOne() const { return Val.isOne(); }

226

227

228

229

230

231 bool isMinusOne() const { return Val.isAllOnes(); }

232

233

234

235

236

237

239 if (IsSigned)

240 return Val.isMaxSignedValue();

241 else

242 return Val.isMaxValue();

243 }

244

245

246

247

248

249

251 if (IsSigned)

252 return Val.isMinSignedValue();

253 else

254 return Val.isMinValue();

255 }

256

257

258

259

260

261

262 bool uge(uint64_t Num) const { return Val.uge(Num); }

263

264

265

266

267

268

270 return Val.getLimitedValue(Limit);

271 }

272

273

275 return V->getValueID() == ConstantIntVal;

276 }

277};

278

279

280

281

285

287

289

290 void destroyConstantImpl();

291

292

293

294

297

298public:

300

301

302

303

304

306

307

308

310

316 APInt *Payload = nullptr);

318 APInt *Payload = nullptr);

322

323

327

328

329 bool isZero() const { return Val.isZero(); }

330

331

332 bool isNegative() const { return Val.isNegative(); }

333

334

335 bool isInfinity() const { return Val.isInfinity(); }

336

337

338 bool isNaN() const { return Val.isNaN(); }

339

340

341

342

343

344

345

347

354

355

357 return V->getValueID() == ConstantFPVal;

358 }

359};

360

361

362

363

366

367 explicit ConstantAggregateZero(Type *Ty)

368 : ConstantData(Ty, ConstantAggregateZeroVal) {}

369

370 void destroyConstantImpl();

371

372public:

374

376

377

378

380

381

382

384

385

386

388

389

391

392

394

395

396

398 return V->getValueID() == ConstantAggregateZeroVal;

399 }

400};

401

402

403

404

405

406

407

408

409

410

411

412

414protected:

417

418public:

419

421

422

424 return V->getValueID() >= ConstantAggregateFirstVal &&

425 V->getValueID() <= ConstantAggregateLastVal;

426 }

427};

428

429template <>

432

434

435

436

437

441

443

444 void destroyConstantImpl();

446

447public:

448

450

451private:

453

454public:

455

456

460

461

463 return V->getValueID() == ConstantArrayVal;

464 }

465};

466

467

468

469

473

475

476 void destroyConstantImpl();

478

479public:

480

482

483 template <typename... Csts>

488

489

490

495 bool Packed = false) {

497 }

498

499

500

502 bool Packed = false);

503

506 bool Packed = false);

507

508

512

513

515 return V->getValueID() == ConstantStructVal;

516 }

517};

518

519

520

521

525

527

528 void destroyConstantImpl();

530

531public:

532

534

535private:

537

538public:

539

540

542

543

544

548

549

550

551

553

554

556 return V->getValueID() == ConstantVectorVal;

557 }

558};

559

560

561

562

565

568

569 void destroyConstantImpl();

570

571public:

573

574

576

577

578

582

583

585 return V->getValueID() == ConstantPointerNullVal;

586 }

587};

588

589

590

591

592

593

594

595

596

597

601

602

603

604 const char *DataElements;

605

606

607

608

609

610 std::unique_ptr Next;

611

612 void destroyConstantImpl();

613

614protected:

617

619

620public:

622

623

624

625

626

628

629

630

632

633

634

636

637

638

640

641

642

644

645

646

648

649

650

651

653

654

656

657

659

660

661

663

664

666

667

668

670

671

672

677

678

679

683 return Str.drop_back();

684 }

685

686

687

688

690

691

693 return V->getValueID() == ConstantDataArrayVal ||

694 V->getValueID() == ConstantDataVectorVal;

695 }

696

697private:

698 const char *getElementPointer(uint64_t Elt) const;

699};

700

701

702

703

704

705

706

709

710 explicit ConstantDataArray(Type *ty, const char *Data)

712

713public:

715

716

717

718

719 template

721 const char *Data = reinterpret_cast<const char *>(Elts.data());

724 }

725

726

727

728 template

732

733

734

735

736

737

738

740 Type *ElementTy) {

743 }

744

745

746

747

748

749

750

754

755

756

757

758

759

762

763

764

768

769

771 return V->getValueID() == ConstantDataArrayVal;

772 }

773};

774

775

776

777

778

779

780

783

784 explicit ConstantDataVector(Type *ty, const char *Data)

786 IsSplatSet(false) {}

787

788 mutable bool IsSplatSet : 1;

789 mutable bool IsSplat : 1;

790 bool isSplatData() const;

791

792public:

794

795

796

797

804

805

806

807

808

809

810

812 Type *ElementTy) {

815 }

816

817

818

819

820

821

822

826

827

828

829

831

832

833

835

836

837

839

840

841

845

846

848 return V->getValueID() == ConstantDataVectorVal;

849 }

850};

851

852

853

854

857

858 explicit ConstantTokenNone(LLVMContext &Context)

859 : ConstantData(Type::getTokenTy(Context), ConstantTokenNoneVal) {}

860

861 void destroyConstantImpl();

862

863public:

865

866

868

869

871 return V->getValueID() == ConstantTokenNoneVal;

872 }

873};

874

875

878

881

882 void destroyConstantImpl();

883

884public:

886

887

889

890

891

895

896

898 return V->getValueID() == ConstantTargetNoneVal;

899 }

900};

901

902

903

904class BlockAddress final : public Constant {

906

908

910

911 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

912

913 void destroyConstantImpl();

914 Value *handleOperandChangeImpl(Value *From, Value *To);

915

916public:

917 void operator delete(void *Ptr) { User::operator delete(Ptr); }

918

919

921

922

923

925

926

927

928

930

931

932

933

935

936

938

941

942

944 return V->getValueID() == BlockAddressVal;

945 }

946};

947

948template <>

951

953

954

955

956

957class DSOLocalEquivalent final : public Constant {

959

961

963

964 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

965

966 void destroyConstantImpl();

967 Value *handleOperandChangeImpl(Value *From, Value *To);

968

969public:

970 void operator delete(void *Ptr) { User::operator delete(Ptr); }

971

972

974

975

977

981

982

984 return V->getValueID() == DSOLocalEquivalentVal;

985 }

986};

987

988template <>

991

993

994

995

996class NoCFIValue final : public Constant {

998

1000

1002

1003 void *operator new(size_t S) { return User::operator new(S, AllocMarker); }

1004

1005 void destroyConstantImpl();

1006 Value *handleOperandChangeImpl(Value *From, Value *To);

1007

1008public:

1009

1010 LLVM_ABI static NoCFIValue *get(GlobalValue *GV);

1011

1012

1014

1018

1019

1023

1024

1026 return V->getValueID() == NoCFIValueVal;

1027 }

1028};

1029

1030template <>

1033

1035

1036

1037class ConstantPtrAuth final : public Constant {

1040

1042

1045

1046 void *operator new(size_t s) { return User::operator new(s, AllocMarker); }

1047

1048 void destroyConstantImpl();

1049 Value *handleOperandChangeImpl(Value *From, Value *To);

1050

1051public:

1052

1053 LLVM_ABI static ConstantPtrAuth *get(Constant *Ptr, ConstantInt *Key,

1054 ConstantInt *Disc, Constant *AddrDisc,

1055 Constant *DeactivationSymbol);

1056

1057

1058

1059 LLVM_ABI ConstantPtrAuth *getWithSameSchema(Constant *Pointer) const;

1060

1061

1063

1064

1066

1067

1069

1070

1074

1075

1076

1077

1081

1082

1086

1090

1091

1092

1093

1094

1095

1097

1098

1099

1100

1101

1103

1104

1105

1106

1108 const Value *Discriminator,

1110

1111

1113 return V->getValueID() == ConstantPtrAuthVal;

1114 }

1115};

1116

1117template <>

1120

1122

1123

1124

1125

1126

1127

1128

1129

1133

1134 void destroyConstantImpl();

1136

1137protected:

1140

1141 setValueSubclassData(Opcode);

1142 }

1143

1145

1146public:

1147

1148

1149

1150

1151

1152

1153

1155

1156

1157

1158

1159

1161

1165 bool HasNUW = false, bool HasNSW = false);

1167 bool HasNUW = false, bool HasNSW = false);

1170 bool OnlyIfReduced = false);

1172 bool OnlyIfReduced = false);

1174 bool OnlyIfReduced = false);

1176 bool OnlyIfReduced = false);

1178 bool OnlyIfReduced = false);

1180 bool OnlyIfReduced = false);

1181

1183

1185 return getAdd(C1, C2, false, true);

1186 }

1187

1189 return getAdd(C1, C2, true, false);

1190 }

1191

1193 return getSub(C1, C2, false, true);

1194 }

1195

1197 return getSub(C1, C2, true, false);

1198 }

1199

1200

1201

1202

1203

1205

1206

1207

1208

1209

1210

1211

1212

1214 bool AllowRHSConstant = false,

1215 bool NSZ = false);

1216

1218

1219

1220

1221

1223 bool AllowRHSConstant = false,

1224 bool NSZ = false);

1225

1226

1227

1228

1229

1230

1231

1233 bool AllowLHSConstant = false);

1234

1235

1237

1238

1239

1240

1241

1242

1243

1245 bool OnlyIfReduced = false);

1246

1247

1250 Type *Ty

1251 );

1252

1253

1254

1257 Type *Ty

1258 );

1259

1260

1261

1263 Constant *C,

1264 Type *Ty

1265 );

1266

1267

1269

1270

1271

1272

1273

1275 unsigned Flags = 0,

1276 Type *OnlyIfReducedTy = nullptr);

1277

1278

1279

1280

1281

1282

1286 std::optional InRange = std::nullopt,

1287 Type *OnlyIfReducedTy = nullptr) {

1290 InRange, OnlyIfReducedTy);

1291 }

1295 std::optional InRange = std::nullopt,

1296 Type *OnlyIfReducedTy = nullptr) {

1297

1298

1299

1301 OnlyIfReducedTy);

1302 }

1306 std::optional InRange = std::nullopt,

1307 Type *OnlyIfReducedTy = nullptr);

1308

1309

1310

1326

1328 Type *OnlyIfReducedTy = nullptr);

1331 Type *OnlyIfReducedTy = nullptr);

1334 Type *OnlyIfReducedTy = nullptr);

1335

1336

1338

1339

1340

1342

1343

1344

1345

1346

1348

1349

1351

1352

1353

1354

1358

1359

1360

1361

1362

1363

1364

1365

1366

1367

1369 bool OnlyIfReduced = false,

1370 Type *SrcTy = nullptr) const;

1371

1372

1373

1374

1375

1376

1377

1378

1380

1381

1382

1383 LLVM_ABI static bool isDesirableBinOp(unsigned Opcode);

1384

1385

1386

1387 LLVM_ABI static bool isSupportedBinOp(unsigned Opcode);

1388

1389

1390 LLVM_ABI static bool isDesirableCastOp(unsigned Opcode);

1391

1392

1393 LLVM_ABI static bool isSupportedCastOp(unsigned Opcode);

1394

1395

1396

1400

1401

1403 return V->getValueID() == ConstantExprVal;

1404 }

1405

1406private:

1407

1408

1409 void setValueSubclassData(unsigned short D) {

1411 }

1412};

1413

1414template <>

1417

1419

1420

1421

1422

1423

1424

1425

1426

1427

1428

1429

1432

1434

1435 void destroyConstantImpl();

1436

1437protected:

1439

1440public:

1442

1443

1445

1446

1447

1449

1450

1451

1453

1454

1455

1457

1458

1460

1461

1463

1464

1466 return V->getValueID() == UndefValueVal ||

1467 V->getValueID() == PoisonValueVal;

1468 }

1469};

1470

1471

1472

1473

1474

1475

1476

1477

1478class PoisonValue final : public UndefValue {

1480

1481 explicit PoisonValue(Type *T) : UndefValue(T, PoisonValueVal) {}

1482

1483 void destroyConstantImpl();

1484

1485public:

1487

1488

1490

1491

1492

1494

1495

1496

1498

1499

1500

1502

1503

1505

1506

1508 return V->getValueID() == PoisonValueVal;

1509 }

1510};

1511

1512}

1513

1514#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This file declares a class to represent arbitrary precision floating point values and provide a varie...

This file implements a class to represent arbitrary precision integral constant values and operations...

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")

static StringRef getOpcodeName(uint8_t Opcode, uint8_t OpcodeBase)

const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]

static bool InRange(int64_t Value, unsigned short Shift, int LBound, int HBound)

#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)

Macro for generating out-of-class operand accessor definitions.

static unsigned getNumElements(Type *Ty)

static SymbolRef::Type getType(const Symbol *Sym)

static constexpr roundingMode rmNearestTiesToEven

LLVM_ABI opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)

Class for arbitrary precision integers.

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

size_t size() const

size - Get the array size.

Class to represent array types.

static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)

This static method is the primary way to construct an ArrayType.

LLVM Basic Block Representation.

const Function * getParent() const

Return the enclosing method, or null if none.

The address of a basic block.

Definition Constants.h:904

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

static LLVM_ABI BlockAddress * lookup(const BasicBlock *BB)

Lookup an existing BlockAddress constant for the given BasicBlock.

friend class Constant

Definition Constants.h:905

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:943

Function * getFunction() const

Definition Constants.h:940

BasicBlock * getBasicBlock() const

Definition Constants.h:939

static LLVM_ABI BlockAddress * get(Function *F, BasicBlock *BB)

Return a BlockAddress for the specified function and basic block.

LLVM_ABI ElementCount getElementCount() const

Return the number of elements in the array, vector, or struct.

ConstantAggregateZero(const ConstantAggregateZero &)=delete

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:397

friend class Constant

Definition Constants.h:365

LLVM_ABI Constant * getSequentialElement() const

If this CAZ has array or vector type, return a zero with the right element type.

LLVM_ABI Constant * getElementValue(Constant *C) const

Return a zero of the right value for the specified GEP index if we can, otherwise return null (e....

LLVM_ABI Constant * getStructElement(unsigned Elt) const

If this CAZ has struct type, return a zero with the right element type for the specified element.

static LLVM_ABI ConstantAggregateZero * get(Type *Ty)

Base class for aggregate constants (with operands).

Definition Constants.h:413

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant)

Transparently provide more efficient getOperand methods.

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:423

LLVM_ABI ConstantAggregate(Type *T, ValueTy VT, ArrayRef< Constant * > V, AllocInfo AllocInfo)

friend class Constant

Definition Constants.h:440

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:462

ArrayType * getType() const

Specialize the getType() method to always return an ArrayType, which reduces the amount of casting ne...

Definition Constants.h:457

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:770

static LLVM_ABI Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)

This method constructs a CDS and initializes it with a text string.

static Constant * get(LLVMContext &Context, ArrayRef< ElementTy > Elts)

get() constructor - Return a constant with array type with an element count and element type matching...

Definition Constants.h:720

static LLVM_ABI Constant * getFP(Type *ElementType, ArrayRef< uint16_t > Elts)

getFP() constructors - Return a constant of array type with a float element type taken from argument ...

friend class ConstantDataSequential

Definition Constants.h:708

static Constant * get(LLVMContext &Context, ArrayTy &Elts)

get() constructor - ArrayTy needs to be compatible with ArrayRef.

Definition Constants.h:729

ConstantDataArray(const ConstantDataArray &)=delete

static Constant * getRaw(StringRef Data, uint64_t NumElements, Type *ElementTy)

getRaw() constructor - Return a constant with array type with an element count and element type match...

Definition Constants.h:739

ArrayType * getType() const

Specialize the getType() method to always return an ArrayType, which reduces the amount of casting ne...

Definition Constants.h:765

LLVM_ABI APFloat getElementAsAPFloat(uint64_t i) const

If this is a sequential container of floating point type, return the specified element as an APFloat.

LLVM_ABI uint64_t getElementAsInteger(uint64_t i) const

If this is a sequential container of integers (of any size), return the specified element in the low ...

StringRef getAsString() const

If this array is isString(), then this method returns the array as a StringRef.

Definition Constants.h:673

LLVM_ABI Constant * getElementAsConstant(uint64_t i) const

Return a Constant for a specified index's element.

friend class Constant

Definition Constants.h:600

LLVM_ABI uint64_t getElementByteSize() const

Return the size (in bytes) of each element in the array/vector.

ConstantDataSequential(const ConstantDataSequential &)=delete

LLVM_ABI float getElementAsFloat(uint64_t i) const

If this is an sequential container of floats, return the specified element as a float.

LLVM_ABI bool isString(unsigned CharSize=8) const

This method returns true if this is an array of CharSize integers.

LLVM_ABI uint64_t getNumElements() const

Return the number of elements in the array or vector.

StringRef getAsCString() const

If this array is isCString(), then this method returns the array (without the trailing null byte) as ...

Definition Constants.h:680

LLVM_ABI APInt getElementAsAPInt(uint64_t i) const

If this is a sequential container of integers (of any size), return the specified element as an APInt...

static LLVM_ABI Constant * getImpl(StringRef Bytes, Type *Ty)

This is the underlying implementation of all of the ConstantDataSequential::get methods.

friend class LLVMContextImpl

Definition Constants.h:599

LLVM_ABI double getElementAsDouble(uint64_t i) const

If this is an sequential container of doubles, return the specified element as a double.

LLVM_ABI Type * getElementType() const

Return the element type of the array/vector.

LLVM_ABI bool isCString() const

This method returns true if the array "isString", ends with a null byte, and does not contains any ot...

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:692

LLVM_ABI StringRef getRawDataValues() const

Return the raw, underlying, bytes of this data.

static LLVM_ABI bool isElementTypeCompatible(Type *Ty)

Return true if a ConstantDataSequential can be formed with a vector or array of the specified element...

ConstantDataSequential(Type *ty, ValueTy VT, const char *Data)

Definition Constants.h:615

static Constant * getRaw(StringRef Data, uint64_t NumElements, Type *ElementTy)

getRaw() constructor - Return a constant with vector type with an element count and element type matc...

Definition Constants.h:811

LLVM_ABI Constant * getSplatValue() const

If this is a splat constant, meaning that all of the elements have the same value,...

static LLVM_ABI Constant * getSplat(unsigned NumElts, Constant *Elt)

Return a ConstantVector with the specified constant in each element.

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:847

LLVM_ABI bool isSplat() const

Returns true if this is a splat constant, meaning that all elements have the same value.

friend class ConstantDataSequential

Definition Constants.h:782

FixedVectorType * getType() const

Specialize the getType() method to always return a FixedVectorType, which reduces the amount of casti...

Definition Constants.h:842

ConstantDataVector(const ConstantDataVector &)=delete

static LLVM_ABI Constant * get(LLVMContext &Context, ArrayRef< uint8_t > Elts)

get() constructors - Return a constant with vector type with an element count and element type matchi...

static LLVM_ABI Constant * getFP(Type *ElementType, ArrayRef< uint16_t > Elts)

getFP() constructors - Return a constant of vector type with a float element type taken from argument...

static bool classof(const Value *V)

Methods to support type inquiry through isa, cast, and dyn_cast.

Definition Constants.h:76

friend class Constant

Definition Constants.h:59

ConstantData(const ConstantData &)=delete

ConstantData(Type *Ty, ValueTy VT)

Definition Constants.h:66

A constant value that is initialized with an expression using other constant values.

Definition Constants.h:1130

static LLVM_ABI Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)

ConstantExpr(Type *ty, unsigned Opcode, AllocInfo AllocInfo)

Definition Constants.h:1138

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:1402

static LLVM_ABI Constant * getAlignOf(Type *Ty)

getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...

static Constant * getNUWSub(Constant *C1, Constant *C2)

Definition Constants.h:1196

static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)

Create an "inbounds" getelementptr.

Definition Constants.h:1311

friend struct ConstantExprKeyType

Definition Constants.h:1131

static LLVM_ABI Constant * getPointerCast(Constant *C, Type *Ty)

Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.

static LLVM_ABI Constant * getTruncOrBitCast(Constant *C, Type *Ty)

static LLVM_ABI Constant * getPointerBitCastOrAddrSpaceCast(Constant *C, Type *Ty)

Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.

LLVM_ABI bool isCast() const

Return true if this is a convert constant expression.

static Constant * getNSWAdd(Constant *C1, Constant *C2)

Definition Constants.h:1184

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant)

Transparently provide more efficient getOperand methods.

static LLVM_ABI Constant * getCast(unsigned ops, Constant *C, Type *Ty, bool OnlyIfReduced=false)

Convenience function for getting a Cast operation.

static LLVM_ABI Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)

static LLVM_ABI Constant * getNot(Constant *C)

friend class Constant

Definition Constants.h:1132

static LLVM_ABI Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)

static LLVM_ABI Constant * getPtrToAddr(Constant *C, Type *Ty, bool OnlyIfReduced=false)

static LLVM_ABI Constant * getSizeOf(Type *Ty)

getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...

static bool isSupportedGetElementPtr(const Type *SrcElemTy)

Whether creating a constant expression for this getelementptr type is supported.

Definition Constants.h:1397

static Constant * getGetElementPtr(Type *Ty, Constant *C, Constant *Idx, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReducedTy=nullptr)

Definition Constants.h:1293

static LLVM_ABI Constant * getXor(Constant *C1, Constant *C2)

static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Value * > IdxList)

Definition Constants.h:1322

static Constant * getNSWNeg(Constant *C)

Definition Constants.h:1182

static Constant * getNSWSub(Constant *C1, Constant *C2)

Definition Constants.h:1192

static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, Constant *Idx)

Definition Constants.h:1315

static Constant * getNUWAdd(Constant *C1, Constant *C2)

Definition Constants.h:1188

static LLVM_ABI Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)

unsigned getOpcode() const

Return the opcode at the root of this constant expression.

Definition Constants.h:1337

static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReducedTy=nullptr)

Getelementptr form.

Definition Constants.h:1284

static LLVM_ABI Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)

static LLVM_ABI Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)

static LLVM_ABI Constant * getNeg(Constant *C, bool HasNSW=false)

static LLVM_ABI Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)

Constant * getWithOperands(ArrayRef< Constant * > Ops) const

This returns the current constant expression with the operands replaced with the specified values.

Definition Constants.h:1355

ConstantFP(const ConstantFP &)=delete

const APFloat & getValue() const

Definition Constants.h:326

friend class ConstantVector

Definition Constants.h:284

static LLVM_ABI Constant * getSNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)

const APFloat & getValueAPF() const

Definition Constants.h:325

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:356

bool isInfinity() const

Return true if the value is infinity.

Definition Constants.h:335

friend class Constant

Definition Constants.h:283

bool isNegative() const

Return true if the sign bit is set.

Definition Constants.h:332

bool isExactlyValue(double V) const

Definition Constants.h:348

static LLVM_ABI Constant * getInfinity(Type *Ty, bool Negative=false)

static LLVM_ABI Constant * getZero(Type *Ty, bool Negative=false)

static Constant * getNegativeZero(Type *Ty)

Definition Constants.h:320

static LLVM_ABI Constant * getNaN(Type *Ty, bool Negative=false, uint64_t Payload=0)

bool isNaN() const

Return true if the value is a NaN.

Definition Constants.h:338

LLVM_ABI bool isExactlyValue(const APFloat &V) const

We don't rely on operator== working on double values, as it returns true for things that are clearly ...

static LLVM_ABI bool isValueValidForType(Type *Ty, const APFloat &V)

Return true if Ty is big enough to represent V.

static LLVM_ABI Constant * getQNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)

bool isZero() const

Return true if the value is positive or negative zero.

Definition Constants.h:329

This is the shared class of boolean and integer constants.

Definition Constants.h:87

static Constant * getSigned(Type *Ty, int64_t V)

Definition Constants.h:139

bool isMinusOne() const

This function will return true iff every bit in this constant is set to true.

Definition Constants.h:231

friend class ConstantVector

Definition Constants.h:89

bool isOne() const

This is just a convenience method to make client code smaller for a common case.

Definition Constants.h:225

bool isNegative() const

Definition Constants.h:214

uint64_t getLimitedValue(uint64_t Limit=~0ULL) const

getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the l...

Definition Constants.h:269

IntegerType * getIntegerType() const

Variant of the getType() method to always return an IntegerType, which reduces the amount of casting ...

Definition Constants.h:198

static LLVM_ABI bool isValueValidForType(Type *Ty, uint64_t V)

This static method returns true if the type Ty is big enough to represent the value V.

friend class Constant

Definition Constants.h:88

static bool classof(const Value *V)

Methods to support type inquiry through isa, cast, and dyn_cast.

Definition Constants.h:274

static LLVM_ABI ConstantInt * getTrue(LLVMContext &Context)

ConstantInt(const ConstantInt &)=delete

bool isZero() const

This is just a convenience method to make client code smaller for a common code.

Definition Constants.h:219

MaybeAlign getMaybeAlignValue() const

Return the constant as an llvm::MaybeAlign.

Definition Constants.h:179

static ConstantInt * getSigned(IntegerType *Ty, int64_t V)

Return a ConstantInt with the specified value for the specified type.

Definition Constants.h:136

bool isMinValue(bool IsSigned) const

This function will return true iff this constant represents the smallest value that may be represente...

Definition Constants.h:250

static LLVM_ABI ConstantInt * getFalse(LLVMContext &Context)

int64_t getSExtValue() const

Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...

Definition Constants.h:174

bool isMaxValue(bool IsSigned) const

This function will return true iff this constant represents the largest value that may be represented...

Definition Constants.h:238

unsigned getBitWidth() const

getBitWidth - Return the scalar bitwidth of this constant.

Definition Constants.h:162

uint64_t getZExtValue() const

Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...

Definition Constants.h:168

Align getAlignValue() const

Return the constant as an llvm::Align, interpreting 0 as Align(1).

Definition Constants.h:186

bool equalsInt(uint64_t V) const

A helper method that can be used to determine if the constant contained within is equal to a constant...

Definition Constants.h:194

const APInt & getValue() const

Return the constant as an APInt value reference.

Definition Constants.h:159

bool uge(uint64_t Num) const

This function will return true iff this constant represents a value with active bits bigger than 64 b...

Definition Constants.h:262

static LLVM_ABI ConstantInt * getBool(LLVMContext &Context, bool V)

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:584

friend class Constant

Definition Constants.h:564

static LLVM_ABI ConstantPointerNull * get(PointerType *T)

Static factory methods - Return objects of the specified value.

PointerType * getType() const

Specialize the getType() method to always return an PointerType, which reduces the amount of casting ...

Definition Constants.h:579

ConstantPointerNull(const ConstantPointerNull &)=delete

A signed pointer, in the ptrauth sense.

Definition Constants.h:1037

Constant * getAddrDiscriminator() const

The address discriminator if any, or the null constant.

Definition Constants.h:1078

friend struct ConstantPtrAuthKeyType

Definition Constants.h:1038

@ AddrDiscriminator_CtorsDtors

Definition Constants.h:1096

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant)

Transparently provide more efficient getOperand methods.

Constant * getPointer() const

The pointer that is signed in this ptrauth signed pointer.

Definition Constants.h:1065

friend class Constant

Definition Constants.h:1039

ConstantInt * getKey() const

The Key ID, an i32 constant.

Definition Constants.h:1068

Constant * getDeactivationSymbol() const

Definition Constants.h:1087

bool hasAddressDiscriminator() const

Whether there is any non-null address discriminator.

Definition Constants.h:1083

ConstantInt * getDiscriminator() const

The integer discriminator, an i64 constant, or 0.

Definition Constants.h:1071

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:1112

static Constant * getAnon(LLVMContext &Ctx, ArrayRef< Constant * > V, bool Packed=false)

Definition Constants.h:494

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:514

static LLVM_ABI Constant * get(StructType *T, ArrayRef< Constant * > V)

friend class Constant

Definition Constants.h:472

static LLVM_ABI StructType * getTypeForElements(ArrayRef< Constant * > V, bool Packed=false)

Return an anonymous struct type to use for a constant with the specified set of elements.

static std::enable_if_t< are_base_of< Constant, Csts... >::value, Constant * > get(StructType *T, Csts *...Vs)

Definition Constants.h:485

StructType * getType() const

Specialization - reduce amount of casting.

Definition Constants.h:509

static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)

Return an anonymous struct that has the specified elements.

Definition Constants.h:491

static LLVM_ABI ConstantTargetNone * get(TargetExtType *T)

Static factory methods - Return objects of the specified value.

friend class Constant

Definition Constants.h:877

TargetExtType * getType() const

Specialize the getType() method to always return an TargetExtType, which reduces the amount of castin...

Definition Constants.h:892

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast.

Definition Constants.h:897

ConstantTargetNone(const ConstantTargetNone &)=delete

ConstantTokenNone(const ConstantTokenNone &)=delete

friend class Constant

Definition Constants.h:856

static LLVM_ABI ConstantTokenNone * get(LLVMContext &Context)

Return the ConstantTokenNone.

static bool classof(const Value *V)

Methods to support type inquiry through isa, cast, and dyn_cast.

Definition Constants.h:870

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:555

friend class Constant

Definition Constants.h:524

FixedVectorType * getType() const

Specialize the getType() method to always return a FixedVectorType, which reduces the amount of casti...

Definition Constants.h:545

LLVM_ABI Constant * getSplatValue(bool AllowPoison=false) const

If all elements of the vector constant have the same value, return that value.

static LLVM_ABI Constant * getSplat(ElementCount EC, Constant *Elt)

Return a ConstantVector with the specified constant in each element.

static LLVM_ABI Constant * get(ArrayRef< Constant * > V)

This is an important base class in LLVM.

Constant(Type *ty, ValueTy vty, AllocInfo AllocInfo)

Wrapper for a function that represents a value that functionally represents the original function.

Definition Constants.h:957

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:983

GlobalValue * getGlobalValue() const

Definition Constants.h:978

friend class Constant

Definition Constants.h:958

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

A parsed version of the target data layout string in and methods for querying it.

static constexpr ElementCount getFixed(ScalarTy MinVal)

Class to represent fixed width SIMD vectors.

Represents flags for the getelementptr instruction/expression.

static GEPNoWrapFlags inBounds()

static GEPNoWrapFlags none()

Class to represent integer types.

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

Wrapper for a value that won't be replaced with a CFI jump table pointer in LowerTypeTestsModule.

Definition Constants.h:996

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:1025

friend class Constant

Definition Constants.h:997

PointerType * getType() const

NoCFIValue is always a pointer.

Definition Constants.h:1020

DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)

Transparently provide more efficient getOperand methods.

GlobalValue * getGlobalValue() const

Definition Constants.h:1015

Class to represent pointers.

static LLVM_ABI PoisonValue * get(Type *T)

Static factory methods - Return an 'poison' object of the specified type.

PoisonValue(const PoisonValue &)=delete

friend class Constant

Definition Constants.h:1479

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:1507

LLVM_ABI PoisonValue * getStructElement(unsigned Elt) const

If this poison has struct type, return a poison with the right element type for the specified element...

LLVM_ABI PoisonValue * getSequentialElement() const

If this poison has array or vector type, return a poison with the right element type.

LLVM_ABI PoisonValue * getElementValue(Constant *C) const

Return an poison of the right value for the specified GEP index if we can, otherwise return null (e....

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

Class to represent struct types.

Class to represent target extensions types, which are generally unintrospectable from target-independ...

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

LLVM_ABI bool isScalableTy(SmallPtrSetImpl< const Type * > &Visited) const

Return true if this is a type whose size is a known multiple of vscale.

static Type * getScalarTy(LLVMContext &C)

LLVM_ABI UndefValue * getElementValue(Constant *C) const

Return an undef of the right value for the specified GEP index if we can, otherwise return null (e....

LLVM_ABI UndefValue * getStructElement(unsigned Elt) const

If this undef has struct type, return a undef with the right element type for the specified element.

UndefValue(const UndefValue &)=delete

friend class Constant

Definition Constants.h:1431

static bool classof(const Value *V)

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition Constants.h:1465

UndefValue(Type *T, ValueTy vty)

Definition Constants.h:1438

LLVM_ABI UndefValue * getSequentialElement() const

If this Undef has array or vector type, return a undef with the right element type.

LLVM Value Representation.

Type * getType() const

All values are typed, get the type of this value.

unsigned short getSubclassDataFromValue() const

void setValueSubclassData(unsigned short D)

ValueTy

Concrete subclass of this.

Base class of all SIMD vector types.

static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)

This static method is the primary way to construct an VectorType.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)

LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key

FunctionAddr VTableAddr uintptr_t uintptr_t Data

DWARFExpression::Operation Op

ArrayRef(const T &OneElt) -> ArrayRef< T >

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

std::conjunction< std::is_base_of< T, Ts >... > are_base_of

traits class for checking whether type T is a base class for all the given types in the variadic list...

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

FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...

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

Align valueOrOne() const

For convenience, returns a valid alignment or 1 if undefined.

Compile-time customization of User operands.

Information about how a User object was allocated, to be passed into the User constructor.

Indicates this User has operands co-allocated.

VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...