CACAO
CodeGenPass.hpp
Go to the documentation of this file.
1 /* src/vm/jit/compiler2/CodeGenPass.hpp - CodeGenPass
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_CODEGENPASS
26 #define _JIT_COMPILER2_CODEGENPASS
27 
31 #include "toolbox/Option.hpp"
32 
33 MM_MAKE_NAME(CodeGenPass)
34 
35 namespace cacao {
36 namespace jit {
37 namespace compiler2 {
38 
39 struct MBBCompare {
41  return lhs->self_iterator() < rhs->self_iterator();
42  }
43 };
44 
45 /**
46  * CodeGenPass
47  * TODO: more info
48  */
49 class CodeGenPass : public Pass, public memory::ManagerMixin<CodeGenPass> {
50 public:
52 #ifdef ENABLE_LOGGING
53  static Option<bool> print_code;
54  static Option<bool> print_data;
55 #endif
56 private:
57  /**
58  * finish code generation
59  *
60  * Finishes the code generation. A new memory, large enough for both
61  * data and code, is allocated and data and code are copied together
62  * to their final layout, unresolved jumps are resolved, ...
63  */
64  void finish(JITData &JD);
66 public:
67  static char ID;
68  CodeGenPass() : Pass() {}
69  virtual bool run(JITData &JD);
70  virtual PassUsage& get_PassUsage(PassUsage &PU) const;
71  std::size_t get_block_size(MachineBasicBlock *MBB) const;
72  BasicBlockMap::const_iterator begin() const { return bbmap.begin(); }
73  BasicBlockMap::const_iterator end() const { return bbmap.end(); }
74 };
75 
76 } // end namespace compiler2
77 } // end namespace jit
78 } // end namespace cacao
79 
80 #endif /* _JIT_COMPILER2_CODEGENPASS */
81 
82 
83 /*
84  * These are local overrides for various environment variables in Emacs.
85  * Please do not remove this and leave it at the end of the file, where
86  * Emacs will automagically detect them.
87  * ---------------------------------------------------------------------
88  * Local variables:
89  * mode: c++
90  * indent-tabs-mode: t
91  * c-basic-offset: 4
92  * tab-width: 4
93  * End:
94  * vim:noexpandtab:sw=4:ts=4:
95  */
Pass superclass All compiler passes should inheritate this class.
Definition: Pass.hpp:48
alloc::map< MachineBasicBlock *, std::size_t, MBBCompare >::type BasicBlockMap
Definition: CodeGenPass.hpp:51
Custom new/delete handler mixin.
Definition: Manager.hpp:43
A basic block of (scheduled) machine instructions.
MBBIterator self_iterator() const
get self iterator
#define MM_MAKE_NAME(x)
Definition: memstats.hpp:127
CodeGenPass TODO: more info.
Definition: CodeGenPass.hpp:49
bool operator()(MachineBasicBlock *lhs, MachineBasicBlock *rhs) const
Definition: CodeGenPass.hpp:40
BasicBlockMap::const_iterator begin() const
Definition: CodeGenPass.hpp:72
Stores the interdependencies of a pass.
Definition: PassUsage.hpp:55
This file contains the command line option parsing library.
BasicBlockMap::const_iterator end() const
Definition: CodeGenPass.hpp:73