LLVM: lib/SandboxIR/Context.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

14

16

18 std::unique_ptr Erased;

21 auto *Val = It->second.release();

22 Erased = std::unique_ptr(Val);

24 }

25 return Erased;

26}

27

29 assert(V->getSubclassID() != Value::ClassID::Constant &&

30 "Can't detach a constant!");

31 assert(V->getSubclassID() != Value::ClassID::User && "Can't detach a user!");

33}

34

36 assert(VPtr->getSubclassID() != Value::ClassID::User &&

37 "Can't register a user!");

38

39 Value *V = VPtr.get();

40 [[maybe_unused]] auto Pair =

42 assert(Pair.second && "Already exists!");

43

44

45

46

47

51 }

52

53 return V;

54}

55

58 auto It = Pair.first;

59 if (!Pair.second)

60 return It->second.get();

61

62

64 switch (LLVMI->getOpcode()) {

65 case llvm::Instruction::VAArg: {

67 It->second = std::unique_ptr(new VAArgInst(LLVMVAArg, *this));

68 return It->second.get();

69 }

70 case llvm::Instruction::Freeze: {

72 It->second =

74 return It->second.get();

75 }

76 case llvm::Instruction::Fence: {

78 It->second = std::unique_ptr(new FenceInst(LLVMFence, *this));

79 return It->second.get();

80 }

81 case llvm::Instruction::Select: {

83 It->second = std::unique_ptr(new SelectInst(LLVMSel, *this));

84 return It->second.get();

85 }

86 case llvm::Instruction::ExtractElement: {

88 It->second = std::unique_ptr(

90 return It->second.get();

91 }

92 case llvm::Instruction::InsertElement: {

94 It->second = std::unique_ptr(

96 return It->second.get();

97 }

98 case llvm::Instruction::ShuffleVector: {

100 It->second = std::unique_ptr(

102 return It->second.get();

103 }

104 case llvm::Instruction::ExtractValue: {

106 It->second = std::unique_ptr(

108 return It->second.get();

109 }

110 case llvm::Instruction::InsertValue: {

112 It->second =

113 std::unique_ptr(new InsertValueInst(LLVMIns, *this));

114 return It->second.get();

115 }

116 case llvm::Instruction::Br: {

118 It->second = std::unique_ptr(new BranchInst(LLVMBr, *this));

119 return It->second.get();

120 }

121 case llvm::Instruction::Load: {

123 It->second = std::unique_ptr(new LoadInst(LLVMLd, *this));

124 return It->second.get();

125 }

126 case llvm::Instruction::Store: {

128 It->second = std::unique_ptr(new StoreInst(LLVMSt, *this));

129 return It->second.get();

130 }

131 case llvm::Instruction::Ret: {

133 It->second = std::unique_ptr(new ReturnInst(LLVMRet, *this));

134 return It->second.get();

135 }

136 case llvm::Instruction::Call: {

138 It->second = std::unique_ptr(new CallInst(LLVMCall, *this));

139 return It->second.get();

140 }

141 case llvm::Instruction::Invoke: {

143 It->second =

145 return It->second.get();

146 }

147 case llvm::Instruction::CallBr: {

149 It->second =

151 return It->second.get();

152 }

153 case llvm::Instruction::LandingPad: {

155 It->second =

156 std::unique_ptr(new LandingPadInst(LLVMLPad, *this));

157 return It->second.get();

158 }

159 case llvm::Instruction::CatchPad: {

161 It->second =

162 std::unique_ptr(new CatchPadInst(LLVMCPI, *this));

163 return It->second.get();

164 }

165 case llvm::Instruction::CleanupPad: {

167 It->second =

168 std::unique_ptr(new CleanupPadInst(LLVMCPI, *this));

169 return It->second.get();

170 }

171 case llvm::Instruction::CatchRet: {

173 It->second =

174 std::unique_ptr(new CatchReturnInst(LLVMCRI, *this));

175 return It->second.get();

176 }

177 case llvm::Instruction::CleanupRet: {

179 It->second = std::unique_ptr(

181 return It->second.get();

182 }

183 case llvm::Instruction::GetElementPtr: {

185 It->second = std::unique_ptr(

187 return It->second.get();

188 }

189 case llvm::Instruction::CatchSwitch: {

191 It->second = std::unique_ptr(

193 return It->second.get();

194 }

195 case llvm::Instruction::Resume: {

197 It->second =

198 std::unique_ptr(new ResumeInst(LLVMResumeInst, *this));

199 return It->second.get();

200 }

201 case llvm::Instruction::Switch: {

203 It->second =

204 std::unique_ptr(new SwitchInst(LLVMSwitchInst, *this));

205 return It->second.get();

206 }

207 case llvm::Instruction::FNeg: {

209 It->second = std::unique_ptr(

211 return It->second.get();

212 }

213 case llvm::Instruction::Add:

214 case llvm::Instruction::FAdd:

215 case llvm::Instruction::Sub:

216 case llvm::Instruction::FSub:

217 case llvm::Instruction::Mul:

218 case llvm::Instruction::FMul:

219 case llvm::Instruction::UDiv:

220 case llvm::Instruction::SDiv:

221 case llvm::Instruction::FDiv:

222 case llvm::Instruction::URem:

223 case llvm::Instruction::SRem:

224 case llvm::Instruction::FRem:

225 case llvm::Instruction::Shl:

226 case llvm::Instruction::LShr:

227 case llvm::Instruction::AShr:

228 case llvm::Instruction::And:

229 case llvm::Instruction::Or:

230 case llvm::Instruction::Xor: {

232 It->second = std::unique_ptr(

234 return It->second.get();

235 }

236 case llvm::Instruction::AtomicRMW: {

238 It->second = std::unique_ptr(

240 return It->second.get();

241 }

242 case llvm::Instruction::AtomicCmpXchg: {

244 It->second = std::unique_ptr(

246 return It->second.get();

247 }

248 case llvm::Instruction::Alloca: {

250 It->second =

252 return It->second.get();

253 }

254 case llvm::Instruction::ZExt:

255 case llvm::Instruction::SExt:

256 case llvm::Instruction::FPToUI:

257 case llvm::Instruction::FPToSI:

258 case llvm::Instruction::FPExt:

259 case llvm::Instruction::PtrToAddr:

260 case llvm::Instruction::PtrToInt:

261 case llvm::Instruction::IntToPtr:

262 case llvm::Instruction::SIToFP:

263 case llvm::Instruction::UIToFP:

264 case llvm::Instruction::Trunc:

265 case llvm::Instruction::FPTrunc:

266 case llvm::Instruction::BitCast:

267 case llvm::Instruction::AddrSpaceCast: {

269 It->second = std::unique_ptr(new CastInst(LLVMCast, *this));

270 return It->second.get();

271 }

272 case llvm::Instruction::PHI: {

274 It->second = std::unique_ptr(new PHINode(LLVMPhi, *this));

275 return It->second.get();

276 }

277 case llvm::Instruction::ICmp: {

279 It->second = std::unique_ptr(new ICmpInst(LLVMICmp, *this));

280 return It->second.get();

281 }

282 case llvm::Instruction::FCmp: {

284 It->second = std::unique_ptr(new FCmpInst(LLVMFCmp, *this));

285 return It->second.get();

286 }

287 case llvm::Instruction::Unreachable: {

289 It->second = std::unique_ptr(

291 return It->second.get();

292 }

293 default:

294 break;

295 }

296 It->second = std::unique_ptr(

298 return It->second.get();

299 }

300

302 switch (LLVMC->getValueID()) {

303 case llvm::Value::ConstantIntVal:

304 It->second = std::unique_ptr(

306 return It->second.get();

307 case llvm::Value::ConstantFPVal:

308 It->second = std::unique_ptr(

310 return It->second.get();

311 case llvm::Value::BlockAddressVal:

312 It->second = std::unique_ptr(

314 return It->second.get();

315 case llvm::Value::ConstantTokenNoneVal:

316 It->second = std::unique_ptr(

318 return It->second.get();

319 case llvm::Value::ConstantAggregateZeroVal: {

321 It->second = std::unique_ptr(

323 auto *Ret = It->second.get();

324

325 auto EC = CAZ->getElementCount();

326 if (EC.isFixed()) {

327 for (auto ElmIdx : seq(0, EC.getFixedValue()))

329 }

330 return Ret;

331 }

332 case llvm::Value::ConstantPointerNullVal:

333 It->second = std::unique_ptr(new ConstantPointerNull(

335 return It->second.get();

336 case llvm::Value::PoisonValueVal:

337 It->second = std::unique_ptr(

339 return It->second.get();

340 case llvm::Value::UndefValueVal:

341 It->second = std::unique_ptr(

343 return It->second.get();

344 case llvm::Value::DSOLocalEquivalentVal: {

346 It->second = std::unique_ptr(

348 auto *Ret = It->second.get();

350 return Ret;

351 }

352 case llvm::Value::ConstantArrayVal:

353 It->second = std::unique_ptr(

355 break;

356 case llvm::Value::ConstantStructVal:

357 It->second = std::unique_ptr(

359 break;

360 case llvm::Value::ConstantVectorVal:

361 It->second = std::unique_ptr(

363 break;

364 case llvm::Value::ConstantDataArrayVal:

365 It->second = std::unique_ptr(

367 break;

368 case llvm::Value::ConstantDataVectorVal:

369 It->second = std::unique_ptr(

371 break;

372 case llvm::Value::FunctionVal:

373 It->second = std::unique_ptr(

375 break;

376 case llvm::Value::GlobalIFuncVal:

377 It->second = std::unique_ptr(

379 break;

380 case llvm::Value::GlobalVariableVal:

381 It->second = std::unique_ptr(

383 break;

384 case llvm::Value::GlobalAliasVal:

385 It->second = std::unique_ptr(

387 break;

388 case llvm::Value::NoCFIValueVal:

389 It->second = std::unique_ptr(

391 break;

392 case llvm::Value::ConstantPtrAuthVal:

393 It->second = std::unique_ptr(

395 break;

396 case llvm::Value::ConstantExprVal:

397 It->second = std::unique_ptr(

399 break;

400 default:

401 It->second = std::unique_ptr(new Constant(LLVMC, *this));

402 break;

403 }

404 auto *NewC = It->second.get();

405 for (llvm::Value *COp : LLVMC->operands())

407 return NewC;

408 }

409

411 It->second = std::unique_ptr(new Argument(LLVMArg, *this));

412 return It->second.get();

413 }

414

417 "This won't create a SBBB, don't call this function directly!");

418 if (auto *SBBB = getValue(LLVMBB))

419 return SBBB;

420 return nullptr;

421 }

422

424 It->second = std::unique_ptr(new OpaqueValue(LLVMMD, *this));

425 return It->second.get();

426 }

427

429 It->second = std::unique_ptr(new OpaqueValue(LLVMAsm, *this));

430 return It->second.get();

431 }

433}

434

437 auto It = Pair.first;

438 if (Pair.second) {

439 It->second = std::unique_ptr(new Argument(LLVMArg, *this));

441 }

443}

444

448

450 assert(getValue(LLVMBB) == nullptr && "Already exists!");

451 auto NewBBPtr = std::unique_ptr(new BasicBlock(LLVMBB, *this));

453

454 BB->buildBasicBlockFromLLVMIR(LLVMBB);

455 return BB;

456}

457

459 auto NewPtr = std::unique_ptr(new VAArgInst(SI, *this));

461}

462

464 auto NewPtr = std::unique_ptr(new FreezeInst(SI, *this));

466}

467

469 auto NewPtr = std::unique_ptr(new FenceInst(SI, *this));

471}

472

474 auto NewPtr = std::unique_ptr(new SelectInst(SI, *this));

476}

477

480 auto NewPtr =

481 std::unique_ptr(new ExtractElementInst(EEI, *this));

483}

484

487 auto NewPtr =

488 std::unique_ptr(new InsertElementInst(IEI, *this));

490}

491

494 auto NewPtr =

495 std::unique_ptr(new ShuffleVectorInst(SVI, *this));

497}

498

500 auto NewPtr =

501 std::unique_ptr(new ExtractValueInst(EVI, *this));

503}

504

506 auto NewPtr =

507 std::unique_ptr(new InsertValueInst(IVI, *this));

509}

510

512 auto NewPtr = std::unique_ptr(new BranchInst(BI, *this));

514}

515

517 auto NewPtr = std::unique_ptr(new LoadInst(LI, *this));

519}

520

522 auto NewPtr = std::unique_ptr(new StoreInst(SI, *this));

524}

525

527 auto NewPtr = std::unique_ptr(new ReturnInst(I, *this));

529}

530

532 auto NewPtr = std::unique_ptr(new CallInst(I, *this));

534}

535

537 auto NewPtr = std::unique_ptr(new InvokeInst(I, *this));

539}

540

542 auto NewPtr = std::unique_ptr(new CallBrInst(I, *this));

544}

545

547 auto NewPtr =

548 std::unique_ptr(new UnreachableInst(UI, *this));

550}

552 auto NewPtr = std::unique_ptr(new LandingPadInst(I, *this));

554}

556 auto NewPtr = std::unique_ptr(new CatchPadInst(I, *this));

558}

560 auto NewPtr = std::unique_ptr(new CleanupPadInst(I, *this));

562}

564 auto NewPtr = std::unique_ptr(new CatchReturnInst(I, *this));

566}

580 auto NewPtr = std::unique_ptr(new CatchSwitchInst(I, *this));

582}

584 auto NewPtr = std::unique_ptr(new ResumeInst(I, *this));

586}

588 auto NewPtr = std::unique_ptr(new SwitchInst(I, *this));

590}

592 auto NewPtr = std::unique_ptr(new UnaryOperator(I, *this));

594}

