CACAO
LoopContainer.hpp
Go to the documentation of this file.
1 /* src/vm/jit/loop/LoopContainer.hpp
2 
3  Copyright (C) 1996-2012
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 
6  This file is part of CACAO.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2, or (at
11  your option) any later version.
12 
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 
23 */
24 
25 #ifndef _LOOP_CONTAINER_HPP
26 #define _LOOP_CONTAINER_HPP
27 
28 #include <vector>
29 
30 #include "vm/jit/jit.hpp"
31 #include "VariableSet.hpp"
32 #include "IntervalMap.hpp"
33 
34 /**
35  * Represents a single loop.
36  */
38 {
39  LoopContainer* parent; // the parent loop or 0 if this is the root loop
40  std::vector<LoopContainer*> children; // all loops contained in this loop
41  s4 depth; // The depth of this loop in the loop hierarchy. The root has depth 0.
42 
43  basicblock* header; // the unique entry point of this loop
44  std::vector<basicblock*> nodes; // all nodes contained in this loop except the header
45  std::vector<basicblock*> footers; // all nodes from which there is a back edge to the header
46 
47  VariableSet writtenVariables; // Contains all variables that are possibly assigned/changed in this loop.
48  VariableSet invariantVariables; // Contains (not necessarily all) integer variables that are not changed in this loop.
49  VariableSet invariantArrays; // Contains (not necessarily all) array variables that are not changed in this loop.
50 
51  IntervalMap invariantIntervals; // The intervals the invariants have before entering the loop.
52  //IntervalMap headerIntervals; // The intervals which are valid right before the header.
53 
55  s4 counterVariable; // The first counter variable of this loop.
56  s4 counterIncrement; // The value which is added to the counterVariable in every iteration.
57  Interval counterInterval; // This interval is valid for the counter variable in every loop node except the header.
58 
60  : parent(0)
61  , depth(0)
62  , header(0)
63 // , invariantIntervals(0)
64 // , headerIntervals(0)
65  , hasCounterVariable(false)
66  , counterVariable(0)
67  , counterIncrement(0)
68  {}
69 };
70 
71 #endif
72 
73 /*
74  * These are local overrides for various environment variables in Emacs.
75  * Please do not remove this and leave it at the end of the file, where
76  * Emacs will automagically detect them.
77  * ---------------------------------------------------------------------
78  * Local variables:
79  * mode: c++
80  * indent-tabs-mode: t
81  * c-basic-offset: 4
82  * tab-width: 4
83  * End:
84  * vim:noexpandtab:sw=4:ts=4:
85  */
86 
VariableSet writtenVariables
Maps variable names to intervals.
Definition: IntervalMap.hpp:38
Represents a single loop.
A container for variables names.
Definition: VariableSet.hpp:37
VariableSet invariantArrays
VariableSet invariantVariables
An integer interval of the form constant_0 + instruction_0 .
Definition: Interval.hpp:39
jlong jlong jlong jlong jint depth
Definition: jvmti.h:497
LoopContainer * parent
int32_t s4
Definition: types.hpp:45
IntervalMap invariantIntervals
std::vector< basicblock * > footers
Interval counterInterval
std::vector< basicblock * > nodes
std::vector< LoopContainer * > children
basicblock * header