OpenASIP  2.0
RegisterQuantityCheck.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file RegisterQuantityCheck.hh
26  *
27  * Declaration of RegisterQuantityCheck class.
28  *
29  * Tests that given machine has enough registers.
30  *
31  * @author Heikki Kultala (hkultala-no.spam-cs.tut.fi)
32  * @note rating: red
33  */
34 
35 #ifndef TTA_REGISTER_QUANTITY_CHECK_HH
36 #define TTA_REGISTER_QUANTITY_CHECK_HH
37 
38 #include "MachineCheck.hh"
39 #include "FullyConnectedCheck.hh"
40 
41 #include <set>
42 #include <string>
43 
44 namespace TTAMachine {
45  class RegisterFile;
46 }
47 
49 public:
51  virtual ~RegisterQuantityCheck();
52 
53  virtual bool check(
54  const TTAMachine::Machine& mach) const;
55  virtual bool check(
56  const TTAMachine::Machine& mach,
57  MachineCheckResults& results) const;
58 
59  bool checkWithIgnore(
60  const TTAMachine::Machine& mach,
61  const std::set<std::string>& ignoreRFs) const;
62  bool checkWithIgnore(
63  const TTAMachine::Machine& mach,
64  MachineCheckResults& results,
65  const std::set<std::string>& ignoreRFs) const;
66 
67  bool checkIntRegs(const TTAMachine::Machine& mach) const;
68  bool canFixIntRegs(const TTAMachine::Machine& mach) const;
69  bool fixIntRegs(TTAMachine::Machine& mach) const;
70 private:
71  typedef std::pair<const TTAMachine::RegisterFile*, int> Register;
72  void findGuardRegisters(
73  const TTAMachine::Machine& mach,
74  std::set<Register>& registers,
75  const std::set<std::string>& ignoreRFs) const;
76  unsigned int countIntRegisters(
77  const TTAMachine::Machine& mach,
78  const std::set<Register>& guardRegs,
79  const std::set<std::string>& ignoreRFs) const;
80  bool checkPredRegs(
81  const unsigned int& regCount,
82  MachineCheckResults* results) const;
83  unsigned int missingIntRegs(
84  const unsigned int& regCount,
85  MachineCheckResults* results,
86  bool isFullyConnected) const;
87 
89 };
90 
91 #endif
RegisterQuantityCheck::checkWithIgnore
bool checkWithIgnore(const TTAMachine::Machine &mach, const std::set< std::string > &ignoreRFs) const
Definition: RegisterQuantityCheck.cc:116
RegisterQuantityCheck::missingIntRegs
unsigned int missingIntRegs(const unsigned int &regCount, MachineCheckResults *results, bool isFullyConnected) const
Definition: RegisterQuantityCheck.cc:315
RegisterQuantityCheck::Register
std::pair< const TTAMachine::RegisterFile *, int > Register
Definition: RegisterQuantityCheck.hh:71
RegisterQuantityCheck
Definition: RegisterQuantityCheck.hh:48
RegisterQuantityCheck::countIntRegisters
unsigned int countIntRegisters(const TTAMachine::Machine &mach, const std::set< Register > &guardRegs, const std::set< std::string > &ignoreRFs) const
Definition: RegisterQuantityCheck.cc:254
FullyConnectedCheck.hh
RegisterQuantityCheck::checkPredRegs
bool checkPredRegs(const unsigned int &regCount, MachineCheckResults *results) const
Definition: RegisterQuantityCheck.cc:288
RegisterQuantityCheck::findGuardRegisters
void findGuardRegisters(const TTAMachine::Machine &mach, std::set< Register > &registers, const std::set< std::string > &ignoreRFs) const
Definition: RegisterQuantityCheck.cc:216
MachineCheck.hh
RegisterQuantityCheck::~RegisterQuantityCheck
virtual ~RegisterQuantityCheck()
Definition: RegisterQuantityCheck.cc:50
MachineCheckResults
Definition: MachineCheckResults.hh:46
RegisterQuantityCheck::fixIntRegs
bool fixIntRegs(TTAMachine::Machine &mach) const
Definition: RegisterQuantityCheck.cc:340
FullyConnectedCheck
Definition: FullyConnectedCheck.hh:51
MachineCheck
Definition: MachineCheck.hh:50
RegisterQuantityCheck::checkIntRegs
bool checkIntRegs(const TTAMachine::Machine &mach) const
Definition: RegisterQuantityCheck.cc:186
RegisterQuantityCheck::check
virtual bool check(const TTAMachine::Machine &mach) const
Definition: RegisterQuantityCheck.cc:61
TTAMachine
Definition: Assembler.hh:48
RegisterQuantityCheck::RegisterQuantityCheck
RegisterQuantityCheck()
Definition: RegisterQuantityCheck.cc:47
RegisterQuantityCheck::fullyConCheck_
FullyConnectedCheck fullyConCheck_
Definition: RegisterQuantityCheck.hh:88
RegisterQuantityCheck::canFixIntRegs
bool canFixIntRegs(const TTAMachine::Machine &mach) const
Definition: RegisterQuantityCheck.cc:380
TTAMachine::Machine
Definition: Machine.hh:73