forked from OSchip/llvm-project
[MachineOutliner][NFC] Make getters in MachineOutliner.h const
Just some refactoring. A few of the getters in OutlinedFunction weren't const. llvm-svn: 348391
This commit is contained in:
parent
34b618bf7e
commit
430ca90d7e
|
@ -202,19 +202,19 @@ public:
|
||||||
|
|
||||||
/// Return the number of bytes it would take to outline this
|
/// Return the number of bytes it would take to outline this
|
||||||
/// function.
|
/// function.
|
||||||
unsigned getOutliningCost() {
|
unsigned getOutliningCost() const {
|
||||||
unsigned CallOverhead = 0;
|
unsigned CallOverhead = 0;
|
||||||
for (std::shared_ptr<Candidate> &C : Candidates)
|
for (const std::shared_ptr<Candidate> &C : Candidates)
|
||||||
CallOverhead += C->getCallOverhead();
|
CallOverhead += C->getCallOverhead();
|
||||||
return CallOverhead + SequenceSize + FrameOverhead;
|
return CallOverhead + SequenceSize + FrameOverhead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the size in bytes of the unoutlined sequences.
|
/// Return the size in bytes of the unoutlined sequences.
|
||||||
unsigned getNotOutlinedCost() { return OccurrenceCount * SequenceSize; }
|
unsigned getNotOutlinedCost() const { return OccurrenceCount * SequenceSize; }
|
||||||
|
|
||||||
/// Return the number of instructions that would be saved by outlining
|
/// Return the number of instructions that would be saved by outlining
|
||||||
/// this function.
|
/// this function.
|
||||||
unsigned getBenefit() {
|
unsigned getBenefit() const {
|
||||||
unsigned NotOutlinedCost = getNotOutlinedCost();
|
unsigned NotOutlinedCost = getNotOutlinedCost();
|
||||||
unsigned OutlinedCost = getOutliningCost();
|
unsigned OutlinedCost = getOutliningCost();
|
||||||
return (NotOutlinedCost < OutlinedCost) ? 0
|
return (NotOutlinedCost < OutlinedCost) ? 0
|
||||||
|
@ -233,7 +233,7 @@ public:
|
||||||
for (Candidate &C : Cands)
|
for (Candidate &C : Cands)
|
||||||
Candidates.push_back(std::make_shared<outliner::Candidate>(C));
|
Candidates.push_back(std::make_shared<outliner::Candidate>(C));
|
||||||
|
|
||||||
unsigned B = getBenefit();
|
const unsigned B = getBenefit();
|
||||||
for (std::shared_ptr<Candidate> &C : Candidates)
|
for (std::shared_ptr<Candidate> &C : Candidates)
|
||||||
C->Benefit = B;
|
C->Benefit = B;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue