summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-07-24 20:20:45 +0000
committerJessica Paquette <jpaquette@apple.com>2018-07-24 20:20:45 +0000
commit58e706a66ab282465ece4a0fa4ddb16a27e746bd (patch)
treee6e1a3f5f154414bb2c9c0c80018a2fa309ff426
parent69f517df2777450ae6afdfed55419422aff95097 (diff)
downloadbcm5719-llvm-58e706a66ab282465ece4a0fa4ddb16a27e746bd.tar.gz
bcm5719-llvm-58e706a66ab282465ece4a0fa4ddb16a27e746bd.zip
[MachineOutliner][NFC] Move outlined function remark into its own function
This pulls the OutlinedFunction remark out into its own function to make the code a bit easier to read. llvm-svn: 337849
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp64
1 files changed, 33 insertions, 31 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index dfd9d14ef56..1babe4239e5 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -716,6 +716,9 @@ struct MachineOutliner : public ModulePass {
unsigned StringLen, std::vector<Candidate> &CandidatesForRepeatedSeq,
OutlinedFunction &OF);
+ /// Remark output explaining that a function was outlined.
+ void emitOutlinedFunctionRemark(OutlinedFunction &OF);
+
/// Find all repeated substrings that satisfy the outlining cost model.
///
/// If a substring appears at least twice, then it must be represented by
@@ -859,6 +862,35 @@ void MachineOutliner::emitNotOutliningCheaperRemark(
});
}
+void MachineOutliner::emitOutlinedFunctionRemark(OutlinedFunction &OF) {
+ MachineBasicBlock *MBB = &*OF.MF->begin();
+ MachineOptimizationRemarkEmitter MORE(*OF.MF, nullptr);
+ MachineOptimizationRemark R(DEBUG_TYPE, "OutlinedFunction",
+ MBB->findDebugLoc(MBB->begin()), MBB);
+ R << "Saved " << NV("OutliningBenefit", OF.getBenefit()) << " bytes by "
+ << "outlining " << NV("Length", OF.Sequence.size()) << " instructions "
+ << "from " << NV("NumOccurrences", OF.getOccurrenceCount())
+ << " locations. "
+ << "(Found at: ";
+
+ // Tell the user the other places the candidate was found.
+ for (size_t i = 0, e = OF.Candidates.size(); i < e; i++) {
+
+ // Skip over things that were pruned.
+ if (!OF.Candidates[i]->InCandidateList)
+ continue;
+
+ R << NV((Twine("StartLoc") + Twine(i)).str(),
+ OF.Candidates[i]->front()->getDebugLoc());
+ if (i != e - 1)
+ R << ", ";
+ }
+
+ R << ")";
+
+ MORE.emit(R);
+}
+
unsigned MachineOutliner::findCandidates(
SuffixTree &ST, const TargetInstrInfo &TII, InstructionMapper &Mapper,
std::vector<std::shared_ptr<Candidate>> &CandidateList,
@@ -1233,37 +1265,7 @@ bool MachineOutliner::outline(
// Does this candidate have a function yet?
if (!OF.MF) {
OF.MF = createOutlinedFunction(M, OF, Mapper);
- MachineBasicBlock *MBB = &*OF.MF->begin();
-
- // Output a remark telling the user that an outlined function was created,
- // and explaining where it came from.
- MachineOptimizationRemarkEmitter MORE(*OF.MF, nullptr);
- MachineOptimizationRemark R(DEBUG_TYPE, "OutlinedFunction",
- MBB->findDebugLoc(MBB->begin()), MBB);
- R << "Saved " << NV("OutliningBenefit", OF.getBenefit())
- << " bytes by "
- << "outlining " << NV("Length", OF.Sequence.size()) << " instructions "
- << "from " << NV("NumOccurrences", OF.getOccurrenceCount())
- << " locations. "
- << "(Found at: ";
-
- // Tell the user the other places the candidate was found.
- for (size_t i = 0, e = OF.Candidates.size(); i < e; i++) {
-
- // Skip over things that were pruned.
- if (!OF.Candidates[i]->InCandidateList)
- continue;
-
- R << NV(
- (Twine("StartLoc") + Twine(i)).str(),
- OF.Candidates[i]->front()->getDebugLoc());
- if (i != e - 1)
- R << ", ";
- }
-
- R << ")";
-
- MORE.emit(R);
+ emitOutlinedFunctionRemark(OF);
FunctionsCreated++;
}
OpenPOWER on IntegriCloud