CACAO
ScheduleClickPass.cpp
Go to the documentation of this file.
1 /* src/vm/jit/compiler2/ScheduleClickPass.cpp - ScheduleClickPass
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 
31 
32 #include "toolbox/logging.hpp"
33 
34 #define DEBUG_NAME "compiler2/ScheduleClick"
35 
36 namespace cacao {
37 namespace jit {
38 namespace compiler2 {
39 
41  // XXX Currently the logic is implemented in ScheduleLatePass
42  // this pass only copies the result. The reason is that
43  // final scheduling must be performed interleaved with schedule
44  // late. This might change if we run passes on instruction rather
45  // then on global scope. Therefor this is kept as a placeholder.
46  M = JD.get_Method();
47  late = get_Pass<ScheduleLatePass>();
48  for (Method::InstructionListTy::const_iterator i = M->begin(),
49  e = M->end() ; i != e ; ++i) {
50  Instruction *I = *i;
51  LOG1("schedule_click: " << I << nl);
52  if (I->is_floating()) {
53  I->set_BeginInst(late->get(I));
54  }
55  }
56  set_schedule(M);
57  // clear schedule
58  M->clear_schedule();
59  return true;
60 }
61 
63  for (Method::const_iterator i = M->begin(), e = M->end(); i!=e; ++i) {
64  Instruction *I = *i;
65  if (!get(I)) {
66  ERROR_MSG("Instruction not Scheduled!","Instruction: " << I);
67  return false;
68  }
69  }
70  return true;
71 }
74  return PU;
75 }
76 
77 // registrate Pass
78 static PassRegistry<ScheduleClickPass> X("ScheduleClickPass");
79 
80 } // end namespace compiler2
81 } // end namespace jit
82 } // end namespace cacao
83 
84 
85 /*
86  * These are local overrides for various environment variables in Emacs.
87  * Please do not remove this and leave it at the end of the file, where
88  * Emacs will automagically detect them.
89  * ---------------------------------------------------------------------
90  * Local variables:
91  * mode: c++
92  * indent-tabs-mode: t
93  * c-basic-offset: 4
94  * tab-width: 4
95  * End:
96  * vim:noexpandtab:sw=4:ts=4:
97  */
#define LOG1(STMT)
Definition: logging.hpp:92
virtual bool is_floating() const
True if the instruction has no fixed control dependencies.
#define ERROR_MSG(EXPR_SHORT, EXPR_LONG)
Definition: logging.hpp:124
virtual bool run(JITData &JD)
Run the Pass.
Stores the interdependencies of a pass.
Definition: PassUsage.hpp:55
Instruction super class.
Definition: Instruction.hpp:75
virtual bool verify() const
Verify the Result.
MIIterator i
InstructionListTy::const_iterator const_iterator
Definition: MethodC2.hpp:69
const_iterator end() const
Definition: MethodC2.hpp:147
BeginInst * get(const Instruction *I) const
MIIterator e
#define I(value)
Definition: codegen.c:279
virtual bool set_BeginInst(BeginInst *b)
const_iterator begin() const
Definition: MethodC2.hpp:143
static PassRegistry< BasicBlockSchedulingPass > X("BasicBlockSchedulingPass")
Nl nl
Definition: OStream.cpp:56
void add_requires()
PassName is required.
Definition: PassUsage.hpp:78
virtual PassUsage & get_PassUsage(PassUsage &PU) const
Set the requirements for the pass.