LLVM: include/llvm/SandboxIR/Constant.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_SANDBOXIR_CONSTANT_H

10#define LLVM_SANDBOXIR_CONSTANT_H

11

26

28

31

33protected:

39 friend class Function;

40 friend class Context;

44

45public:

46

49#define DEF_CONST(ID, CLASS) case ClassID::ID:

50#include "llvm/SandboxIR/Values.def"

51 return true;

52 default:

53 return false;

54 }

55 }

60#ifndef NDEBUG

65#endif

66};

67

68

72 friend class Context;

73

74 Use getOperandUseInternal(unsigned OpIdx, bool Verify) const final {

76 }

77

78public:

85

86

87

89

90

91

92

93

94

95

97 bool IsSigned = false);

98

99

100

101

102

103

106

107

108

110

111

112

115

116

117

119

120

121

122

126

127

131

132

133

134

138

139

140

141

142

146

147

148

149

153

154

155

156

160

161

162

163

164

168

169

170

172

173

174

175

176

177

178

179

180

181

184

186

187

188

189

191

192

193

194

195

197

198

199

200

201

203

204

205

206

207

208

212

213

214

215

216

217

221

222

223

224

225

226

230

231

232

233

234

235

239

240

247#ifndef NDEBUG

255#endif

256};

257

258

259class ConstantFP final : public Constant {

262 friend class Context;

263

264public:

265

266

267

268

270

271

272

274

276

278

282 APInt *Payload = nullptr);

284 APInt *Payload = nullptr);

286

289

290

292

299

300

302

303

305

306

308

309

311

312

313

314

315

316

317

321

325

326

330

331

335#ifndef NDEBUG

343#endif

344};

345

346

348protected:

351

352public:

353

356 return ID == ClassID::ConstantVector || ID == ClassID::ConstantStruct ||

357 ID == ClassID::ConstantArray;

358 }

359};

360

364 friend class Context;

365

366public:

369

370

371

372

374 return From->getSubclassID() == ClassID::ConstantArray;

375 }

376};

377

381 friend class Context;

382

383public:

385

386 template <typename... Csts>

391

392

397 bool Packed = false) {

399 }

400

403

404

406 bool Packed = false) {

408 "ConstantStruct::getTypeForElements cannot be called on empty list");

410 }

411

412

416

417

419 return From->getSubclassID() == ClassID::ConstantStruct;

420 }

421};

422

426 friend class Context;

427

428public:

430

431

433

434

438

439

440

442

443

445 return From->getSubclassID() == ClassID::ConstantVector;

446 }

447};

448

449

450class ConstantAggregateZero final : public Constant {

452 : Constant(ClassID::ConstantAggregateZero, C, Ctx) {}

453 friend class Context;

454

455public:

457

458

460

461

463

464

466

468

472

473

475 return From->getSubclassID() == ClassID::ConstantAggregateZero;

476 }

480#ifndef NDEBUG

488#endif

489};

490

491

492

493

494

495

496

497

499protected:

503

504public:

505

506

507

508

512

513

517

518

522

523

527

528

532

533

537

538

539

541 return Ctx.getOrCreateConstant(

543 }

544

546 return Ctx.getType(

548 }

549

553

554

558

562

563

567

568

572

573

577

578

579

583

588};

589

594

595public:

597 return From->getSubclassID() == ClassID::ConstantDataArray;

598 }

599

600

601

602 template

605 return Ctx.getOrCreateConstant(NewLLVMC);

606 }

607

608

609

610 template

614

615

616

617

618

619

620

622 Type *ElementTy) {

623 auto *LLVMC =

626 }

627

628

629

630

631

632

635 return ElementType->getContext().getOrCreateConstant(LLVMC);

636 }

639 return ElementType->getContext().getOrCreateConstant(LLVMC);

640 }

643 return ElementType->getContext().getOrCreateConstant(LLVMC);

644 }

645

646

647

648

649

651 bool AddNull = true) {

652 auto *LLVMC =

654 return Ctx.getOrCreateConstant(LLVMC);

655 }

656

657

658

662};

663

664

665

666

667

668

673

674public:

675

677 return From->getSubclassID() == ClassID::ConstantDataVector;

678 }

679

680

681

684 return Ctx.getOrCreateConstant(NewLLVMC);

685 }

