aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-12-05 18:12:52 +0000
committerJessica Paquette <jpaquette@apple.com>2018-12-05 18:12:52 +0000
commit430ca90d7e23117bbf9112a2b42787a036ad8d61 (patch)
tree0018516e5d31d3acf51f84b55b83ee5cfe4dc89d
parent34b618bf7ed0932ba8cc7eeab8c954fee4913005 (diff)
downloadllvm-430ca90d7e23117bbf9112a2b42787a036ad8d61.zip
llvm-430ca90d7e23117bbf9112a2b42787a036ad8d61.tar.gz
llvm-430ca90d7e23117bbf9112a2b42787a036ad8d61.tar.bz2
[MachineOutliner][NFC] Make getters in MachineOutliner.h const
Just some refactoring. A few of the getters in OutlinedFunction weren't const. llvm-svn: 348391
-rw-r--r--llvm/include/llvm/CodeGen/MachineOutliner.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineOutliner.h b/llvm/include/llvm/CodeGen/MachineOutliner.h
index da26f70..19abeba 100644
--- a/llvm/include/llvm/CodeGen/MachineOutliner.h
+++ b/llvm/include/llvm/CodeGen/MachineOutliner.h
@@ -202,19 +202,19 @@ public:
/// Return the number of bytes it would take to outline this
/// function.
- unsigned getOutliningCost() {
+ unsigned getOutliningCost() const {
unsigned CallOverhead = 0;
- for (std::shared_ptr<Candidate> &C : Candidates)
+ for (const std::shared_ptr<Candidate> &C : Candidates)
CallOverhead += C->getCallOverhead();
return CallOverhead + SequenceSize + FrameOverhead;
}
/// 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
/// this function.
- unsigned getBenefit() {
+ unsigned getBenefit() const {
unsigned NotOutlinedCost = getNotOutlinedCost();
unsigned OutlinedCost = getOutliningCost();
return (NotOutlinedCost < OutlinedCost) ? 0
@@ -233,7 +233,7 @@ public:
for (Candidate &C : Cands)
Candidates.push_back(std::make_shared<outliner::Candidate>(C));
- unsigned B = getBenefit();
+ const unsigned B = getBenefit();
for (std::shared_ptr<Candidate> &C : Candidates)
C->Benefit = B;
}