596 auto NewPtr = std::unique_ptr(new BinaryOperator(I, *this));

598}

600 auto NewPtr = std::unique_ptr(new AtomicRMWInst(I, *this));

602}

610 auto NewPtr = std::unique_ptr(new AllocaInst(I, *this));

612}

614 auto NewPtr = std::unique_ptr(new CastInst(I, *this));

616}

618 auto NewPtr = std::unique_ptr(new PHINode(I, *this));

620}

622 auto NewPtr = std::unique_ptr(new ICmpInst(I, *this));

624}

626 auto NewPtr = std::unique_ptr(new FCmpInst(I, *this));

628}

632 return It->second.get();

633 return nullptr;

634}

635

639

641

647

651 return It->second.get();

652 return nullptr;

653}

654

657 auto It = Pair.first;

658 if (!Pair.second)

659 return It->second.get();

660 It->second = std::unique_ptr(new Module(*LLVMM, *this));

661 return It->second.get();

662}

663

665

666

667

669

670

673

674 auto NewFPtr = std::unique_ptr(new Function(F, *this));

676

677 for (auto &Arg : F->args())

679

680 for (auto &BB : *F)

682 return SBF;

683}

684

687

688 for (auto &LLVMF : *LLVMM)

690

693

694 for (auto &Alias : LLVMM->aliases())