688 return Ctx.getOrCreateConstant(NewLLVMC);

689 }

692 return Ctx.getOrCreateConstant(NewLLVMC);

693 }

696 return Ctx.getOrCreateConstant(NewLLVMC);

697 }

700 return Ctx.getOrCreateConstant(NewLLVMC);

701 }

704 return Ctx.getOrCreateConstant(NewLLVMC);

705 }

706

707

708

709

710

711

712

714 Type *ElementTy) {

715 auto *NewLLVMC =

718 }

719

720

721

722

723

724

727 return ElementType->getContext().getOrCreateConstant(NewLLVMC);

728 }

731 return ElementType->getContext().getOrCreateConstant(NewLLVMC);

732 }

735 return ElementType->getContext().getOrCreateConstant(NewLLVMC);

736 }

737

738

739

740

746

747

748

752

753

754

756 return Ctx.getOrCreateConstant(

758 }

759

760

761

765};

766

767

768class ConstantPointerNull final : public Constant {

770 : Constant(ClassID::ConstantPointerNull, C, Ctx) {}

771 friend class Context;

772

773public:

775

777

778

780 return From->getSubclassID() == ClassID::ConstantPointerNull;

781 }

785#ifndef NDEBUG

793#endif

794};

795

796

798protected:

803 friend class Context;

804

805public:

806

808

809

810

812

813

814

816

817

818

820

821

823

824

828

829

837#ifndef NDEBUG

845#endif

846};

847

851 friend class Context;

852

853public:

854

856

857

858

860

861

862

864

865

866

868

869

871

872

876#ifndef NDEBUG

884#endif

885};

886

888protected:

891 friend class Context;

892

893public:

895

898 case ClassID::Function:

899 case ClassID::GlobalVariable:

900 case ClassID::GlobalAlias:

901 case ClassID::GlobalIFunc:

902 return true;

903 default:

904 return false;

905 }

906 }

907

914

915

916

917

918

919

923

925

930

934

936

937

952

953

954};

955

957protected:

960 friend class Context;

964

965public:

969

972 case ClassID::Function:

973 case ClassID::GlobalVariable:

974 case ClassID::GlobalIFunc:

975 return true;

976 default:

977 return false;

978 }

979 }

980

981

982

983

984

988

989

990

991

992

996

997

998

999

1000

1002

1004

1005

1006

1007

1008

1009

1011

1015

1016

1017

1018

1019

1020

1024};

1025

1026

1027

1028

1029template <typename GlobalT, typename LLVMGlobalT, typename ParentT,

1030 typename LLVMParentT>

1032

1033 struct LLVMGVToGV {

1035 LLVMGVToGV(Context &Ctx) : Ctx(Ctx) {}

1036 LLVM_ABI GlobalT &operator()(LLVMGlobalT &LLVMGV) const;

1037 };

1038

1039public:

1042

1045 return this->Ctx.getModule(LLVMM);

1046 }

1047

1049 decltype(static_cast<LLVMGlobalT *>(nullptr)->getIterator()), LLVMGVToGV>;

1051 decltype(static_cast<LLVMGlobalT *>(nullptr)->getReverseIterator()),

1052 LLVMGVToGV>;

1055 LLVMGVToGV ToGV(this->Ctx);

1056 return map_iterator(LLVMGV->getIterator(), ToGV);

1057 }

1060 LLVMGVToGV ToGV(this->Ctx);

1061 return map_iterator(LLVMGV->getReverseIterator(), ToGV);

1062 }

1063};

1064

1065

1074

1075class GlobalIFunc final

1076 : public GlobalWithNodeAPI<GlobalIFunc, llvm::GlobalIFunc, GlobalObject,

1077 llvm::GlobalObject> {

1080 friend class Context;

1081

1082public:

1083

1085 return From->getSubclassID() == ClassID::GlobalIFunc;

1086 }

1087

1088

1089

1090

1091

1092

1094

1096

1097

1098

1103

1107

1108

1109

1110#ifndef NDEBUG

1118#endif

1119};

1120

1121class GlobalVariable final

1122 : public GlobalWithNodeAPI<GlobalVariable, llvm::GlobalVariable,

1123 GlobalObject, llvm::GlobalObject> {

1126 friend class Context;

1127

1128

1129 struct LLVMGVToGV {

1133 };

1134

1135public:

1136

1138 return From->getSubclassID() == ClassID::GlobalVariable;

1139 }

