LLVM: lib/IR/Core.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

44#include

45#include

46#include

47#include <system_error>

48

49using namespace llvm;

50

52

54 return reinterpret_cast<BasicBlock **>(BBs);

55}

56

57#define DEBUG_TYPE "ir"

58

65}

66

69}

70

71

72

73void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch) {

74 if (Major)

75 *Major = LLVM_VERSION_MAJOR;

76 if (Minor)

77 *Minor = LLVM_VERSION_MINOR;

78 if (Patch)

79 *Patch = LLVM_VERSION_PATCH;

80}

81

82

83

85 return strdup(Message);

86}

87

89 free(Message);

90}

91

92

93

94

97 return GlobalContext;

98}

99

102}

103

105

108 void *DiagnosticContext) {

109 unwrap(C)->setDiagnosticHandlerCallBack(

111 Handler),

112 DiagnosticContext);

113}

114

117 unwrap(C)->getDiagnosticHandlerCallBack());

118}

119

121 return unwrap(C)->getDiagnosticContext();

122}

123

125 void *OpaqueHandle) {

126 auto YieldCallback =

128 unwrap(C)->setYieldCallback(YieldCallback, OpaqueHandle);

129}

130

132 return unwrap(C)->shouldDiscardValueNames();

133}

134

136 unwrap(C)->setDiscardValueNames(Discard);

137}

138

141}

142

144 unsigned SLen) {

146}

147

150}

151

154}

155

158}

159

161 return Attribute::AttrKind::EndAttrKinds;

162}

163

169}

170

172 return unwrap(A).getKindAsEnum();

173}

174

177 if (Attr.isEnumAttribute())

178 return 0;

179 return Attr.getValueAsInt();

180}

181

187}

188

191 return wrap(Attr.getValueAsType());

192}

193

195 unsigned KindID,

196 unsigned NumBits,

198 const uint64_t UpperWords[]) {

201 unsigned NumWords = divideCeil(NumBits, 64);

203 Ctx, AttrKind,

205 APInt(NumBits, ArrayRef(UpperWords, NumWords)))));

206}

207

209 const char *K, unsigned KLength,

210 const char *V, unsigned VLength) {

213}

214

217 auto S = unwrap(A).getKindAsString();

219 return S.data();

220}

221

224 auto S = unwrap(A).getValueAsString();

226 return S.data();

227}

228

231 return Attr.isEnumAttribute() || Attr.isIntAttribute();

232}

233

235 return unwrap(A).isStringAttribute();

236}

237

239 return unwrap(A).isTypeAttribute();

240}

241

243 std::string MsgStorage;

246

249

251}

252

255

256 switch(unwrap(DI)->getSeverity()) {

257 default:

259 break;

262 break;

265 break;

268 break;

269 }

270

271 return severity;

272}

273

274

275

278}

279

283}

284

287}

288

290 auto &Str = unwrap(M)->getModuleIdentifier();

291 *Len = Str.length();

292 return Str.c_str();

293}

294

297}

298

300 auto &Str = unwrap(M)->getSourceFileName();

301 *Len = Str.length();

302 return Str.c_str();

303}

304

307}

308

309

311 return unwrap(M)->getDataLayoutStr().c_str();

312}

313

316}

317

319 unwrap(M)->setDataLayout(DataLayoutStr);

320}

321

322

324 return unwrap(M)->getTargetTriple().c_str();

325}

326

329}

330

331

337};

338

341 switch (Behavior) {

343 return Module::ModFlagBehavior::Error;

345 return Module::ModFlagBehavior::Warning;

347 return Module::ModFlagBehavior::Require;

349 return Module::ModFlagBehavior::Override;

351 return Module::ModFlagBehavior::Append;

353 return Module::ModFlagBehavior::AppendUnique;

354 }

356}

357

360 switch (Behavior) {

361 case Module::ModFlagBehavior::Error:

363 case Module::ModFlagBehavior::Warning:

365 case Module::ModFlagBehavior::Require:

367 case Module::ModFlagBehavior::Override:

369 case Module::ModFlagBehavior::Append:

371 case Module::ModFlagBehavior::AppendUnique:

373 default:

375 }

376}

377

380 unwrap(M)->getModuleFlagsMetadata(MFEs);

381

384 for (unsigned i = 0; i < MFEs.size(); ++i) {

385 const auto &ModuleFlag = MFEs[i];

387 Result[i].Key = ModuleFlag.Key->getString().data();

388 Result[i].KeyLen = ModuleFlag.Key->getString().size();

389 Result[i].Metadata = wrap(ModuleFlag.Val);

390 }

391 *Len = MFEs.size();

392 return Result;

393}

394

396 free(Entries);

397}

398

401 unsigned Index) {

405}

406

408 unsigned Index, size_t *Len) {

412 return MFE.Key;

413}

414

416 unsigned Index) {

420}

421

423 const char *Key, size_t KeyLen) {

424 return wrap(unwrap(M)->getModuleFlag({Key, KeyLen}));

425}

426

428 const char *Key, size_t KeyLen,

431 {Key, KeyLen}, unwrap(Val));

432}

433

436}

437

440}

441

442

443

446 false, true);

447}

448

450 char **ErrorMessage) {

451 std::error_code EC;

453 if (EC) {

454 *ErrorMessage = strdup(EC.message().c_str());

455 return true;

456 }

457

459

461

463 std::string E = "Error printing to file: " + dest.error().message();

464 *ErrorMessage = strdup(E.c_str());

465 return true;

466 }

467

468 return false;

469}

470

472 std::string buf;

474

477

478 return strdup(buf.c_str());

479}

480

481

484}

485

488}

489

492}

493

495 auto &Str = unwrap(M)->getModuleInlineAsm();

496 *Len = Str.length();

497 return Str.c_str();

498}

499

501 size_t AsmStringSize, const char *Constraints,

502 size_t ConstraintsSize, LLVMBool HasSideEffects,

506 switch (Dialect) {

509 break;

512 break;

513 }

515 StringRef(AsmString, AsmStringSize),

516 StringRef(Constraints, ConstraintsSize),

517 HasSideEffects, IsAlignStack, AD, CanThrow));

518}

519

521

522 Value *Val = unwrap(InlineAsmVal);

523 const std::string &AsmString = cast(Val)->getAsmString();

524

525 *Len = AsmString.length();

526 return AsmString.c_str();

527}

528

530 size_t *Len) {

531 Value *Val = unwrap(InlineAsmVal);

532 const std::string &ConstraintString =

533 cast(Val)->getConstraintString();

534

535 *Len = ConstraintString.length();

536 return ConstraintString.c_str();

537}

538

540

541 Value *Val = unwrap(InlineAsmVal);

543

544 switch (Dialect) {

549 }

550

553}

554

556 Value *Val = unwrap(InlineAsmVal);

557 return (LLVMTypeRef)cast(Val)->getFunctionType();

558}

559

561 Value *Val = unwrap(InlineAsmVal);

562 return cast(Val)->hasSideEffects();

563}

564

566 Value *Val = unwrap(InlineAsmVal);

567 return cast(Val)->isAlignStack();

568}

569

571 Value *Val = unwrap(InlineAsmVal);

572 return cast(Val)->canThrow();

573}

574

575

577 return wrap(&unwrap(M)->getContext());

578}

579

580

581

582

583

584

628 llvm_unreachable("Typed pointers are unsupported via the C API");

629 }

631}

632

634{

635 return unwrap(Ty)->isSized();

636}

637

639 return wrap(&unwrap(Ty)->getContext());

640}

641

644}

645

647 std::string buf;

649

652 else

653 os << "Printing Type";

654

656

657 return strdup(buf.c_str());

658}

659

660

661

664}

667}

670}

673}

676}

679}

682}

683

686}

689}

692}

695}

698}

701}

704}

705

707 return unwrap(IntegerTy)->getBitWidth();

708}

709

710

711

714}

717}

720}

723}

726}

729}

732}

735}

736

739}

742}

745}

748}

751}

754}

757}

760}

761

762

763

765 LLVMTypeRef *ParamTypes, unsigned ParamCount,

768 return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));

769}

770

772 return unwrap(FunctionTy)->isVarArg();

773}

774

776 return wrap(unwrap(FunctionTy)->getReturnType());

777}

778

780 return unwrap(FunctionTy)->getNumParams();

781}

782

784 FunctionType *Ty = unwrap(FunctionTy);

785 for (Type *T : Ty->params())

786 *Dest++ = wrap(T);

787}

788

789

790

795}

796

801}

802

804{

806}

807

809{

811 if (Type->hasName())

812 return nullptr;

813 return Type->getName().data();

814}

815

819 unwrap(StructTy)->setBody(Tys, Packed != 0);

820}

821

823 return unwrap(StructTy)->getNumElements();

824}

825

827 StructType *Ty = unwrap(StructTy);

829 *Dest++ = wrap(T);

830}

831

833 StructType *Ty = unwrap(StructTy);

835}

836

838 return unwrap(StructTy)->isPacked();

839}

840

842 return unwrap(StructTy)->isOpaque();

843}

844

846 return unwrap(StructTy)->isLiteral();

847}

848

851}

852

855}

856

857

858

860 int i = 0;

861 for (auto *T : unwrap(Tp)->subtypes()) {

862 Arr[i] = wrap(T);

863 i++;

864 }

865}

866

869}

870

873}

874

878}

879

881 return true;

882}

883

886}

887

891}

892

894 auto *Ty = unwrap(WrappedTy);

895 if (auto *ATy = dyn_cast(Ty))

896 return wrap(ATy->getElementType());

897 return wrap(cast(Ty)->getElementType());

898}

899

901 return unwrap(Tp)->getNumContainedTypes();

902}

903

905 return unwrap(ArrayTy)->getNumElements();

906}

907

909 return unwrap(ArrayTy)->getNumElements();

910}

911

913 return unwrap(PointerTy)->getAddressSpace();

914}

915

917 return unwrap(VectorTy)->getElementCount().getKnownMinValue();

918}

919

921 return wrap(unwrap(PtrAuth)->getPointer());

922}

923

925 return wrap(unwrap(PtrAuth)->getKey());

926}

927

929 return wrap(unwrap(PtrAuth)->getDiscriminator());

930}

931

933 return wrap(unwrap(PtrAuth)->getAddrDiscriminator());

934}

935

936

937

940}

941

944}

947}

950}

953}

954

957}

960}

961

964 unsigned TypeParamCount,

965 unsigned *IntParams,

966 unsigned IntParamCount) {

971}

972

975 return Type->getName().data();

976}

977

980 return Type->getNumTypeParameters();

981}

982

984 unsigned Idx) {

986 return wrap(Type->getTypeParameter(Idx));

987}

988

991 return Type->getNumIntParameters();

992}

993

996 return Type->getIntParameter(Idx);

997}

998

999

1000

1001

1002

1005}

1006

1008 switch(unwrap(Val)->getValueID()) {

1009#define LLVM_C_API 1

1010#define HANDLE_VALUE(Name) \

1011 case Value::Name##Val: \

1012 return LLVM##Name##ValueKind;

1013#include "llvm/IR/Value.def"

1014 default:

1016 }

1017}

1018

1020 auto *V = unwrap(Val);

1021 *Length = V->getName().size();

1022 return V->getName().data();

1023}

1024

1027}

1028

1031}

1032

1035}

1036

1039}

1040

1042 std::string buf;

1044

1047 else

1048 os << "Printing Value";

1049

1051

1052 return strdup(buf.c_str());

1053}

1054

1056 return wrap(&unwrap(Val)->getContext());

1057}

1058

1060 std::string buf;

1062

1065 else

1066 os << "Printing DbgRecord";

1067

1069

1070 return strdup(buf.c_str());

1071}

1072

1075}

1076

1078 return unwrap(Inst)->hasMetadata();

1079}

1080

1082 auto *I = unwrap(Inst);

1083 assert(I && "Expected instruction");

1084 if (auto *MD = I->getMetadata(KindID))

1086 return nullptr;

1087}

1088

1089

1090

1091

1094 assert((isa(MD) || isa(MD)) &&

1095 "Expected a metadata node or a canonicalized constant");

1096

1097 if (MDNode *N = dyn_cast(MD))

1098 return N;

1099

1101}

1102

1105

1106 unwrap(Inst)->setMetadata(KindID, N);

1107}

1108

1112};

1113

1119 AccessMD(MVEs);

1120

1124 for (unsigned i = 0; i < MVEs.size(); ++i) {

1125 const auto &ModuleFlag = MVEs[i];

1126 Result[i].Kind = ModuleFlag.first;

1127 Result[i].Metadata = wrap(ModuleFlag.second);

1128 }

1129 *NumEntries = MVEs.size();

1130 return Result;

1131}

1132

1135 size_t *NumEntries) {

1137 Entries.clear();

1138 unwrap(Value)->getAllMetadata(Entries);

1139 });

1140}

1141

1142

1143

1144#define LLVM_DEFINE_VALUE_CAST(name) \

1145 LLVMValueRef LLVMIsA##name(LLVMValueRef Val) { \

1146 return wrap(static_cast<Value*>(dyn_cast_or_null(unwrap(Val)))); \

1147 }

1148

1150

1152 if (auto *MD = dyn_cast_or_null(unwrap(Val)))

1153 if (isa(MD->getMetadata()) ||

1154 isa(MD->getMetadata()))

1155 return Val;

1156 return nullptr;

1157}

1158

1160 if (auto *MD = dyn_cast_or_null(unwrap(Val)))

1161 if (isa(MD->getMetadata()))

1162 return Val;

1163 return nullptr;

1164}

1165

1167 if (auto *MD = dyn_cast_or_null(unwrap(Val)))

1168 if (isa(MD->getMetadata()))

1169 return Val;

1170 return nullptr;

1171}

1172

1173

1177 if (I == V->use_end())

1178 return nullptr;

1179 return wrap(&*I);

1180}

1181

1183 Use *Next = unwrap(U)->getNext();

1184 if (Next)

1185 return wrap(Next);

1186 return nullptr;

1187}

1188

1191}

1192

1195}

1196

1197

1198

1200 unsigned Index) {

1202 if (Op)

1203 return nullptr;

1204 if (auto *C = dyn_cast(Op))

1205 return wrap(C->getValue());

1207}

1208

1211 if (auto *MD = dyn_cast(V)) {

1212 if (auto *L = dyn_cast(MD->getMetadata())) {

1213 assert(Index == 0 && "Function-local metadata can only have one operand");

1214 return wrap(L->getValue());

1215 }

1217 cast(MD->getMetadata()), Index);

1218 }

1219

1220 return wrap(cast(V)->getOperand(Index));

1221}

1222

1225 return wrap(&cast(V)->getOperandUse(Index));

1226}

1227

1229 unwrap(Val)->setOperand(Index, unwrap(Op));

1230}

1231

1234 if (isa(V))

1236

1237 return cast(V)->getNumOperands();

1238}

1239

1240

1241

1244}

1245

1248}

1249

1252}

1253

1256}

1257

1259 return isa(unwrap(Ty));

1260}

1261

1264 return C->isNullValue();

1265 return false;

1266}

1267

1269 return isa(unwrap(Val));

1270}

1271

1273 return isa(unwrap(Val));

1274}

1275

1278}

1279

1280

1281

1283 size_t SLen) {

1285}

1286

1288 size_t Count) {

1290}

1291

1293 unsigned SLen) {

1297}

1298

1301}

1302

1304 unsigned Count) {

1307 for (auto *OV : ArrayRef(Vals, Count)) {

1310 if (!V)

1311 MD = nullptr;

1312 else if (auto *C = dyn_cast(V))

1314 else if (auto *MDV = dyn_cast(V)) {

1315 MD = MDV->getMetadata();

1316 assert(!isa(MD) && "Unexpected function-local metadata "

1317 "outside of direct argument to call");

1318 } else {

1319

1320 assert(Count == 1 &&

1321 "Expected only one operand to function-local metadata");

1323 }

1324

1326 }

1328}

1329

1332}

1333

1336}

1337

1339 auto *V = unwrap(Val);

1340 if (auto *C = dyn_cast(V))

1342 if (auto *MAV = dyn_cast(V))

1343 return wrap(MAV->getMetadata());

1345}

1346

1348 if (const auto *MD = dyn_cast(unwrap(V)))

1349 if (const MDString *S = dyn_cast(MD->getMetadata())) {

1350 *Length = S->getString().size();

1351 return S->getString().data();

1352 }

1354 return nullptr;

1355}

1356

1358 auto *MD = unwrap(V);

1359 if (isa(MD->getMetadata()))