696

697 for (auto &IFunc : LLVMM->ifuncs())

699

700 return M;

701}

702

705 CBEntry.second(I);

706}

707

710 CBEntry.second(I);

711}

712

715 CBEntry.second(I, WhereIt);

716}

717

720 CBEntry.second(U, NewSrc);

721}

722

723

724

725

727

730 "EraseInstrCallbacks size limit exceeded");

733 return ID;

734}

738 "Callback ID not found in EraseInstrCallbacks during deregistration");

739}

740

744 "CreateInstrCallbacks size limit exceeded");

747 return ID;

748}

752 "Callback ID not found in CreateInstrCallbacks during deregistration");

753}

754

757 "MoveInstrCallbacks size limit exceeded");

760 return ID;

761}

765 "Callback ID not found in MoveInstrCallbacks during deregistration");

766}

767

770 "SetUseCallbacks size limit exceeded");

773 return ID;

774}

778 "Callback ID not found in SetUseCallbacks during deregistration");

779}

780

781}

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

Machine Check Debug Module

an instruction to allocate memory on the stack

This class represents an incoming formal argument to a Function.

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

LLVM Basic Block Representation.

Conditional or Unconditional Branch instruction.

CallBr instruction, tracking function calls that may not return control but instead transfer it to a ...

This class represents a function call, abstracting a target machine's calling convention.