1140

1141

1142

1146

1147

1148

1149

1150

1151

1152

1153

1154

1155

1156

1157

1158

1159

1160

1161

1162

1166

1167

1168

1172

1173

1174

1175

1176

1178

1179

1180

1182

1183

1184

1185

1186

1187

1188

1193

1198

1199

1200

1201

1202

1203

1204

1205

1206

1207

1208

1212

1213

1217

1218

1222

1223

1227

1228

1232

1233

1237

1238

1239

1240

1244

1245

1249

1250

1251

1255

1256

1257

1258

1259

1263

1264

1268

1269

1270

1271

1272

1273

1275

1276

1277

1278#ifndef NDEBUG

1286#endif

1287};

1288

1289class GlobalAlias final

1290 : public GlobalWithNodeAPI<GlobalAlias, llvm::GlobalAlias, GlobalValue,

1291 llvm::GlobalValue> {

1294 friend class Context;

1295

1296public:

1297

1299 return From->getSubclassID() == ClassID::GlobalAlias;

1300 }

1301

1302

1303

1304

1305

1306

1309

1313 static_cast<const GlobalAlias *>(this)->getAliaseeObject());

1314 }

1315

1319};

1320

1324 friend class Context;

1325

1326 Use getOperandUseInternal(unsigned OpIdx, bool Verify) const final {

1328 }

1329

1330public:

1331

1333

1335

1336

1338

1342

1346

1347#ifndef NDEBUG

1355#endif

1356};

1357

1358class ConstantPtrAuth final : public Constant {

1360 : Constant(ClassID::ConstantPtrAuth, C, Ctx) {}

1361 friend class Context;

1362

1363public:

1364

1367 Constant *DeactivationSymbol);

1368

1370

1371

1373

1374

1376

1377

1378

1379

1381

1383

1384

1388

1389

1390

1391

1392

1397

1398

1399

1400

1404 Key->Val, Discriminator->Val, DL);

1405 }

1406

1407

1408

1410

1411

1413 return From->getSubclassID() == ClassID::ConstantPtrAuth;

1414 }

1415};

1416

1429

1432 : Constant(ClassID::BlockAddress, C, Ctx) {}

1433 friend class Context;

1434

1435public:

1436

1438

1439

1440

1442

1443

1444

1445

1447

1450

1451

1453 return From->getSubclassID() == ClassID::BlockAddress;

1454 }

1455};

1456

1457class DSOLocalEquivalent final : public Constant {

1459 : Constant(ClassID::DSOLocalEquivalent, C, Ctx) {}

1460 friend class Context;

1461

1462public:

1463

1465

1467

1468

1470 return From->getSubclassID() == ClassID::DSOLocalEquivalent;

1471 }

1472

1476

1477#ifndef NDEBUG

1480 "Expected a DSOLocalEquivalent!");

1481 }

1486#endif

1487};

1488

1489

1490class ConstantTokenNone final : public Constant {

1492 : Constant(ClassID::ConstantTokenNone, C, Ctx) {}

1493 friend class Context;

1494

1495public:

1496

1498

1499

1501 return From->getSubclassID() == ClassID::ConstantTokenNone;

1502 }

1503

1507

1508#ifndef NDEBUG

1511 "Expected a ConstantTokenNone!");

1512 }

1517#endif

1518};

1519

1520}

1521

1522#endif

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

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

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

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

#define LLVM_TEMPLATE_ABI

This file contains the declarations for the subclasses of Constant, which represent the different fla...

This file contains the declaration of the GlobalIFunc class, which represents a single indirect funct...

MachineInstr unsigned OpIdx

ppc ctr loops PowerPC CTR Loops Verify

Class for arbitrary precision integers.

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

This class holds the attributes for a particular argument, parameter, function, or return value.

Functions, function parameters, and return types can have attributes to indicate how they should be t...

AttrKind

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

The address of a basic block.

All zero aggregate value.

ConstantArray - Constant Array Declarations.

An array constant whose element type is a simple 1/2/4/8-byte integer or float/double,...

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...

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 ...

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...

ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...

static LLVM_ABI bool isElementTypeCompatible(Type *Ty)

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