1360 return 1;

1361 return cast(MD->getMetadata())->getNumOperands();

1362}

1363

1367 if (I == Mod->named_metadata_end())

1368 return nullptr;

1369 return wrap(&*I);

1370}

1371

1375 if (I == Mod->named_metadata_begin())

1376 return nullptr;

1377 return wrap(&*--I);

1378}

1379

1384 return nullptr;

1385 return wrap(&*I);

1386}

1387

1392 return nullptr;

1393 return wrap(&*--I);

1394}

1395

1397 const char *Name, size_t NameLen) {

1399}

1400

1402 const char *Name, size_t NameLen) {

1403 return wrap(unwrap(M)->getOrInsertNamedMetadata({Name, NameLen}));

1404}

1405

1410}

1411

1413 auto *MD = unwrap(V);

1414 if (auto *MDV = dyn_cast(MD->getMetadata())) {

1415 *Dest = wrap(MDV->getValue());

1416 return;

1417 }

1418 const auto *N = cast(MD->getMetadata());

1419 const unsigned numOperands = N->getNumOperands();

1421 for (unsigned i = 0; i < numOperands; i++)

1423}

1424

1427 auto *MD = cast(unwrap(V));

1428 auto *N = cast(MD->getMetadata());

1429 N->replaceOperandWith(Index, unwrap(Replacement));

1430}

1431

1434 return N->getNumOperands();

1435 }

1436 return 0;

1437}

1438

1442 if (N)

1443 return;

1445 for (unsigned i=0;i<N->getNumOperands();i++)

1447}

1448

1452 if (N)

1453 return;

1454 if (!Val)

1455 return;

1456 N->addOperand(extractMDNode(unwrap(Val)));

1457}

1458

1460 if (Length) return nullptr;

1462 if (const auto *I = dyn_cast(unwrap(Val))) {

1463 if (const auto &DL = I->getDebugLoc()) {

1464 S = DL->getDirectory();

1465 }

1466 } else if (const auto *GV = dyn_cast(unwrap(Val))) {

1468 GV->getDebugInfo(GVEs);

1469 if (GVEs.size())

1471 S = DGV->getDirectory();

1472 } else if (const auto *F = dyn_cast(unwrap(Val))) {

1473 if (const DISubprogram *DSP = F->getSubprogram())

1474 S = DSP->getDirectory();

1475 } else {

1476 assert(0 && "Expected Instruction, GlobalVariable or Function");

1477 return nullptr;

1478 }

1480 return S.data();

1481}

1482

1484 if (Length) return nullptr;

1486 if (const auto *I = dyn_cast(unwrap(Val))) {

1487 if (const auto &DL = I->getDebugLoc()) {

1488 S = DL->getFilename();

1489 }

1490 } else if (const auto *GV = dyn_cast(unwrap(Val))) {

1492 GV->getDebugInfo(GVEs);

1493 if (GVEs.size())

1495 S = DGV->getFilename();

1496 } else if (const auto *F = dyn_cast(unwrap(Val))) {

1497 if (const DISubprogram *DSP = F->getSubprogram())

1498 S = DSP->getFilename();

1499 } else {

1500 assert(0 && "Expected Instruction, GlobalVariable or Function");

1501 return nullptr;

1502 }

1504 return S.data();

1505}

1506

1508 unsigned L = 0;

1509 if (const auto *I = dyn_cast(unwrap(Val))) {

1510 if (const auto &DL = I->getDebugLoc()) {

1511 L = DL->getLine();

1512 }

1513 } else if (const auto *GV = dyn_cast(unwrap(Val))) {

1515 GV->getDebugInfo(GVEs);

1516 if (GVEs.size())

1518 L = DGV->getLine();

1519 } else if (const auto *F = dyn_cast(unwrap(Val))) {

1520 if (const DISubprogram *DSP = F->getSubprogram())

1521 L = DSP->getLine();

1522 } else {

1523 assert(0 && "Expected Instruction, GlobalVariable or Function");

1524 return -1;

1525 }

1526 return L;

1527}

1528

1530 unsigned C = 0;

1531 if (const auto *I = dyn_cast(unwrap(Val)))

1532 if (const auto &DL = I->getDebugLoc())

1533 C = DL->getColumn();

1534 return C;

1535}

1536

1537

1538

1541 return wrap(ConstantInt::get(unwrap(IntTy), N, SignExtend != 0));

1542}

1543

1545 unsigned NumWords,

1547 IntegerType *Ty = unwrap(IntTy);

1548 return wrap(ConstantInt::get(

1550}

1551

1554 return wrap(ConstantInt::get(unwrap(IntTy), StringRef(Str),

1555 Radix));

1556}

1557

1559 unsigned SLen, uint8_t Radix) {

1560 return wrap(ConstantInt::get(unwrap(IntTy), StringRef(Str, SLen),

1561 Radix));

1562}

1563

1565 return wrap(ConstantFP::get(unwrap(RealTy), N));

1566}

1567

1570}

1571

1573 unsigned SLen) {

1575}

1576

1578 return unwrap(ConstantVal)->getZExtValue();

1579}

1580

1582 return unwrap(ConstantVal)->getSExtValue();

1583}

1584

1586 ConstantFP *cFP = unwrap(ConstantVal) ;

1588

1591 *LosesInfo = false;

1593 }

1594

1595 bool APFLosesInfo;

1597 APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &APFLosesInfo);

1598 *LosesInfo = APFLosesInfo;

1600}

1601

1602

1603

1606 LLVMBool DontNullTerminate) {

1607

1608

1610 DontNullTerminate == 0));

1611}

1612

1615 LLVMBool DontNullTerminate) {

1616

1617

1619 DontNullTerminate == 0));

1620}

1621

1623 LLVMBool DontNullTerminate) {

1625 DontNullTerminate);

1626}

1627

1629 return wrap(unwrap(C)->getAggregateElement(Idx));

1630}

1631

1633 return wrap(unwrap(C)->getElementAsConstant(idx));

1634}

1635

1637 return unwrap(C)->isString();

1638}

1639

1641 StringRef Str = unwrap(C)->getAsString();

1642 *Length = Str.size();

1643 return Str.data();

1644}

1645

1650}

1651

1656}

1657

1660 unsigned Count, LLVMBool Packed) {

1661 Constant **Elements = unwrap(ConstantVals, Count);

1663 Packed != 0));

1664}

1665

1669 Packed);

1670}

1671

1674 unsigned Count) {

1675 Constant **Elements = unwrap(ConstantVals, Count);

1676 StructType *Ty = unwrap(StructTy);

1677

1679}

1680

1683 ArrayRef(unwrap(ScalarConstantVals, Size), Size)));

1684}

1685

1689 unwrap(Ptr), unwrap(Key),

1690 unwrap(Disc), unwrap(AddrDisc)));

1691}

1692

1693

1694

1696{

1697 switch (opcode) {

1699#define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;

1700#include "llvm/IR/Instruction.def"

1701#undef HANDLE_INST

1702 }

1703}

1704

1706{

1707 switch (code) {

1708#define HANDLE_INST(num, opc, clas) case LLVM##opc: return num;

1709#include "llvm/IR/Instruction.def"

1710#undef HANDLE_INST

1711 }

1713}

1714

1715

1716

1725

1726 return NewGEPFlags;

1727}

1728

1737

1738 return NewGEPFlags;

1739}

1740

1741

1742

1745}

1746

1749}

1750

1753}

1754

1757}

1758

1761}

1762

1765}

1766

1767

1770}

1771

1774 unwrap(RHSConstant)));

1775}

1776

1780 unwrap(RHSConstant)));

1781}

1782

1786 unwrap(RHSConstant)));

1787}

1788

1791 unwrap(RHSConstant)));

1792}

1793

1797 unwrap(RHSConstant)));

1798}

1799

1803 unwrap(RHSConstant)));

1804}

1805

1808 unwrap(RHSConstant)));

1809}

1810

1814 unwrap(RHSConstant)));

1815}

1816

1820 unwrap(RHSConstant)));

1821}

1822

1825 unwrap(RHSConstant)));

1826}

1827

1829 LLVMValueRef *ConstantIndices, unsigned NumIndices) {

1831 NumIndices);

1832 Constant *Val = unwrap(ConstantVal);

1834}

1835

1838 unsigned NumIndices) {

1840 NumIndices);

1841 Constant *Val = unwrap(ConstantVal);

1843}

1844

1848 unsigned NumIndices,

1851 NumIndices);

1852 Constant *Val = unwrap(ConstantVal);

1855}

1856

1860}

1861

1865}

1866

1870}

1871

1875}

1876

1881}

1882

1887}

1888

1893}

1894

1898 unwrap(IndexConstant)));

1899}

1900

1905 unwrap(ElementValueConstant),

1906 unwrap(IndexConstant)));

1907}

1908

1915 unwrap(VectorBConstant),

1916 IntMask));

1917}

1918

1920 const char *Constraints,

1924 Constraints, HasSideEffects, IsAlignStack));

1925}

1926

1929}

1930

1932 return wrap(unwrap(BlockAddr)->getFunction());

1933}

1934

1936 return wrap(unwrap(BlockAddr)->getBasicBlock());

1937}

1938

1939

1940

1943}

1944

1946 return unwrap(Global)->isDeclaration();

1947}

1948

1950 switch (unwrap(Global)->getLinkage()) {

1973 }

1974

1976}

1977

1980

1981 switch (Linkage) {

1984 break;

1987 break;

1990 break;

1993 break;

1996 errs() << "LLVMSetLinkage(): LLVMLinkOnceODRAutoHideLinkage is no "

1997 "longer supported.");

1998 break;

2001 break;

2004 break;

2007 break;

2010 break;

2013 break;

2016 break;

2019 break;

2023 << "LLVMSetLinkage(): LLVMDLLImportLinkage is no longer supported.");

2024 break;

2028 << "LLVMSetLinkage(): LLVMDLLExportLinkage is no longer supported.");

2029 break;

2032 break;

2035 errs() << "LLVMSetLinkage(): LLVMGhostLinkage is no longer supported.");

2036 break;

2039 break;

2040 }

2041}

2042

2044

2045

2046 return unwrap(Global)->getSection().data();

2047}

2048

2050 unwrap(Global)->setSection(Section);

2051}

2052

2055 unwrap(Global)->getVisibility());

2056}

2057

2059 unwrap(Global)

2061}

2062

2065 unwrap(Global)->getDLLStorageClass());

2066}

2067

2069 unwrap(Global)->setDLLStorageClass(

2071}

2072

2074 switch (unwrap(Global)->getUnnamedAddr()) {

2075 case GlobalVariable::UnnamedAddr::None:

2077 case GlobalVariable::UnnamedAddr::Local:

2079 case GlobalVariable::UnnamedAddr::Global:

2081 }

2083}

2084

2087

2088 switch (UnnamedAddr) {

2090 return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::None);

2092 return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Local);

2094 return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Global);

2095 }

2096}

2097

2099 return unwrap(Global)->hasGlobalUnnamedAddr();

2100}

2101

2103 unwrap(Global)->setUnnamedAddr(

2104 HasUnnamedAddr ? GlobalValue::UnnamedAddr::Global

2105 : GlobalValue::UnnamedAddr::None);

2106}

2107

2110}

2111

2112

2113

2116 if (GlobalObject *GV = dyn_cast(P))

2117 return GV->getAlign() ? GV->getAlign()->value() : 0;

2118 if (AllocaInst *AI = dyn_cast(P))

2119 return AI->getAlign().value();

2120 if (LoadInst *LI = dyn_cast(P))

2121 return LI->getAlign().value();

2122 if (StoreInst *SI = dyn_cast(P))

2123 return SI->getAlign().value();

2124 if (AtomicRMWInst *RMWI = dyn_cast(P))

2125 return RMWI->getAlign().value();

2127 return CXI->getAlign().value();

2128

2130 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, "

2131 "and AtomicCmpXchgInst have alignment");

2132}

2133

2136 if (GlobalObject *GV = dyn_cast(P))

2137 GV->setAlignment(MaybeAlign(Bytes));

2138 else if (AllocaInst *AI = dyn_cast(P))

2139 AI->setAlignment(Align(Bytes));

2140 else if (LoadInst *LI = dyn_cast(P))

2141 LI->setAlignment(Align(Bytes));

2142 else if (StoreInst *SI = dyn_cast(P))

2143 SI->setAlignment(Align(Bytes));

2144 else if (AtomicRMWInst *RMWI = dyn_cast(P))

2145 RMWI->setAlignment(Align(Bytes));

2147 CXI->setAlignment(Align(Bytes));

2148 else

2150 "only GlobalValue, AllocaInst, LoadInst, StoreInst, AtomicRMWInst, and "

2151 "and AtomicCmpXchgInst have alignment");

2152}

2153

2155 size_t *NumEntries) {

2157 Entries.clear();

2159 Instr->getAllMetadata(Entries);

2160 } else {

2161 unwrap(Value)->getAllMetadata(Entries);

2162 }

2163 });

2164}

2165

2167 unsigned Index) {

2170 return MVE.Kind;

2171}

2172

2175 unsigned Index) {

2179}

2180

2182 free(Entries);

2183}

2184

2187 unwrap(Global)->setMetadata(Kind, unwrap(MD));

2188}

2189

2191 unwrap(Global)->eraseMetadata(Kind);

2192}

2193

2195 unwrap(Global)->clearMetadata();

2196}

2197

2198

2199

2203}

2204

2206 const char *Name,

2210 nullptr, GlobalVariable::NotThreadLocal,

2212}

2213

2216}

2217

2221}

2222

2226 if (I == Mod->global_end())

2227 return nullptr;

2228 return wrap(&*I);

2229}

2230

2234 if (I == Mod->global_begin())

2235 return nullptr;

2236 return wrap(&*--I);

2237}

2238

2240 GlobalVariable *GV = unwrap(GlobalVar);

2243 return nullptr;

2244 return wrap(&*I);

2245}

2246

2248 GlobalVariable *GV = unwrap(GlobalVar);

2251 return nullptr;

2252 return wrap(&*--I);

2253}

2254

2256 unwrap(GlobalVar)->eraseFromParent();

2257}

2258

2260 GlobalVariable* GV = unwrap(GlobalVar);

2262 return nullptr;

2264}

2265

2267 unwrap(GlobalVar)->setInitializer(

2268 ConstantVal ? unwrap(ConstantVal) : nullptr);

2269}

2270

2272 return unwrap(GlobalVar)->isThreadLocal();

2273}

2274

2276 unwrap(GlobalVar)->setThreadLocal(IsThreadLocal != 0);

2277}

2278

2280 return unwrap(GlobalVar)->isConstant();

2281}

2282

2284 unwrap(GlobalVar)->setConstant(IsConstant != 0);

2285}

2286

2288 switch (unwrap(GlobalVar)->getThreadLocalMode()) {

2289 case GlobalVariable::NotThreadLocal:

2291 case GlobalVariable::GeneralDynamicTLSModel:

2293 case GlobalVariable::LocalDynamicTLSModel:

2295 case GlobalVariable::InitialExecTLSModel:

2297 case GlobalVariable::LocalExecTLSModel:

2299 }

2300

2301 llvm_unreachable("Invalid GlobalVariable thread local mode");

2302}

2303

2305 GlobalVariable *GV = unwrap(GlobalVar);

2306

2307 switch (Mode) {

2310 break;

2313 break;

2316 break;

2319 break;

2322 break;

2323 }

2324}

2325

2327 return unwrap(GlobalVar)->isExternallyInitialized();

2328}

2329

2331 unwrap(GlobalVar)->setExternallyInitialized(IsExtInit);

2332}

2333

2334

2335

2338 const char *Name) {

2341 unwrap(Aliasee), unwrap(M)));

2342}

2343

2345 const char *Name, size_t NameLen) {

2347}

2348

2352 if (I == Mod->alias_end())

2353 return nullptr;

2354 return wrap(&*I);

2355}

2356

2360 if (I == Mod->alias_begin())

2361 return nullptr;

2362 return wrap(&*--I);

2363}

2364

2366 GlobalAlias *Alias = unwrap(GA);

2369 return nullptr;

2370 return wrap(&*I);

2371}

2372

2374 GlobalAlias *Alias = unwrap(GA);

2377 return nullptr;

2378 return wrap(&*--I);

2379}

2380

2382 return wrap(unwrap(Alias)->getAliasee());

2383}

2384

2386 unwrap(Alias)->setAliasee(unwrap(Aliasee));

2387}

2388

2389

2390

2395}

2396

2399}

