summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-11-11 21:57:02 +0000
committerDan Gohman <gohman@apple.com>2009-11-11 21:57:02 +0000
commit02b155427e581892e3fb819597a396a608a4135f (patch)
tree5318737a8ff66af2e2735d53df19e8a56e13da66 /llvm/lib/CodeGen/BranchFolding.h
parent84d49a2085bb2fd086944ec5bebe4ba63597c633 (diff)
downloadbcm5719-llvm-02b155427e581892e3fb819597a396a608a4135f.tar.gz
bcm5719-llvm-02b155427e581892e3fb819597a396a608a4135f.zip
Promote MergePotentialsElt and SameTailElt to be regular classes
instead of typedefs for std::pair. This simplifies the type of SameTails, which previously was std::vector<std::pair<std::vector<std::pair<unsigned, MachineBasicBlock *> >::iterator, MachineBasicBlock::iterator> llvm-svn: 86885
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.h')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.h51
1 files changed, 49 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.h b/llvm/lib/CodeGen/BranchFolding.h
index f1ebc4fefb6..864358c9c8a 100644
--- a/llvm/lib/CodeGen/BranchFolding.h
+++ b/llvm/lib/CodeGen/BranchFolding.h
@@ -30,11 +30,58 @@ namespace llvm {
const TargetRegisterInfo *tri,
MachineModuleInfo *mmi);
private:
- typedef std::pair<unsigned,MachineBasicBlock*> MergePotentialsElt;
+ class MergePotentialsElt {
+ unsigned Hash;
+ MachineBasicBlock *Block;
+ public:
+ MergePotentialsElt(unsigned h, MachineBasicBlock *b)
+ : Hash(h), Block(b) {}
+
+ unsigned getHash() const { return Hash; }
+ MachineBasicBlock *getBlock() const { return Block; }
+
+ void setBlock(MachineBasicBlock *MBB) {
+ Block = MBB;
+ }
+
+ bool operator<(const MergePotentialsElt &) const;
+ };
typedef std::vector<MergePotentialsElt>::iterator MPIterator;
std::vector<MergePotentialsElt> MergePotentials;
- typedef std::pair<MPIterator, MachineBasicBlock::iterator> SameTailElt;
+ class SameTailElt {
+ MPIterator MPIter;
+ MachineBasicBlock::iterator TailStartPos;
+ public:
+ SameTailElt(MPIterator mp, MachineBasicBlock::iterator tsp)
+ : MPIter(mp), TailStartPos(tsp) {}
+
+ MPIterator getMPIter() const {
+ return MPIter;
+ }
+ MergePotentialsElt &getMergePotentialsElt() const {
+ return *getMPIter();
+ }
+ MachineBasicBlock::iterator getTailStartPos() const {
+ return TailStartPos;
+ }
+ unsigned getHash() const {
+ return getMergePotentialsElt().getHash();
+ }
+ MachineBasicBlock *getBlock() const {
+ return getMergePotentialsElt().getBlock();
+ }
+ bool tailIsWholeBlock() const {
+ return TailStartPos == getBlock()->begin();
+ }
+
+ void setBlock(MachineBasicBlock *MBB) {
+ getMergePotentialsElt().setBlock(MBB);
+ }
+ void setTailStartPos(MachineBasicBlock::iterator Pos) {
+ TailStartPos = Pos;
+ }
+ };
std::vector<SameTailElt> SameTails;
bool EnableTailMerge;
OpenPOWER on IntegriCloud