This is the base class for all instructions that perform data casts.

ConstantFolder - Create constants with minimum, target independent, folding.

This is an important base class in LLVM.

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

An instruction for ordering other memory operations.

This class represents a freeze function that returns random concrete value if an operand is either a ...

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

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

This instruction inserts a single (scalar) element into a VectorType value.

This instruction inserts a struct field of array element value into an aggregate value.

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

The landingpad instruction holds all of the information necessary to generate correct exception handl...

An instruction for reading from memory.

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

iterator_range< ifunc_iterator > ifuncs()

iterator_range< alias_iterator > aliases()

iterator_range< global_iterator > globals()

Resume the propagation of an exception.

Return a value (possibly void), from a function.

This class represents the LLVM 'select' instruction.

This instruction constructs a fixed permutation of two input vectors.

An instruction for storing to memory.

This function has undefined behavior.

This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...

LLVM Value Representation.

Argument of a sandboxir::Function.

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

An ID for a registered callback.

LLVM_ABI BasicBlock * createBasicBlock(llvm::BasicBlock *BB)

Create a sandboxir::BasicBlock for an existing LLVM IR BB.

Definition Context.cpp:449

std::function< void(Instruction *)> CreateInstrCallback

LLVM_ABI GetElementPtrInst * createGetElementPtrInst(llvm::GetElementPtrInst *I)

