// disk.
for (Module::iterator F = TheModule->begin(), E = TheModule->end();
F != E; ++F) {
- if (F->isMaterializable()) {
- if (std::error_code EC = materialize(F))
- return EC;
- }
+ if (std::error_code EC = materialize(F))
+ return EC;
}
// At this point, if there are any function bodies, the current bit is
// pointing to the END_BLOCK record after them. Now make sure the rest
/// so, return true.
///
bool FunctionPassManager::run(Function &F) {
- if (F.isMaterializable()) {
- if (std::error_code EC = F.materialize())
- report_fatal_error("Error reading bitcode file: " + EC.message());
- }
+ if (std::error_code EC = F.materialize())
+ report_fatal_error("Error reading bitcode file: " + EC.message());
return FPM->run(F);
}
void Verifier::visitGlobalValue(const GlobalValue &GV) {
- Assert1(!GV.isDeclaration() || GV.isMaterializable() ||
- GV.hasExternalLinkage() || GV.hasExternalWeakLinkage(),
+ Assert1(!GV.isDeclaration() || GV.hasExternalLinkage() ||
+ GV.hasExternalWeakLinkage(),
"Global is external, but doesn't have external or weak linkage!",
&GV);
}
// Materialize if needed.
- if (SF->isMaterializable()) {
- if (std::error_code EC = SF->materialize())
- return emitError(EC.message());
- }
+ if (std::error_code EC = SF->materialize())
+ return emitError(EC.message());
// Skip if no body (function is external).
if (SF->isDeclaration())
}
// Materialize if needed.
- if (SF->isMaterializable()) {
- if (std::error_code EC = SF->materialize())
- return emitError(EC.message());
- }
+ if (std::error_code EC = SF->materialize())
+ return emitError(EC.message());
// Skip if no body (function is external).
if (SF->isDeclaration())
unsigned char
AArch64Subtarget::ClassifyGlobalReference(const GlobalValue *GV,
const TargetMachine &TM) const {
-
- // Determine whether this is a reference to a definition or a declaration.
- // Materializable GVs (in JIT lazy compilation mode) do not require an extra
- // load from stub.
- bool isDecl = GV->hasAvailableExternallyLinkage();
- if (GV->isDeclaration() && !GV->isMaterializable())
- isDecl = true;
+ bool isDecl = GV->isDeclarationForLinker();
// MachO large model always goes via a GOT, simply to get a single 8-byte
// absolute relocation on all global addresses.
if (RelocM == Reloc::Static)
return false;
- // Materializable GVs (in JIT lazy compilation mode) do not require an extra
- // load from stub.
- bool isDecl = GV->hasAvailableExternallyLinkage();
- if (GV->isDeclaration() && !GV->isMaterializable())
- isDecl = true;
+ bool isDecl = GV->isDeclarationForLinker();
if (!isTargetMachO()) {
// Extra load is needed for all externally visible.
// We never have stubs if HasLazyResolverStubs=false or if in static mode.
if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static)
return false;
- // If symbol visibility is hidden, the extra load is not needed if
- // the symbol is definitely defined in the current translation unit.
- bool isDecl = GV->isDeclaration() && !GV->isMaterializable();
+ bool isDecl = GV->isDeclaration();
if (GV->hasHiddenVisibility() && !isDecl && !GV->hasCommonLinkage())
return false;
return GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
if (GV->hasDLLImportStorageClass())
return X86II::MO_DLLIMPORT;
- // Determine whether this is a reference to a definition or a declaration.
- // Materializable GVs (in JIT lazy compilation mode) do not require an extra
- // load from stub.
- bool isDecl = GV->hasAvailableExternallyLinkage();
- if (GV->isDeclaration() && !GV->isMaterializable())
- isDecl = true;
+ bool isDecl = GV->isDeclarationForLinker();
// X86-64 in PIC mode.
if (isPICStyleRIPRel()) {
Module *M = GO->getParent();
GlobalObject *Ret;
if (auto *F = dyn_cast<Function>(GO)) {
- if (F->isMaterializable()) {
- if (F->materialize())
- message(LDPL_FATAL, "LLVM gold plugin has failed to read a function");
-
+ if (F->materialize())
+ message(LDPL_FATAL, "LLVM gold plugin has failed to read a function");
}
auto *NewF = Function::Create(F->getFunctionType(), F->getLinkage(),
if (!DeleteFn)
for (size_t i = 0, e = GVs.size(); i != e; ++i) {
GlobalValue *GV = GVs[i];
- if (GV->isMaterializable()) {
- if (std::error_code EC = GV->materialize()) {
- errs() << argv[0] << ": error reading input: " << EC.message()
- << "\n";
- return 1;
- }
+ if (std::error_code EC = GV->materialize()) {
+ errs() << argv[0] << ": error reading input: " << EC.message() << "\n";
+ return 1;
}
}
else {
// Deleting. Materialize every GV that's *not* in GVs.
SmallPtrSet<GlobalValue *, 8> GVSet(GVs.begin(), GVs.end());
for (auto &G : M->globals()) {
- if (!GVSet.count(&G) && G.isMaterializable()) {
+ if (!GVSet.count(&G)) {
if (std::error_code EC = G.materialize()) {
errs() << argv[0] << ": error reading input: " << EC.message()
<< "\n";
}
}
for (auto &F : *M) {
- if (!GVSet.count(&F) && F.isMaterializable()) {
+ if (!GVSet.count(&F)) {
if (std::error_code EC = F.materialize()) {
errs() << argv[0] << ": error reading input: " << EC.message()
<< "\n";