mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-19 08:35:45 +00:00
Add some constantness to BranchProbabilityInfo and BlockFrequnencyInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146986 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -870,11 +870,11 @@ MachineBasicBlock::findDebugLoc(instr_iterator MBBI) {
|
||||
|
||||
/// getSuccWeight - Return weight of the edge from this block to MBB.
|
||||
///
|
||||
uint32_t MachineBasicBlock::getSuccWeight(MachineBasicBlock *succ) {
|
||||
uint32_t MachineBasicBlock::getSuccWeight(const MachineBasicBlock *succ) const {
|
||||
if (Weights.empty())
|
||||
return 0;
|
||||
|
||||
succ_iterator I = std::find(Successors.begin(), Successors.end(), succ);
|
||||
const_succ_iterator I = std::find(Successors.begin(), Successors.end(), succ);
|
||||
return *getWeightIterator(I);
|
||||
}
|
||||
|
||||
@@ -888,6 +888,16 @@ getWeightIterator(MachineBasicBlock::succ_iterator I) {
|
||||
return Weights.begin() + index;
|
||||
}
|
||||
|
||||
/// getWeightIterator - Return wight iterator corresonding to the I successor
|
||||
/// iterator
|
||||
MachineBasicBlock::const_weight_iterator MachineBasicBlock::
|
||||
getWeightIterator(MachineBasicBlock::const_succ_iterator I) const {
|
||||
assert(Weights.size() == Successors.size() && "Async weight list!");
|
||||
const size_t index = std::distance(Successors.begin(), I);
|
||||
assert(index < Weights.size() && "Not a current successor!");
|
||||
return Weights.begin() + index;
|
||||
}
|
||||
|
||||
void llvm::WriteAsOperand(raw_ostream &OS, const MachineBasicBlock *MBB,
|
||||
bool t) {
|
||||
OS << "BB#" << MBB->getNumber();
|
||||
|
||||
Reference in New Issue
Block a user