Definition Context.cpp:574

MapVector< CallbackID, CreateInstrCallback > CreateInstrCallbacks

Callbacks called when an IR instruction is about to get created.

LLVM_ABI CallBrInst * createCallBrInst(llvm::CallBrInst *I)

Definition Context.cpp:541

LLVM_ABI Module * createModule(llvm::Module *LLVMM)

Create a sandboxir::Module corresponding to LLVMM.

Definition Context.cpp:685

IRBuilder< ConstantFolder > LLVMIRBuilder

std::function< void(const Use &, Value *)> SetUseCallback

MapVector< CallbackID, EraseInstrCallback > EraseInstrCallbacks

Callbacks called when an IR instruction is about to get erased.

LLVM_ABI sandboxir::Value * getValue(llvm::Value *V) const

Definition Context.cpp:629

LLVM_ABI Argument * getOrCreateArgument(llvm::Argument *LLVMArg)

Get or create a sandboxir::Argument for an existing LLVM IR LLVMArg.

Definition Context.cpp:435

LLVM_ABI void unregisterSetUseCallback(CallbackID ID)

Definition Context.cpp:775

LLVM_ABI ReturnInst * createReturnInst(llvm::ReturnInst *I)

Definition Context.cpp:526

LLVM_ABI void runEraseInstrCallbacks(Instruction *I)

Definition Context.cpp:703

LLVM_ABI Module * getModule(llvm::Module *LLVMM) const

Definition Context.cpp:648

friend ExtractElementInst

LLVM_ABI VAArgInst * createVAArgInst(llvm::VAArgInst *SI)

Definition Context.cpp:458

LLVM_ABI CleanupReturnInst * createCleanupReturnInst(llvm::CleanupReturnInst *I)

Definition Context.cpp:568

LLVM_ABI AllocaInst * createAllocaInst(llvm::AllocaInst *I)

Definition Context.cpp:609

LLVM_ABI void runCreateInstrCallbacks(Instruction *I)

Definition Context.cpp:708

LLVM_ABI AtomicRMWInst * createAtomicRMWInst(llvm::AtomicRMWInst *I)

