CACAO
InstructionSchedule.hpp
Go to the documentation of this file.
1 /* src/vm/jit/compiler2/InstructionSchedule.hpp - InstructionSchedule
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_INSTRUCTIONSCHEDULE
26 #define _JIT_COMPILER2_INSTRUCTIONSCHEDULE
27 
29 
30 namespace cacao {
31 namespace jit {
32 namespace compiler2 {
33 
34 class BeginInst;
35 
36 /**
37  * InstructionSchedule
38  * TODO: more info
39  */
40 template <class _Inst>
42 public:
44  typedef typename InstructionListTy::const_iterator const_inst_iterator;
45  typedef typename InstructionListTy::const_reverse_iterator const_reverse_inst_iterator;
46 protected:
49 public:
51  _Inst* operator[](const BeginInst* BI) const {
52  return get(BI);
53  }
54  _Inst* get(const BeginInst* BI) const {
55  typename MapTy::const_iterator i = map.find(BI);
56  if (i == map.end()) {
57  return NULL;
58  }
59  return i->second;
60  }
62  typename MapTy::const_iterator i = map.find(BI);
63  assert(i != map.end());
64  return i->second.begin();
65  }
67  typename MapTy::const_iterator i = map.find(BI);
68  assert(i != map.end());
69  return i->second.end();
70  }
72  typename MapTy::const_iterator i = map.find(BI);
73  assert(i != map.end());
74  return i->second.rbegin();
75  }
77  typename MapTy::const_iterator i = map.find(BI);
78  assert(i != map.end());
79  return i->second.rend();
80  }
81 };
82 
83 } // end namespace compiler2
84 } // end namespace jit
85 } // end namespace cacao
86 
87 #endif /* _JIT_COMPILER2_INSTRUCTIONSCHEDULE */
88 
89 
90 /*
91  * These are local overrides for various environment variables in Emacs.
92  * Please do not remove this and leave it at the end of the file, where
93  * Emacs will automagically detect them.
94  * ---------------------------------------------------------------------
95  * Local variables:
96  * mode: c++
97  * indent-tabs-mode: t
98  * c-basic-offset: 4
99  * tab-width: 4
100  * End:
101  * vim:noexpandtab:sw=4:ts=4:
102  */
BeginInst * BI
_Inst * operator[](const BeginInst *BI) const
This Instruction marks the start of a basic block.
const_inst_iterator inst_begin(const BeginInst *BI) const
std::vector< T, Allocator< T > > type
Definition: vector.hpp:38
const_reverse_inst_iterator inst_rend(const BeginInst *BI) const
MIIterator i
alloc::unordered_map< const BeginInst *, InstructionListTy >::type MapTy
jmethodID jint const void jint const jvmtiAddrLocationMap * map
Definition: jvmti.h:338
InstructionListTy::const_reverse_iterator const_reverse_inst_iterator
alloc::vector< _Inst * >::type InstructionListTy
const_reverse_inst_iterator inst_rbegin(const BeginInst *BI) const
const_inst_iterator inst_end(const BeginInst *BI) const
InstructionListTy::const_iterator const_inst_iterator
InstructionSchedule TODO: more info.
std::unordered_map< Key, T, Hash, KeyEqual, Allocator< std::pair< const Key, T > > > type