2400

2404}

2405

2409 if (I == Mod->end())

2410 return nullptr;

2411 return wrap(&*I);

2412}

2413

2417 if (I == Mod->begin())

2418 return nullptr;

2419 return wrap(&*--I);

2420}

2421

2423 Function *Func = unwrap(Fn);

2425 if (++I == Func->getParent()->end())

2426 return nullptr;

2427 return wrap(&*I);

2428}

2429

2431 Function *Func = unwrap(Fn);

2433 if (I == Func->getParent()->begin())

2434 return nullptr;

2435 return wrap(&*--I);

2436}

2437

2439 unwrap(Fn)->eraseFromParent();

2440}

2441

2443 return unwrap(Fn)->hasPersonalityFn();

2444}

2445

2447 return wrap(unwrap(Fn)->getPersonalityFn());

2448}

2449

2451 unwrap(Fn)->setPersonalityFn(

2452 PersonalityFn ? unwrap(PersonalityFn) : nullptr);

2453}

2454

2457 return F->getIntrinsicID();

2458 return 0;

2459}

2460

2462 assert(ID < llvm::Intrinsic::num_intrinsics && "Intrinsic ID out of range");

2464}

2465

2467 unsigned ID,

2469 size_t ParamCount) {

2473}

2474

2478 *NameLength = Str.size();

2479 return Str.data();

2480}

2481

2483 LLVMTypeRef *ParamTypes, size_t ParamCount) {

2487}

2488

2490 size_t ParamCount, size_t *NameLength) {

2494 *NameLength = Str.length();

2495 return strdup(Str.c_str());

2496}

2497

2500 size_t ParamCount, size_t *NameLength) {

2504 *NameLength = Str.length();

2505 return strdup(Str.c_str());

2506}

2507

2510}

2511

2515}

2516

2518 return unwrap(Fn)->getCallingConv();

2519}

2520

2522 return unwrap(Fn)->setCallingConv(

2524}

2525

2527 Function *F = unwrap(Fn);

2528 return F->hasGC()? F->getGC().c_str() : nullptr;

2529}

2530

2532 Function *F = unwrap(Fn);

2533 if (GC)

2534 F->setGC(GC);

2535 else

2536 F->clearGC();

2537}

2538

2540 Function *F = unwrap(Fn);

2541 return wrap(F->getPrefixData());

2542}

2543

2545 Function *F = unwrap(Fn);

2546 return F->hasPrefixData();

2547}

2548

2550 Function *F = unwrap(Fn);

2551 Constant *prefix = unwrap(prefixData);

2552 F->setPrefixData(prefix);

2553}

2554

2556 Function *F = unwrap(Fn);

2557 return wrap(F->getPrologueData());

2558}

2559

2561 Function *F = unwrap(Fn);

2562 return F->hasPrologueData();

2563}

2564

2566 Function *F = unwrap(Fn);

2567 Constant *prologue = unwrap(prologueData);

2568 F->setPrologueData(prologue);

2569}

2570

2573 unwrap(F)->addAttributeAtIndex(Idx, unwrap(A));

2574}

2575

2577 auto AS = unwrap(F)->getAttributes().getAttributes(Idx);

2578 return AS.getNumAttributes();

2579}

2580

2583 auto AS = unwrap(F)->getAttributes().getAttributes(Idx);

2584 for (auto A : AS)

2585 *Attrs++ = wrap(A);

2586}

2587

2590 unsigned KindID) {

2591 return wrap(unwrap(F)->getAttributeAtIndex(

2593}

2594

2597 const char *K, unsigned KLen) {

2598 return wrap(

2599 unwrap(F)->getAttributeAtIndex(Idx, StringRef(K, KLen)));

2600}

2601

2603 unsigned KindID) {

2605}

2606

2608 const char *K, unsigned KLen) {

2609 unwrap(F)->removeAttributeAtIndex(Idx, StringRef(K, KLen));

2610}

2611

2613 const char *V) {

2614 Function *Func = unwrap(Fn);

2616 Func->addFnAttr(Attr);

2617}

2618

2619

2620

2622

2623

2624 return unwrap(FnRef)->arg_size();

2625}

2626

2628 Function *Fn = unwrap(FnRef);

2630 *ParamRefs++ = wrap(&A);

2631}

2632

2634 Function *Fn = unwrap(FnRef);

2636}

2637

2640}

2641

2643 Function *Func = unwrap(Fn);

2645 if (I == Func->arg_end())

2646 return nullptr;

2647 return wrap(&*I);

2648}

2649

2651 Function *Func = unwrap(Fn);

2653 if (I == Func->arg_begin())

2654 return nullptr;

2655 return wrap(&*--I);

2656}

2657

2659 Argument *A = unwrap(Arg);

2661 if (A->getArgNo() + 1 >= Fn->arg_size())

2662 return nullptr;

2664}

2665

2667 Argument *A = unwrap(Arg);

2668 if (A->getArgNo() == 0)

2669 return nullptr;

2670 return wrap(&A->getParent()->arg_begin()[A->getArgNo() - 1]);

2671}

2672

2674 Argument *A = unwrap(Arg);

2676}

2677

2678

2679

2681 const char *Name, size_t NameLen,

2688}

2689

2691 const char *Name, size_t NameLen) {

2693}

2694

2698 if (I == Mod->ifunc_end())

2699 return nullptr;

2700 return wrap(&*I);

2701}

2702

2706 if (I == Mod->ifunc_begin())

2707 return nullptr;

2708 return wrap(&*--I);

2709}

2710

2712 GlobalIFunc *GIF = unwrap(IFunc);

2715 return nullptr;

2716 return wrap(&*I);

2717}

2718

2720 GlobalIFunc *GIF = unwrap(IFunc);

2723 return nullptr;

2724 return wrap(&*--I);

2725}

2726

2728 return wrap(unwrap(IFunc)->getResolver());

2729}

2730

2732 unwrap(IFunc)->setResolver(unwrap(Resolver));

2733}

2734

2736 unwrap(IFunc)->eraseFromParent();

2737}

2738

2740 unwrap(IFunc)->removeFromParent();

2741}

2742

2743

2744

2747 unsigned NumArgs) {

2750}

2751

2753 delete unwrap(Bundle);

2754}

2755

2758 *Len = Str.size();

2759 return Str.data();

2760}

2761

2763 return unwrap(Bundle)->inputs().size();

2764}

2765

2767 unsigned Index) {

2768 return wrap(unwrap(Bundle)->inputs()[Index]);

2769}

2770

2771

2772

2775}

2776

2778 return isa(unwrap(Val));

2779}

2780

2782 return wrap(unwrap(Val));

2783}

2784

2787}

2788

2791}

2792

2794 return wrap(unwrap(BB)->getTerminator());

2795}

2796

2798 return unwrap(FnRef)->size();

2799}

2800

2802 Function *Fn = unwrap(FnRef);

2804 *BasicBlocksRefs++ = wrap(&BB);

2805}

2806

2808 return wrap(&unwrap(Fn)->getEntryBlock());

2809}

2810

2812 Function *Func = unwrap(Fn);

2814 if (I == Func->end())

2815 return nullptr;

2816 return wrap(&*I);

2817}

2818

2820 Function *Func = unwrap(Fn);

2822 if (I == Func->begin())

2823 return nullptr;

2824 return wrap(&*--I);

2825}

2826

2830 if (++I == Block->getParent()->end())

2831 return nullptr;

2832 return wrap(&*I);

2833}

2834

2838 if (I == Block->getParent()->begin())

2839 return nullptr;

2840 return wrap(&*--I);

2841}

2842

2844 const char *Name) {

2846}

2847

2852 assert(CurBB && "current insertion point is invalid!");

2854}

2855

2858 unwrap(Fn)->insert(unwrap(Fn)->end(), unwrap(BB));

2859}

2860

2863 const char *Name) {

2865}

2866

2869}

2870

2873 const char *Name) {

2876}

2877

2879 const char *Name) {

2881}

2882

2885}

2886

2889}

2890

2893}

2894

2897}

2898

2899

2900

2902 return wrap(unwrap(Inst)->getParent());

2903}

2904

2908 if (I == Block->end())

2909 return nullptr;

2910 return wrap(&*I);

2911}

2912

2916 if (I == Block->begin())

2917 return nullptr;

2918 return wrap(&*--I);

2919}

2920

2922 Instruction *Instr = unwrap(Inst);

2924 if (++I == Instr->getParent()->end())

2925 return nullptr;

2926 return wrap(&*I);

2927}

2928

2930 Instruction *Instr = unwrap(Inst);

2932 if (I == Instr->getParent()->begin())

2933 return nullptr;

2934 return wrap(&*--I);

2935}

2936

2938 unwrap(Inst)->removeFromParent();

2939}

2940

2942 unwrap(Inst)->eraseFromParent();

2943}

2944

2946 unwrap(Inst)->deleteValue();

2947}

2948

2953}

2954

2959}

2960

2965}

2966

2969 return wrap(C->clone());

2970 return nullptr;

2971}

2972

2975 return (I && I->isTerminator()) ? wrap(I) : nullptr;

2976}

2977

2979 Instruction *Instr = unwrap(Inst);

2980 auto I = Instr->DebugMarker->StoredDbgRecords.begin();

2981 if (I == Instr->DebugMarker->StoredDbgRecords.end())

2982 return nullptr;

2983 return wrap(&*I);

2984}

2985

2987 Instruction *Instr = unwrap(Inst);

2988 auto I = Instr->DebugMarker->StoredDbgRecords.rbegin();

2989 if (I == Instr->DebugMarker->StoredDbgRecords.rend())

2990 return nullptr;

2991 return wrap(&*I);

2992}

2993

2997 if (++I == Record->getInstruction()->DebugMarker->StoredDbgRecords.end())

2998 return nullptr;

2999 return wrap(&*I);

3000}

3001

3005 if (I == Record->getInstruction()->DebugMarker->StoredDbgRecords.begin())

3006 return nullptr;

3007 return wrap(&*--I);

3008}

3009

3012 return FPI->arg_size();

3013 }

3014 return unwrap(Instr)->arg_size();

3015}

3016

3017

3018

3020 return unwrap(Instr)->getCallingConv();

3021}

3022

3024 return unwrap(Instr)->setCallingConv(

3026}

3027

3029 unsigned align) {

3030 auto *Call = unwrap(Instr);

3033 Call->addAttributeAtIndex(Idx, AlignAttr);

3034}

3035

3038 unwrap(C)->addAttributeAtIndex(Idx, unwrap(A));

3039}

3040

3043 auto *Call = unwrap(C);

3044 auto AS = Call->getAttributes().getAttributes(Idx);

3045 return AS.getNumAttributes();

3046}

3047

3050 auto *Call = unwrap(C);

3051 auto AS = Call->getAttributes().getAttributes(Idx);

3052 for (auto A : AS)

3053 *Attrs++ = wrap(A);

3054}

3055

3058 unsigned KindID) {

3059 return wrap(unwrap(C)->getAttributeAtIndex(

3061}

3062

3065 const char *K, unsigned KLen) {

3066 return wrap(

3067 unwrap(C)->getAttributeAtIndex(Idx, StringRef(K, KLen)));

3068}

3069

3071 unsigned KindID) {

3073}

3074

3076 const char *K, unsigned KLen) {

3077 unwrap(C)->removeAttributeAtIndex(Idx, StringRef(K, KLen));

3078}

3079

3081 return wrap(unwrap(Instr)->getCalledOperand());

3082}

3083

3085 return wrap(unwrap(Instr)->getFunctionType());

3086}

3087

3089 return unwrap(C)->getNumOperandBundles();

3090}

3091

3093 unsigned Index) {

3094 return wrap(

3095 new OperandBundleDef(unwrap(C)->getOperandBundleAt(Index)));

3096}

3097

3098

3099

3101 return unwrap(Call)->isTailCall();

3102}

3103

3105 unwrap(Call)->setTailCall(isTailCall);

3106}

3107

3109 return (LLVMTailCallKind)unwrap(Call)->getTailCallKind();

3110}

3111

3114}

3115

3116

3117

3119 return wrap(unwrap(Invoke)->getNormalDest());

3120}

3121

3124 return wrap(CRI->getUnwindDest());

3126 return wrap(CSI->getUnwindDest());

3127 }

3128 return wrap(unwrap(Invoke)->getUnwindDest());

3129}

3130

3132 unwrap(Invoke)->setNormalDest(unwrap(B));

3133}

3134

3137 return CRI->setUnwindDest(unwrap(B));

3139 return CSI->setUnwindDest(unwrap(B));

3140 }

3141 unwrap(Invoke)->setUnwindDest(unwrap(B));

3142}

3143

3145 return wrap(unwrap(CallBr)->getDefaultDest());

3146}

3147

3149 return unwrap(CallBr)->getNumIndirectDests();

3150}

3151

3153 return wrap(unwrap(CallBr)->getIndirectDest(Idx));

3154}

3155

3156

3157

3159 return unwrap(Term)->getNumSuccessors();

3160}

3161

3163 return wrap(unwrap(Term)->getSuccessor(i));

3164}

3165

3167 return unwrap(Term)->setSuccessor(i, unwrap(block));

3168}

3169

3170

3171

3173 return unwrap(Branch)->isConditional();

3174}

3175

3177 return wrap(unwrap(Branch)->getCondition());

3178}

3179

3181 return unwrap(Branch)->setCondition(unwrap(Cond));

3182}

3183

3184

3185

3187 return wrap(unwrap(Switch)->getDefaultDest());

3188}

3189

3190

3191

3193 return wrap(unwrap(Alloca)->getAllocatedType());

3194}

3195

3196

3197

3199 return unwrap(GEP)->isInBounds();

3200}

3201

3203 return unwrap(GEP)->setIsInBounds(InBounds);

3204}

3205

3207 return wrap(unwrap(GEP)->getSourceElementType());

3208}

3209

3213}

3214

3218}

3219

3220

3221

3224 PHINode *PhiVal = unwrap(PhiNode);

3225 for (unsigned I = 0; I != Count; ++I)

3227}

3228

3230 return unwrap(PhiNode)->getNumIncomingValues();

3231}

3232

3234 return wrap(unwrap(PhiNode)->getIncomingValue(Index));

3235}

3236

3238 return wrap(unwrap(PhiNode)->getIncomingBlock(Index));

3239}

3240

3241

3242

3245 if (auto *GEP = dyn_cast(I))

3246 return GEP->getNumIndices();

3247 if (auto *EV = dyn_cast(I))

3248 return EV->getNumIndices();

3249 if (auto *IV = dyn_cast(I))

3250 return IV->getNumIndices();

3252 "LLVMGetNumIndices applies only to extractvalue and insertvalue!");

3253}

3254

3257 if (auto *EV = dyn_cast(I))

3258 return EV->getIndices().data();

3259 if (auto *IV = dyn_cast(I))

3260 return IV->getIndices().data();

3262 "LLVMGetIndices applies only to extractvalue and insertvalue!");

3263}

3264

3265

3266

3267

3270}

3271

3274}

3275

3277 Instruction *Instr, bool BeforeDbgRecords) {

3279 I.setHeadBit(BeforeDbgRecords);

3281}

3282

3286 unwrap(Instr), false);

3287}

3288

3293 unwrap(Instr), true);

3294}

3295

3297 Instruction *I = unwrap(Instr);

3299}

3300

3303 Instruction *I = unwrap(Instr);

3305}

3306

3309 unwrap(Builder)->SetInsertPoint(BB);

3310}

3311

3313 return wrap(unwrap(Builder)->GetInsertBlock());

3314}

3315

3317 unwrap(Builder)->ClearInsertionPoint();

3318}

3319

3321 unwrap(Builder)->Insert(unwrap(Instr));

3322}

3323

3325 const char *Name) {

3326 unwrap(Builder)->Insert(unwrap(Instr), Name);

3327}

3328

3330 delete unwrap(Builder);

3331}

3332

3333

3334

3336 return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode());

3337}

3338

3340 if (Loc)

3341 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap(Loc)));

3342 else

3343 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc());

3344}

3345

3348 L ? cast(unwrap(L)->getMetadata()) : nullptr;

3349 unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(Loc));

3350}

3351

3355 Context, unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()));

3356}

3357

3359 unwrap(Builder)->SetInstDebugLocation(unwrap(Inst));

3360}

3361

3363 unwrap(Builder)->AddMetadataToInst(unwrap(Inst));

3364}

3365

3368

3369 unwrap(Builder)->setDefaultFPMathTag(FPMathTag

3370 ? unwrap(FPMathTag)

3371 : nullptr);

