CACAO
GlobalSchedule.hpp
Go to the documentation of this file.
1 /* src/vm/jit/compiler2/GlobalSchedule.hpp - GlobalSchedule
2 
3  Copyright (C) 2013
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 _JIT_COMPILER2_GLOBALSCHEDULE
26 #define _JIT_COMPILER2_GLOBALSCHEDULE
27 
32 
33 namespace cacao {
34 namespace jit {
35 namespace compiler2 {
36 
37 
38 /**
39  * GlobalSchedule
40  * TODO: more info
41  */
43 public:
45 protected:
48  void set_schedule(const Method* M) {
49  map.clear();
50  for (Method::InstructionListTy::const_iterator i = M->begin(),
51  e = M->end() ; i != e ; ++i) {
52  Instruction *I = *i;
53  BeginInst *BI= I->get_BeginInst();
54  if (BI) {
55  map[I] = BI;
56  bb_map[BI].insert(I);
57  }
58  }
59  }
60 public:
63  map[I] = BI;
64  bb_map[BI].insert(I);
65  }
66 
67  BeginInst* operator[](const Instruction* I) const {
68  return get(I);
69  }
70  BeginInst* get(const Instruction* I) const {
72  if (i == map.end()) {
73  return NULL;
74  }
75  return i->second;
76  }
79  assert(i != bb_map.end());
80  return i->second.begin();
81  }
84  assert(i != bb_map.end());
85  return i->second.end();
86  }
87 };
88 
89 } // end namespace compiler2
90 } // end namespace jit
91 } // end namespace cacao
92 
93 #endif /* _JIT_COMPILER2_GLOBALSCHEDULE */
94 
95 
96 /*
97  * These are local overrides for various environment variables in Emacs.
98  * Please do not remove this and leave it at the end of the file, where
99  * Emacs will automagically detect them.
100  * ---------------------------------------------------------------------
101  * Local variables:
102  * mode: c++
103  * indent-tabs-mode: t
104  * c-basic-offset: 4
105  * tab-width: 4
106  * End:
107  * vim:noexpandtab:sw=4:ts=4:
108  */
const_inst_iterator inst_end(const BeginInst *BI) const
GlobalSchedule TODO: more info.
alloc::unordered_map< const BeginInst *, alloc::unordered_set< Instruction * >::type >::type bb_map
const_inst_iterator inst_begin(const BeginInst *BI) const
BeginInst * operator[](const Instruction *I) const
This Instruction mark the start of a basic block.
_Base::const_iterator const_iterator
void add_Instruction(Instruction *I, BeginInst *BI)
_Base::const_iterator const_iterator
Instruction super class.
Definition: Instruction.hpp:73
MIIterator i
const_iterator end() const
Definition: MethodC2.hpp:141
MIIterator e
#define I(value)
Definition: codegen.c:279
alloc::unordered_set< Instruction * >::type::const_iterator const_inst_iterator
jmethodID jint const void jint const jvmtiAddrLocationMap * map
Definition: jvmti.h:338
const Method & M
const_iterator begin() const
Definition: MethodC2.hpp:137
virtual BeginInst * get_BeginInst() const
Get the corresponding BeginInst.
alloc::unordered_map< const Instruction *, BeginInst * >::type map