llvm.org GIT mirror llvm / 1bef1cd
While in GlobalValue fix the function(s) that don't follow the naming convention and update users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237461 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 4 years ago
8 changed file(s) with 18 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
4646 /// lazily. If the Materializer doesn't support this capability, this method
4747 /// is a noop.
4848 ///
49 virtual void Dematerialize(GlobalValue *) {}
49 virtual void dematerialize(GlobalValue *) {}
5050
5151 /// Make sure the entire Module has been completely read.
5252 ///
53 virtual std::error_code MaterializeModule(Module *M) = 0;
53 virtual std::error_code materializeModule(Module *M) = 0;
5454
5555 virtual std::error_code materializeMetadata() = 0;
5656 virtual void setStripDebugInfo() = 0;
316316 /// If this GlobalValue is read in, and if the GVMaterializer supports it,
317317 /// release the memory for the function, and set it up to be materialized
318318 /// lazily. If !isDematerializable(), this method is a noop.
319 void Dematerialize();
319 void dematerialize();
320320
321321 /// @}
322322
491491 /// If the GlobalValue is read in, and if the GVMaterializer supports it,
492492 /// release the memory for the function, and set it up to be materialized
493493 /// lazily. If !isDematerializable(), this method is a no-op.
494 void Dematerialize(GlobalValue *GV);
494 void dematerialize(GlobalValue *GV);
495495
496496 /// Make sure all GlobalValues in this Module are fully read.
497497 std::error_code materializeAll();
239239
240240 bool isDematerializable(const GlobalValue *GV) const override;
241241 std::error_code materialize(GlobalValue *GV) override;
242 std::error_code MaterializeModule(Module *M) override;
242 std::error_code materializeModule(Module *M) override;
243243 std::vector getIdentifiedStructTypes() const override;
244 void Dematerialize(GlobalValue *GV) override;
244 void dematerialize(GlobalValue *GV) override;
245245
246246 /// @brief Main interface to parsing a bitcode buffer.
247247 /// @returns true if an error occurred.
44464446 return DeferredFunctionInfo.count(const_cast(F));
44474447 }
44484448
4449 void BitcodeReader::Dematerialize(GlobalValue *GV) {
4449 void BitcodeReader::dematerialize(GlobalValue *GV) {
44504450 Function *F = dyn_cast(GV);
44514451 // If this function isn't dematerializable, this is a noop.
44524452 if (!F || !isDematerializable(F))
44594459 F->setIsMaterializable(true);
44604460 }
44614461
4462 std::error_code BitcodeReader::MaterializeModule(Module *M) {
4462 std::error_code BitcodeReader::materializeModule(Module *M) {
44634463 assert(M == TheModule &&
44644464 "Can only Materialize the Module this BitcodeReader is attached to.");
44654465
3737 std::error_code GlobalValue::materialize() {
3838 return getParent()->materialize(this);
3939 }
40 void GlobalValue::Dematerialize() {
41 getParent()->Dematerialize(this);
40 void GlobalValue::dematerialize() {
41 getParent()->dematerialize(this);
4242 }
4343
4444 /// Override destroyConstant to make sure it doesn't get called on
393393 return Materializer->materialize(GV);
394394 }
395395
396 void Module::Dematerialize(GlobalValue *GV) {
396 void Module::dematerialize(GlobalValue *GV) {
397397 if (Materializer)
398 return Materializer->Dematerialize(GV);
398 return Materializer->dematerialize(GV);
399399 }
400400
401401 std::error_code Module::materializeAll() {
402402 if (!Materializer)
403403 return std::error_code();
404 return Materializer->MaterializeModule(this);
404 return Materializer->materializeModule(this);
405405 }
406406
407407 std::error_code Module::materializeAllPermanently() {
12261226 for (Argument &Arg : Src.args())
12271227 ValueMap.erase(&Arg);
12281228
1229 Src.Dematerialize();
1229 Src.dematerialize();
12301230 return false;
12311231 }
12321232
7474 GlobalValue::InternalLinkage);
7575
7676 // Check that the linkage type is preserved after dematerialization.
77 M->getFunction("func")->Dematerialize();
77 M->getFunction("func")->dematerialize();
7878 EXPECT_TRUE(M->getFunction("func")->empty());
7979 EXPECT_TRUE(M->getFunction("func")->getLinkage() ==
8080 GlobalValue::InternalLinkage);
159159 EXPECT_FALSE(verifyModule(*M, &dbgs()));
160160
161161 // Try (and fail) to dematerialize @func.
162 M->getFunction("func")->Dematerialize();
162 M->getFunction("func")->dematerialize();
163163 EXPECT_FALSE(M->getFunction("func")->empty());
164164 }
165165
190190 EXPECT_FALSE(verifyModule(*M, &dbgs()));
191191
192192 // Try (and fail) to dematerialize @func.
193 M->getFunction("func")->Dematerialize();
193 M->getFunction("func")->dematerialize();
194194 EXPECT_FALSE(M->getFunction("func")->empty());
195195 EXPECT_FALSE(verifyModule(*M, &dbgs()));
196196 }
222222 EXPECT_FALSE(verifyModule(*M, &dbgs()));
223223
224224 // Try (and fail) to dematerialize @func.
225 M->getFunction("func")->Dematerialize();
225 M->getFunction("func")->dematerialize();
226226 EXPECT_FALSE(M->getFunction("func")->empty());
227227 EXPECT_FALSE(verifyModule(*M, &dbgs()));
228228 }