A vector constant whose element type is a simple 1/2/4/8-byte integer or float/double,...

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...

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

Return a ConstantVector with the specified constant in each element.

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...

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

ConstantFP - Floating Point Values [float, double].

This is the shared class of boolean and integer constants.

A constant pointer value that points to null.

A signed pointer, in the ptrauth sense.

A constant token which is empty.

Constant Vector Declarations.

This is an important base class in LLVM.

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

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

static bool isValidLinkage(LinkageTypes L)

static bool isValidLinkage(LinkageTypes L)

static UnnamedAddr getMinUnnamedAddr(UnnamedAddr A, UnnamedAddr B)

VisibilityTypes

An enumeration for the kinds of visibility of global values.

LinkageTypes

An enumeration for the kinds of linkage for global values.

A Module instance is used to store all the information related to an LLVM module.

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

In order to facilitate speculative execution, many instructions do not invoke immediate undefined beh...

Interface for looking up the initializer for a variable name, used by Init::resolveReferences.

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

'undef' values are things that do not have specified contents.

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

static LLVM_ABI BlockAddress * lookup(const BasicBlock *BB)

Lookup an existing BlockAddress constant for the given BasicBlock.

LLVM_ABI Function * getFunction() const

friend class Context

Definition Constant.h:1433

LLVM_ABI BasicBlock * getBasicBlock() const

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

Return a BlockAddress for the specified function and basic block.

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1452

static LLVM_ABI ConstantAggregateZero * get(Type *Ty)

ElementCount getElementCount() const

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

Definition Constant.h:469

unsigned getUseOperandNo(const Use &Use) const final

\Returns the operand index of Use.

Definition Constant.h:477

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:474

LLVM_ABI Constant * getSequentialElement() const

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

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:481

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.

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....

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:484

friend class Context

Definition Constant.h:453

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:354

ConstantAggregate(ClassID ID, llvm::Constant *C, Context &Ctx)

Definition Constant.h:349

static bool classof(const Value *From)

For isa/dyn_cast.

Definition Constant.h:373

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

friend class Context

Definition Constant.h:364

LLVM_ABI ArrayType * getType() const

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

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

Definition Constant.h:633

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

Definition Constant.h:641

static bool classof(const Value *From)

Definition Constant.h:596

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

Definition Constant.h:637

ArrayType * getType() const

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

Definition Constant.h:659

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

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

Definition Constant.h:650

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

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

Definition Constant.h:603

friend class Context

Definition Constant.h:593

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

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

Definition Constant.h:611

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 Constant.h:621

uint64_t getElementAsInteger(unsigned ElmIdx) const

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

Definition Constant.h:514

StringRef getRawDataValues() const

Return the raw, underlying, bytes of this data.

Definition Constant.h:580

StringRef getAsCString() const

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

Definition Constant.h:574

Type * getElementType() const

Return the element type of the array/vector.

Definition Constant.h:545

static bool isElementTypeCompatible(Type *Ty)

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

Definition Constant.h:509

unsigned getNumElements() const

Return the number of elements in the array or vector.

Definition Constant.h:550

APFloat getElementAsAPFloat(unsigned ElmIdx) const

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

Definition Constant.h:524

bool isCString() const

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

Definition Constant.h:564

static bool classof(const Value *From)

Definition Constant.h:584

StringRef getAsString() const

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

Definition Constant.h:569

uint64_t getElementByteSize() const

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

Definition Constant.h:555

bool isString(unsigned CharSize=8) const

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

Definition Constant.h:559

float getElementAsFloat(unsigned ElmIdx) const

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

Definition Constant.h:529

double getElementAsDouble(unsigned ElmIdx) const

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

Definition Constant.h:534

Constant * getElementAsConstant(unsigned ElmIdx) const

Return a Constant for a specified index's element.

Definition Constant.h:540

ConstantDataSequential(ClassID ID, llvm::ConstantDataSequential *C, Context &Ctx)

Definition Constant.h:500

APInt getElementAsAPInt(unsigned ElmIdx) const

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

Definition Constant.h:519

static Constant * get(Context &Ctx, ArrayRef< uint32_t > Elts)

Definition Constant.h:690

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

Return a ConstantVector with the specified constant in each element.

Definition Constant.h:741

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

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

Definition Constant.h:725

FixedVectorType * getType() const

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

