blob: 9fb1b8b301391e7316bcaa223db646cc5e77211c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
//===-- llvm/CodeGen/Splitter.h - Splitter -*- C++ -*----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CODEGEN_SPLITTER_H
#define LLVM_CODEGEN_SPLITTER_H
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include <deque>
#include <map>
#include <string>
#include <vector>
namespace llvm {
class LiveInterval;
class LiveIntervals;
struct LiveRange;
class LoopSplit;
class MachineDominatorTree;
class MachineRegisterInfo;
class SlotIndexes;
class TargetInstrInfo;
class VNInfo;
class LoopSplitter : public MachineFunctionPass {
friend class LoopSplit;
public:
static char ID;
LoopSplitter() : MachineFunctionPass(ID) {
initializeLoopSplitterPass(*PassRegistry::getPassRegistry());
}
virtual void getAnalysisUsage(AnalysisUsage &au) const;
virtual bool runOnMachineFunction(MachineFunction &fn);
virtual void releaseMemory();
private:
MachineFunction *mf;
LiveIntervals *lis;
MachineLoopInfo *mli;
MachineRegisterInfo *mri;
MachineDominatorTree *mdt;
SlotIndexes *sis;
const TargetInstrInfo *tii;
const TargetRegisterInfo *tri;
std::string fqn;
std::deque<LiveInterval*> intervals;
typedef std::pair<SlotIndex, SlotIndex> SlotPair;
typedef std::vector<SlotPair> LoopRanges;
typedef std::map<MachineLoop*, LoopRanges> LoopRangeMap;
LoopRangeMap loopRangeMap;
void dumpLoopInfo(MachineLoop &loop);
void dumpOddTerminators();
void updateTerminators(MachineBasicBlock &mbb);
bool canInsertPreHeader(MachineLoop &loop);
MachineBasicBlock& insertPreHeader(MachineLoop &loop);
bool isCriticalEdge(MachineLoop::Edge &edge);
bool canSplitEdge(MachineLoop::Edge &edge);
MachineBasicBlock& splitEdge(MachineLoop::Edge &edge, MachineLoop &loop);
LoopRanges& getLoopRanges(MachineLoop &loop);
std::pair<bool, SlotPair> getLoopSubRange(const LiveRange &lr,
MachineLoop &loop);
void dumpLoopRanges(MachineLoop &loop);
void processHeader(LoopSplit &split);
void processLoopExits(LoopSplit &split);
void processLoopUses(LoopSplit &split);
bool splitOverLoop(LiveInterval &li, MachineLoop &loop);
void processInterval(LiveInterval &li);
void processIntervals();
};
}
#endif
|