3372}

3373

3375 return wrap(&unwrap(Builder)->getContext());

3376}

3377

3379 return wrap(unwrap(Builder)->getDefaultFPMathTag());

3380}

3381

3382

3383

3385 return wrap(unwrap(B)->CreateRetVoid());

3386}

3387

3390}

3391

3393 unsigned N) {

3395}

3396

3399}

3400

3404}

3405

3409}

3410

3412 unsigned NumDests) {

3414}

3415

3419 unsigned NumIndirectDests, LLVMValueRef *Args,

3421 unsigned NumBundles, const char *Name) {

3422

3424 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {

3427 }

3428

3430 unwrap(Ty), unwrap(Fn), unwrap(DefaultDest),

3433}

3434

3438 const char *Name) {

3439 return wrap(unwrap(B)->CreateInvoke(unwrap(Ty), unwrap(Fn),

3442}

3443

3449 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {

3452 }

3456}

3457

3460 const char *Name) {

3461

3462

3463

3464 if (PersFn)

3466 unwrap(PersFn));

3468}

3469

3472 const char *Name) {

3475}

3476

3479 const char *Name) {

3480 if (ParentPad == nullptr) {

3483 }

3484 return wrap(unwrap(B)->CreateCleanupPad(

3486}

3487

3490}

3491

3494 unsigned NumHandlers, const char *Name) {

3495 if (ParentPad == nullptr) {

3498 }

3500 NumHandlers, Name));

3501}

3502

3505 return wrap(unwrap(B)->CreateCatchRet(unwrap(CatchPad),

3507}

3508

3511 return wrap(unwrap(B)->CreateCleanupRet(unwrap(CatchPad),

3513}

3514

3516 return wrap(unwrap(B)->CreateUnreachable());

3517}

3518

3521 unwrap(Switch)->addCase(unwrap(OnVal), unwrap(Dest));

3522}

3523

3525 unwrap(IndirectBr)->addDestination(unwrap(Dest));

3526}

3527

3529 return unwrap(LandingPad)->getNumClauses();

3530}

3531

3533 return wrap(unwrap(LandingPad)->getClause(Idx));

3534}

3535

3537 unwrap(LandingPad)->addClause(unwrap(ClauseVal));

3538}

3539

3541 return unwrap(LandingPad)->isCleanup();

3542}

3543

3545 unwrap(LandingPad)->setCleanup(Val);

3546}

3547

3549 unwrap(CatchSwitch)->addHandler(unwrap(Dest));

3550}

3551

3553 return unwrap(CatchSwitch)->getNumHandlers();

3554}

3555

3557 CatchSwitchInst *CSI = unwrap(CatchSwitch);

3559 *Handlers++ = wrap(H);

3560}

3561

3563 return wrap(unwrap(CatchPad)->getCatchSwitch());

3564}

3565

3567 unwrap(CatchPad)

3568 ->setCatchSwitch(unwrap(CatchSwitch));

3569}

3570

3571

3572

3574 return wrap(unwrap(Funclet)->getArgOperand(i));

3575}

3576

3578 unwrap(Funclet)->setArgOperand(i, unwrap(value));

3579}

3580

3581

3582

3592

3593 return NewFMF;

3594}

3595

3612

3613 return NewFMF;

3614}

3615

3617 const char *Name) {

3619}

3620

3622 const char *Name) {

3624}

3625

3627 const char *Name) {

3629}

3630

3632 const char *Name) {

3634}

3635

3637 const char *Name) {

3639}

3640

3642 const char *Name) {

3644}

3645

3647 const char *Name) {

3649}

3650

3652 const char *Name) {

3654}

3655

3657 const char *Name) {

3659}

3660

3662 const char *Name) {

3664}

3665

3667 const char *Name) {

3669}

3670

3672 const char *Name) {

3674}

3675

3677 const char *Name) {

3679}

3680

3684}

3685

3687 const char *Name) {

3689}

3690

3694}

3695

3697 const char *Name) {

3699}

3700

3702 const char *Name) {

3704}

3705

3707 const char *Name) {

3709}

3710

3712 const char *Name) {

3714}

3715

3717 const char *Name) {

3719}

3720

3722 const char *Name) {

3724}

3725

3727 const char *Name) {

3729}

3730

3732 const char *Name) {

3734}

3735

3737 const char *Name) {

3739}

3740

3742 const char *Name) {

3744}

3745

3748 const char *Name) {

3751}

3752

3755}

3756

3758 const char *Name) {

3760}

3761

3763 const char *Name) {

3765 if (auto *I = dyn_cast(Neg))

3766 I->setHasNoUnsignedWrap();

3767 return wrap(Neg);

3768}

3769

3772}

3773

3776}

3777

3779 Value *P = unwrap(ArithInst);

3780 return cast(P)->hasNoUnsignedWrap();

3781}

3782

3784 Value *P = unwrap(ArithInst);

3785 cast(P)->setHasNoUnsignedWrap(HasNUW);

3786}

3787

3789 Value *P = unwrap(ArithInst);

3790 return cast(P)->hasNoSignedWrap();

3791}

3792

3794 Value *P = unwrap(ArithInst);

3795 cast(P)->setHasNoSignedWrap(HasNSW);

3796}

3797

3799 Value *P = unwrap(DivOrShrInst);

3800 return cast(P)->isExact();

3801}

3802

3804 Value *P = unwrap(DivOrShrInst);

3805 cast(P)->setIsExact(IsExact);

3806}

3807

3809 Value *P = unwrap(NonNegInst);

3810 return cast(P)->hasNonNeg();

3811}

3812

3814 Value *P = unwrap(NonNegInst);

3815 cast(P)->setNonNeg(IsNonNeg);

3816}

3817

3819 Value *P = unwrap(FPMathInst);

3820 FastMathFlags FMF = cast(P)->getFastMathFlags();

3822}

3823

3825 Value *P = unwrap(FPMathInst);

3827}

3828

3830 Value *Val = unwrap(V);

3831 return isa(Val);

3832}

3833

3835 Value *P = unwrap(Inst);

3836 return cast(P)->isDisjoint();

3837}

3838

3840 Value *P = unwrap(Inst);

3841 cast(P)->setIsDisjoint(IsDisjoint);

3842}

3843

3844

3845

3847 const char *Name) {

3851 return wrap(unwrap(B)->CreateMalloc(ITy, unwrap(Ty), AllocSize, nullptr,

3852 nullptr, Name));

3853}

3854

3861 nullptr, Name));

3862}

3863

3866 unsigned Align) {

3869}

3870

3878}

3879

3887}

3888

3890 const char *Name) {

3892}

3893

3897}

3898

3901}

3902

3906}

3907

3911}

3912

3914 switch (Ordering) {

3921 return AtomicOrdering::AcquireRelease;

3923 return AtomicOrdering::SequentiallyConsistent;

3924 }

3925

3927}

3928

3930 switch (Ordering) {

3936 case AtomicOrdering::AcquireRelease:

3938 case AtomicOrdering::SequentiallyConsistent:

3940 }

3941

3943}

3944

3946 switch (BinOp) {

3970 }

3971

3973}

3974

3976 switch (BinOp) {

4000 default: break;

4001 }

4002

4004}

4005

4007 LLVMBool isSingleThread, const char *Name) {

4008 return wrap(

4013}

4014

4017 const char *Name) {

4018 return wrap(

4020}

4021

4024 unsigned NumIndices, const char *Name) {

4027}

4028

4031 unsigned NumIndices, const char *Name) {

4033 return wrap(

4035}

4036

4040 unsigned NumIndices, const char *Name,

4045}

4046

4049 const char *Name) {

4050 return wrap(

4052}

4053

4055 const char *Name) {

4057}

4058

4060 const char *Name) {

4062}

4063

4066 if (LoadInst *LI = dyn_cast(P))

4067 return LI->isVolatile();

4068 if (StoreInst *SI = dyn_cast(P))

4069 return SI->isVolatile();

4071 return AI->isVolatile();

4072 return cast(P)->isVolatile();

4073}

4074

4077 if (LoadInst *LI = dyn_cast(P))

4078 return LI->setVolatile(isVolatile);

4079 if (StoreInst *SI = dyn_cast(P))

4080 return SI->setVolatile(isVolatile);

4082 return AI->setVolatile(isVolatile);

4083 return cast(P)->setVolatile(isVolatile);

4084}

4085

4087 return unwrap(CmpXchgInst)->isWeak();

4088}

4089

4091 return unwrap(CmpXchgInst)->setWeak(isWeak);

4092}

4093

4097 if (LoadInst *LI = dyn_cast(P))

4098 O = LI->getOrdering();

4099 else if (StoreInst *SI = dyn_cast(P))

4100 O = SI->getOrdering();

4101 else if (FenceInst *FI = dyn_cast(P))

4102 O = FI->getOrdering();

4103 else

4104 O = cast(P)->getOrdering();

4106}

4107

4111

4112 if (LoadInst *LI = dyn_cast(P))

4113 return LI->setOrdering(O);

4114 else if (FenceInst *FI = dyn_cast(P))

4115 return FI->setOrdering(O);

4116 else if (AtomicRMWInst *ARWI = dyn_cast(P))

4117 return ARWI->setOrdering(O);

4118 return cast(P)->setOrdering(O);

4119}

4120

4122 return mapToLLVMRMWBinOp(unwrap(Inst)->getOperation());

4123}

4124

4127}

4128

4129

4130

4134}

4135

4139}

4140

4144}

4145

4149}

4150

4154}

4155

4159}

4160

4164}

4165

4169}

4170

4174}

4175

4179}

4180

4184}

4185

4189}

4190

4194}

4195

4200}

4201

4206}

4207

4212}

4213

4218}

4219

4223}

4224

4227 const char *Name) {

4228 return wrap(

4230}

4231

4235 true, Name));

4236}

4237

4241}

4242

4246 unwrap(Src), SrcIsSigned, unwrap(DestTy), DestIsSigned));

4247}

4248

4249

4250

4253 const char *Name) {

4256}

4257

4260 const char *Name) {

4263}

4264

4265

4266

4269}

4270

4273 const char *Name) {

4274 FunctionType *FTy = unwrap(Ty);

4277}

4278

4283 unsigned NumBundles, const char *Name) {

4284 FunctionType *FTy = unwrap(Ty);

4286 for (auto *Bundle : ArrayRef(Bundles, NumBundles)) {

4289 }

4292}

4293

4296 const char *Name) {

4299}

4300

4304}

4305

4310}

4311

4314 const char *Name) {

4317}

4318

4321 const char *Name) {

4324}

4325

4327 unsigned Index, const char *Name) {

4329}

4330

4333 const char *Name) {

4335 Index, Name));

4336}

4337

4339 const char *Name) {

4341}

4342

4344 const char *Name) {

4346}

4347

4349 const char *Name) {

4351}

4352

4355 const char *Name) {

4358}

4359

4369}

4370

4375 unsigned SSID) {

4380}

4381

4387

4388 return wrap(unwrap(B)->CreateAtomicCmpXchg(

4393}

4394

4399 unsigned SSID) {

4400 return wrap(unwrap(B)->CreateAtomicCmpXchg(

4404}

4405

4409 return I->getShuffleMask().size();

4410}

4411

4415 return I->getMaskValue(Elt);

4416}

4417

4419

4421 return unwrap(Inst)->isAtomic();

4422}

4423

4425

4426 Instruction *I = unwrap(AtomicInst);

4427 if (I->isAtomic())

4428 return 0;

4429

4431}

4432

4434

4435 Instruction *I = unwrap(AtomicInst);

4436 if (I->isAtomic())

4437 return;

4438

4441}

4442

4444 Instruction *I = unwrap(AtomicInst);

4445 assert(I->isAtomic() && "Expected an atomic instruction");

4447}

4448

4450 Instruction *I = unwrap(AtomicInst);

4451 assert(I->isAtomic() && "Expected an atomic instruction");

4453}

4454

4457 return mapToLLVMOrdering(cast(P)->getSuccessOrdering());

4458}

4459

4464

4465 return cast(P)->setSuccessOrdering(O);

4466}

4467

4470 return mapToLLVMOrdering(cast(P)->getFailureOrdering());

4471}

4472

4477

4478 return cast(P)->setFailureOrdering(O);

4479}

4480

4481

4482

4486}

4487

4490}

4491

4492

4493

4494

4496 const char *Path,

4498 char **OutMessage) {

4499

4501 if (std::error_code EC = MBOrErr.getError()) {

4502 *OutMessage = strdup(EC.message().c_str());

4503 return 1;

4504 }

4505 *OutMemBuf = wrap(MBOrErr.get().release());

4506 return 0;

4507}

4508

4510 char **OutMessage) {

4512 if (std::error_code EC = MBOrErr.getError()) {

4513 *OutMessage = strdup(EC.message().c_str());

4514 return 1;

4515 }

4516 *OutMemBuf = wrap(MBOrErr.get().release());

4517 return 0;

4518}

4519

4521 const char *InputData,

4522 size_t InputDataLength,

4523 const char *BufferName,

4524 LLVMBool RequiresNullTerminator) {

4525

4528 RequiresNullTerminator).release());

4529}

4530

4532 const char *InputData,

4533 size_t InputDataLength,

4534 const char *BufferName) {

4535

4536 return wrap(

4539}

4540

4542 return unwrap(MemBuf)->getBufferStart();

4543}

4544

4546 return unwrap(MemBuf)->getBufferSize();

4547}

4548

4550 delete unwrap(MemBuf);

4551}

4552

4553

4554

4557}

4558

4561}

4562

4566}

4567

4569 return unwraplegacy::PassManager(PM)->run(*unwrap(M));

4570}

4571

4573 return unwraplegacy::FunctionPassManager(FPM)->doInitialization();

4574}

4575

4577 return unwraplegacy::FunctionPassManager(FPM)->run(*unwrap(F));

4578}

4579

4581 return unwraplegacy::FunctionPassManager(FPM)->doFinalization();

4582}

4583

4586}

4587

4588

4589

4592}

4593

4595}

4596

4599}

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

This file contains the simple types necessary to represent the attributes associated with functions a...

static const Function * getParent(const Value *V)

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

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

#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)

#define LLVM_EXTENSION

LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics.

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

Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx

Given that RA is a live value

static Function * getFunction(Constant *C)

static char getTypeID(Type *Ty)

LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)

static Module::ModFlagBehavior map_to_llvmModFlagBehavior(LLVMModuleFlagBehavior Behavior)

#define LLVM_DEFINE_VALUE_CAST(name)

static LLVMValueMetadataEntry * llvm_getMetadata(size_t *NumEntries, llvm::function_ref< void(MetadataEntries &)> AccessMD)

static GEPNoWrapFlags mapFromLLVMGEPNoWrapFlags(LLVMGEPNoWrapFlags GEPFlags)

static MDNode * extractMDNode(MetadataAsValue *MAV)

static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, BasicBlock *Block, Instruction *Instr, bool BeforeDbgRecords)

static LLVMOpcode map_to_llvmopcode(int opcode)

static LLVMFastMathFlags mapToLLVMFastMathFlags(FastMathFlags FMF)

static FastMathFlags mapFromLLVMFastMathFlags(LLVMFastMathFlags FMF)

LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[], uint8_t Radix)

static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering)

static Intrinsic::ID llvm_map_to_intrinsic_id(unsigned ID)

static LLVMModuleFlagBehavior map_from_llvmModFlagBehavior(Module::ModFlagBehavior Behavior)

static LLVMAtomicOrdering mapToLLVMOrdering(AtomicOrdering Ordering)

LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)

static LLVMValueRef getMDNodeOperandImpl(LLVMContext &Context, const MDNode *N, unsigned Index)

LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char Str[], unsigned SLen)

static int map_from_llvmopcode(LLVMOpcode code)

static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp)

static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp)

LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)

LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char Str[], unsigned SLen, uint8_t Radix)

static LLVMContext & getGlobalContext()

static LLVMGEPNoWrapFlags mapToLLVMGEPNoWrapFlags(GEPNoWrapFlags GEPFlags)

BasicBlock ** unwrap(LLVMBasicBlockRef *BBs)

Module.h This file contains the declarations for the Module class.

if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod

const SmallVectorImpl< MachineOperand > & Cond

static BinaryOperator * CreateMul(Value *S1, Value *S2, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)

static BinaryOperator * CreateAdd(Value *S1, Value *S2, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)

static Instruction * CreateNeg(Value *S1, const Twine &Name, BasicBlock::iterator InsertBefore, Value *FlagsOp)

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