Definition Constant.h:762

static Constant * get(Context &Ctx, ArrayRef< uint64_t > Elts)

Definition Constant.h:694

static bool classof(const Value *From)

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

Definition Constant.h:676

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

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

Definition Constant.h:682

static Constant * get(Context &Ctx, ArrayRef< float > Elts)

Definition Constant.h:698

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 Constant.h:713

static Constant * get(Context &Ctx, ArrayRef< uint16_t > Elts)

Definition Constant.h:686

static Constant * get(Context &Ctx, ArrayRef< double > Elts)

Definition Constant.h:702

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

Definition Constant.h:733

friend class Context

Definition Constant.h:672

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

Definition Constant.h:729

bool isSplat() const

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

Definition Constant.h:749

Constant * getSplatValue() const

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

Definition Constant.h:755

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1424

friend class Context

Definition Constant.h:1420

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

const APFloat & getValue() const

Definition Constant.h:296

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

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 ...

Definition Constant.h:318

bool isNegative() const

Return true if the sign bit is set.

Definition Constant.h:304

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

static LLVM_ABI Constant * get(Type *Ty, double V)

This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...

bool isZero() const

Return true if the value is positive or negative zero.

Definition Constant.h:301

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:336

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:339

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:327

bool isNaN() const

Return true if the value is a NaN.

Definition Constant.h:310

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

Return true if Ty is big enough to represent V.

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

const APFloat & getValueAPF() const

Definition Constant.h:293

friend class Context

Definition Constant.h:262

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

bool isInfinity() const

Return true if the value is infinity.

Definition Constant.h:307

unsigned getUseOperandNo(const Use &Use) const final

\Returns the operand index of Use.

Definition Constant.h:332

static LLVM_ABI Constant * getNegativeZero(Type *Ty)

bool isExactlyValue(double V) const

Definition Constant.h:322

bool isMinusOne() const

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

Definition Constant.h:202

static LLVM_ABI ConstantInt * getTrue(Context &Ctx)

unsigned getBitWidth() const

getBitWidth - Return the scalar bitwidth of this constant.

Definition Constant.h:128

MaybeAlign getMaybeAlignValue() const

Return the constant as an llvm::MaybeAlign.

Definition Constant.h:150

const APInt & getValue() const

Return the constant as an APInt value reference.

Definition Constant.h:123

bool isZero() const

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

Definition Constant.h:190

bool isMaxValue(bool IsSigned) const

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

Definition Constant.h:209

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 Constant.h:227

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

bool isOne() const

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

Definition Constant.h:196

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:248

int64_t getSExtValue() const

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

Definition Constant.h:143

static LLVM_ABI ConstantInt * getFalse(Context &Ctx)

bool isNegative() const

Definition Constant.h:185

bool isMinValue(bool IsSigned) const

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

Definition Constant.h:218

LLVM_ABI IntegerType * getIntegerType() const

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

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 Constant.h:165

unsigned getUseOperandNo(const Use &Use) const override

\Returns the operand index of Use.

Definition Constant.h:244

static LLVM_ABI ConstantInt * get(Type *Ty, uint64_t V, bool IsSigned=false)

If Ty is a vector type, return a Constant with a splat of the given value.

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:251

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

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

friend class Context

Definition Constant.h:72

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 Constant.h:236

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.

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:241

uint64_t getZExtValue() const

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

Definition Constant.h:135

Align getAlignValue() const

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

Definition Constant.h:157

static LLVM_ABI ConstantPointerNull * get(PointerType *Ty)

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:786

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:789

LLVM_ABI PointerType * getType() const

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:779

unsigned getUseOperandNo(const Use &Use) const final

\Returns the operand index of Use.

Definition Constant.h:782

friend class Context

Definition Constant.h:771

Definition Constant.h:1358

LLVM_ABI ConstantPtrAuth * getWithSameSchema(Constant *Pointer) const

Produce a new ptrauth expression signing the given value using the same schema as is stored in one.

LLVM_ABI Constant * getPointer() const

The pointer that is signed in this ptrauth signed pointer.

LLVM_ABI Constant * getAddrDiscriminator() const

The address discriminator if any, or the null constant.

LLVM_ABI ConstantInt * getDiscriminator() const

The integer discriminator, an i64 constant, or 0.