Definition Context.cpp:599

LLVM_ABI InsertValueInst * createInsertValueInst(llvm::InsertValueInst *IVI)

Definition Context.cpp:505

LLVM_ABI FCmpInst * createFCmpInst(llvm::FCmpInst *I)

Definition Context.cpp:625

std::function< void(Instruction *)> EraseInstrCallback

CallbackID::ValTy NextCallbackID

A counter used for assigning callback IDs during registration.

LLVM_ABI ExtractElementInst * createExtractElementInst(llvm::ExtractElementInst *EEI)

Definition Context.cpp:479

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

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

Definition Context.cpp:445

LLVM_ABI CallbackID registerSetUseCallback(SetUseCallback CB)

Register a callback that gets called when a Use gets set.

Definition Context.cpp:768

LLVM_ABI BranchInst * createBranchInst(llvm::BranchInst *I)

Definition Context.cpp:511

LLVM_ABI ShuffleVectorInst * createShuffleVectorInst(llvm::ShuffleVectorInst *SVI)

Definition Context.cpp:493

LLVM_ABI BinaryOperator * createBinaryOperator(llvm::BinaryOperator *I)

Definition Context.cpp:595

friend class Instruction

Iterator for Instructions in a `BasicBlock.

LLVM_ABI Module * getOrCreateModule(llvm::Module *LLVMM)

Definition Context.cpp:655

LLVM_ABI LoadInst * createLoadInst(llvm::LoadInst *LI)

Definition Context.cpp:516

DenseMap< llvm::Value *, std::unique_ptr< Value > > LLVMValueToValueMap

Maps LLVM Value to the corresponding sandboxir::Value.

LLVM_ABI FreezeInst * createFreezeInst(llvm::FreezeInst *SI)

Definition Context.cpp:463

LLVM_ABI PHINode * createPHINode(llvm::PHINode *I)

Definition Context.cpp:617

LLVM_ABI CallbackID registerCreateInstrCallback(CreateInstrCallback CB)

Register a callback that gets called right after a SandboxIR instruction is created.

Definition Context.cpp:742

LLVM_ABI Context(LLVMContext &LLVMCtx)

Definition Context.cpp:636

LLVM_ABI CatchPadInst * createCatchPadInst(llvm::CatchPadInst *I)

Definition Context.cpp:555

LLVM_ABI void clear()

Clears function-level state.

Definition Context.cpp:642

LLVM_ABI ICmpInst * createICmpInst(llvm::ICmpInst *I)

Definition Context.cpp:621

MapVector< CallbackID, MoveInstrCallback > MoveInstrCallbacks

Callbacks called when an IR instruction is about to get moved.

LLVM_ABI std::unique_ptr< Value > detach(Value *V)

Remove SBV from all SandboxIR maps and stop owning it.

Definition Context.cpp:28

LLVM_ABI void unregisterCreateInstrCallback(CallbackID ID)

Definition Context.cpp:749

LLVM_ABI ExtractValueInst * createExtractValueInst(llvm::ExtractValueInst *IVI)

Definition Context.cpp:499

LLVM_ABI CastInst * createCastInst(llvm::CastInst *I)

Definition Context.cpp:613

DenseMap< llvm::Module *, std::unique_ptr< Module > > LLVMModuleToModuleMap

Maps an LLVM Module to the corresponding sandboxir::Module.

LLVM_ABI StoreInst * createStoreInst(llvm::StoreInst *SI)

Definition Context.cpp:521

LLVM_ABI CatchReturnInst * createCatchReturnInst(llvm::CatchReturnInst *I)

Definition Context.cpp:563

LLVM_ABI CatchSwitchInst * createCatchSwitchInst(llvm::CatchSwitchInst *I)

Definition Context.cpp:579

std::function< void(Instruction *, const BBIterator &)> MoveInstrCallback

LLVM_ABI void unregisterMoveInstrCallback(CallbackID ID)

Definition Context.cpp:762

LLVM_ABI CleanupPadInst * createCleanupPadInst(llvm::CleanupPadInst *I)

Definition Context.cpp:559

Value * getOrCreateValue(llvm::Value *LLVMV)

Get or create a sandboxir::Value for an existing LLVM IR LLVMV.

LLVM_ABI FenceInst * createFenceInst(llvm::FenceInst *SI)

Definition Context.cpp:468

LLVM_ABI CallInst * createCallInst(llvm::CallInst *I)

Definition Context.cpp:531

LLVM_ABI SwitchInst * createSwitchInst(llvm::SwitchInst *I)

Definition Context.cpp:587

LLVM_ABI void runMoveInstrCallbacks(Instruction *I, const BBIterator &Where)

Definition Context.cpp:713

LLVM_ABI UnaryOperator * createUnaryOperator(llvm::UnaryOperator *I)

Definition Context.cpp:591

LLVM_ABI Value * getOrCreateValueInternal(llvm::Value *V, llvm::User *U=nullptr)

This is the actual function that creates sandboxir values for V, and among others handles all instruc...

Definition Context.cpp:56

LLVM_ABI InvokeInst * createInvokeInst(llvm::InvokeInst *I)

Definition Context.cpp:536

LLVM_ABI Value * registerValue(std::unique_ptr< Value > &&VPtr)

Take ownership of VPtr and store it in LLVMValueToValueMap.

Definition Context.cpp:35

LLVM_ABI LandingPadInst * createLandingPadInst(llvm::LandingPadInst *I)

Definition Context.cpp:551

LLVM_ABI InsertElementInst * createInsertElementInst(llvm::InsertElementInst *IEI)

Definition Context.cpp:486

LLVM_ABI Function * createFunction(llvm::Function *F)

Create a sandboxir::Function for an existing LLVM IR F, including all blocks and instructions.

Definition Context.cpp:664

LLVM_ABI SelectInst * createSelectInst(llvm::SelectInst *SI)

Definition Context.cpp:473

LLVM_ABI ResumeInst * createResumeInst(llvm::ResumeInst *I)

Definition Context.cpp:583

LLVM_ABI void unregisterEraseInstrCallback(CallbackID ID)

Definition Context.cpp:735

MapVector< CallbackID, SetUseCallback > SetUseCallbacks

Callbacks called when a Use gets its source set.

friend class BasicBlock

Various leaf nodes.

LLVM_ABI CallbackID registerMoveInstrCallback(MoveInstrCallback CB)

Register a callback that gets called when a SandboxIR instruction is about to be moved.

Definition Context.cpp:755

LLVM_ABI UnreachableInst * createUnreachableInst(llvm::UnreachableInst *UI)

Definition Context.cpp:546

LLVM_ABI AtomicCmpXchgInst * createAtomicCmpXchgInst(llvm::AtomicCmpXchgInst *I)

Definition Context.cpp:604

LLVM_ABI void runSetUseCallbacks(const Use &U, Value *NewSrc)

Definition Context.cpp:718

LLVM_ABI CallbackID registerEraseInstrCallback(EraseInstrCallback CB)

Register a callback that gets called when a SandboxIR instruction is about to be removed from its par...

Definition Context.cpp:728

LLVM_ABI std::unique_ptr< Value > detachLLVMValue(llvm::Value *V)

Remove V from the maps and returns the unique_ptr.

Definition Context.cpp:17

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

An LLLVM Instruction that has no SandboxIR equivalent class gets mapped to an OpaqueInstr.

bool emplaceIfTracking(ArgsT... Args)

A convenience wrapper for track() that constructs and tracks the Change object if tracking is enabled...

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

#define llvm_unreachable(msg)

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

unsigned ID

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

static constexpr int MaxRegisteredCallbacks

Definition Context.cpp:726

decltype(auto) dyn_cast(const From &Val)

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

auto cast_or_null(const Y &Val)

bool isa(const From &Val)

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

@ Global

Append to llvm.global_dtors.

decltype(auto) cast(const From &Val)

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

auto seq(T Begin, T End)

Iterate over an integral type from Begin up to - but not including - End.