static Type * getValueType(Value *V)

Returns the type of the given value/instruction V.

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

unify loop Fixup each natural loop to have a single exit block

static std::optional< unsigned > getOpcode(ArrayRef< VPValue * > Values)

Returns the opcode of Values or ~0 if they do not all agree.

static const uint32_t IV[8]

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

double convertToDouble() const

Converts this APFloat to host double value.

Class for arbitrary precision integers.

an instruction to allocate memory on the stack

This class represents an incoming formal argument to a Function.

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

An instruction that atomically checks whether a specified value is in a memory location,...

an instruction that atomically reads a memory location, combines it with another value,...

BinOp

This enumeration lists the possible modifications atomicrmw can make.

@ USubCond

Subtract only if no unsigned overflow.

@ Min

*p = old <signed v ? old : v

@ USubSat

*p = usub.sat(old, v) usub.sat matches the behavior of llvm.usub.sat.

@ UIncWrap

Increment one up to a maximum value.

@ Max

*p = old >signed v ? old : v

@ UMin

*p = old <unsigned v ? old : v

@ FMin

*p = minnum(old, v) minnum matches the behavior of llvm.minnum.

@ UMax

*p = old >unsigned v ? old : v

@ FMax

*p = maxnum(old, v) maxnum matches the behavior of llvm.maxnum.

@ UDecWrap

Decrement one until a minimum value or zero.

static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)

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

Return a uniquified Attribute object.

AttrKind

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

static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)

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

LLVM Basic Block Representation.

void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW=nullptr, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const

Print the basic block to an output stream with an optional AssemblyAnnotationWriter.

void setIsNewDbgInfoFormat(bool NewFlag)

Ensure the block is in "old" dbg.value format (NewFlag == false) or in the new format (NewFlag == tru...

static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)

Creates a new BasicBlock.

void moveAfter(BasicBlock *MovePos)

Unlink this basic block from its current function and insert it right after MovePos in the function M...

void removeFromParent()

Unlink 'this' from the containing function, but do not delete it.

const Function * getParent() const

Return the enclosing method, or null if none.

SymbolTableList< BasicBlock >::iterator eraseFromParent()

Unlink 'this' from the containing function and delete it.

InstListType::iterator iterator

Instruction iterators...

LLVMContext & getContext() const

Get the context in which this basic block lives.

bool IsNewDbgInfoFormat

Flag recording whether or not this block stores debug-info in the form of intrinsic instructions (fal...

void moveBefore(BasicBlock *MovePos)

Unlink this basic block from its current function and insert it into the function that MovePos lives ...

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

Return a BlockAddress for the specified function and basic block.

static Instruction::CastOps getCastOpcode(const Value *Val, bool SrcIsSigned, Type *Ty, bool DstIsSigned)

Returns the opcode necessary to cast Val into Ty using usual casting rules.

handler_range handlers()

iteration adapter for range-for loops.

Predicate

This enumeration lists the possible predicates for CmpInst subclasses.

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

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

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

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

static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)

static 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)

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

Create an "inbounds" getelementptr.

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

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

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

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

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

static Constant * getNot(Constant *C)

static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)

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

static Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)

static Constant * getSizeOf(Type *Ty)

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

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

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

static Constant * getNSWNeg(Constant *C)

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

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

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

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.

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

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

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

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

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

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

ConstantFP - Floating Point Values [float, double].

const APFloat & getValueAPF() const

static ConstantPointerNull * get(PointerType *T)

Static factory methods - Return objects of the specified value.

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

Return a pointer signed with the specified parameters.

This class represents a range of values.

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

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

Return an anonymous struct that has the specified elements.

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

This is an important base class in LLVM.

static Constant * getAllOnesValue(Type *Ty)

static Constant * getNullValue(Type *Ty)

Constructor to create a '0' constant of arbitrary type.

This class represents an Operation in the Expression.

Base class for non-instruction debug metadata records that have positions within IR.

Basic diagnostic printer that uses an underlying raw_ostream.

Represents either an error or a value T.

std::error_code getError() const

This instruction compares its operands according to the predicate given to the constructor.

Convenience struct for specifying and reasoning about fast-math flags.

void setAllowContract(bool B=true)

bool noSignedZeros() const

void setAllowReciprocal(bool B=true)

bool allowReciprocal() const

void setNoSignedZeros(bool B=true)

bool allowReassoc() const

Flag queries.

void setNoNaNs(bool B=true)

void setAllowReassoc(bool B=true)

Flag setters.

void setApproxFunc(bool B=true)

void setNoInfs(bool B=true)

bool allowContract() const

An instruction for ordering other memory operations.

static FixedVectorType * get(Type *ElementType, unsigned NumElts)

static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)

BasicBlockListType::iterator iterator

iterator_range< arg_iterator > args()

void setPersonalityFn(Constant *Fn)

Function::iterator insert(Function::iterator Position, BasicBlock *BB)

Insert BB in the basic block list at Position.

Represents flags for the getelementptr instruction/expression.

static GEPNoWrapFlags inBounds()

static GEPNoWrapFlags noUnsignedWrap()

static GEPNoWrapFlags noUnsignedSignedWrap()

bool hasNoUnsignedSignedWrap() const

bool hasNoUnsignedWrap() const

GEPNoWrapFlags getNoWrapFlags() const

an instruction for type-safe pointer arithmetic to access elements of arrays and structs

void setNoWrapFlags(GEPNoWrapFlags NW)

Set nowrap flags for GEP instruction.

static GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)

If a parent module is specified, the alias is automatically inserted into the end of the specified mo...

static GlobalIFunc * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Resolver, Module *Parent)

If a parent module is specified, the ifunc is automatically inserted into the end of the specified mo...

void setUnnamedAddr(UnnamedAddr Val)

void setThreadLocalMode(ThreadLocalMode Val)

void setLinkage(LinkageTypes LT)

DLLStorageClassTypes

Storage classes of global values for PE targets.

Module * getParent()

Get the module that this global value is contained inside of...

VisibilityTypes

An enumeration for the kinds of visibility of global values.

@ PrivateLinkage

Like Internal, but omit from symbol table.

@ CommonLinkage

Tentative definitions.

@ InternalLinkage

Rename collisions when linking (static functions).

@ LinkOnceAnyLinkage

Keep one copy of function when linking (inline)

@ WeakODRLinkage

Same, but only replaced by something equivalent.

@ ExternalLinkage

Externally visible function.

@ WeakAnyLinkage

Keep one copy of named function when linking (weak)

@ AppendingLinkage

Special purpose, only applies to global arrays.

@ AvailableExternallyLinkage

Available for inspection, not emission.

@ ExternalWeakLinkage

ExternalWeak linkage description.

@ LinkOnceODRLinkage

Same, but only replaced by something equivalent.

const Constant * getInitializer() const

getInitializer - Return the initializer for this global variable.

bool hasInitializer() const

Definitions have initializers, declarations don't.

This instruction compares its operands according to the predicate given to the constructor.

void SetInsertPoint(BasicBlock *TheBB)

This specifies that created instructions should be appended to the end of the specified block.

This provides a uniform API for creating instructions and inserting them into a basic block: either a...

static InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT, bool canThrow=false)

InlineAsm::get - Return the specified uniqued inline asm string.

Class to represent integer types.

static IntegerType * get(LLVMContext &C, unsigned NumBits)

This static method is the primary way of constructing an IntegerType.

unsigned getBitWidth() const

Get the number of bits in this IntegerType.

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

void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy

Defines the type of a yield callback.

An instruction for reading from memory.

static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)

static MDString * get(LLVMContext &Context, StringRef Str)

static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)

Open the specified memory range as a MemoryBuffer.

static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")

Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it.

static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)

Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...

static ErrorOr< std::unique_ptr< MemoryBuffer > > getSTDIN()

Read all of stdin into a file buffer, and return it.

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

global_iterator global_begin()

ifunc_iterator ifunc_begin()

ModFlagBehavior

This enumeration defines the supported behaviors of module flags.

global_iterator global_end()

NamedMDListType::iterator named_metadata_iterator

The named metadata iterators.

IFuncListType::iterator ifunc_iterator

The Global IFunc iterators.

named_metadata_iterator named_metadata_begin()

ifunc_iterator ifunc_end()

alias_iterator alias_end()

alias_iterator alias_begin()

FunctionListType::iterator iterator

The Function iterators.

GlobalListType::iterator global_iterator

The Global Variable iterator.

AliasListType::iterator alias_iterator

The Global Alias iterators.

named_metadata_iterator named_metadata_end()

StringRef getName() const

Module * getParent()

Get the module that holds this named metadata collection.

A container for an operand bundle being viewed as a set of values rather than a set of uses.

void addIncoming(Value *V, BasicBlock *BB)

Add an incoming value to the end of the PHI list.

PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...

static PoisonValue * get(Type *T)

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

A global registry used in conjunction with static constructors to make pluggable components (like tar...

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

static ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)

This instruction constructs a fixed permutation of two input vectors.

ArrayRef< int > getShuffleMask() const

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

void push_back(const T &Elt)

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

An instruction for storing to memory.

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

constexpr size_t size() const

size - Get the string size.

constexpr const char * data() const

data - Get a pointer to the start of the string (which may not be null terminated).

Class to represent struct types.

static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)

This static method is the primary way to create a literal StructType.

ArrayRef< Type * > elements() const

static StructType * getTypeByName(LLVMContext &C, StringRef Name)

Return the type with the specified name, or null if there is none by that name.

static StructType * create(LLVMContext &Context, StringRef Name)

This creates an identified struct.

Type * getTypeAtIndex(const Value *V) const

Given an index value into the type, return the type of the element.

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

static TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})

Return a target extension type having the specified name and optional type and integer parameters.

Triple - Helper class for working with autoconf configuration names.

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

static Type * getHalfTy(LLVMContext &C)

static Type * getDoubleTy(LLVMContext &C)

static Type * getX86_FP80Ty(LLVMContext &C)

static Type * getBFloatTy(LLVMContext &C)

static IntegerType * getInt1Ty(LLVMContext &C)

bool isFloatTy() const

Return true if this is 'float', a 32-bit IEEE fp type.

static Type * getX86_AMXTy(LLVMContext &C)

bool isBFloatTy() const

Return true if this is 'bfloat', a 16-bit bfloat type.

static Type * getMetadataTy(LLVMContext &C)

@ X86_AMXTyID

AMX vectors (8192 bits, X86 specific)

@ TypedPointerTyID

Typed pointer used by some GPU targets.

@ HalfTyID

16-bit floating point type

@ TargetExtTyID

Target extension type.

@ VoidTyID

type with no size

@ ScalableVectorTyID

Scalable SIMD vector type.

@ FloatTyID

32-bit floating point type

@ IntegerTyID

Arbitrary bit width integers.

@ FixedVectorTyID

Fixed width SIMD vector type.

@ BFloatTyID

16-bit floating point type (7-bit significand)

@ DoubleTyID

64-bit floating point type

@ X86_FP80TyID

80-bit floating point type (X87)

@ PPC_FP128TyID

128-bit floating point type (two 64-bits, PowerPC)

@ FP128TyID

128-bit floating point type (112-bit significand)

static Type * getVoidTy(LLVMContext &C)

static Type * getLabelTy(LLVMContext &C)

static Type * getFP128Ty(LLVMContext &C)

static IntegerType * getInt16Ty(LLVMContext &C)

bool isHalfTy() const

Return true if this is 'half', a 16-bit IEEE fp type.

LLVMContext & getContext() const

Return the LLVMContext in which this type was uniqued.

static IntegerType * getInt8Ty(LLVMContext &C)

static IntegerType * getInt128Ty(LLVMContext &C)

bool isDoubleTy() const

Return true if this is 'double', a 64-bit IEEE fp type.

static Type * getTokenTy(LLVMContext &C)

static IntegerType * getInt32Ty(LLVMContext &C)

static IntegerType * getInt64Ty(LLVMContext &C)

static Type * getFloatTy(LLVMContext &C)

static Type * getPPC_FP128Ty(LLVMContext &C)

static UndefValue * get(Type *T)

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

A Use represents the edge between a Value definition and its users.

LLVM Value Representation.

Type * getType() const

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

void setName(const Twine &Name)

Change the name of the value.

void replaceAllUsesWith(Value *V)

Change all uses of this to point to a new Value.

use_iterator_impl< Use > use_iterator

LLVMContext & getContext() const

All values hold a context through their type.

StringRef getName() const

Return a constant reference to the value's name.

An efficient, type-erasing, non-owning reference to a callable.

self_iterator getIterator()

FunctionPassManager manages FunctionPasses.

PassManager manages ModulePassManagers.

A raw_ostream that writes to a file descriptor.

bool has_error() const

Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...

std::error_code error() const

void close()

Manually flush the stream and close the file.

A raw_ostream that writes to an std::string.

typename ilist_select_iterator_type< OptionsT::has_iterator_bits, OptionsT, false, false >::type iterator

LLVMContextRef LLVMGetGlobalContext()

Obtain the global context instance.

unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A)

Get the unique id corresponding to the enum attribute passed as argument.

void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)

Set whether the given context discards all value names.

uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A)

Get the enum attribute's value.

LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A)

Get the type attribute's value.

unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)

LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)

Return an enum LLVMDiagnosticSeverity.

char * LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI)

Return a string representation of the DiagnosticInfo.

unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen)

Return an unique id given the name of a enum attribute, or 0 if no attribute by that name exists.

unsigned LLVMGetSyncScopeID(LLVMContextRef C, const char *Name, size_t SLen)

Maps a synchronization scope name to a ID unique within this context.

LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)

Get the diagnostic handler of this context.

LLVMBool LLVMContextShouldDiscardValueNames(LLVMContextRef C)

Retrieve whether the given context is set to discard all value names.

LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, LLVMTypeRef type_ref)

Create a type attribute.

LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength)

Create a string attribute.

LLVMAttributeRef LLVMCreateConstantRangeAttribute(LLVMContextRef C, unsigned KindID, unsigned NumBits, const uint64_t LowerWords[], const uint64_t UpperWords[])

Create a ConstantRange attribute.

void LLVMContextDispose(LLVMContextRef C)

Destroy a context instance.

LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val)

Create an enum attribute.

const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)

Get the string attribute's kind.

LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)

Obtain a Type from a context by its registered name.

LLVMContextRef LLVMContextCreate()

Create a new context.

void(* LLVMYieldCallback)(LLVMContextRef, void *)

unsigned LLVMGetLastEnumAttributeKind(void)

LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A)

LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A)

const char * LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length)

Get the string attribute's value.

void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle)

Set the yield callback function for this context.

unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)

void LLVMContextSetDiagnosticHandler(LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext)

Set the diagnostic handler for this context.

void(* LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *)

void * LLVMContextGetDiagnosticContext(LLVMContextRef C)

Get the diagnostic context of this context.

LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A)

Check for the different types of attributes.

LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)

LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)

Deprecated: Use LLVMBuildGlobalString instead, which has identical behavior.

LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, LLVMBool isSingleThread, const char *Name)

LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)

LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)

Gets whether the instruction has the disjoint flag set.

LLVMValueRef LLVMBuildNot(LLVMBuilderRef B, LLVMValueRef V, const char *Name)

void LLVMSetAtomicSyncScopeID(LLVMValueRef AtomicInst, unsigned SSID)

Sets the synchronization scope ID of an atomic instruction.

LLVMValueRef LLVMBuildInvokeWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)

LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildAnd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

void LLVMClearInsertionPosition(LLVMBuilderRef Builder)

LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool isWeak)

void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW)

LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)

LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildZExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildSExt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag)

Set the default floating-point math metadata for the given builder.

LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef B, LLVMValueRef AggVal, unsigned Index, const char *Name)

LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef B, LLVMRealPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)

LLVMValueRef LLVMBuildAtomicCmpXchgSyncScope(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, unsigned SSID)

LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)

LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned, LLVMTypeRef DestTy, LLVMBool DestIsSigned)

LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef Inst)

void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW)

LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildShl(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc)

Set location information used by debugging information.

int LLVMGetUndefMaskElem(void)

LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst)

LLVMValueRef LLVMBuildFRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)

LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)

LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)

void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint)

Sets the disjoint flag for the instruction.

LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMPositionBuilderBeforeDbgRecords(LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr)

Set the builder position before Instr and any attached debug records, or if Instr is null set the pos...

LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)

LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)

LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef PersFn, unsigned NumClauses, const char *Name)

LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef B, LLVMValueRef *RetVals, unsigned N)