static LLVM_ABI ConstantPtrAuth * get(Constant *Ptr, ConstantInt *Key, ConstantInt *Disc, Constant *AddrDisc, Constant *DeactivationSymbol)

Return a pointer signed with the specified parameters.

bool hasAddressDiscriminator() const

Whether there is any non-null address discriminator.

Definition Constant.h:1385

bool isKnownCompatibleWith(const Value *Key, const Value *Discriminator, const DataLayout &DL) const

Check whether an authentication operation with key Key and (possibly blended) discriminator Discrimin...

Definition Constant.h:1401

LLVM_ABI ConstantInt * getKey() const

The Key ID, an i32 constant.

bool hasSpecialAddressDiscriminator(uint64_t Value) const

Whether the address uses a special address discriminator.

Definition Constant.h:1393

friend class Context

Definition Constant.h:1361

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1412

Constant * getDeactivationSymbol() const

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

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

Definition Constant.h:388

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

Definition Constant.h:396

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

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

Definition Constant.h:405

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

Return an anonymous struct that has the specified elements.

Definition Constant.h:393

StructType * getType() const

Specialization - reduce amount of casting.

Definition Constant.h:413

friend class Context

Definition Constant.h:381

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

This version of the method allows an empty list.

static bool classof(const Value *From)

For isa/dyn_cast.

Definition Constant.h:418

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:1513

unsigned getUseOperandNo(const Use &Use) const final

\Returns the operand index of Use.

Definition Constant.h:1504

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:1509

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1500

static LLVM_ABI ConstantTokenNone * get(Context &Ctx)

Return the ConstantTokenNone.

friend class Context

Definition Constant.h:1493

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

Return a ConstantVector with the specified constant in each element.

static bool classof(const Value *From)

For isa/dyn_cast.

Definition Constant.h:444

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

LLVM_ABI Constant * getSplatValue(bool AllowPoison=false) const

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

FixedVectorType * getType() const

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

Definition Constant.h:435

friend class Context

Definition Constant.h:426

sandboxir::Context & getParent() const

Definition Constant.h:56

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:61

void dumpOS(raw_ostream &OS) const override

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:47

Constant(llvm::Constant *C, sandboxir::Context &SBCtx)

Definition Constant.h:34

Constant(ClassID ID, llvm::Constant *C, sandboxir::Context &SBCtx)

Definition Constant.h:36

friend class Function

Definition Constant.h:39

friend class Context

Definition Constant.h:40

unsigned getUseOperandNo(const Use &Use) const override

\Returns the operand index of Use.

Definition Constant.h:57

friend class ConstantInt

Definition Constant.h:38

Use getOperandUseInternal(unsigned OpIdx, bool Verify) const override

\Returns the Use for the OpIdx'th operand.

Definition Constant.h:41

LLVM_ABI Constant * getOrCreateConstant(llvm::Constant *LLVMC)

Get or create a sandboxir::Constant from an existing LLVM IR LLVMC.

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1469

static LLVM_ABI DSOLocalEquivalent * get(GlobalValue *GV)

Return a DSOLocalEquivalent for the specified global value.

unsigned getUseOperandNo(const Use &Use) const final

\Returns the operand index of Use.

Definition Constant.h:1473

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:1478

LLVM_ABI GlobalValue * getGlobalValue() const

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:1482

friend class Context

Definition Constant.h:1460

static bool isValidLinkage(LinkageTypes L)

Definition Constant.h:1316

LLVM_ABI Constant * getAliasee() const

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1298

LLVM_ABI const GlobalObject * getAliaseeObject() const

LLVM_ABI void setAliasee(Constant *Aliasee)

friend class Context

Definition Constant.h:1294

GlobalObject * getAliaseeObject()

Definition Constant.h:1311

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:1111

static bool isValidLinkage(LinkageTypes L)

Definition Constant.h:1104

const Function * getResolverFunction() const

Definition Constant.h:1100

LLVM_ABI Constant * getResolver() const

LLVM_ABI void setResolver(Constant *Resolver)

LLVM_ABI Function * getResolverFunction()

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1084

friend class Context

Definition Constant.h:1080

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:1114

Definition Constant.h:956

Use getOperandUseInternal(unsigned OpIdx, bool Verify) const final

\Returns the Use for the OpIdx'th operand.

Definition Constant.h:961

