llvm.org GIT mirror llvm / 838f8a4
Drop materializeAllPermanently. This inlines materializeAll into the only caller (materializeAllPermanently) and renames materializeAllPermanently to just materializeAll. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256024 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 3 years ago
6 changed file(s) with 8 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
430430
431431 /// Sets the GVMaterializer to GVM. This module must not yet have a
432432 /// Materializer. To reset the materializer for a module that already has one,
433 /// call MaterializeAllPermanently first. Destroying this module will destroy
433 /// call materializeAll first. Destroying this module will destroy
434434 /// its materializer without materializing any more GlobalValues. Without
435435 /// destroying the Module, there is no way to detach or destroy a materializer
436436 /// without materializing all the GVs it controls, to avoid leaving orphan
444444 /// problem. If successful, this returns false.
445445 std::error_code materialize(GlobalValue *GV);
446446
447 /// Make sure all GlobalValues in this Module are fully read.
448 std::error_code materializeAll();
449
450447 /// Make sure all GlobalValues in this Module are fully read and clear the
451448 /// Materializer. If the module is corrupt, this DOES NOT clear the old
452449 /// Materializer.
453 std::error_code materializeAllPermanently();
450 std::error_code materializeAll();
454451
455452 std::error_code materializeMetadata();
456453
58465846
58475847 if (MaterializeAll) {
58485848 // Read in the entire module, and destroy the BitcodeReader.
5849 if (std::error_code EC = M->materializeAllPermanently())
5849 if (std::error_code EC = M->materializeAll())
58505850 return cleanupOnError(EC);
58515851 } else {
58525852 // Resolve forward references from blockaddresses.
3434 ExecutionEngine *Interpreter::create(std::unique_ptr M,
3535 std::string *ErrStr) {
3636 // Tell this Module to materialize everything and release the GVMaterializer.
37 if (std::error_code EC = M->materializeAllPermanently()) {
37 if (std::error_code EC = M->materializeAll()) {
3838 if (ErrStr)
3939 *ErrStr = EC.message();
4040 // We got an error, just return 0
378378 //
379379 void Module::setMaterializer(GVMaterializer *GVM) {
380380 assert(!Materializer &&
381 "Module already has a GVMaterializer. Call MaterializeAllPermanently"
381 "Module already has a GVMaterializer. Call materializeAll"
382382 " to clear it out before setting another one.");
383383 Materializer.reset(GVM);
384384 }
393393 std::error_code Module::materializeAll() {
394394 if (!Materializer)
395395 return std::error_code();
396 return Materializer->materializeModule(this);
397 }
398
399 std::error_code Module::materializeAllPermanently() {
400 if (std::error_code EC = materializeAll())
396 if (std::error_code EC = Materializer->materializeModule(this))
401397 return EC;
402
403398 Materializer.reset();
404399 return std::error_code();
405400 }
420420
421421 // If not jitting lazily, load the whole bitcode file eagerly too.
422422 if (NoLazyCompilation) {
423 if (std::error_code EC = Mod->materializeAllPermanently()) {
423 if (std::error_code EC = Mod->materializeAll()) {
424424 errs() << argv[0] << ": bitcode didn't read correctly.\n";
425425 errs() << "Reason: " << EC.message() << "\n";
426426 exit(1);
158158 ErrorOr> MOrErr =
159159 getStreamedBitcodeModule(DisplayFilename, std::move(Streamer), Context);
160160 M = std::move(*MOrErr);
161 M->materializeAllPermanently();
161 M->materializeAll();
162162 } else {
163163 errs() << argv[0] << ": " << ErrorMessage << '\n';
164164 return 1;