LLVMValueRef LLVMBuildAShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, const char *Name)

LLVMValueRef LLVMBuildCallWithOperandBundles(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)

LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMSetOrdering(LLVMValueRef MemAccessInst, LLVMAtomicOrdering Ordering)

void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)

LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i)

unsigned LLVMGetAtomicSyncScopeID(LLVMValueRef AtomicInst)

Returns the synchronization scope ID of an atomic instruction.

LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef B, LLVMValueRef AggVal, LLVMValueRef EltVal, unsigned Index, const char *Name)

LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildMemSet(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Val, LLVMValueRef Len, unsigned Align)

Creates and inserts a memset to the specified pointer and the specified value.

LLVMValueRef LLVMBuildBr(LLVMBuilderRef B, LLVMBasicBlockRef Dest)

LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildSRem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMDisposeBuilder(LLVMBuilderRef Builder)

int LLVMGetMaskValue(LLVMValueRef SVInst, unsigned Elt)

Get the mask value at position Elt in the mask of a ShuffleVector instruction.

LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx)

LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder)

Get location information used by debugging information.

LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)

LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef B, LLVMValueRef List, LLVMTypeRef Ty, const char *Name)

LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)

LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool singleThread)

LLVMValueRef LLVMBuildICmp(LLVMBuilderRef B, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)

Get the parent catchswitch instruction of a catchpad instruction.

void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool NewValue)

LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildURem(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMSetAtomicRMWBinOp(LLVMValueRef Inst, LLVMAtomicRMWBinOp BinOp)

LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)

void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)

LLVMValueRef LLVMBuildOr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMBool LLVMGetNUW(LLVMValueRef ArithInst)

LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildCallBr(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMBasicBlockRef DefaultDest, LLVMBasicBlockRef *IndirectDests, unsigned NumIndirectDests, LLVMValueRef *Args, unsigned NumArgs, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)

LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)

Deprecated: Passing the NULL location will crash.

LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMBool LLVMIsAtomic(LLVMValueRef Inst)

Returns whether an instruction is an atomic instruction, e.g., atomicrmw, cmpxchg,...

LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)

LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)

LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)

Get the dafult floating-point math metadata for a given builder.

LLVMValueRef LLVMBuildAtomicRMWSyncScope(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, unsigned SSID)

LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch)

Set the parent catchswitch instruction of a catchpad instruction.

LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)

LLVMValueRef LLVMBuildStructGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, unsigned Idx, const char *Name)

unsigned LLVMGetNumClauses(LLVMValueRef LandingPad)

LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst)

Gets if the instruction has the non-negative flag set.

LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val, LLVMValueRef PointerVal)

LLVMValueRef LLVMBuildCatchSwitch(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMBasicBlockRef UnwindBB, unsigned NumHandlers, const char *Name)

LLVMValueRef LLVMBuildFenceSyncScope(LLVMBuilderRef B, LLVMAtomicOrdering Ordering, unsigned SSID, const char *Name)

LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

Deprecated: This cast is always signed.

LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)

LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)

void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers)

Obtain the basic blocks acting as handlers for a catchswitch instruction.

LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemAccessInst)

LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef B, LLVMValueRef If, LLVMBasicBlockRef Then, LLVMBasicBlockRef Else)

LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr, unsigned NumDests)

void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest)

LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)

LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name)

LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst)

LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef B, LLVMValueRef Val, const char *Name)

void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value)

LLVMValueRef LLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size)

Creates and inserts a memcpy between the specified pointers.

LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef B, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst)

Attempts to set the debug location for the given instruction using the current debug location for the...

void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst)

Adds the metadata registered with the given builder to the given instruction.

LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef B)

LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef B, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name)

void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile)

LLVMValueRef LLVMBuildFree(LLVMBuilderRef B, LLVMValueRef PointerVal)

LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)

unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch)

LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMBuilderRef LLVMCreateBuilder(void)

void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)

LLVMValueRef LLVMBuildPhi(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name)

LLVMBool LLVMCanValueUseFastMathFlags(LLVMValueRef V)

Check if a given value can potentially have fast math flags.

void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal, LLVMBasicBlockRef Dest)

LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)

LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn)

LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V, LLVMBasicBlockRef Else, unsigned NumCases)

void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr)

LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef B, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)

LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad)

LLVMBool LLVMGetNSW(LLVMValueRef ArithInst)

LLVMValueRef LLVMBuildMemMove(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size)

Creates and inserts a memmove between the specified pointers.

LLVMValueRef LLVMBuildLShr(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

unsigned LLVMGetNumMaskElements(LLVMValueRef SVInst)

Get the number of elements in the mask of a ShuffleVector instruction.

LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B)

LLVMValueRef LLVMBuildRet(LLVMBuilderRef B, LLVMValueRef V)

void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest)

void LLVMPositionBuilderBeforeInstrAndDbgRecords(LLVMBuilderRef Builder, LLVMValueRef Instr)

Set the builder position before Instr and any attached debug records.

LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)

void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr)

Set the builder position before Instr but after any attached debug records.

LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder)

Deprecated: Returning the NULL location will crash.

LLVMAtomicOrdering LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst)

void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg)

Sets the non-negative flag for the instruction.

LLVMContextRef LLVMGetBuilderContext(LLVMBuilderRef Builder)

Obtain the context to which this builder is associated.

void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact)

LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder)

LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad, LLVMValueRef *Args, unsigned NumArgs, const char *Name)

void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)

void LLVMSetFastMathFlags(LLVMValueRef FPMathInst, LLVMFastMathFlags FMF)

Sets the flags for which fast-math-style optimizations are allowed for this value.

LLVMValueRef LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name, LLVMGEPNoWrapFlags NoWrapFlags)

Creates a GetElementPtr instruction.

LLVMFastMathFlags LLVMGetFastMathFlags(LLVMValueRef FPMathInst)

Get the flags for which fast-math-style optimizations are allowed for this value.

LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)

LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst)

LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)

void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block, LLVMValueRef Instr)

Set the builder position before Instr but after any attached debug records, or if Instr is null set t...

void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block)

LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef B, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)

LLVMValueRef LLVMBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)

void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)

size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)

LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)

LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData, size_t InputDataLength, const char *BufferName, LLVMBool RequiresNullTerminator)

LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path, LLVMMemoryBufferRef *OutMemBuf, char **OutMessage)

const char * LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)

LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)

LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)

Changes the type of M so it can be passed to FunctionPassManagers and the JIT.

void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP)

Destroys the module M.

const char * LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len)

Obtain the identifier of a module.

void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr)

Set the data layout for a module.

LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy)

Add a function to a module under a specified name.

LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M)

Soon to be deprecated.

LLVMNamedMDNodeRef LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NMD)

Decrement a NamedMDNode iterator to the previous NamedMDNode.

LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name, size_t Length)

Obtain a Function value from a Module by its name.

LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name)

Deprecated: Use LLVMGetTypeByName2 instead.

void LLVMSetSourceFileName(LLVMModuleRef M, const char *Name, size_t Len)

Set the original source file name of a module to a string Name with length Len.

void LLVMDumpModule(LLVMModuleRef M)

Dump a representation of a module to stderr.

void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len)

Append inline assembly to a module.

LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)

Obtain an iterator to the first Function in a Module.

const char * LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length)

Return the filename of the debug location for this value, which must be an llvm::Instruction,...

LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage)

Print a representation of a module to a file.

void LLVMDisposeModule(LLVMModuleRef M)

Destroy a module instance.

LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, const char *AsmString, size_t AsmStringSize, const char *Constraints, size_t ConstraintsSize, LLVMBool HasSideEffects, LLVMBool IsAlignStack, LLVMInlineAsmDialect Dialect, LLVMBool CanThrow)

Create the specified uniqued inline asm string.

const char * LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length)

Return the directory of the debug location for this value, which must be an llvm::Instruction,...

const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)

Get inline assembly for a module.

const char * LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len)

Obtain the module's original source file name.

const char * LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NMD, size_t *NameLen)

Retrieve the name of a NamedMDNode.

LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M)

Obtain the context to which this module is associated.

const char * LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal, size_t *Len)

Get the raw constraint string for an inline assembly snippet.

LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, LLVMContextRef C)

Create a new, empty module in a specific context.

LLVMMetadataRef LLVMModuleFlagEntriesGetMetadata(LLVMModuleFlagEntry *Entries, unsigned Index)

Returns the metadata for a module flag entry at a specific index.

const char * LLVMModuleFlagEntriesGetKey(LLVMModuleFlagEntry *Entries, unsigned Index, size_t *Len)

Returns the key for a module flag entry at a specific index.

LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M)

Obtain an iterator to the last Function in a Module.

void LLVMSetTarget(LLVMModuleRef M, const char *Triple)

Set the target triple for a module.

const char * LLVMGetDataLayoutStr(LLVMModuleRef M)

Obtain the data layout for a module.

const char * LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len)

Get the template string used for an inline assembly snippet.

LLVMModuleFlagBehavior LLVMModuleFlagEntriesGetFlagBehavior(LLVMModuleFlagEntry *Entries, unsigned Index)

Returns the flag behavior for a module flag entry at a specific index.

unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)

Return the column number of the debug location for this value, which must be an llvm::Instruction.

unsigned LLVMGetDebugLocLine(LLVMValueRef Val)

Return the line number of the debug location for this value, which must be an llvm::Instruction,...

LLVMBool LLVMGetInlineAsmNeedsAlignedStack(LLVMValueRef InlineAsmVal)

Get if the inline asm snippet needs an aligned stack.

LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID)

Create a new, empty module in the global context.

LLVMModuleFlagEntry * LLVMCopyModuleFlagsMetadata(LLVMModuleRef M, size_t *Len)

Returns the module flags as an array of flag-key-value triples.

void LLVMAddModuleFlag(LLVMModuleRef M, LLVMModuleFlagBehavior Behavior, const char *Key, size_t KeyLen, LLVMMetadataRef Val)

Add a module-level flag to the module-level flags metadata if it doesn't already exist.

void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)

Deprecated: Use LLVMSetModuleInlineAsm2 instead.

LLVMBool LLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal)

Get if the inline asm snippet has side effects.

void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries)

Destroys module flags metadata entries.

LLVMInlineAsmDialect LLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal)

Get the dialect used by the inline asm snippet.

unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name)

Obtain the number of operands for named metadata in a module.

const char * LLVMGetTarget(LLVMModuleRef M)

Obtain the target triple for a module.

LLVMNamedMDNodeRef LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NMD)

Advance a NamedMDNode iterator to the next NamedMDNode.

void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len)

Set inline assembly for a module.

LLVMNamedMDNodeRef LLVMGetLastNamedMetadata(LLVMModuleRef M)

Obtain an iterator to the last NamedMDNode in a Module.

LLVMBool LLVMGetInlineAsmCanUnwind(LLVMValueRef InlineAsmVal)

Get if the inline asm snippet may unwind the stack.

LLVMMetadataRef LLVMGetModuleFlag(LLVMModuleRef M, const char *Key, size_t KeyLen)

Add a module-level flag to the module-level flags metadata if it doesn't already exist.

const char * LLVMGetDataLayout(LLVMModuleRef M)

LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name)

Obtain a Function value from a Module by its name.

void LLVMSetIsNewDbgInfoFormat(LLVMModuleRef M, LLVMBool UseNewFormat)

Soon to be deprecated.

LLVMNamedMDNodeRef LLVMGetNamedMetadata(LLVMModuleRef M, const char *Name, size_t NameLen)

Retrieve a NamedMDNode with the given name, returning NULL if no such node exists.

LLVMNamedMDNodeRef LLVMGetOrInsertNamedMetadata(LLVMModuleRef M, const char *Name, size_t NameLen)

Retrieve a NamedMDNode with the given name, creating a new node if no such node exists.

LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)

Decrement a Function iterator to the previous Function.

char * LLVMPrintModuleToString(LLVMModuleRef M)

Return a string representation of the module.

void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char *Name, LLVMValueRef *Dest)

Obtain the named metadata operands for a module.

LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn)

Advance a Function iterator to the next Function.

LLVMTypeRef LLVMGetInlineAsmFunctionType(LLVMValueRef InlineAsmVal)

Get the function type of the inline assembly snippet.

void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len)

Set the identifier of a module to a string Ident with length Len.

void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char *Name, LLVMValueRef Val)

Add an operand to named metadata.

LLVMNamedMDNodeRef LLVMGetFirstNamedMetadata(LLVMModuleRef M)

Obtain an iterator to the first NamedMDNode in a Module.

LLVMValueRef LLVMGetOperandBundleArgAtIndex(LLVMOperandBundleRef Bundle, unsigned Index)

Obtain the operand for an operand bundle at the given index.

unsigned LLVMGetNumOperandBundleArgs(LLVMOperandBundleRef Bundle)

Obtain the number of operands for an operand bundle.

LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen, LLVMValueRef *Args, unsigned NumArgs)

Create a new operand bundle.

void LLVMDisposeOperandBundle(LLVMOperandBundleRef Bundle)

Destroy an operand bundle.

const char * LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len)

Obtain the tag of an operand bundle as a string.

LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M)

Initializes, executes on the provided module, and finalizes all of the passes scheduled in the pass m...

LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P)

Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.

LLVMPassManagerRef LLVMCreatePassManager()

Constructs a new whole-module pass pipeline.

void LLVMDisposePassManager(LLVMPassManagerRef PM)

Frees the memory of a pass pipeline.

LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)

Finalizes all of the function passes scheduled in the function pass manager.

LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F)

Executes all of the function passes scheduled in the function pass manager on the provided function.

LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)

Initializes all of the function passes scheduled in the function pass manager.

LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M)

Constructs a new function-by-function pass pipeline over the module provider.

LLVMBool LLVMIsMultithreaded()

Check whether LLVM is executing in thread-safe mode or not.

LLVMBool LLVMStartMultithreaded()

Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...

void LLVMStopMultithreaded()

Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THR...

LLVMTypeRef LLVMFP128Type(void)

LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)

Obtain a 128-bit floating point type (112-bit mantissa) from a context.

LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C)

Obtain a 64-bit floating point type from a context.

LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C)

Obtain a 80-bit floating point type (X87) from a context.

LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C)

Obtain a 16-bit floating point type from a context.

LLVMTypeRef LLVMBFloatTypeInContext(LLVMContextRef C)

Obtain a 16-bit brain floating point type from a context.

LLVMTypeRef LLVMBFloatType(void)

LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)

Obtain a 32-bit floating point type from a context.

LLVMTypeRef LLVMHalfType(void)

Obtain a floating point type from the global context.

LLVMTypeRef LLVMX86FP80Type(void)

LLVMTypeRef LLVMPPCFP128Type(void)

LLVMTypeRef LLVMFloatType(void)

LLVMTypeRef LLVMDoubleType(void)

LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C)

Obtain a 128-bit floating point type (two 64-bits) from a context.

LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy)

Returns whether a function type is variadic.

unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy)

Obtain the number of parameters this function accepts.

void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest)

Obtain the types of a function's parameters.

LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType, LLVMTypeRef *ParamTypes, unsigned ParamCount, LLVMBool IsVarArg)

Obtain a function type consisting of a specified signature.

LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy)

Obtain the Type this function Type returns.

LLVMTypeRef LLVMInt64Type(void)

LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C)

LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)

LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)

LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)

Obtain an integer type from a context with specified bit width.

LLVMTypeRef LLVMInt32Type(void)

LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C)

LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)

LLVMTypeRef LLVMIntType(unsigned NumBits)

LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C)

LLVMTypeRef LLVMInt8Type(void)

LLVMTypeRef LLVMInt1Type(void)

Obtain an integer type from the global context with a specified bit width.

LLVMTypeRef LLVMInt128Type(void)

unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy)

LLVMTypeRef LLVMInt16Type(void)

LLVMTypeRef LLVMVoidType(void)

These are similar to the above functions except they operate on the global context.

const char * LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy)

Obtain the name for this target extension type.

LLVMTypeRef LLVMGetTargetExtTypeTypeParam(LLVMTypeRef TargetExtTy, unsigned Idx)

Get the type parameter at the given index for the target extension type.

unsigned LLVMGetTargetExtTypeNumTypeParams(LLVMTypeRef TargetExtTy)

Obtain the number of type parameters for this target extension type.

LLVMTypeRef LLVMX86AMXTypeInContext(LLVMContextRef C)

Create a X86 AMX type in a context.

LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C)

Create a metadata type in a context.

LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)

Create a token type in a context.

