forked from OSchip/llvm-project
ELF: Remove member variables that are used only in one function.
Differential Revision: https://reviews.llvm.org/D22396 llvm-svn: 275526
This commit is contained in:
parent
112351dc38
commit
601b07c7f5
|
@ -144,8 +144,7 @@ static bool shouldInternalize(const SmallPtrSet<GlobalValue *, 8> &Used,
|
||||||
}
|
}
|
||||||
|
|
||||||
BitcodeCompiler::BitcodeCompiler()
|
BitcodeCompiler::BitcodeCompiler()
|
||||||
: Combined(new llvm::Module("ld-temp.o", Driver->Context)),
|
: Combined(new llvm::Module("ld-temp.o", Driver->Context)) {}
|
||||||
Mover(*Combined) {}
|
|
||||||
|
|
||||||
static void undefine(Symbol *S) {
|
static void undefine(Symbol *S) {
|
||||||
replaceBody<Undefined>(S, S->body()->getName(), STV_DEFAULT, S->body()->Type);
|
replaceBody<Undefined>(S, S->body()->getName(), STV_DEFAULT, S->body()->Type);
|
||||||
|
@ -236,6 +235,7 @@ void BitcodeCompiler::add(BitcodeFile &F) {
|
||||||
Keep.push_back(GV);
|
Keep.push_back(GV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IRMover Mover(*Combined);
|
||||||
if (Error E = Mover.move(Obj->takeModule(), Keep,
|
if (Error E = Mover.move(Obj->takeModule(), Keep,
|
||||||
[](GlobalValue &, IRMover::ValueAdder) {})) {
|
[](GlobalValue &, IRMover::ValueAdder) {})) {
|
||||||
handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EIB) {
|
handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EIB) {
|
||||||
|
@ -286,13 +286,13 @@ std::vector<std::unique_ptr<InputFile>> BitcodeCompiler::runSplitCodegen(
|
||||||
// Merge all the bitcode files we have seen, codegen the result
|
// Merge all the bitcode files we have seen, codegen the result
|
||||||
// and return the resulting ObjectFile.
|
// and return the resulting ObjectFile.
|
||||||
std::vector<std::unique_ptr<InputFile>> BitcodeCompiler::compile() {
|
std::vector<std::unique_ptr<InputFile>> BitcodeCompiler::compile() {
|
||||||
TheTriple = Combined->getTargetTriple();
|
|
||||||
for (const auto &Name : InternalizedSyms) {
|
for (const auto &Name : InternalizedSyms) {
|
||||||
GlobalValue *GV = Combined->getNamedValue(Name.first());
|
GlobalValue *GV = Combined->getNamedValue(Name.first());
|
||||||
assert(GV);
|
assert(GV);
|
||||||
internalize(*GV);
|
internalize(*GV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string TheTriple = Combined->getTargetTriple();
|
||||||
std::string Msg;
|
std::string Msg;
|
||||||
const Target *T = TargetRegistry::lookupTarget(TheTriple, Msg);
|
const Target *T = TargetRegistry::lookupTarget(TheTriple, Msg);
|
||||||
if (!T)
|
if (!T)
|
||||||
|
|
|
@ -44,11 +44,9 @@ private:
|
||||||
const std::function<std::unique_ptr<llvm::TargetMachine>()> &TMFactory);
|
const std::function<std::unique_ptr<llvm::TargetMachine>()> &TMFactory);
|
||||||
|
|
||||||
std::unique_ptr<llvm::Module> Combined;
|
std::unique_ptr<llvm::Module> Combined;
|
||||||
llvm::IRMover Mover;
|
|
||||||
std::vector<SmallString<0>> OwningData;
|
std::vector<SmallString<0>> OwningData;
|
||||||
llvm::StringSet<> InternalizedSyms;
|
llvm::StringSet<> InternalizedSyms;
|
||||||
llvm::StringSet<> AsmUndefinedRefs;
|
llvm::StringSet<> AsmUndefinedRefs;
|
||||||
std::string TheTriple;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue