aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-11-12 17:50:55 +0000
committerJessica Paquette <jpaquette@apple.com>2018-11-12 17:50:55 +0000
commit3954272ac11e93a11e5e1addfbafa786d93aa892 (patch)
tree9b288851675ce2d938373d6466f97e6d493f19c0 /llvm/lib/CodeGen/MachineOutliner.cpp
parent35fc356fec4ae76dd9d083bf1dd708c08f453394 (diff)
downloadllvm-3954272ac11e93a11e5e1addfbafa786d93aa892.zip
llvm-3954272ac11e93a11e5e1addfbafa786d93aa892.tar.gz
llvm-3954272ac11e93a11e5e1addfbafa786d93aa892.tar.bz2
[MachineOutliner][NFC] Put suffix tree in buildCandidateList
It's only used there, so it doesn't make much sense to have it in runOnModule. llvm-svn: 346681
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index c69bfec..7c2635e 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -919,7 +919,7 @@ struct MachineOutliner : public ModulePass {
unsigned
buildCandidateList(std::vector<std::shared_ptr<Candidate>> &CandidateList,
std::vector<OutlinedFunction> &FunctionList,
- SuffixTree &ST, InstructionMapper &Mapper);
+ InstructionMapper &Mapper);
/// Helper function for pruneOverlaps.
/// Removes \p C from the candidate list, and updates its \p OutlinedFunction.
@@ -1263,8 +1263,10 @@ void MachineOutliner::pruneOverlaps(
unsigned MachineOutliner::buildCandidateList(
std::vector<std::shared_ptr<Candidate>> &CandidateList,
- std::vector<OutlinedFunction> &FunctionList, SuffixTree &ST,
+ std::vector<OutlinedFunction> &FunctionList,
InstructionMapper &Mapper) {
+ // Construct a suffix tree and use it to find candidates.
+ SuffixTree ST(Mapper.UnsignedVec);
std::vector<unsigned> CandidateSequence; // Current outlining candidate.
unsigned MaxCandidateLen = 0; // Length of the longest candidate.
@@ -1628,15 +1630,12 @@ bool MachineOutliner::runOnModule(Module &M) {
// Prepare instruction mappings for the suffix tree.
populateMapper(Mapper, M, MMI);
-
- // Construct a suffix tree, use it to find candidates, and then outline them.
- SuffixTree ST(Mapper.UnsignedVec);
std::vector<std::shared_ptr<Candidate>> CandidateList;
std::vector<OutlinedFunction> FunctionList;
// Find all of the outlining candidates.
unsigned MaxCandidateLen =
- buildCandidateList(CandidateList, FunctionList, ST, Mapper);
+ buildCandidateList(CandidateList, FunctionList, Mapper);
// Remove candidates that overlap with other candidates.
pruneOverlaps(CandidateList, FunctionList, Mapper, MaxCandidateLen);