LLVMTypeRef LLVMX86AMXType(void)

LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)

Create a label type in a context.

LLVMTypeRef LLVMTargetExtTypeInContext(LLVMContextRef C, const char *Name, LLVMTypeRef *TypeParams, unsigned TypeParamCount, unsigned *IntParams, unsigned IntParamCount)

Create a target extension type in LLVM context.

unsigned LLVMGetTargetExtTypeNumIntParams(LLVMTypeRef TargetExtTy)

Obtain the number of int parameters for this target extension type.

unsigned LLVMGetTargetExtTypeIntParam(LLVMTypeRef TargetExtTy, unsigned Idx)

Get the int parameter at the given index for the target extension type.

LLVMTypeRef LLVMLabelType(void)

LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)

Create a void type in a context.

unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)

Obtain the length of an array type.

LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy)

Obtain the element type of an array or vector type.

unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy)

Obtain the address space of a pointer type.

uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy)

Obtain the length of an array type.

LLVMValueRef LLVMGetConstantPtrAuthPointer(LLVMValueRef PtrAuth)

Get the pointer value for the associated ConstantPtrAuth constant.

LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace)

Create a pointer type that points to a defined type.

unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)

Return the number of types in the derived type.

LLVMValueRef LLVMGetConstantPtrAuthDiscriminator(LLVMValueRef PtrAuth)

Get the discriminator value for the associated ConstantPtrAuth constant.

LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount)

Create a vector type that contains a defined type and has a specific number of elements.

LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty)

Determine whether a pointer is opaque.

LLVMTypeRef LLVMPointerTypeInContext(LLVMContextRef C, unsigned AddressSpace)

Create an opaque pointer type in a context.

LLVMValueRef LLVMGetConstantPtrAuthKey(LLVMValueRef PtrAuth)

Get the key value for the associated ConstantPtrAuth constant.

LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount)

Create a fixed size array type that refers to a specific type.

LLVMTypeRef LLVMScalableVectorType(LLVMTypeRef ElementType, unsigned ElementCount)

Create a vector type that contains a defined type and has a scalable number of elements.

LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount)

Create a fixed size array type that refers to a specific type.

void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr)

Returns type's subtypes.

LLVMValueRef LLVMGetConstantPtrAuthAddrDiscriminator(LLVMValueRef PtrAuth)

Get the address discriminator value for the associated ConstantPtrAuth constant.

unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)

Obtain the (possibly scalable) number of elements in a vector type.

void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)

Set the contents of a structure type.

LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)

Determine whether a structure is packed.

LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i)

Get the type of the element at a given index in the structure.

LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)

Create a new structure type in the global context.

const char * LLVMGetStructName(LLVMTypeRef Ty)

Obtain the name of a structure.

void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest)

Get the elements within a structure.

LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy)

Determine whether a structure is opaque.

unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy)

Get the number of elements defined inside the structure.

LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)

Create an empty structure in a context having a specified name.

LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy)

Determine whether a structure is literal.

LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)

Create a new structure type in a context.

LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)

Whether the type has a known size.

LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)

Obtain the enumerated type of a Type instance.

char * LLVMPrintTypeToString(LLVMTypeRef Ty)

Return a string representation of the type.

void LLVMDumpType(LLVMTypeRef Ty)

Dump a representation of a type to stderr.

LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty)

Obtain the context to which this type instance is associated.

LLVMTailCallKind

Tail call kind for LLVMSetTailCallKind and LLVMGetTailCallKind.

LLVMOpcode

External users depend on the following values being stable.

unsigned LLVMAttributeIndex

unsigned LLVMFastMathFlags

Flags to indicate what fast-math-style optimizations are allowed on operations.

unsigned LLVMGEPNoWrapFlags

Flags that constrain the allowed wrap semantics of a getelementptr instruction.

@ LLVMDLLImportLinkage

Obsolete.

@ LLVMInternalLinkage

Rename collisions when linking (static functions)

@ LLVMLinkOnceAnyLinkage

Keep one copy of function when linking (inline)

@ LLVMExternalLinkage

Externally visible function.

@ LLVMExternalWeakLinkage

ExternalWeak linkage description.

@ LLVMLinkOnceODRLinkage

Same, but only replaced by something equivalent.

@ LLVMPrivateLinkage

Like Internal, but omit from symbol table.

@ LLVMDLLExportLinkage

Obsolete.

@ LLVMLinkerPrivateLinkage

Like Private, but linker removes.

@ LLVMWeakODRLinkage

Same, but only replaced by something equivalent.

@ LLVMGhostLinkage

Obsolete.

@ LLVMWeakAnyLinkage

Keep one copy of function when linking (weak)

@ LLVMAppendingLinkage

Special purpose, only applies to global arrays.

@ LLVMCommonLinkage

Tentative definitions.

@ LLVMLinkOnceODRAutoHideLinkage

Obsolete.

@ LLVMLinkerPrivateWeakLinkage

Like LinkerPrivate, but is weak.

@ LLVMAvailableExternallyLinkage

@ LLVMHalfTypeKind

16 bit floating point type

@ LLVMFP128TypeKind

128 bit floating point type (112-bit mantissa)

@ LLVMIntegerTypeKind

Arbitrary bit width integers.

@ LLVMPointerTypeKind

Pointers.

@ LLVMX86_FP80TypeKind

80 bit floating point type (X87)

@ LLVMX86_AMXTypeKind

X86 AMX.

@ LLVMMetadataTypeKind

Metadata.

@ LLVMScalableVectorTypeKind

Scalable SIMD vector type.

@ LLVMArrayTypeKind

Arrays.

@ LLVMBFloatTypeKind

16 bit brain floating point type

@ LLVMStructTypeKind

Structures.

@ LLVMLabelTypeKind

Labels.

@ LLVMDoubleTypeKind

64 bit floating point type

@ LLVMVoidTypeKind

type with no size

@ LLVMTokenTypeKind

Tokens.

@ LLVMFloatTypeKind

32 bit floating point type

@ LLVMFunctionTypeKind

Functions.

@ LLVMVectorTypeKind

Fixed width SIMD vector type.

@ LLVMPPC_FP128TypeKind

128 bit floating point type (two 64-bits)

@ LLVMTargetExtTypeKind

Target extension type.

@ LLVMInstructionValueKind

@ LLVMGlobalUnnamedAddr

Address of the GV is globally insignificant.

@ LLVMLocalUnnamedAddr

Address of the GV is locally insignificant.

@ LLVMNoUnnamedAddr

Address of the GV is significant.

@ LLVMModuleFlagBehaviorRequire

Adds a requirement that another module flag be present and have a specified value after linking is pe...

@ LLVMModuleFlagBehaviorWarning

Emits a warning if two values disagree.

@ LLVMModuleFlagBehaviorOverride

Uses the specified value, regardless of the behavior or value of the other module.

@ LLVMModuleFlagBehaviorAppendUnique

Appends the two values, which are required to be metadata nodes.

@ LLVMModuleFlagBehaviorAppend

Appends the two values, which are required to be metadata nodes.

@ LLVMModuleFlagBehaviorError

Emits an error if two values disagree, otherwise the resulting value is that of the operands.

@ LLVMAtomicRMWBinOpXor

Xor a value and return the old one.

@ LLVMAtomicRMWBinOpXchg

Set the new value and return the one old.

@ LLVMAtomicRMWBinOpSub

Subtract a value and return the old one.

@ LLVMAtomicRMWBinOpUMax

Sets the value if it's greater than the original using an unsigned comparison and return the old one.

@ LLVMAtomicRMWBinOpUSubSat

Subtracts the value, clamping to zero.

@ LLVMAtomicRMWBinOpAnd

And a value and return the old one.

@ LLVMAtomicRMWBinOpUDecWrap

Decrements the value, wrapping back to the input value when decremented below zero.

@ LLVMAtomicRMWBinOpFMax

Sets the value if it's greater than the original using an floating point comparison and return the ol...

@ LLVMAtomicRMWBinOpMin

Sets the value if it's Smaller than the original using a signed comparison and return the old one.

@ LLVMAtomicRMWBinOpOr

OR a value and return the old one.

@ LLVMAtomicRMWBinOpFMin

Sets the value if it's smaller than the original using an floating point comparison and return the ol...

@ LLVMAtomicRMWBinOpMax

Sets the value if it's greater than the original using a signed comparison and return the old one.

@ LLVMAtomicRMWBinOpUIncWrap

Increments the value, wrapping back to zero when incremented above input value.

@ LLVMAtomicRMWBinOpFAdd

Add a floating point value and return the old one.

@ LLVMAtomicRMWBinOpFSub

Subtract a floating point value and return the old one.

@ LLVMAtomicRMWBinOpAdd

Add a value and return the old one.

@ LLVMAtomicRMWBinOpUMin

Sets the value if it's greater than the original using an unsigned comparison and return the old one.

@ LLVMAtomicRMWBinOpNand

Not-And a value and return the old one.

@ LLVMAtomicRMWBinOpUSubCond

Subtracts the value only if no unsigned overflow.

@ LLVMFastMathAllowReassoc

@ LLVMFastMathNoSignedZeros

@ LLVMFastMathAllowContract

@ LLVMFastMathAllowReciprocal

@ LLVMGeneralDynamicTLSModel

@ LLVMLocalDynamicTLSModel

@ LLVMInitialExecTLSModel

@ LLVMAtomicOrderingAcquireRelease

provides both an Acquire and a Release barrier (for fences and operations which both read and write m...

@ LLVMAtomicOrderingRelease

Release is similar to Acquire, but with a barrier of the sort necessary to release a lock.

@ LLVMAtomicOrderingAcquire

Acquire provides a barrier of the sort necessary to acquire a lock to access other memory with normal...

@ LLVMAtomicOrderingMonotonic

guarantees that if you take all the operations affecting a specific address, a consistent ordering ex...

@ LLVMAtomicOrderingSequentiallyConsistent

provides Acquire semantics for loads and Release semantics for stores.

@ LLVMAtomicOrderingNotAtomic

A load or store which is not atomic.

@ LLVMAtomicOrderingUnordered

Lowest level of atomicity, guarantees somewhat sane results, lock free.

@ LLVMInlineAsmDialectATT

@ LLVMInlineAsmDialectIntel

LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB)

Advance a basic block iterator.

void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)

Append the given basic block to the basic block list of the given function.

void LLVMDeleteBasicBlock(LLVMBasicBlockRef BBRef)

Remove a basic block from a function and delete it.

LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn)

Obtain the first basic block in a function.

LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)

Convert an LLVMValueRef to an LLVMBasicBlockRef instance.

LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)

Create a new basic block without inserting it into a function.

void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BBRef)

Remove a basic block from a function.

void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)

Move a basic block to before another one.

LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB)

Convert a basic block instance to a value type.

void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, LLVMBasicBlockRef BB)

Insert the given basic block after the insertion point of the given builder.

void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs)

Obtain all of the basic blocks in a function.

LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef FnRef, const char *Name)

Append a basic block to the end of a function using the global context.

LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)

Obtain the terminator instruction for a basic block.

unsigned LLVMCountBasicBlocks(LLVMValueRef FnRef)

Obtain the number of basic blocks in a function.

void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)

Move a basic block to after another one.

LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn)

Obtain the last basic block in a function.

LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, LLVMValueRef FnRef, const char *Name)

Append a basic block to the end of a function.

LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB)

Obtain the function to which a basic block belongs.

LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB)

Obtain the first instruction in a basic block.

LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)

Obtain the last instruction in a basic block.

LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C, LLVMBasicBlockRef BBRef, const char *Name)

Insert a basic block in a function before another basic block.

LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef BBRef, const char *Name)

Insert a basic block in a function using the global context.

LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)

Obtain the basic block that corresponds to the entry point of a function.

LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val)

Determine whether an LLVMValueRef is itself a basic block.

const char * LLVMGetBasicBlockName(LLVMBasicBlockRef BB)

Obtain the string name of a basic block.

LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB)

Go backwards in a basic block iterator.

LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)

Create a ConstantStruct in the global Context.

LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, unsigned Length)

Create a ConstantArray from values.

LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals, uint64_t Length)

Create a ConstantArray from values.

LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size)

Create a ConstantVector from values.

LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)

Create a ConstantDataSequential and initialize it with a string.

LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, LLVMValueRef *ConstantVals, unsigned Count)

Create a non-anonymous ConstantStruct from values.

LLVMBool LLVMIsConstantString(LLVMValueRef C)

Returns true if the specified constant is an array of i8.

LLVMValueRef LLVMConstantPtrAuth(LLVMValueRef Ptr, LLVMValueRef Key, LLVMValueRef Disc, LLVMValueRef AddrDisc)

Create a ConstantPtrAuth constant with the given values.

LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx)

Get element of a constant aggregate (struct, array or vector) at the specified index.

LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)

Create a ConstantDataSequential with string content in the global context.

const char * LLVMGetAsString(LLVMValueRef C, size_t *Length)

Get the given constant data sequential as a string.

LLVMValueRef LLVMConstStringInContext2(LLVMContextRef C, const char *Str, size_t Length, LLVMBool DontNullTerminate)

Create a ConstantDataSequential and initialize it with a string.

LLVMValueRef LLVMConstStructInContext(LLVMContextRef C, LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)

Create an anonymous ConstantStruct with the specified values.

LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)

LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)

LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty)

LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)

LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType)

LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType)

LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal)

LLVMValueRef LLVMGetBlockAddressFunction(LLVMValueRef BlockAddr)

Gets the function associated with a given BlockAddress constant value.

LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)

LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant)

LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)

LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)

LLVMBasicBlockRef LLVMGetBlockAddressBasicBlock(LLVMValueRef BlockAddr)

Gets the basic block associated with a given BlockAddress constant value.

LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty)

LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)

Deprecated: Use LLVMGetInlineAsm instead.

LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)

LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal)

LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMConstGEPWithNoWrapFlags(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices, LLVMGEPNoWrapFlags NoWrapFlags)

Creates a constant GetElementPtr expression.

LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)

LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant)

LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal)

LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)

LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal)

LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)

void LLVMGlobalSetMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD)

Sets a metadata attachment, erasing the existing metadata attachment if it already exists for the giv...

unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry *Entries, unsigned Index)

Returns the kind of a value metadata entry at a specific index.

void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry *Entries)

Destroys value metadata entries.

void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz)

LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global)

void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes)

Set the preferred alignment of the value.

LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)

const char * LLVMGetSection(LLVMValueRef Global)

LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)

Returns the "value type" of a global value.

LLVMBool LLVMIsDeclaration(LLVMValueRef Global)

LLVMVisibility LLVMGetVisibility(LLVMValueRef Global)

void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)

LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global)

Deprecated: Use LLVMGetUnnamedAddress instead.

LLVMLinkage LLVMGetLinkage(LLVMValueRef Global)

LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global)

LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)

Returns the underlying metadata node of a value metadata entry at a specific index.

void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr)

void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)

void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)

Deprecated: Use LLVMSetUnnamedAddress instead.

void LLVMGlobalClearMetadata(LLVMValueRef Global)

Removes all metadata attachments from this value.

unsigned LLVMGetAlignment(LLVMValueRef V)

Obtain the preferred alignment of the value.

void LLVMSetSection(LLVMValueRef Global, const char *Section)

void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind)

Erases a metadata attachment of the given kind if it exists.

LLVMValueMetadataEntry * LLVMGlobalCopyAllMetadata(LLVMValueRef Value, size_t *NumEntries)

Retrieves an array of metadata entries representing the metadata attached to this value.

LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)

Obtain a constant value for an integer type.

LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])

Obtain a constant value for an integer of arbitrary precision.

LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text)

Obtain a constant for a floating point value parsed from a string.

double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *LosesInfo)

Obtain the double value for an floating point constant value.

long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)

Obtain the sign extended value for an integer constant value.

unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal)

Obtain the zero extended value for an integer constant value.

LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N)

Obtain a constant value referring to a double floating point value.

LLVMBool LLVMIsNull(LLVMValueRef Val)

Determine whether a value instance is null.

LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty)

Obtain a constant value referring to an undefined value of a type.

LLVMValueRef LLVMGetPoison(LLVMTypeRef Ty)

Obtain a constant value referring to a poison value of a type.

LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)

Obtain a constant value referring to the instance of a type consisting of all ones.

LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty)

Obtain a constant that is a constant pointer pointing to NULL for a specified type.

LLVMValueRef LLVMConstNull(LLVMTypeRef Ty)

Obtain a constant value referring to the null instance of a type.

