25 #ifndef _JIT_COMPILER2_LOOPPASSBASE
26 #define _JIT_COMPILER2_LOOPPASSBASE
90 template<
class NodeType>
99 if (
dfs[a_i] ==
dfs[b_i]) {
103 return dfs[a_i] <
dfs[b_i];
129 int v =
i.get_index();
134 i.get_successors(successors);
137 ee = successors.
end(); ii != ee ; ++ii) {
138 int w = (*ii).get_index();
141 if ((*ii).get_parent() !=
i) {
144 forwardedges[w].insert(v);
147 backedges[w].insert(v);
150 crossedges[w].insert(v);
154 treeedges[w].insert(v);
161 for (
int w = 0; w <
size ; ++w ) {
175 set = forwardedges[w];
193 int w =
i.get_index();
204 int v_r = unionfind.
find(v);
205 assert(v_r != end &&
"Element not found!");
213 if(!index_to_loop[v]) {
214 index_to_loop[v] =
loop;
216 if (index_to_loop[w]) {
218 if(inner_loop != loop) {
241 if (backedges[x].
size() != 0) {
244 if(inner_loop != loop) {
253 incoming.insert(ref1.begin(), ref1.end());
255 incoming.insert(ref2.begin(), ref2.end());
257 incoming.insert(ref3.begin(), ref3.end());
263 int y_r = unionfind.
find(y);
272 assert(0 &&
"Graph is irreduciable. Can not yet deal with it.");
276 if ( P.find(y_r) == P.end() and y_r != w) {
282 if (highpt[y_r] == -1) {
287 if (!index_to_loop[y_r]) {
288 index_to_loop[y_r] =
loop;
303 for (
int w = 0; w <
size ; ++w ) {
306 for (
int w = 0; w <
size ; ++w ) {
312 this->set_loop(dfs[w],loop);
std::set< Key, Compare, Allocator< Key > > type
bool is_decendant(int w, int v) const
Pass superclass All compiler passes should inheritate this class.
void add_top_loop(LoopType *loop)
NodeType * get_exit() const
void insert_loop_header(NodeType *node, LoopType *loop)
virtual bool run(JITData &JD)
Run the Pass.
LoopComparator(DFSTraversal< NodeType > &dfs)
virtual T find(T x)
find the repres to of a given element x
Custom new/delete handler mixin.
const DFSTraversal< BeginInst > dfs
NodeType * get_init_node(JITData &JD)
DFSTraversal< NodeType > & dfs
virtual void make_set(T s)
Create a new set.
void add_inner_loop(LoopBase *inner_loop)
int num_decendants(int v) const
NodeListTy & succ(const NodeType *v, NodeListTy &list)
alloc::set< const NodeType * >::type NodeListTy
bool is_ancestor(int v, int w) const
JNIEnv jthread jobject jclass jlong size
LoopBase * get_parent() const
std::vector< T, Allocator< T > > type
Stores the interdependencies of a pass.
reverse_iterator rbegin()
virtual PassUsage & get_PassUsage(PassUsage &PU) const
Set the requirements for the pass.
alloc::map< const NodeType *, const NodeType * >::type EdgeMapTy
alloc::map< const NodeType *, int >::type IndexMapTy
alloc::vector< const NodeType * >::type NodeMapTy
NodeType * get_header() const
bool operator()(const LoopBase< NodeType > *a, const LoopBase< NodeType > *b)
alloc::map< const NodeType *, NodeListTy >::type NodeListMapTy
virtual T set_union(T r, T s)
union the set that contains r with the set that contains s