mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
BFI: Clean up BlockMass
Implementation is small now -- the interesting logic was moved to `BranchProbability` a while ago. Move it into `bfi_detail` and get rid of the related TODOs. I was originally planning to define it within `BlockFrequencyInfoImpl` (or `BFIIBase`), but it seems cleaner in a namespace. Besides, `isPodLike` needs to be specialized before `BlockMass` can be used in some of the other data structures, and there isn't a clear way to do that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212866 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -31,15 +31,26 @@
|
|||||||
|
|
||||||
#define DEBUG_TYPE "block-freq"
|
#define DEBUG_TYPE "block-freq"
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// BlockMass definition.
|
|
||||||
//
|
|
||||||
// TODO: Make this private to BlockFrequencyInfoImpl or delete.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
|
class BasicBlock;
|
||||||
|
class BranchProbabilityInfo;
|
||||||
|
class Function;
|
||||||
|
class Loop;
|
||||||
|
class LoopInfo;
|
||||||
|
class MachineBasicBlock;
|
||||||
|
class MachineBranchProbabilityInfo;
|
||||||
|
class MachineFunction;
|
||||||
|
class MachineLoop;
|
||||||
|
class MachineLoopInfo;
|
||||||
|
|
||||||
|
namespace bfi_detail {
|
||||||
|
|
||||||
|
struct IrreducibleGraph;
|
||||||
|
|
||||||
|
// This is part of a workaround for a GCC 4.7 crash on lambdas.
|
||||||
|
template <class BT> struct BlockEdgesAdder;
|
||||||
|
|
||||||
/// \brief Mass of a block.
|
/// \brief Mass of a block.
|
||||||
///
|
///
|
||||||
/// This class implements a sort of fixed-point fraction always between 0.0 and
|
/// This class implements a sort of fixed-point fraction always between 0.0 and
|
||||||
@@ -128,37 +139,12 @@ inline raw_ostream &operator<<(raw_ostream &OS, const BlockMass &X) {
|
|||||||
return X.print(OS);
|
return X.print(OS);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> struct isPodLike<BlockMass> {
|
} // end namespace bfi_detail
|
||||||
|
|
||||||
|
template <> struct isPodLike<bfi_detail::BlockMass> {
|
||||||
static const bool value = true;
|
static const bool value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// BlockFrequencyInfoImpl definition.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
namespace llvm {
|
|
||||||
|
|
||||||
class BasicBlock;
|
|
||||||
class BranchProbabilityInfo;
|
|
||||||
class Function;
|
|
||||||
class Loop;
|
|
||||||
class LoopInfo;
|
|
||||||
class MachineBasicBlock;
|
|
||||||
class MachineBranchProbabilityInfo;
|
|
||||||
class MachineFunction;
|
|
||||||
class MachineLoop;
|
|
||||||
class MachineLoopInfo;
|
|
||||||
|
|
||||||
namespace bfi_detail {
|
|
||||||
struct IrreducibleGraph;
|
|
||||||
|
|
||||||
// This is part of a workaround for a GCC 4.7 crash on lambdas.
|
|
||||||
template <class BT> struct BlockEdgesAdder;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \brief Base class for BlockFrequencyInfoImpl
|
/// \brief Base class for BlockFrequencyInfoImpl
|
||||||
///
|
///
|
||||||
/// BlockFrequencyInfoImplBase has supporting data structures and some
|
/// BlockFrequencyInfoImplBase has supporting data structures and some
|
||||||
@@ -170,6 +156,7 @@ template <class BT> struct BlockEdgesAdder;
|
|||||||
class BlockFrequencyInfoImplBase {
|
class BlockFrequencyInfoImplBase {
|
||||||
public:
|
public:
|
||||||
typedef ScaledNumber<uint64_t> Scaled64;
|
typedef ScaledNumber<uint64_t> Scaled64;
|
||||||
|
typedef bfi_detail::BlockMass BlockMass;
|
||||||
|
|
||||||
/// \brief Representative of a block.
|
/// \brief Representative of a block.
|
||||||
///
|
///
|
||||||
|
@@ -21,11 +21,6 @@ using namespace llvm::bfi_detail;
|
|||||||
|
|
||||||
#define DEBUG_TYPE "block-freq"
|
#define DEBUG_TYPE "block-freq"
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// BlockMass implementation.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
ScaledNumber<uint64_t> BlockMass::toScaled() const {
|
ScaledNumber<uint64_t> BlockMass::toScaled() const {
|
||||||
if (isFull())
|
if (isFull())
|
||||||
return ScaledNumber<uint64_t>(1, 0);
|
return ScaledNumber<uint64_t>(1, 0);
|
||||||
@@ -46,11 +41,6 @@ raw_ostream &BlockMass::print(raw_ostream &OS) const {
|
|||||||
return OS;
|
return OS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// BlockFrequencyInfoImpl implementation.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
typedef BlockFrequencyInfoImplBase::BlockNode BlockNode;
|
typedef BlockFrequencyInfoImplBase::BlockNode BlockNode;
|
||||||
|
Reference in New Issue
Block a user