bool hasComdat() const

Definition Constant.h:1003

VCallVisibility getVCallVisibility() const

Definition Constant.h:1012

bool hasSection() const

Check if this global has a custom object file section.

Definition Constant.h:985

StringRef getSection() const

Get the custom section of this global if it has one.

Definition Constant.h:993

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:970

friend class Context

Definition Constant.h:960

unsigned getUseOperandNo(const Use &Use) const final

\Returns the operand index of Use.

Definition Constant.h:966

llvm::GlobalObject::VCallVisibility VCallVisibility

Definition Constant.h:1010

LLVM_ABI void setSection(StringRef S)

Change the section for this global.

GlobalObject(ClassID ID, llvm::GlobalObject *C, Context &Ctx)

Definition Constant.h:958

bool canIncreaseAlignment() const

Returns true if the alignment of the value can be unilaterally increased.

Definition Constant.h:1021

Definition Constant.h:887

UnnamedAddr getUnnamedAddr() const

Definition Constant.h:926

bool hasDefaultVisibility() const

Definition Constant.h:942

bool hasComdat() const

Definition Constant.h:935

bool hasAtLeastLocalUnnamedAddr() const

Returns true if this value's address is not significant in this module.

Definition Constant.h:920

llvm::GlobalValue::UnnamedAddr UnnamedAddr

Definition Constant.h:924

LLVM_ABI void setUnnamedAddr(UnnamedAddr V)

bool hasHiddenVisibility() const

Definition Constant.h:945

VisibilityTypes getVisibility() const

Definition Constant.h:939

unsigned getAddressSpace() const

Definition Constant.h:908

bool hasGlobalUnnamedAddr() const

Definition Constant.h:911

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:896

llvm::GlobalValue::VisibilityTypes VisibilityTypes

Definition Constant.h:938

friend class Context

Definition Constant.h:891

static UnnamedAddr getMinUnnamedAddr(UnnamedAddr A, UnnamedAddr B)

Definition Constant.h:931

llvm::GlobalValue::LinkageTypes LinkageTypes

Definition Constant.h:894

bool hasProtectedVisibility() const

Definition Constant.h:948

GlobalValue(ClassID ID, llvm::GlobalValue *C, Context &Ctx)

Definition Constant.h:889

LLVM_ABI void setVisibility(VisibilityTypes V)

Definition Constant.h:1123

LLVM_ABI Constant * getInitializer() const

getInitializer - Return the initializer for this global variable.

AttributeSet getAttributes() const

Return the attribute set for this global.

Definition Constant.h:1234

bool isExternallyInitialized() const

Definition Constant.h:1194

Attribute getAttribute(Attribute::AttrKind Kind) const

Return the attribute object.

Definition Constant.h:1224

AttributeList getAttributesAsList(unsigned Index) const

Return attribute set as list with index.

Definition Constant.h:1241

unsigned getCodeModelRaw() const

Get the custom code model raw value of this global.

Definition Constant.h:1252

bool hasImplicitSection() const

Check if section name is present.

Definition Constant.h:1246

bool hasDefinitiveInitializer() const

hasDefinitiveInitializer - Whether the global variable has an initializer, and any other instances of...

Definition Constant.h:1163

bool hasInitializer() const

Definitions have initializers, declarations don't.

Definition Constant.h:1143

Attribute getAttribute(StringRef Kind) const

Return the attribute object.

Definition Constant.h:1229

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1137

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:1279

LLVM_ABI void setExternallyInitialized(bool Val)

bool hasAttribute(Attribute::AttrKind Kind) const

Return true if the attribute exists.

Definition Constant.h:1209

bool hasAttribute(StringRef Kind) const

Return true if the attribute exists.

Definition Constant.h:1214

LLVM_ABI void setInitializer(Constant *InitVal)

setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...

LLVM_ABI void setAlignment(MaybeAlign Align)

Sets the alignment attribute of the GlobalVariable.

LLVM_ABI void setConstant(bool V)

bool hasAttributes() const

Return true if any attributes exist.

Definition Constant.h:1219

std::optional< CodeModel::Model > getCodeModel() const

Get the custom code model of this global if it has one.

Definition Constant.h:1260

friend class Context

Definition Constant.h:1126

bool isConstant() const

If the value is a global constant, its value is immutable throughout the runtime execution of the pro...