unsigned LLVMCountParams(LLVMValueRef FnRef)

Obtain the number of parameters in a function.

LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg)

Obtain the previous parameter to a function.

LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)

Obtain the next parameter to a function.

LLVMValueRef LLVMGetParamParent(LLVMValueRef V)

Obtain the function to which this argument belongs.

LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)

Obtain the first parameter to a function.

void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align)

Set the alignment for a function parameter.

LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index)

Obtain the parameter at the specified index.

LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)

Obtain the last parameter to a function.

void LLVMGetParams(LLVMValueRef FnRef, LLVMValueRef *ParamRefs)

Obtain the parameters in a function.

void LLVMSetGC(LLVMValueRef Fn, const char *GC)

Define the garbage collector to use during code generation.

const char * LLVMGetGC(LLVMValueRef Fn)

Obtain the name of the garbage collector to use during code generation.

LLVMValueRef LLVMGetPrologueData(LLVMValueRef Fn)

Gets the prologue data associated with a function.

void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)

unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx)

LLVMBool LLVMHasPersonalityFn(LLVMValueRef Fn)

Check whether the given function has a personality function.

unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen)

Obtain the intrinsic ID number which matches the given function name.

const char * LLVMIntrinsicGetName(unsigned ID, size_t *NameLength)

Retrieves the name of an intrinsic.

unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn)

Obtain the calling function of a function.

LLVMValueRef LLVMGetPrefixData(LLVMValueRef Fn)

Gets the prefix data associated with a function.

void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)

void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData)

Sets the prefix data for the function.

char * LLVMIntrinsicCopyOverloadedName(unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)

Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead.

LLVMAttributeRef LLVMGetStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, const char *K, unsigned KLen)

LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)

Obtain the personality function attached to the function.

void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)

Set the personality function attached to the function.

LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID)

Obtain if the intrinsic identified by the given ID is overloaded.

void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)

Add an attribute to a function.

char * LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount, size_t *NameLength)

Copies the name of an overloaded intrinsic identified by a given list of parameter types.

void LLVMDeleteFunction(LLVMValueRef Fn)

Remove a function from its containing module and deletes it.

void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData)

Sets the prologue data for the function.

LLVMBool LLVMHasPrologueData(LLVMValueRef Fn)

Check if a given function has prologue data.

LLVMBool LLVMHasPrefixData(LLVMValueRef Fn)

Check if a given function has prefix data.

void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)

void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)

Set the calling convention of a function.

LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)

Get or insert the declaration of an intrinsic.

LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, unsigned KindID)

void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V)

Add a target-dependent attribute to a function.

LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID, LLVMTypeRef *ParamTypes, size_t ParamCount)

Retrieves the type of an intrinsic.

unsigned LLVMGetIntrinsicID(LLVMValueRef Fn)

Obtain the ID number from a function instance.

LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)

Obtain the enumerated type of a Value instance.

const char * LLVMGetValueName(LLVMValueRef Val)

Deprecated: Use LLVMGetValueName2 instead.

LLVMTypeRef LLVMTypeOf(LLVMValueRef Val)

Obtain the type of a value.

LLVMBool LLVMIsConstant(LLVMValueRef Ty)

Determine whether the specified value instance is constant.

void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal)

Replace all uses of a value with another one.

const char * LLVMGetValueName2(LLVMValueRef Val, size_t *Length)

Obtain the string name of a value.

LLVMContextRef LLVMGetValueContext(LLVMValueRef Val)

Obtain the context to which this value is associated.

char * LLVMPrintDbgRecordToString(LLVMDbgRecordRef Record)

Return a string representation of the DbgRecord.

void LLVMSetValueName(LLVMValueRef Val, const char *Name)

Deprecated: Use LLVMSetValueName2 instead.

void LLVMDumpValue(LLVMValueRef Val)

Dump a representation of a value to stderr.

LLVMBool LLVMIsUndef(LLVMValueRef Val)

Determine whether a value instance is undefined.

LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val)

LLVMBool LLVMIsPoison(LLVMValueRef Val)

Determine whether a value instance is poisonous.

LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)

void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen)

Set the string name of a value.

LLVMValueRef LLVMIsAValueAsMetadata(LLVMValueRef Val)

char * LLVMPrintValueToString(LLVMValueRef Val)

Return a string representation of the value.

void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)

Remove a global indirect function from its parent module and delete it.

void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)

Remove a global indirect function from its parent module.

LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc)

Advance a GlobalIFunc iterator to the next GlobalIFunc.

LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)

Obtain a GlobalIFunc value from a Module by its name.

LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M)

Obtain an iterator to the last GlobalIFunc in a Module.

LLVMValueRef LLVMAddGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen, LLVMTypeRef Ty, unsigned AddrSpace, LLVMValueRef Resolver)

Add a global indirect function to a module under a specified name.

void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver)

Sets the resolver function associated with this indirect function.

LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)

Obtain an iterator to the first GlobalIFunc in a Module.

LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc)

Retrieves the resolver function associated with this indirect function, or NULL if it doesn't not exi...

LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)

Decrement a GlobalIFunc iterator to the previous GlobalIFunc.

LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)

Obtain the type that is being allocated by the alloca instruction.

LLVMOperandBundleRef LLVMGetOperandBundleAtIndex(LLVMValueRef C, unsigned Index)

Obtain the operand bundle attached to this instruction at the given index.

LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr)

Obtain the pointer to the function invoked by this instruction.

void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef *Attrs)

unsigned LLVMGetNumArgOperands(LLVMValueRef Instr)

Obtain the argument count for a call instruction.

void LLVMSetNormalDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)

Set the normal destination basic block.

unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)

Obtain the calling convention for a call instruction.

LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef Instr)

Obtain the function type called by this instruction.

unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx)

void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)

unsigned LLVMGetNumOperandBundles(LLVMValueRef C)

Obtain the number of operand bundles attached to this instruction.

LLVMBasicBlockRef LLVMGetCallBrIndirectDest(LLVMValueRef CallBr, unsigned Idx)

Get the indirect destination of a CallBr instruction at the given index.

void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC)

Set the calling convention for a call instruction.

LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)

LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke)

Return the normal destination basic block.

void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)

unsigned LLVMGetCallBrNumIndirectDests(LLVMValueRef CallBr)

Get the number of indirect destinations of a CallBr instruction.

void LLVMSetUnwindDest(LLVMValueRef Invoke, LLVMBasicBlockRef B)

Set the unwind destination basic block.

void LLVMSetTailCall(LLVMValueRef Call, LLVMBool isTailCall)

Set whether a call instruction is a tail call.

LLVMBool LLVMIsTailCall(LLVMValueRef Call)

Obtain whether a call instruction is a tail call.

void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx, unsigned align)

LLVMBasicBlockRef LLVMGetCallBrDefaultDest(LLVMValueRef CallBr)

Get the default destination of a CallBr instruction.

void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)

LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call)

Obtain a tail call kind of the call instruction.

void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind kind)

Set the call kind of the call instruction.

LLVMAttributeRef LLVMGetCallSiteStringAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, const char *K, unsigned KLen)

LLVMBasicBlockRef LLVMGetUnwindDest(LLVMValueRef Invoke)

Return the unwind destination basic block.

LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP)

Get the source element type of the given GEP operator.

LLVMBool LLVMIsInBounds(LLVMValueRef GEP)

Check whether the given GEP operator is inbounds.

void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)

Set the given GEP instruction to be inbounds or not.

void LLVMGEPSetNoWrapFlags(LLVMValueRef GEP, LLVMGEPNoWrapFlags NoWrapFlags)

Set the no-wrap related flags for the given GEP instruction.

LLVMGEPNoWrapFlags LLVMGEPGetNoWrapFlags(LLVMValueRef GEP)

Get the no-wrap related flags for the given GEP instruction.

const unsigned * LLVMGetIndices(LLVMValueRef Inst)

Obtain the indices as an array.

unsigned LLVMGetNumIndices(LLVMValueRef Inst)

Obtain the number of indices.

void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count)

Add an incoming value to the end of a PHI list.

LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)

Obtain an incoming value to a PHI node as an LLVMValueRef.

unsigned LLVMCountIncoming(LLVMValueRef PhiNode)

Obtain the number of incoming basic blocks to a PHI node.

LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index)

Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.

unsigned LLVMGetNumSuccessors(LLVMValueRef Term)

Return the number of successors that this terminator has.

LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef Switch)

Obtain the default destination basic block of a switch instruction.

void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)

Update the specified successor to point at the provided block.

void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond)

Set the condition of a branch instruction.

LLVMValueRef LLVMGetCondition(LLVMValueRef Branch)

Return the condition of a branch instruction.

LLVMBool LLVMIsConditional(LLVMValueRef Branch)

Return if a branch is conditional.

LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i)

Return the specified successor.

LLVMDbgRecordRef LLVMGetPreviousDbgRecord(LLVMDbgRecordRef Rec)

Obtain the previous DbgRecord in the sequence or NULL if there are no more.

LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst)

Create a copy of 'this' instruction that is identical in all ways except the following:

LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)

Obtain the instruction that occurs after the one specified.

void LLVMDeleteInstruction(LLVMValueRef Inst)

Delete an instruction.

LLVMValueRef LLVMIsATerminatorInst(LLVMValueRef Inst)

Determine whether an instruction is a terminator.

LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst)

Obtain the code opcode for an individual instruction.

LLVMValueMetadataEntry * LLVMInstructionGetAllMetadataOtherThanDebugLoc(LLVMValueRef Value, size_t *NumEntries)

Returns the metadata associated with an instruction value, but filters out all the debug locations.

LLVMDbgRecordRef LLVMGetFirstDbgRecord(LLVMValueRef Inst)

Obtain the first debug record attached to an instruction.

LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst)

Obtain the float predicate of an instruction.

int LLVMHasMetadata(LLVMValueRef Inst)

Determine whether an instruction has any metadata attached.

void LLVMInstructionEraseFromParent(LLVMValueRef Inst)

Remove and delete an instruction.

void LLVMInstructionRemoveFromParent(LLVMValueRef Inst)

Remove an instruction.

LLVMDbgRecordRef LLVMGetNextDbgRecord(LLVMDbgRecordRef Rec)

Obtain the next DbgRecord in the sequence or NULL if there are no more.

LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID)

Return metadata associated with an instruction value.

LLVMDbgRecordRef LLVMGetLastDbgRecord(LLVMValueRef Inst)

Obtain the last debug record attached to an instruction.

LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)

Obtain the predicate of an instruction.

void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val)

Set metadata associated with an instruction value.

LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst)

Obtain the basic block to which an instruction belongs.

LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst)

Obtain the instruction that occurred before this one.

int LLVMGetNumOperands(LLVMValueRef Val)

Obtain the number of operands in a llvm::User value.

void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op)

Set an operand at a specific index in a llvm::User value.

LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)

Obtain the use of an operand at a specific index in a llvm::User value.

LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index)

Obtain an operand at a specific index in a llvm::User value.

LLVMValueRef LLVMGetUser(LLVMUseRef U)

Obtain the user value for a user.

LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)

Obtain the first use of a value.

LLVMUseRef LLVMGetNextUse(LLVMUseRef U)

Obtain the next use of a value.

LLVMValueRef LLVMGetUsedValue(LLVMUseRef U)

Obtain the value this use corresponds to.

#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro)

void LLVMShutdown()

Deallocate and destroy all ManagedStatic variables.

void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch)

Return the major, minor, and patch version of LLVM.

void LLVMDisposeMessage(char *Message)

char * LLVMCreateMessage(const char *Message)

struct LLVMOpaqueValue * LLVMValueRef

Represents an individual value in LLVM IR.

struct LLVMOpaqueAttributeRef * LLVMAttributeRef

Used to represent an attributes.

struct LLVMOpaqueNamedMDNode * LLVMNamedMDNodeRef

Represents an LLVM Named Metadata Node.

struct LLVMOpaquePassManager * LLVMPassManagerRef

struct LLVMOpaqueDbgRecord * LLVMDbgRecordRef

struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef

struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef

LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...

struct LLVMOpaqueContext * LLVMContextRef

The top-level container for all LLVM global data.

struct LLVMOpaqueBuilder * LLVMBuilderRef

Represents an LLVM basic block builder.

struct LLVMOpaqueUse * LLVMUseRef

Used to get the users and usees of a Value.

struct LLVMOpaqueBasicBlock * LLVMBasicBlockRef

Represents a basic block of instructions in LLVM IR.

struct LLVMOpaqueType * LLVMTypeRef

Each value in the LLVM IR has a type, an LLVMTypeRef.

struct LLVMOpaqueMetadata * LLVMMetadataRef

Represents an LLVM Metadata.

struct LLVMOpaqueModule * LLVMModuleRef

The top-level container for all other LLVM Intermediate Representation (IR) objects.

struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef

Interface used to provide a module to JIT or interpreter.

struct LLVMOpaqueOperandBundle * LLVMOperandBundleRef

void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee)

Set the target value of an alias.

LLVMValueRef LLVMGetLastGlobalAlias(LLVMModuleRef M)

Obtain an iterator to the last GlobalAlias in a Module.

LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)

Advance a GlobalAlias iterator to the next GlobalAlias.

LLVMValueRef LLVMAliasGetAliasee(LLVMValueRef Alias)

Retrieve the target value of an alias.

LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)

Decrement a GlobalAlias iterator to the previous GlobalAlias.

LLVMValueRef LLVMAddAlias2(LLVMModuleRef M, LLVMTypeRef ValueTy, unsigned AddrSpace, LLVMValueRef Aliasee, const char *Name)

Add a GlobalAlias with the given value type, address space and aliasee.

LLVMValueRef LLVMGetFirstGlobalAlias(LLVMModuleRef M)

Obtain an iterator to the first GlobalAlias in a Module.

LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)

Obtain a GlobalAlias value from a Module by its name.

void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)

void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode)

LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar)

LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length)

LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M)

LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)

LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)

LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)

LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)

void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit)

LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)

void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)

LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)

void LLVMDeleteGlobal(LLVMValueRef GlobalVar)

LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar)

LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar)

LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name, unsigned AddressSpace)

void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal)

LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)

#define llvm_unreachable(msg)

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

@ C

The default llvm calling convention, compatible with C.

Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > Tys={})

Look up the Function declaration of the intrinsic id in the Module M.

std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > Tys)

Return the LLVM name for an intrinsic.

StringRef getName(ID id)

Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".

ID lookupIntrinsicID(StringRef Name)

This does the actual lookup of an intrinsic ID which matches the given function name.

bool isOverloaded(ID id)

Returns true if the intrinsic can be overloaded.

FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys={})

Return the function type for an intrinsic.

@ SingleThread

Synchronized with respect to signal handlers executing in the same thread.

@ System

Synchronized with respect to all concurrently executing threads.

@ OF_TextWithCRLF

The file should be opened in text mode and use a carriage linefeed '\r '.

This is an optimization pass for GlobalISel generic memory operations.

constexpr bool llvm_is_multithreaded()

Returns true if LLVM is compiled with support for multi-threading, and false otherwise.

void initializeSafepointIRVerifierPass(PassRegistry &)

void initializeVerifierLegacyPassPass(PassRegistry &)

void setAtomicSyncScopeID(Instruction *I, SyncScope::ID SSID)

A helper function that sets an atomic operation's sync scope.

OperandBundleDefT< Value * > OperandBundleDef

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

std::optional< SyncScope::ID > getAtomicSyncScopeID(const Instruction *I)

A helper function that returns an atomic operation's sync scope; returns std::nullopt if it is not an...

void initializeCore(PassRegistry &)

Initialize all passes linked into the Core library.

LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)

constexpr int PoisonMaskElem

raw_fd_ostream & errs()

This returns a reference to a raw_ostream for standard error.

@ Global

Append to llvm.global_dtors.

AtomicOrdering

Atomic ordering for LLVM's memory model.

constexpr T divideCeil(U Numerator, V Denominator)

Returns the integer ceil(Numerator / Denominator).

void initializeDominatorTreeWrapperPassPass(PassRegistry &)

void initializePrintModulePassWrapperPass(PassRegistry &)

void llvm_shutdown()

llvm_shutdown - Deallocate and destroy all ManagedStatic variables.

LLVMAttributeRef wrap(Attribute Attr)

void initializePrintFunctionPassWrapperPass(PassRegistry &)

LLVMModuleFlagBehavior Behavior

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

void(*)(const DiagnosticInfo *DI, void *Context) DiagnosticHandlerTy

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