OpenASIP  2.0
ControlDependenceGraphPass.cc
Go to the documentation of this file.
1 /*
2  Copyright 2002-2008 Tampere University. All Rights
3  Reserved.
4 
5  This file is part of TTA-Based Codesign Environment (TCE).
6 
7  TCE is free software; you can redistribute it and/or modify it under the
8  terms of the GNU General Public License version 2 as published by the Free
9  Software Foundation.
10 
11  TCE is distributed in the hope that it will be useful, but WITHOUT ANY
12  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  details.
15 
16  You should have received a copy of the GNU General Public License along
17  with TCE; if not, write to the Free Software Foundation, Inc., 51 Franklin
18  St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20  As a special exception, you may use this file as part of a free software
21  library without restriction. Specifically, if other files instantiate
22  templates or use macros or inline functions from this file, or you compile
23  this file and link it with other files to produce an executable, this
24  file does not by itself cause the resulting executable to be covered by
25  the GNU General Public License. This exception does not however
26  invalidate any other reasons why the executable file might be covered by
27  the GNU General Public License.
28 */
29 /**
30  * @file ControlDependenceGraphPass.cc
31  *
32  * Definition of ControlDependenceGraphPass class.
33  *
34  * @author VladimĂ­r Guzma 2008 (vladimir.guzma@tut.fi)
35  * @note rating: red
36  */
37 
39 #include "Application.hh"
41 #include "Machine.hh"
42 #include "BasicBlockPass.hh"
43 
44 /**
45  * Constructor.
46  */
48  SchedulerPass(data) {
49 }
50 
51 /**
52  * Destructor.
53  */
55 }
56 
57 /**
58  * Handles a single control dependence graph.
59  *
60  * The pass should work with any kind of control dependence graph, it should not
61  * assume the CDG represents a whole procedure, for example.
62  *
63  * @param cdg The control dependence graph to handle.
64  * @param machine The target machine if any. (NullMachine::instance() if
65  * target machine is irrelevant).
66  * @exception In case handling is unsuccesful for any reason (cdg might
67  * still get modified).
68  */
69 void
71  ControlDependenceGraph& cdg, const TTAMachine::Machine& targetMachine) {
72  //Trivial handling so far, just compute analysis info for serialization
73  // Throws exception in case there is indirect jump
74  cdg.nodeCount();
75  try {
76  cdg.analyzeCDG();
77  } catch (const InvalidData& e) {
78  // CFG had indirect jump
79  } catch (const Exception& e) {
80  throw ModuleRunTimeError(
81  __FILE__, __LINE__, __func__, e.errorMessageStack());
82  }
83  targetMachine.machineTester();
84 }
SchedulerPass
Definition: SchedulerPass.hh:43
ControlDependenceGraph::analyzeCDG
void analyzeCDG()
Definition: ControlDependenceGraph.cc:745
ControlDependenceGraphPass::handleControlDependenceGraph
virtual void handleControlDependenceGraph(ControlDependenceGraph &cdg, const TTAMachine::Machine &targetMachine)=0
Definition: ControlDependenceGraphPass.cc:70
ControlDependenceGraph.hh
ControlDependenceGraphPass.hh
ControlDependenceGraphPass::ControlDependenceGraphPass
ControlDependenceGraphPass(InterPassData &data)
Definition: ControlDependenceGraphPass.cc:47
InvalidData
Definition: Exception.hh:149
TTAMachine::Machine::machineTester
MachineTester & machineTester() const
Definition: Machine.cc:671
BasicBlockPass.hh
Application.hh
__func__
#define __func__
Definition: Application.hh:67
InterPassData
Definition: InterPassData.hh:48
Exception::errorMessageStack
std::string errorMessageStack(bool messagesOnly=false) const
Definition: Exception.cc:138
Machine.hh
Exception
Definition: Exception.hh:54
ModuleRunTimeError
Definition: Exception.hh:1043
ControlDependenceGraph
Definition: ControlDependenceGraph.hh:65
ControlDependenceGraphPass::~ControlDependenceGraphPass
virtual ~ControlDependenceGraphPass()
Definition: ControlDependenceGraphPass.cc:54
BoostGraph::nodeCount
int nodeCount() const
TTAMachine::Machine
Definition: Machine.hh:73