Definition Constant.h:1189

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:1282

MaybeAlign getAlign() const

Returns the alignment of the given variable.

Definition Constant.h:1265

bool hasUniqueInitializer() const

hasUniqueInitializer - Whether the global variable has an initializer, and any changes made to the in...

Definition Constant.h:1169

GlobalWithNodeAPI(Value::ClassID ID, LLVMParentT *C, Context &Ctx)

Definition Constant.h:1040

iterator getIterator() const

Definition Constant.h:1053

mapped_iterator< decltype(static_cast< LLVMGlobalT * >(nullptr) ->getReverseIterator()), LLVMGVToGV > reverse_iterator

Definition Constant.h:1050

reverse_iterator getReverseIterator() const

Definition Constant.h:1058

Module * getParent() const

Definition Constant.h:1043

mapped_iterator< decltype(static_cast< LLVMGlobalT * >(nullptr) ->getIterator()), LLVMGVToGV > iterator

Definition Constant.h:1048

Class to represent integer types.

In SandboxIR the Module is mainly used to access the list of global objects.

Definition Constant.h:1321

LLVM_ABI PointerType * getType() const

NoCFIValue is always a pointer.

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:1339

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:1351

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:1348

LLVM_ABI GlobalValue * getGlobalValue() const

unsigned getUseOperandNo(const Use &Use) const final

\Returns the operand index of Use.

Definition Constant.h:1343

friend class Context

Definition Constant.h:1324

static LLVM_ABI NoCFIValue * get(GlobalValue *GV)

Return a NoCFIValue for the specified function.

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:880

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:877

LLVM_ABI PoisonValue * getSequentialElement() const

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

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...

friend class Context

Definition Constant.h:851

static LLVM_ABI PoisonValue * get(Type *T)

Static factory methods - Return an 'poison' object of the specified 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....

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:873

Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...

Context & getContext() const

unsigned getUseOperandNo(const Use &Use) const final

\Returns the operand index of Use.

Definition Constant.h:834

void verify() const override

Should crash if there is something wrong with the instruction.

Definition Constant.h:838

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....

static LLVM_ABI UndefValue * get(Type *T)

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

void dumpOS(raw_ostream &OS) const override

Definition Constant.h:841

UndefValue(ClassID ID, llvm::Constant *C, Context &Ctx)

Definition Constant.h:801

static bool classof(const sandboxir::Value *From)

For isa/dyn_cast.

Definition Constant.h:830

UndefValue(llvm::UndefValue *C, Context &Ctx)

Definition Constant.h:799

unsigned getNumElements() const

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

Definition Constant.h:825

LLVM_ABI UndefValue * getSequentialElement() const

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

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.

friend class Context

Definition Constant.h:803

Represents a Def-use/Use-def edge in SandboxIR.

A sandboxir::User has operands.

unsigned getUseOperandNoDefault(const Use &Use) const

The default implementation works only for single-LLVMIR-instruction Users and only if they match exac...

Use getOperandUseDefault(unsigned OpIdx, bool Verify) const

\Returns the Use edge that corresponds to OpIdx.

User(ClassID ID, llvm::Value *V, Context &Ctx)

A SandboxIR Value has users. This is the base class.

llvm::Value * Val

The LLVM Value that corresponds to this SandboxIR Value.

friend class ConstantStruct

friend class ConstantVector

ClassID getSubclassID() const

friend class ConstantDataVector

void dumpCommonSuffix(raw_ostream &OS) const

Context & Ctx

All values point to the context.

friend class ConstantPointerNull

friend class ConstantPtrAuth

LLVM_ABI Type * getType() const

friend class ConstantExpr

Context & getContext() const

friend class GlobalVariable

friend class BlockAddress

friend class ConstantArray

friend class ConstantDataArray

void dumpCommonPrefix(raw_ostream &OS) const

friend class ConstantAggregateZero

friend class DSOLocalEquivalent

#define llvm_unreachable(msg)

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

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

@ C

The default llvm calling convention, compatible with C.

Context & getContext() const

BasicBlock(llvm::BasicBlock *BB, Context &SBCtx)

mapped_iterator< ItTy, FuncTy > map_iterator(ItTy I, FuncTy F)

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

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

FunctionAddr VTableAddr uintptr_t uintptr_t Data

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.

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