25 #ifndef _JIT_COMPILER2_LOOPPASSBASE
26 #define _JIT_COMPILER2_LOOPPASSBASE
91 template<
class NodeType>
100 if (
dfs[a_i] ==
dfs[b_i]) {
104 return dfs[a_i] <
dfs[b_i];
130 int v =
i.get_index();
135 i.get_successors(successors);
138 ee = successors.
end(); ii != ee ; ++ii) {
139 int w = (*ii).get_index();
142 if ((*ii).get_parent() !=
i) {
145 forwardedges[w].insert(v);
148 backedges[w].insert(v);
151 crossedges[w].insert(v);
155 treeedges[w].insert(v);
162 for (
int w = 0; w <
size ; ++w ) {
176 set = forwardedges[w];
194 int w =
i.get_index();
205 int v_r = unionfind.
find(v);
206 assert(v_r != end &&
"Element not found!");
214 if(!index_to_loop[v]) {
215 index_to_loop[v] =
loop;
217 if (index_to_loop[w]) {
219 if(inner_loop != loop) {
242 if (backedges[x].
size() != 0) {
245 if(inner_loop != loop) {
254 incoming.insert(ref1.begin(), ref1.end());
256 incoming.insert(ref2.begin(), ref2.end());
258 incoming.insert(ref3.begin(), ref3.end());
264 int y_r = unionfind.
find(y);
273 assert(0 &&
"Graph is irreduciable. Can not yet deal with it.");
277 if ( P.find(y_r) == P.end() and y_r != w) {
283 if (highpt[y_r] == -1) {
288 if (!index_to_loop[y_r]) {
289 index_to_loop[y_r] =
loop;
304 for (
int w = 0; w <
size ; ++w ) {
307 for (
int w = 0; w <
size ; ++w ) {
313 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